run-inst.sh revision 320484435d67c1fb90dca3e8836d81bf939c8ba2
575N/A# VirtualBox Makeself installation starter script for Linux 575N/A# Copyright (C) 2006-2009 Oracle Corporation 575N/A# Oracle Corporation confidential 575N/A# This is a stub installation script to be included in VirtualBox Makeself 575N/A# installers which removes any previous installations of the package, unpacks 575N/A# the package into the filesystem (by default under /opt) and starts the real 575N/A# Note: These variable names must *not* clash with variables in $CONFIG_DIR/$CONFIG! 575N/A info "Usage: install [<installation directory>] | uninstall [force] [no_setup]" 575N/A# Create a symlink in the filesystem and add it to the list of package files 575N/A # The file the link should point to 575N/A # The name of the actual symlink file. Must be an absolute path to a 575N/A # non-existing file in an existing directory. 575N/A { echo 1>&2 "$self: no target specified"; return 1; } 575N/A { echo 1>&2 "$self: link file name is not absolute"; return 1; } 575N/A# Create symbolic links targeting all files in a directory in another 575N/A# directory in the filesystem 575N/A # Directory containing the link target files 575N/A # Directory to create the link files in 575N/A# Look for broken installations or installations without a known uninstaller 575N/A# and try to clean them up, asking the user first. 575N/A # Whether to force cleanup without asking the user 575N/A if ! test "$1" = "force" ; then 575N/AYou appear to have a version of the _PACKAGE_ software 575N/Aon your system which was installed from a different source or using a 575N/Adifferent type of installer. If you installed it from a package from your 575N/ALinux distribution or if it is a default part of the system then we strongly 1214N/Arecommend that you cancel this installation and remove it properly before 575N/Ainstalling this version. If this is simply an older or a damaged 575N/Ainstallation you may safely proceed. 575N/ADo you wish to continue anyway? [yes or no] 575N/A # Stop what we can in the way of services and remove them from the 575N/A # Get rid of any remaining files 1365N/A # And any packages left under /opt 575N/A# Sensible default actions # Do not do cleanup of old modules when removing them. For if [
"`echo $1|cut -c1`" !=
"/" ];
then info "Please specify an absolute path" # uninstall any previous installation abort "Failed to remove existing installation. Aborting..." test "$ACTION" =
"install" ||
exit 0 # install the new version # Create a list of the files in the archive, skipping any directories which # already exist in the filesystem. # Set symlinks into /usr and /sbin # Install, set up and start init scripts # Remember our installation configuration # $PACKAGE installation record. # Package installation directory INSTALL_DIR=$INSTALLATION_DIR # Package uninstaller. If you repackage this software, please make sure # that this prints a message and returns an error so that the default # uninstaller does not attempt to delete the files installed by your INSTALL_VER=$INSTALLATION_VER # Auto-generated uninstallation file PATH=\$PATH:/bin:/sbin:/usr/sbin LOGFILE="/var/log/$PACKAGE-uninstall.log" if ! test -r "$INSTALLATION_DIR/$ROUTINES"; then echo 1>&2 "Required file $ROUTINES not found. Aborting..." . "$INSTALLATION_DIR/$ROUTINES" # We need to be run as root echo 1>&2 "Removing installed version $INSTALLATION_VER of $PACKAGE_NAME..." if test "\$1" = "no_cleanup"; then test -r "$CONFIG_DIR/$CONFIG_FILES" || abort "Required file $CONFIG_FILES not found. Aborting..." # Stop and clean up all services for i in "$INSTALLATION_DIR/init/"*; do stop_init_script "\`basename "\$i"\`" test -z "\$NO_CLEANUP" && cleanup_init "\`basename "\$i"\`" 2>> "\$LOGFILE" remove_init_script "\`basename "\$i"\`" # And remove all files and empty installation directories # Remove any non-directory entries cat "$CONFIG_DIR/$CONFIG_FILES" | xargs rm 2>/dev/null # Remove any empty (of files) directories in the file list cat "$CONFIG_DIR/$CONFIG_FILES" | find "\$file" -depth -type d -exec rmdir '{}' ';' 2>/dev/null rm "$CONFIG_DIR/$CONFIG_FILES" 2>/dev/null rm "$CONFIG_DIR/$CONFIG" 2>/dev/null rmdir "$CONFIG_DIR" 2>/dev/null