Changeset 99524 in vbox for trunk/src/VBox/Additions/linux/installer
- Timestamp:
- Apr 24, 2023 4:54:25 PM (22 months ago)
- svn:sync-xref-src-repo-rev:
- 157028
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/installer/vboxadd.sh
r99512 r99524 67 67 OLDMODULES="vboxguest vboxadd vboxsf vboxvfs vboxvideo" 68 68 SERVICE="VirtualBox Guest Additions" 69 VBOXSERVICE_PIDFILE="/var/run/vboxadd-service.sh" 69 70 ## systemd logs information about service status, otherwise do that ourselves. 70 71 QUIET= … … 120 121 { 121 122 log "${1}" 122 echo "$ 1" >&2123 echo "${SERVICE}: $1" >&2 123 124 echo "The log file $LOG may contain further information." >&2 124 125 exit 1 … … 962 963 check_pid() 963 964 { 964 pid= $1965 pid="$1" 965 966 966 967 test -n "$pid" -a -d "/proc/$pid" … … 1008 1009 check_status_user() 1009 1010 { 1010 check_pid "$(cat /var/run/vboxadd-service.sh)" >/dev/null 2>&1 1011 } 1012 1013 send_sig_usr1_by_pidfile() 1014 { 1015 pidfile=$1 1011 [ -r "$VBOXSERVICE_PIDFILE" ] && check_pid "$(cat $VBOXSERVICE_PIDFILE)" >/dev/null 2>&1 1012 } 1013 1014 send_signal_by_pidfile() 1015 { 1016 sig="$1" 1017 pidfile="$2" 1016 1018 1017 1019 if [ -f "$pidfile" ]; then 1018 1020 check_pid $(cat "$pidfile") 1019 1021 if [ $? -eq 0 ]; then 1020 kill -USR1$(cat "$pidfile") >/dev/null 2>&11022 kill "$sig" $(cat "$pidfile") >/dev/null 2>&1 1021 1023 else 1022 1024 # Do not spoil $?. … … 1032 1034 # update is started or kernel modules are going to be reloaded, 1033 1035 # so VBoxClient can release vboxguest.ko resources and then restart itself. 1034 send_sig_usr1() 1035 { 1036 send_signal() 1037 { 1038 sig="$1" 1036 1039 # Specify whether we sending signal to VBoxClient parent (control) 1037 1040 # process or a child (actual service) process. 1038 process_type="$ 1"1041 process_type="$2" 1039 1042 1040 1043 pidfile_postfix="" … … 1053 1056 [ -z "$process_type" -a -n "$(echo "$pid_file" | grep "service")" ] && continue 1054 1057 1055 send_sig _usr1_by_pidfile"$pid_file"1058 send_signal_by_pidfile -USR1 "$pid_file" 1056 1059 done 1057 1060 1058 1061 fi 1059 1062 done 1063 } 1064 1065 # Helper function which executes a command, prints error message if command fails, 1066 # and preserves command execution status for further processing. 1067 try_load_preserve_rc() 1068 { 1069 cmd="$1" 1070 msg="$2" 1071 1072 $cmd >/dev/null 2>&1 1073 1074 rc=$? 1075 [ $rc -eq 0 ] || info "$msg" 1076 1077 return $rc 1060 1078 } 1061 1079 … … 1071 1089 1072 1090 # Unmount Shared Folders. 1073 umount -a -t vboxsf >/dev/null 2>&1 || fail "unable to unmount shared folders "1091 umount -a -t vboxsf >/dev/null 2>&1 || fail "unable to unmount shared folders, mount point(s) might be still in use" 1074 1092 1075 1093 # Stop VBoxDRMClient. 1076 send_sig _usr1_by_pidfile"/var/run/VBoxDRMClient" || fail "unable to stop VBoxDRMClient"1094 send_signal_by_pidfile "-USR1" "/var/run/VBoxDRMClient" || fail "unable to stop VBoxDRMClient" 1077 1095 1078 1096 if [ $? -eq 0 ]; then 1079 1097 # Tell legacy VBoxClient processes to release vboxguest.ko references. 1080 send_sig _usr1""1098 send_signal "-USR1" "" 1081 1099 1082 1100 # Tell compatible VBoxClient processes to release vboxguest.ko references. 1083 send_sig _usr1"service"1101 send_signal "-USR1" "service" 1084 1102 1085 1103 # Try unload. … … 1107 1125 running_vboxguest 1108 1126 if [ $? -eq 0 ]; then 1109 fail "Cannot reload kernel modules: one or more module(s) is still in use" 1127 info "cannot reload kernel modules: one or more module(s) is still in use" 1128 false 1110 1129 else 1111 1130 # Do not spoil $?. … … 1114 1133 1115 1134 # Load drivers (skip vboxvideo since it is not loaded for very old guests). 1116 [ $? -eq 0 ] && modprobe vboxguest >/dev/null 2>&11117 [ $? -eq 0 ] && modprobe vboxsf >/dev/null 2>&11135 [ $? -eq 0 ] && try_load_preserve_rc "modprobe vboxguest" "unable to load vboxguest kernel module, see dmesg" 1136 [ $? -eq 0 ] && try_load_preserve_rc "modprobe vboxsf" "unable to load vboxsf kernel module, see dmesg" 1118 1137 1119 1138 # Start VBoxService and VBoxDRMClient. 1120 [ $? -eq 0 ] && $VBOX_SERVICE_SCRIPT start >/dev/null 2>&11139 [ $? -eq 0 ] && try_load_preserve_rc "$VBOX_SERVICE_SCRIPT start" "unable to start VBoxService" 1121 1140 1122 1141 # Reload VBoxClient processes. 1123 [ $? -eq 0 ] && send_sig_usr1 "control"1142 [ $? -eq 0 ] && try_load_preserve_rc "send_signal "-USR1" control" "unable to reload user session services" 1124 1143 1125 1144 if [ $? -eq 0 ]; then … … 1135 1154 info "NOTE: you may still consider to re-login if some user session specific services (Shared Clipboard, Drag and Drop, Seamless or Guest Screen Resize) were not restarted automatically" 1136 1155 else 1137 fail "cannot verify if kernel modules and services were reloaded" 1156 # In case of failure, sent SIGTERM to abandoned control processes to remove leftovers from failed reloading. 1157 send_signal "-TERM" "control" 1158 1159 fail "kernel modules and services were not reloaded" 1138 1160 fi 1139 1161 else … … 1218 1240 info "User-land services are running" 1219 1241 else 1220 fail "User-land services are not running" 1242 info "User-land services are not running" 1243 false 1221 1244 fi 1222 1245 ;;
Note:
See TracChangeset
for help on using the changeset viewer.