Changeset 44142 in vbox
- Timestamp:
- Dec 17, 2012 12:41:48 PM (12 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/Makefile.kmk
r44121 r44142 380 380 $(VBOX_REL_LNX_HOST_DRV)do_dkms \ 381 381 $(VBOX_REL_LNX_INST_SRC)routines.sh \ 382 $(VBOX_REL_LNX_ADD_INST)module-autologon.sh=>installer/module-autologon \ 382 383 $(VBOX_REL_LNX_ADD_INST)vboxadd.sh=>vboxadd \ 383 384 $(VBOX_REL_LNX_ADD_INST)vboxadd-service.sh=>vboxadd-service \ -
trunk/src/VBox/Installer/linux/routines.sh
r44080 r44142 622 622 } 623 623 624 install_autologon() {625 info "Installing auto-logon support ..."626 627 ## Parameters:628 # Greeter directory. Defaults to /usr/share/xgreeters.629 greeter_dir="$1"630 # LightDM config. Defaults to /etc/lightdm/lightdm.conf.631 lightdm_config="$2"632 # Whether to force installation if non-compatible distribution633 # is detected.634 force="$3"635 636 # Check for Ubuntu and derivates. @todo Debian?637 distros="Ubuntu UbuntuStudio Edubuntu Kubuntu Lubuntu Mythbuntu Xubuntu"638 ## @todo Map Linux Mint versions to Ubuntu ones.639 640 ## @todo Move the distro check to a routine / globals as soon as641 ## we have other distribution-dependent stuff.642 which lsb_release &>/dev/null643 if test "$?" -ne "0"; then644 info "Error: lsb_release not found (path set?), skipping auto-logon installation"645 return 1646 fi647 distro_name=$(lsb_release -si)648 distro_ver=$(lsb_release -sr)649 650 for distro_cur in ${distros}; do651 if test "$distro_name" = "$distro_cur"; then652 distro_found="true"653 break654 fi655 done656 657 if test -z "$distro_found"; then658 if ! test "$force" = "force"; then659 info "Error: Unsupported distribution \"$distro_name\" found, skipping auto-logon installation"660 return 1661 fi662 info "Warning: Unsupported distribution \"$distro_name\" found"663 else664 # Do we have Ubuntu 11.10 or greater?665 # Use AWK for comparison since we run on plan sh.666 echo | awk 'END { exit ( !('"$distro_ver >= 11.10"') ); }'667 if test "$?" -ne "0"; then668 if ! test "$force" = "force"; then669 info "Error: Version $distro_ver of \"$distro_name\" not supported, skipping auto-logon installation"670 return 1671 fi672 info "Warning: Unsupported \"$distro_name\" version $distro_ver found"673 fi674 fi675 676 # Install dependencies (lightdm and FLTK 1.3+) using apt-get.677 which apt-get &>/dev/null678 if test "$?" -ne "0"; then679 info "Error: apt-get not found (path set?), skipping auto-logon installation"680 return 1681 fi682 info "Checking and installing necessary dependencies ..."683 apt-get -qqq -y install libfltk1.3 libfltk-images1.3 || return 1684 apt-get -qqq -y install lightdm || return 1685 686 # Check for LightDM config.687 if ! test -f "$lightdm_config"; then688 info "Error: LightDM config \"$lightdm_config\" not found (LightDM installed?), skipping auto-logon installation"689 return 1690 fi691 692 # Check for /usr/share/xgreeters.693 if ! test -d "$greeter_dir"; then694 if ! test "$force" = "force"; then695 info "Error: Directory \"$greeter_dir\" does not exist, skipping auto-logon installation"696 return 1697 fi698 info "Warning: Directory \"$greeter_dir\" does not exist, creating it"699 mkdir -p -m 755 "$greeter_dir" || return 1700 fi701 702 # Link to required greeter files into $greeter_dir.703 add_symlink "$INSTALLATION_DIR/share/VBoxGuestAdditions/vbox-greeter.desktop" "$greeter_dir/vbox-greeter.desktop"704 705 # Backup and activate greeter config.706 if ! test -f "$lightdm_config.vbox-backup"; then707 info "Backing up LightDM configuration file ..."708 cp "$lightdm_config" "$lightdm_config.vbox-backup" || return 1709 chmod 644 "$lightdm_config.vbox-backup" || return 1710 fi711 sed -i -e 's/^\s*greeter-session\s*=/greeter-sessio**n=vbox-greeter/g' "$lightdm_config" || return 1712 chmod 644 "$lightdm_config" || return 1713 714 info "Auto-logon installation successful"715 return 0716 }717 718 remove_autologon() {719 if test -z "$LIGHTDM_CONFIG"; then720 return 0721 fi722 info "Un-installing auto-logon support ..."723 724 # Switch back to original greeter.725 if test -f "$LIGHTDM_CONFIG.vbox-backup"; then726 mv "$LIGHTDM_CONFIG.vbox-backup" "$LIGHTDM_CONFIG"727 if test "$?" -ne "0"; then728 info "Warning: Could not restore original LightDM config \"$LIGHTDM_CONFIG\""729 fi730 fi731 732 # Remove greeter directory (if not empty).733 rm "$LIGHTDM_GREETER_DIR" 2>/dev/null734 735 return 0736 }737 -
trunk/src/VBox/Installer/linux/run-inst.sh
r44090 r44142 24 24 PATH=$PATH:/bin:/sbin:/usr/sbin 25 25 26 set -xv 27 26 28 # Note: These variable names must *not* clash with variables in $CONFIG_DIR/$CONFIG! 27 29 PACKAGE="_PACKAGE_" … … 43 45 LOGFILE="/var/log/$PACKAGE.log" 44 46 45 INSTALLATION_LIGHTDM_CONFIG="/etc/lightdm/lightdm.conf"46 INSTALLATION_LIGHTDM_GREETER_DIR="/usr/share/xgreeters"47 48 47 . "./$ROUTINES" 49 48 … … 57 56 { 58 57 info "" 59 info "Usage: $SELF install [<installation directory>] [--with-autologon] |" 58 info "Usage: $SELF install [<installation directory>]" 59 info " [--enable <module>] |" 60 60 info " uninstall" 61 61 info " [--force] [--no-setup]" … … 153 153 done 154 154 155 remove_autologon156 157 155 # Get rid of any remaining files 158 156 for i in $DEFAULT_FILE_NAMES; do … … 201 199 # Sensible default actions 202 200 ACTION="install" 203 WITH_AUTOLOGON=""204 201 DO_SETUP="true" 205 202 NO_CLEANUP="" 206 203 FORCE_UPGRADE="" 207 while true 204 205 while [ $# -ge 2 ]; 208 206 do 209 if [ "$2" = "" ]; then 210 break 207 ARG=$2 208 shift 209 210 if [ -z "$MY_END_OF_OPTIONS" ]; then 211 case "$ARG" in 212 213 install) 214 ACTION="install" 215 ;; 216 217 uninstall) 218 ACTION="uninstall" 219 ;; 220 221 ## @todo Add per-module options handling, e.g. --lightdm-greeter-dir 222 # or --lightdm-config 223 224 --enable) 225 MODULE_CUR=$2 226 MODULE_CUR_PATH=$2 227 # Check if corresponding module in installer/module-$1 exists. 228 # Note: Module names may not contain spaces or other funny things. 229 if [ ! -f "./installer/module-${MODULE_CUR}" ]; then 230 info "Error: Module \"${MODULE_CUR}\" does not exist." 231 usage 232 fi 233 # Give the module the chance of doing initialization work / checks. 234 . "./installer/module-${MODULE_CUR}" 235 mod_${MODULE_CUR}_init 236 if test $? -ne 0; then 237 echo 1>&2 "Module '${CUR_MODULE}' failed to initialize" 238 if ! test "$FORCE_UPGRADE" = "force"; then 239 return 1 240 fi 241 # Continue initialization. 242 fi 243 # Add module to the list of modules to handle later. 244 if test -z "${INSTALLATION_MODULES_LIST}"; then 245 INSTALLATION_MODULES_LIST="${MODULE_CUR}" 246 else 247 INSTALLATION_MODULES_LIST="${INSTALLATION_MODULES_LIST} ${MODULE_CUR}" 248 fi 249 shift 250 ;; 251 252 --force|force) # Keep "force" for backwards compatibility. 253 FORCE_UPGRADE="force" 254 ;; 255 256 --no-setup|no_setup) # Keep "no_setup" for backwards compatibility. 257 DO_SETUP="" 258 ;; 259 260 --no-cleanup|no_cleanup) # Keep "no_cleanup" for backwards compatibility. 261 # Do not do cleanup of old modules when removing them. For 262 # testing purposes only. 263 DO_SETUP="" 264 NO_CLEANUP="no_cleanup" 265 ;; 266 267 --) 268 MY_END_OF_OPTIONS="1" 269 ;; 270 271 *) 272 if [ "`echo $1|cut -c1`" != "/" ]; then 273 info "Please specify an absolute path" 274 usage 275 fi 276 INSTALLATION_DIR="$1" 277 shift 278 ;; 279 esac 211 280 fi 212 shift213 case "$1" in214 install)215 ACTION="install"216 ;;217 218 uninstall)219 ACTION="uninstall"220 ;;221 222 --lightdm-config)223 INSTALLATION_LIGHTDM_CONFIG="$2"224 shift225 ;;226 227 --lightdm-greeter-dir)228 INSTALLATION_LIGHTDM_GREETER_DIR="$2"229 shift230 ;;231 232 --with-autologon)233 WITH_AUTOLOGON="true"234 ;;235 236 --force|force) # Keep "force" for backwards compatibility.237 FORCE_UPGRADE="force"238 ;;239 240 --no-setup|no_setup) # Keep "no_setup" for backwards compatibility.241 DO_SETUP=""242 ;;243 244 --no-cleanup|no_cleanup) # Keep "no_cleanup" for backwards compatibility.245 # Do not do cleanup of old modules when removing them. For246 # testing purposes only.247 DO_SETUP=""248 NO_CLEANUP="no_cleanup"249 ;;250 251 *)252 if [ "`echo $1|cut -c1`" != "/" ]; then253 info "Please specify an absolute path"254 usage255 fi256 INSTALLATION_DIR="$1"257 ;;258 esac259 281 done 260 282 … … 274 296 rmdir "$CONFIG_DIR" 2>/dev/null 275 297 test "$ACTION" = "install" || exit 0 298 299 # Set installer modules directory 300 INSTALLATION_MODULES_DIR="$INSTALLATION_DIR/installer/" 301 302 # install and load installer modules 303 info "Copying additional installer modules ..." 304 mkdir -p -m 755 "$INSTALLATION_MODULES_DIR" 305 for CUR_FILE in installer/*; do 306 install -p -m 755 "$CUR_FILE" "$INSTALLATION_MODULES_DIR" 307 if [ $? -ne 0 ]; then 308 info "Error: Failed to copy installer module \"$CUR_FILE\"" 309 if ! test "$FORCE_UPGRADE" = "force"; then 310 exit 1 311 fi 312 fi 313 done 276 314 277 315 # install the new version … … 303 341 link_into_fs "src" "/usr/src" 304 342 343 info "Installing additional modules ..." 344 for CUR_MODULE in $(find "$INSTALLATION_MODULES_DIR") 345 do 346 echo "$CUR_MODULE" >> "$CONFIG_DIR/$CONFIG_FILES" 347 done 348 349 for CUR_MODULE in ${INSTALLATION_MODULES_LIST} 350 do 351 mod_${CUR_MODULE}_install 352 if [ $? -ne 0 ]; then 353 info "Error: Failed to install module \"$CUR_MODULE\"" 354 if ! test "$FORCE_UPGRADE" = "force"; then 355 exit 1 356 fi 357 fi 358 done 359 305 360 # Remember our installation configuration before we call any init scripts 306 361 cat > "$CONFIG_DIR/$CONFIG" << EOF … … 308 363 # Package installation directory 309 364 INSTALL_DIR='$INSTALLATION_DIR' 365 # Additional installation modules 366 INSTALL_MODULES_DIR='$INSTALLATION_MODULES_DIR' 367 INSTALL_MODULES_LIST='$INSTALLATION_MODULES_LIST' 310 368 # Package uninstaller. If you repackage this software, please make sure 311 369 # that this prints a message and returns an error so that the default … … 319 377 BUILD_TYPE='$BUILD_TYPE' 320 378 USERNAME='$USERNAME' 321 # LightDM greeter configuration322 LIGHTDM_CONFIG='$INSTALLATION_LIGHTDM_CONFIG'323 LIGHTDM_GREETER_DIR='$INSTALLATION_LIGHTDM_GREETER_DIR'324 379 EOF 380 381 # Give the modules the chance to write their stuff 382 # to the installation config as well. 383 info "Saving modules configuration ..." 384 for CUR_MODULE in ${INSTALLATION_MODULES_LIST} 385 do 386 echo "$(mod_${CUR_MODULE}_config_save)" >> "$CONFIG_DIR/$CONFIG" 387 done 325 388 326 389 # Install, set up and start init scripts … … 372 435 fi 373 436 done 437 438 # Load all modules 439 # Important: This needs to be done before loading the configuration 440 # value below to not override values which are set to a default 441 # value in the modules itself. 442 for CUR_MODULE in \$(find "$INSTALLATION_MODULES_DIR" -name "module-*") 443 do 444 . "\$CUR_MODULE" 445 done 446 447 # Load configuration values 448 test -r "$CONFIG_DIR/$CONFIG" && . "$CONFIG_DIR/$CONFIG" 449 450 # Call uninstallation initialization of all modules 451 for CUR_MODULE in "$INSTALLATION_MODULES_LIST" 452 do 453 if test -z "\$CUR_MODULE"; then 454 continue 455 fi 456 mod_\${CUR_MODULE}_pre_uninstall 457 if [ $? -ne 0 ]; then 458 echo 1>&2 "Module \"\$CUR_MODULE\" failed to initialize uninstallation" 459 # Continue initialization. 460 fi 461 done 462 463 # Call uninstallation of all modules 464 for CUR_MODULE in "$INSTALLATION_MODULES_LIST" 465 do 466 if test -z "\$CUR_MODULE"; then 467 continue 468 fi 469 mod_\${CUR_MODULE}_uninstall 470 if [ $? -ne 0 ]; then 471 echo 1>&2 "Module \"\$CUR_MODULE\" failed to uninstall" 472 # Continue uninstallation. 473 fi 474 done 374 475 375 476 # And remove all files and empty installation directories … … 387 488 done 388 489 389 # Load configuration values390 test -r "$CONFIG_DIR/$CONFIG" && . "$CONFIG_DIR/$CONFIG"391 392 # Remove auto-logon support393 remove_autologon394 395 490 # Remove configuration files 396 491 rm "$CONFIG_DIR/$CONFIG_FILES" 2>/dev/null … … 404 499 echo "$INSTALLATION_DIR/" >> "$CONFIG_DIR/$CONFIG_FILES" 405 500 406 # Install auto-logon support.407 if test -n "$WITH_AUTOLOGON"; then408 ## @todo Make parameters configurable thru command line.409 install_autologon "$INSTALLATION_LIGHTDM_GREETER_DIR" "$INSTALLATION_LIGHTDM_CONFIG" "$FORCE_UPGRADE"410 fi411
Note:
See TracChangeset
for help on using the changeset viewer.