VirtualBox

Changeset 37789 in vbox


Ignore:
Timestamp:
Jul 6, 2011 9:09:09 AM (14 years ago)
Author:
vboxsync
Message:

Solaris/Installer: Diff checking before replacing /etc/netmasks symlink. Updating boot-archive on pkg removal. Quoting fixes for remote installs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Installer/solaris/vboxconfig.sh

    r37787 r37789  
    7171DESC_VBOXUSB="USB"
    7272
     73UPDATEBOOTARCHIVE=0
    7374REMOTEINST=0
    7475FATALOP=fatal
     
    227228    if test "$REMOTEINST" -eq 1 || test -z "$HOST_OS_MINORVERSION" || test -z "$HOST_OS_MAJORVERSION"; then
    228229        if test -f "$PKG_INSTALL_ROOT/etc/release"; then
    229             HOST_OS_MAJORVERSION=`cat $PKG_INSTALL_ROOT/etc/release | grep "Solaris 10"`
     230            HOST_OS_MAJORVERSION=`cat "$PKG_INSTALL_ROOT/etc/release" | grep "Solaris 10"`
    230231            if test -n "$HOST_OS_MAJORVERSION"; then
    231232                HOST_OS_MAJORVERSION="5.10"
    232233            else
    233                 HOST_OS_MAJORVERSION=`cat $PKG_INSTALL_ROOT/etc/release | egrep "snv_|oi_"`
     234                HOST_OS_MAJORVERSION=`cat "$PKG_INSTALL_ROOT/etc/release" | egrep "snv_|oi_"`
    234235                if test -n "$HOST_OS_MAJORVERSION"; then
    235236                    HOST_OS_MAJORVERSION="5.11"
     
    237238            fi
    238239            if test "$HOST_OS_MAJORVERSION" != "5.10"; then
    239                 HOST_OS_MINORVERSION=`cat $PKG_INSTALL_ROOT/etc/release | tr ' ' '\n' | egrep 'snv_|oi_' | sed -e "s/snv_//" -e "s/oi_//" -e "s/[^0-9]//"`
     240                HOST_OS_MINORVERSION=`cat "$PKG_INSTALL_ROOT/etc/release" | tr ' ' '\n' | egrep 'snv_|oi_' | sed -e "s/snv_//" -e "s/oi_//" -e "s/[^0-9]//"`
    240241            else
    241242                HOST_OS_MINORVERSION=""
     
    281282}
    282283
     284# update_boot_archive()
     285# cannot fail
     286update_boot_archive()
     287{
     288    infoprint "Updating the boot archive..."
     289    if test "$REMOTEINST" -eq 0; then
     290        $BIN_BOOTADM update-archive > /dev/null
     291    else
     292        $BIN_BOOTADM update-archive -R "$PKG_INSTALL_ROOT" > /dev/null
     293    fi
     294    UPDATEBOOTARCHIVE=0
     295}
     296
     297
    283298# module_added(modname)
    284299# returns 1 if added, 0 otherwise
     
    292307    # Add a space at end of module name to make sure we have a perfect match to avoid
    293308    # any substring matches: e.g "vboxusb" & "vboxusbmon"
    294     loadentry=`cat $PKG_INSTALL_ROOT/etc/name_to_major | grep "$1 "`
     309    loadentry=`cat "$PKG_INSTALL_ROOT/etc/name_to_major" | grep "$1 "`
    295310    if test -z "$loadentry"; then
    296311        return 1
     
    373388    module_added $modname
    374389    if test "$?" -eq 0; then
     390        UPDATEBOOTARCHIVE=1
    375391        if test "$ISIPS" != "$IPSOP"; then
    376392            $BIN_REMDRV $BASEDIR_OPT $modname
     
    496512    # Add vboxdrv to devlink.tab
    497513    if test -f "$PKG_INSTALL_ROOT/etc/devlink.tab"; then
    498         sed -e '/name=vboxdrv/d' $PKG_INSTALL_ROOT/etc/devlink.tab > $PKG_INSTALL_ROOT/etc/devlink.vbox
    499         echo "type=ddi_pseudo;name=vboxdrv      \D" >> $PKG_INSTALL_ROOT/etc/devlink.vbox
    500         mv -f $PKG_INSTALL_ROOT/etc/devlink.vbox $PKG_INSTALL_ROOT/etc/devlink.tab
     514        sed -e '/name=vboxdrv/d' "$PKG_INSTALL_ROOT/etc/devlink.tab" > "$PKG_INSTALL_ROOT/etc/devlink.vbox"
     515        echo "type=ddi_pseudo;name=vboxdrv      \D" >> "$PKG_INSTALL_ROOT/etc/devlink.vbox"
     516        mv -f "$PKG_INSTALL_ROOT/etc/devlink.vbox" "$PKG_INSTALL_ROOT/etc/devlink.tab"
    501517    else
    502518        errorprint "Missing $PKG_INSTALL_ROOT/etc/devlink.tab, aborting install"
     
    550566
    551567            # Add vboxusbmon to devlink.tab
    552             sed -e '/name=vboxusbmon/d' $PKG_INSTALL_ROOT/etc/devlink.tab > $PKG_INSTALL_ROOT/etc/devlink.vbox
    553             echo "type=ddi_pseudo;name=vboxusbmon       \D" >> $PKG_INSTALL_ROOT/etc/devlink.vbox
    554             mv -f $PKG_INSTALL_ROOT/etc/devlink.vbox $PKG_INSTALL_ROOT/etc/devlink.tab
     568            sed -e '/name=vboxusbmon/d' "$PKG_INSTALL_ROOT/etc/devlink.tab" > "$PKG_INSTALL_ROOT/etc/devlink.vbox"
     569            echo "type=ddi_pseudo;name=vboxusbmon       \D" >> "$PKG_INSTALL_ROOT/etc/devlink.vbox"
     570            mv -f "$PKG_INSTALL_ROOT/etc/devlink.vbox" "$PKG_INSTALL_ROOT/etc/devlink.tab"
    555571
    556572            # Create the device link for non-remote installs
     
    590606
    591607    # Remove vboxdrv from devlink.tab
    592     if test -f $PKG_INSTALL_ROOT/etc/devlink.tab; then
    593         devlinkfound=`cat $PKG_INSTALL_ROOT/etc/devlink.tab | grep vboxdrv`
     608    if test -f "$PKG_INSTALL_ROOT/etc/devlink.tab"; then
     609        devlinkfound=`cat "$PKG_INSTALL_ROOT/etc/devlink.tab" | grep vboxdrv`
    594610        if test -n "$devlinkfound"; then
    595             sed -e '/name=vboxdrv/d' $PKG_INSTALL_ROOT/etc/devlink.tab > $PKG_INSTALL_ROOT/etc/devlink.vbox
    596             mv -f $PKG_INSTALL_ROOT/etc/devlink.vbox $PKG_INSTALL_ROOT/etc/devlink.tab
     611            sed -e '/name=vboxdrv/d' "$PKG_INSTALL_ROOT/etc/devlink.tab" > "$PKG_INSTALL_ROOT/etc/devlink.vbox"
     612            mv -f "$PKG_INSTALL_ROOT/etc/devlink.vbox" "$PKG_INSTALL_ROOT/etc/devlink.tab"
    597613        fi
    598614
    599615        # Remove vboxusbmon from devlink.tab
    600         devlinkfound=`cat $PKG_INSTALL_ROOT/etc/devlink.tab | grep vboxusbmon`
     616        devlinkfound=`cat "$PKG_INSTALL_ROOT/etc/devlink.tab" | grep vboxusbmon`
    601617        if test -n "$devlinkfound"; then
    602             sed -e '/name=vboxusbmon/d' $PKG_INSTALL_ROOT/etc/devlink.tab > $PKG_INSTALL_ROOT/etc/devlink.vbox
    603             mv -f $PKG_INSTALL_ROOT/etc/devlink.vbox $PKG_INSTALL_ROOT/etc/devlink.tab
     618            sed -e '/name=vboxusbmon/d' "$PKG_INSTALL_ROOT/etc/devlink.tab" > "$PKG_INSTALL_ROOT/etc/devlink.vbox"
     619            mv -f "$PKG_INSTALL_ROOT/etc/devlink.vbox" "$PKG_INSTALL_ROOT/etc/devlink.tab"
    604620        fi
    605621    fi
     
    628644    # remove devlinks
    629645    if test -h "$PKG_INSTALL_ROOT/dev/vboxdrv" || test -f "$PKG_INSTALL_ROOT/dev/vboxdrv"; then
    630         rm -f $PKG_INSTALL_ROOT/dev/vboxdrv
     646        rm -f "$PKG_INSTALL_ROOT/dev/vboxdrv"
    631647    fi
    632648    if test -h "$PKG_INSTALL_ROOT/dev/vboxusbmon" || test -f "$PKG_INSTALL_ROOT/dev/vboxusbmon"; then
    633         rm -f $PKG_INSTALL_ROOT/dev/vboxusbmon
     649        rm -f "$PKG_INSTALL_ROOT/dev/vboxusbmon"
    634650    fi
    635651
    636652    # unpatch nwam/dhcpagent fix
    637     nwamfile=$PKG_INSTALL_ROOT/etc/nwam/llp
     653    nwamfile="$PKG_INSTALL_ROOT/etc/nwam/llp"
    638654    nwambackupfile=$nwamfile.vbox
    639655    if test -f "$nwamfile"; then
     
    643659
    644660    # remove netmask configuration
    645     nmaskfile=$PKG_INSTALL_ROOT/etc/inet/netmasks
     661    if test -h "$PKG_INSTALL_ROOT/etc/netmasks"; then
     662        nmaskfile="$PKG_INSTALL_ROOT/etc/inet/netmasks"
     663    else
     664        nmaskfile="$PKG_INSTALL_ROOT/etc/netmasks"
     665    fi
    646666    nmaskbackupfile=$nmaskfile.vbox
    647667    if test -f "$nmaskfile"; then
    648668        sed -e '/#VirtualBox_SectionStart/,/#VirtualBox_SectionEnd/d' $nmaskfile > $nmaskbackupfile
    649669        mv -f $nmaskbackupfile $nmaskfile
     670    fi
     671
     672    if test $UPDATEBOOTARCHIVE -eq 1; then
     673        update_boot_archive
    650674    fi
    651675
     
    794818        if test -f "$DIR_CONF/vboxnet.conf"; then
    795819            # nwam/dhcpagent fix
    796             nwamfile=$PKG_INSTALL_ROOT/etc/nwam/llp
     820            nwamfile="$PKG_INSTALL_ROOT/etc/nwam/llp"
    797821            nwambackupfile=$nwamfile.vbox
    798822            if test -f "$nwamfile"; then
     
    820844                    # a copy of the actual file, repair that behaviour here.
    821845                    recreatelink=0
    822                     if test -h $PKG_INSTALL_ROOT/etc/netmasks; then
    823                         nmaskfile=$PKG_INSTALL_ROOT/etc/inet/netmasks
     846                    if test -h "$PKG_INSTALL_ROOT/etc/netmasks"; then
     847                        nmaskfile="$PKG_INSTALL_ROOT/etc/inet/netmasks"
    824848                    else
    825                         nmaskfile=$PKG_INSTALL_ROOT/etc/netmasks
     849                        nmaskfile="$PKG_INSTALL_ROOT/etc/netmasks"
    826850                        recreatelink=1
    827851                    fi
     
    831855                    if test -f $nmaskfile; then
    832856                        sed -e '/#VirtualBox_SectionStart/,/#VirtualBox_SectionEnd/d' $nmaskfile > $nmaskbackupfile
     857
     858                        if test $recreatelink -eq 1; then
     859                            # Check after removing our settings if /etc/netmasks is identifcal to /etc/inet/netmasks
     860                            anydiff=`diff $nmaskbackupfile "$PKG_INSTALL_ROOT/etc/inet/netmasks"`
     861                            if test ! -z $anydiff; then
     862                                # User may have some custom settings in /etc/netmasks, don't overwrite /etc/netmasks!
     863                                recreatelink=2
     864                            fi
     865                        fi                       
     866
    833867                        echo "#VirtualBox_SectionStart" >> $nmaskbackupfile
    834868                        inst=0
     
    844878                        # Recreate /etc/netmasks as a link if necessary
    845879                        if test $recreatelink -eq 1; then
    846                             cp -f $PKG_INSTALL_ROOT/etc/netmasks $PKG_INSTALL_ROOT/etc/inet/netmasks
    847                             ln -sf ./inet/netmasks $PKG_INSTALL_ROOT/etc/netmasks
     880                            rm -f "$PKG_INSTALL_ROOT/etc/netmasks"
     881                            ln -sf ./inet/netmasks "$PKG_INSTALL_ROOT/etc/netmasks"
     882                        elif test $recreatelink -eq 2; then
     883                            warnprint "/etc/netmasks is a symlink (to /etc/inet/netmasks) that older"
     884                            warnprint "VirtualBox installers incorrectly overwrote. Now the contents"
     885                            warnprint "of /etc/netmasks and /etc/inet/netmasks differ, therefore "
     886                            warnprint "VirtualBox will not attempt to overwrite /etc/netmasks as a"
     887                            warnprint "symlink to /etc/inet/netmasks. Please resolve this manually."
    848888                        fi
    849889                    fi
     
    855895        fi
    856896
    857         if test -f $PKG_INSTALL_ROOT/var/svc/manifest/application/virtualbox/virtualbox-webservice.xml || test -f $PKG_INSTALL_ROOT/var/svc/manifest/application/virtualbox/virtualbox-zoneaccess.xml; then
     897        if test -f "$PKG_INSTALL_ROOT/var/svc/manifest/application/virtualbox/virtualbox-webservice.xml" || test -f "$PKG_INSTALL_ROOT/var/svc/manifest/application/virtualbox/virtualbox-zoneaccess.xml"; then
    858898            infoprint "Configuring services..."
    859899            if test "$REMOTEINST" -eq 1; then
     
    876916        # and icons. There is still some delay until the GUI picks it up,
    877917        # but that cannot be helped.
    878         if test -d $PKG_INSTALL_ROOT/usr/share/icons; then
     918        if test -d "$PKG_INSTALL_ROOT/usr/share/icons"; then
    879919            infoprint "Installing MIME types and icons..."
    880920            if test "$REMOTEINST" -eq 0; then
     
    925965        fi
    926966
    927         # Update boot archive
    928         infoprint "Updating the boot archive..."
    929         if test "$REMOTEINST" -eq 0; then
    930             $BIN_BOOTADM update-archive > /dev/null
    931         else
    932             $BIN_BOOTADM update-archive -R $PKG_INSTALL_ROOT > /dev/null
    933         fi
    934 
     967        update_boot_archive
     968   
    935969        return 0
    936970    else
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