Changeset 98687 in vbox for trunk/src/VBox/Additions/linux
- Timestamp:
- Feb 22, 2023 2:52:35 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/installer/vboxadd.sh
r98609 r98687 79 79 # Rotate log files 80 80 LOG="/var/log/vboxadd-setup.log" 81 mv "${LOG}.3" "${LOG}.4" 2>/dev/null82 mv "${LOG}.2" "${LOG}.3" 2>/dev/null83 mv "${LOG}.1" "${LOG}.2" 2>/dev/null84 mv "${LOG}" "${LOG}.1" 2>/dev/null81 mv -f "${LOG}.3" "${LOG}.4" 2>/dev/null 82 mv -f "${LOG}.2" "${LOG}.3" 2>/dev/null 83 mv -f "${LOG}.1" "${LOG}.2" 2>/dev/null 84 mv -f "${LOG}" "${LOG}.1" 2>/dev/null 85 85 } 86 86 … … 178 178 running_module() 179 179 { 180 lsmod | grep -q $1180 lsmod | grep -q "$1" 181 181 } 182 182 … … 206 206 } 207 207 208 # A wrapper for check_running_module_version.209 # Go through the list of Guest Additions' modules and210 # verify if they are loaded and running version matches211 # to current installation version. Skip vboxvideo since212 # it is not loaded for old guests.213 check_status_kernel()214 {215 for mod in vboxguest vboxsf; do216 running_module "$mod" || fail "module $mod not loaded"217 check_running_module_version "$mod" || fail "currently loaded module $mod version ($(running_module_version "$mod")) does not match to VirtualBox Guest Additions installation version ($VBOX_VERSION $VBOX_REVISION)"218 done219 }220 208 221 209 # Checks if systemctl is present and functional (i.e., systemd is the init process). … … 250 238 "/etc/init.d/${name}" "${action}" quiet 251 239 fi 252 }253 254 # Check whether user-land processes are running.255 # Currently only check for VBoxService.256 check_status_user()257 {258 do_sysvinit_action vboxadd-service status >/dev/null 2>&1259 240 } 260 241 … … 951 932 pid=$1 952 933 953 [ -d "/proc/$pid" ] && true 934 test -n "$pid" -a -d "/proc/$pid" 935 } 936 937 # A wrapper for check_running_module_version. 938 # Go through the list of Guest Additions' modules and 939 # verify if they are loaded and running version matches 940 # to current installation version. Skip vboxvideo since 941 # it is not loaded for old guests. 942 check_status_kernel() 943 { 944 for mod in vboxguest vboxsf; do 945 946 for attempt in 1 2 3 4 5; do 947 948 # Wait before the next attempt. 949 [ $? -ne 0 ] && sleep 1 950 951 running_module "$mod" 952 if [ $? -eq 0 ]; then 953 mod_is_running="1" 954 check_running_module_version "$mod" 955 [ $? -eq 0 ] && break 956 else 957 mod_is_running="" 958 false 959 fi 960 961 done 962 963 # In case of error, try to print out proper reason of failure. 964 if [ $? -ne 0 ]; then 965 # Was module loaded? 966 [ -n "$mod_is_running" ] || fail "module $mod is not loaded" 967 # If module was loaded it means that it has incorrect version. 968 fail "currently loaded module $mod version ($(running_module_version "$mod")) does not match to VirtualBox Guest Additions installation version ($VBOX_VERSION $VBOX_REVISION)" 969 fi 970 971 done 972 } 973 974 # Check whether user-land processes are running. 975 # Currently only check for VBoxService. 976 check_status_user() 977 { 978 check_pid "$(cat /var/run/vboxadd-service.sh)" >/dev/null 2>&1 954 979 } 955 980 … … 1013 1038 [ "$(setup_complete)" = "1" ] || fail "kernel modules were set up yet, please consider running 'rcvboxadd setup' first." 1014 1039 1015 # Stop VBoxService (systemctl stop vboxadd-service.service). 1016 do_sysvinit_action vboxadd-service stop >/dev/null 2>&1 1040 # Stop VBoxService if running. 1041 do_sysvinit_action vboxadd-service status >/dev/null 2>&1 1042 if [ $? -eq 0 ]; then 1043 do_sysvinit_action vboxadd-service stop >/dev/null 2>&1 || fail "unable to stop VBoxService" 1044 fi 1017 1045 1018 1046 # Unmount Shared Folders. 1019 [ $? -eq 0 ] && umount -a -t vboxsf >/dev/null 2>&11047 umount -a -t vboxsf >/dev/null 2>&1 || fail "unable to unmount shared folders" 1020 1048 1021 1049 # Stop VBoxDRMClient. 1022 [ $? -eq 0 ] && send_sig_usr1_by_pidfile "/var/run/VBoxDRMClient"1050 send_sig_usr1_by_pidfile "/var/run/VBoxDRMClient" || fail "unable to stop VBoxDRMClient" 1023 1051 1024 1052 if [ $? -eq 0 ]; then … … 1043 1071 if [ $? -eq 0 ]; then 1044 1072 modprobe -r vboxguest >/dev/null 2>&1 1073 [ $? -eq 0 ] && break 1045 1074 else 1046 1075 # Do not spoil $?. … … 1067 1096 # Reload VBoxClient processes. 1068 1097 [ $? -eq 0 ] && send_sig_usr1 "control" 1069 fi 1070 1071 if [ $? -eq 0 ]; then 1072 1073 # Check if we just loaded modules of correct version. 1074 check_status_kernel 1075 1076 # Check if user-land processes were restarted as well. 1077 check_status_user 1078 1079 # Take reported version of running Guest Additions from running vboxguest module (as a paranoia check). 1080 info "kernel modules and services $(running_module_version "vboxguest") reloaded" 1081 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" 1098 1099 if [ $? -eq 0 ]; then 1100 1101 # Check if we just loaded modules of correct version. 1102 check_status_kernel 1103 1104 # Check if user-land processes were restarted as well. 1105 check_status_user 1106 1107 # Take reported version of running Guest Additions from running vboxguest module (as a paranoia check). 1108 info "kernel modules and services $(running_module_version "vboxguest") reloaded" 1109 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" 1110 else 1111 fail "cannot verify if kernel modules and services were reloaded" 1112 fi 1082 1113 else 1083 fail "cannot reload kernel modules and restartservices"1114 fail "cannot stop user services" 1084 1115 fi 1085 1116 }
Note:
See TracChangeset
for help on using the changeset viewer.