Changeset 58024 in vbox for trunk/src/VBox/Installer/solaris
- Timestamp:
- Oct 5, 2015 1:41:42 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Installer/solaris/vboxconfig.sh
r56299 r58024 48 48 BIN_PKILL=/usr/bin/pkill 49 49 BIN_PGREP=/usr/bin/pgrep 50 BIN_IPADM=/usr/sbin/ipadm 50 51 51 52 # "vboxdrv" is also used in sed lines here (change those as well if it ever changes) … … 55 56 MOD_VBOXNET=vboxnet 56 57 DESC_VBOXNET="NetAdapter" 57 MOD_VBOXNET_INST= 3258 MOD_VBOXNET_INST=8 58 59 59 60 MOD_VBOXFLT=vboxflt … … 209 210 BIN_PGREP=`find_bin_path "$BIN_PGREP"` 210 211 fi 212 213 if test ! -x "$BIN_IPADM"; then 214 BIN_IPADM=`find_bin_path "$BIN_IPADM"` 215 fi 211 216 } 212 217 … … 246 251 # or "pkg://solaris/system/[email protected],5.11-0.175.0.0.0.1.0:20111012T032837Z" 247 252 # or "pkg://solaris/system/[email protected]:20121012T032837Z" [1] 248 253 # [1]: The sed below doesn't handle this. It's instead parsed below in the PSARC/2012/240 case. 249 254 STR_KERN_MAJOR=`echo "$PKGFMRI" | sed 's/^.*\@//;s/\,.*//'` 250 255 if test ! -z "$STR_KERN_MAJOR"; then … … 943 948 944 949 950 # plumb vboxnet0 instance 951 # failure: non fatal 952 plumb_net() 953 { 954 # S11 175a renames vboxnet0 as 'netX', undo this and rename it back (S12+ or S11 b175+) 955 if test "$HOST_OS_MAJORVERSION" -gt 11 || (test "$HOST_OS_MAJORVERSION" -eq 11 && test "$HOST_OS_MINORVERSION" -gt 174); then 956 vanityname=`dladm show-phys -po link,device | grep vboxnet0 | cut -f1 -d':'` 957 if test $? -eq 0 && test ! -z "$vanityname" && test "$vanityname" != "vboxnet0"; then 958 dladm rename-link "$vanityname" vboxnet0 959 if test $? -ne 0; then 960 errorprint "Failed to rename vanity interface ($vanityname) to vboxnet0" 961 fi 962 fi 963 fi 964 965 # use ipadm for Solaris 12 and newer 966 if test "$HOST_OS_MAJORVERSION" -ge 12; then 967 $BIN_IPADM create-ip vboxnet0 968 if test "$?" -eq 0; then 969 $BIN_IPADM create-addr -T static -a local 192.168.56.1/24 vboxnet0/v4addr 970 if test "$?" -ne 0; then 971 warnprint "Failed to create local address for vboxnet0!" 972 fi 973 else 974 warnprint "Failed to create IP instance for vboxnet0!" 975 fi 976 else 977 $BIN_IFCONFIG vboxnet0 plumb 978 $BIN_IFCONFIG vboxnet0 up 979 if test "$?" -eq 0; then 980 $BIN_IFCONFIG vboxnet0 192.168.56.1 netmask 255.255.255.0 up 981 982 # /etc/netmasks is a symlink, older installers replaced this with 983 # a copy of the actual file, repair that behaviour here. 984 recreatelink=0 985 if test -h "$PKG_INSTALL_ROOT/etc/netmasks"; then 986 nmaskfile="$PKG_INSTALL_ROOT/etc/inet/netmasks" 987 else 988 nmaskfile="$PKG_INSTALL_ROOT/etc/netmasks" 989 recreatelink=1 990 fi 991 992 # add the netmask to stay persistent across host reboots 993 nmaskbackupfile=$nmaskfile.vbox 994 if test -f $nmaskfile; then 995 sed -e '/#VirtualBox_SectionStart/,/#VirtualBox_SectionEnd/d' $nmaskfile > $nmaskbackupfile 996 997 if test $recreatelink -eq 1; then 998 # Check after removing our settings if /etc/netmasks is identifcal to /etc/inet/netmasks 999 anydiff=`diff $nmaskbackupfile "$PKG_INSTALL_ROOT/etc/inet/netmasks"` 1000 if test ! -z "$anydiff"; then 1001 # User may have some custom settings in /etc/netmasks, don't overwrite /etc/netmasks! 1002 recreatelink=2 1003 fi 1004 fi 1005 1006 echo "#VirtualBox_SectionStart" >> $nmaskbackupfile 1007 inst=0 1008 networkn=56 1009 while test $inst -ne 1; do 1010 echo "192.168.$networkn.0 255.255.255.0" >> $nmaskbackupfile 1011 inst=`expr $inst + 1` 1012 networkn=`expr $networkn + 1` 1013 done 1014 echo "#VirtualBox_SectionEnd" >> $nmaskbackupfile 1015 mv -f $nmaskbackupfile $nmaskfile 1016 1017 # Recreate /etc/netmasks as a link if necessary 1018 if test $recreatelink -eq 1; then 1019 cp -f "$PKG_INSTALL_ROOT/etc/netmasks" "$PKG_INSTALL_ROOT/etc/inet/netmasks" 1020 ln -sf ./inet/netmasks "$PKG_INSTALL_ROOT/etc/netmasks" 1021 elif test $recreatelink -eq 2; then 1022 warnprint "/etc/netmasks is a symlink (to /etc/inet/netmasks) that older" 1023 warnprint "VirtualBox installers incorrectly overwrote. Now the contents" 1024 warnprint "of /etc/netmasks and /etc/inet/netmasks differ, therefore " 1025 warnprint "VirtualBox will not attempt to overwrite /etc/netmasks as a" 1026 warnprint "symlink to /etc/inet/netmasks. Please resolve this manually" 1027 warnprint "by updating /etc/inet/netmasks and creating /etc/netmasks as a" 1028 warnprint "symlink to /etc/inet/netmasks" 1029 fi 1030 fi 1031 else 1032 # Should this be fatal? 1033 warnprint "Failed to bring up vboxnet0!" 1034 fi 1035 fi 1036 } 1037 1038 1039 # unplumb all vboxnet instances 1040 # failure: fatal 1041 unplumb_net() 1042 { 1043 inst=0 1044 # use ipadm for Solaris 12 and newer 1045 if test "$HOST_OS_MAJORVERSION" -ge 12; then 1046 while test $inst -ne $MOD_VBOXNET_INST; do 1047 vboxnetup=`$BIN_IPADM show-addr -p -o addrobj vboxnet$inst >/dev/null 2>&1` 1048 if test "$?" -eq 0; then 1049 $BIN_IPADM delete-addr vboxnet$inst/v4addr 1050 $BIN_IPADM delete-ip vboxnet$inst 1051 if test "$?" -ne 0; 1052 errorprint "VirtualBox NetAdapter 'vboxnet$inst' couldn't be removed (probably in use)." 1053 if test "$fatal" = "$FATALOP"; then 1054 exit 1 1055 fi 1056 fi 1057 fi 1058 1059 inst=`expr $inst + 1` 1060 done 1061 else 1062 inst=0 1063 while test $inst -ne $MOD_VBOXNET_INST; do 1064 vboxnetup=`$BIN_IFCONFIG vboxnet$inst >/dev/null 2>&1` 1065 if test "$?" -eq 0; then 1066 $BIN_IFCONFIG vboxnet$inst unplumb 1067 if test "$?" -ne 0; then 1068 errorprint "VirtualBox NetAdapter 'vboxnet$inst' couldn't be unplumbed (probably in use)." 1069 if test "$fatal" = "$FATALOP"; then 1070 exit 1 1071 fi 1072 fi 1073 fi 1074 1075 # unplumb vboxnet0 ipv6 1076 vboxnetup=`$BIN_IFCONFIG vboxnet$inst inet6 >/dev/null 2>&1` 1077 if test "$?" -eq 0; then 1078 $BIN_IFCONFIG vboxnet$inst inet6 unplumb 1079 if test "$?" -ne 0; then 1080 errorprint "VirtualBox NetAdapter 'vboxnet$inst' IPv6 couldn't be unplumbed (probably in use)." 1081 if test "$fatal" = "$FATALOP"; then 1082 exit 1 1083 fi 1084 fi 1085 fi 1086 1087 inst=`expr $inst + 1` 1088 done 1089 fi 1090 } 1091 1092 945 1093 # cleanup_install([fatal]) 946 1094 # failure: depends on [fatal] … … 968 1116 969 1117 # unplumb all vboxnet instances for non-remote installs 970 inst=0 971 while test $inst -ne $MOD_VBOXNET_INST; do 972 vboxnetup=`$BIN_IFCONFIG vboxnet$inst >/dev/null 2>&1` 973 if test "$?" -eq 0; then 974 $BIN_IFCONFIG vboxnet$inst unplumb 975 if test "$?" -ne 0; then 976 errorprint "VirtualBox NetAdapter 'vboxnet$inst' couldn't be unplumbed (probably in use)." 977 if test "$fatal" = "$FATALOP"; then 978 exit 1 979 fi 980 fi 981 fi 982 983 # unplumb vboxnet0 ipv6 984 vboxnetup=`$BIN_IFCONFIG vboxnet$inst inet6 >/dev/null 2>&1` 985 if test "$?" -eq 0; then 986 $BIN_IFCONFIG vboxnet$inst inet6 unplumb 987 if test "$?" -ne 0; then 988 errorprint "VirtualBox NetAdapter 'vboxnet$inst' IPv6 couldn't be unplumbed (probably in use)." 989 if test "$fatal" = "$FATALOP"; then 990 exit 1 991 fi 992 fi 993 fi 994 995 inst=`expr $inst + 1` 996 done 1118 unplumb_net 997 1119 998 1120 # Stop our other daemons, non-fatal … … 1063 1185 # plumb and configure vboxnet0 for non-remote installs 1064 1186 if test "$REMOTEINST" -eq 0; then 1065 # S11 175a renames vboxnet0 as 'netX', undo this and rename it back (S12+ or S11 b175+) 1066 if test "$HOST_OS_MAJORVERSION" -gt 11 || (test "$HOST_OS_MAJORVERSION" -eq 11 && test "$HOST_OS_MINORVERSION" -gt 174); then 1067 vanityname=`dladm show-phys -po link,device | grep vboxnet0 | cut -f1 -d':'` 1068 if test $? -eq 0 && test ! -z "$vanityname" && test "$vanityname" != "vboxnet0"; then 1069 dladm rename-link "$vanityname" vboxnet0 1070 if test $? -ne 0; then 1071 errorprint "Failed to rename vanity interface ($vanityname) to vboxnet0" 1072 fi 1073 fi 1074 fi 1075 1076 $BIN_IFCONFIG vboxnet0 plumb 1077 $BIN_IFCONFIG vboxnet0 up 1078 if test "$?" -eq 0; then 1079 $BIN_IFCONFIG vboxnet0 192.168.56.1 netmask 255.255.255.0 up 1080 1081 # /etc/netmasks is a symlink, older installers replaced this with 1082 # a copy of the actual file, repair that behaviour here. 1083 recreatelink=0 1084 if test -h "$PKG_INSTALL_ROOT/etc/netmasks"; then 1085 nmaskfile="$PKG_INSTALL_ROOT/etc/inet/netmasks" 1086 else 1087 nmaskfile="$PKG_INSTALL_ROOT/etc/netmasks" 1088 recreatelink=1 1089 fi 1090 1091 # add the netmask to stay persistent across host reboots 1092 nmaskbackupfile=$nmaskfile.vbox 1093 if test -f $nmaskfile; then 1094 sed -e '/#VirtualBox_SectionStart/,/#VirtualBox_SectionEnd/d' $nmaskfile > $nmaskbackupfile 1095 1096 if test $recreatelink -eq 1; then 1097 # Check after removing our settings if /etc/netmasks is identifcal to /etc/inet/netmasks 1098 anydiff=`diff $nmaskbackupfile "$PKG_INSTALL_ROOT/etc/inet/netmasks"` 1099 if test ! -z "$anydiff"; then 1100 # User may have some custom settings in /etc/netmasks, don't overwrite /etc/netmasks! 1101 recreatelink=2 1102 fi 1103 fi 1104 1105 echo "#VirtualBox_SectionStart" >> $nmaskbackupfile 1106 inst=0 1107 networkn=56 1108 while test $inst -ne 1; do 1109 echo "192.168.$networkn.0 255.255.255.0" >> $nmaskbackupfile 1110 inst=`expr $inst + 1` 1111 networkn=`expr $networkn + 1` 1112 done 1113 echo "#VirtualBox_SectionEnd" >> $nmaskbackupfile 1114 mv -f $nmaskbackupfile $nmaskfile 1115 1116 # Recreate /etc/netmasks as a link if necessary 1117 if test $recreatelink -eq 1; then 1118 cp -f "$PKG_INSTALL_ROOT/etc/netmasks" "$PKG_INSTALL_ROOT/etc/inet/netmasks" 1119 ln -sf ./inet/netmasks "$PKG_INSTALL_ROOT/etc/netmasks" 1120 elif test $recreatelink -eq 2; then 1121 warnprint "/etc/netmasks is a symlink (to /etc/inet/netmasks) that older" 1122 warnprint "VirtualBox installers incorrectly overwrote. Now the contents" 1123 warnprint "of /etc/netmasks and /etc/inet/netmasks differ, therefore " 1124 warnprint "VirtualBox will not attempt to overwrite /etc/netmasks as a" 1125 warnprint "symlink to /etc/inet/netmasks. Please resolve this manually" 1126 warnprint "by updating /etc/inet/netmasks and creating /etc/netmasks as a" 1127 warnprint "symlink to /etc/inet/netmasks" 1128 fi 1129 fi 1130 else 1131 # Should this be fatal? 1132 warnprint "Failed to bring up vboxnet0!!" 1133 fi 1187 plumb_net 1134 1188 fi 1135 1189 fi
Note:
See TracChangeset
for help on using the changeset viewer.