VirtualBox

Changeset 99537 in vbox for trunk/src/VBox/Additions/linux


Ignore:
Timestamp:
Apr 26, 2023 7:47:47 PM (22 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
157046
Message:

Additions: Linux: rcvboxadd: skip system accounts when iterating over $HOME directories in order to find VBoxClient pidfiles, bugref:10359.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/linux/installer/vboxadd.sh

    r99536 r99537  
    10931093    [ -z "$process_type" ] || pidfile_postfix="-$process_type"
    10941094
    1095     for user_home in $(getent passwd | cut -d ':' -f 6); do
    1096         if [ -d "$user_home" ]; then
    1097 
    1098             for pid_file in "$user_home"/.vboxclient-*"$pidfile_postfix".pid; do
    1099 
    1100                 # If process type was not specified, we assume that signal supposed
    1101                 # to be sent to legacy VBoxClient processes which have different
    1102                 # pidfile name pattern (it does not contain "control" or "service").
    1103                 # Skip those pidfiles who has.
    1104                 [ -z "$process_type" -a -n "$(echo "$pid_file" | grep "control")" ] && continue
    1105                 [ -z "$process_type" -a -n "$(echo "$pid_file" | grep "service")" ] && continue
    1106 
    1107                 send_signal_by_pidfile -USR1 "$pid_file"
    1108             done
    1109 
    1110         fi
     1095    for user_name in $(getent passwd | cut -d ':' -f 1); do
     1096
     1097        # Filter out empty login names (paranoia).
     1098        [ -n "$user_name" ] || continue
     1099
     1100        user_shell=$(getent passwd "$user_name" | cut -d ':' -f 7)
     1101
     1102        # Filter out login names with not specified shells (paranoia).
     1103        [ -n "$user_shell" ] || continue
     1104
     1105        # Filter out know non-login account names.
     1106        case "$user_shell" in
     1107        *nologin)   skip_user_home="1";;
     1108        *sync)      skip_user_home="1";;
     1109        *shutdown)  skip_user_home="1";;
     1110        *halt)      skip_user_home="1";;
     1111        *)          skip_user_home=""
     1112        esac
     1113        [ -z "$skip_user_home" ] || continue;
     1114
     1115        user_home=$(getent passwd "$user_name" | cut -d ':' -f 6)
     1116
     1117        for pid_file in "$user_home"/.vboxclient-*"$pidfile_postfix".pid; do
     1118
     1119            [ -r "$pid_file" ] || continue
     1120
     1121            # If process type was not specified, we assume that signal supposed
     1122            # to be sent to legacy VBoxClient processes which have different
     1123            # pidfile name pattern (it does not contain "control" or "service").
     1124            # Skip those pidfiles who has.
     1125            [ -z "$process_type" -a -n "$(echo "$pid_file" | grep "control")" ] && continue
     1126            [ -z "$process_type" -a -n "$(echo "$pid_file" | grep "service")" ] && continue
     1127
     1128            send_signal_by_pidfile -USR1 "$pid_file"
     1129
     1130        done
    11111131    done
    11121132}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette