- Timestamp:
- Apr 12, 2011 3:40:51 PM (14 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 4 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/Makefile.kmk
r36518 r36658 72 72 endif 73 73 74 ifeq ($(KBUILD_TARGET),linux) 75 INSTALLS += LnxAddIso-scripts 76 LnxAddIso-scripts_INST = bin/additions 77 LnxAddIso-scripts_MODE = a+rx,u+w 78 LnxAddIso-scripts_SOURCES = \ 79 $(LnxAddIso-scripts_0_OUTDIR)/runasroot.sh \ 80 $(LnxAddIso-scripts_0_OUTDIR)/autorun.sh 81 LnxAddIso-scripts_CLEAN = \ 82 $(LnxAddIso-scripts_0_OUTDIR)/runasroot.sh \ 83 $(LnxAddIso-scripts_0_OUTDIR)/autorun.sh 84 85 $$(LnxAddIso-scripts_0_OUTDIR)/runasroot.sh: \ 86 $(PATH_SUB_CURRENT)/../Installer/linux/runasroot.sh \ 87 $(PATH_SUB_CURRENT)/../Installer/linux/sh-utils.sh \ 88 | $$(dir $$@) 89 $(QUIET)$(SED) \ 90 -e '/#include sh-utils.sh/ {' \ 91 -e "r $(PATH_ROOT)/src/VBox/Installer/linux/sh-utils.sh" \ 92 -e 'd' \ 93 -e '}' \ 94 --output $@ \ 95 $< 96 97 $$(LnxAddIso-scripts_0_OUTDIR)/autorun.sh: \ 98 $(PATH_SUB_CURRENT)/linux/installer/autorun.sh \ 99 $(PATH_SUB_CURRENT)/../Installer/linux/sh-utils.sh \ 100 | $$(dir $$@) 101 $(QUIET)$(SED) \ 102 -e '/#include sh-utils.sh/ {' \ 103 -e "r $(PATH_ROOT)/src/VBox/Installer/linux/sh-utils.sh" \ 104 -e 'd' \ 105 -e '}' \ 106 --output $@ \ 107 $< 108 endif # KBUILD_TARGET == linux 74 109 ifeq ($(KBUILD_TARGET),win) 75 110 # -
trunk/src/VBox/Additions/linux/Makefile.kmk
r36603 r36658 327 327 $(VBOX_BRAND_LICENSE_TXT)=>LICENSE 328 328 329 INSTALLS += AutoRun-sh330 AutoRun-sh_INST = bin/additions/331 AutoRun-sh_MODE = a+rx,u+w332 AutoRun-sh_SOURCES = \333 $(VBOX_REL_LNX_INST_SRC)runasroot.sh \334 $(VBOX_REL_LNX_ADD_INST)autorun.sh335 336 329 337 330 # -
trunk/src/VBox/Additions/linux/installer/autorun.sh
r36626 r36658 1 1 #!/bin/sh 2 # $Id$ 2 3 # 3 4 # VirtualBox Guest Additions installation script for *nix guests … … 5 6 6 7 # 7 # Copyright (C) 2009-201 0Oracle Corporation8 # Copyright (C) 2009-2011 Oracle Corporation 8 9 # 9 10 # This file is part of VirtualBox Open Source Edition (OSE), as … … 18 19 PATH=$PATH:/bin:/sbin:/usr/sbin 19 20 20 # Deal with differing "which" semantics 21 mywhich() { 22 which "$1" 2>/dev/null | grep -v "no $1" 23 } 24 25 # Get the name and execute switch for a useful terminal emulator 26 # 27 # Sets $gxtpath to the emulator path or empty 28 # Sets $gxttitle to the "title" switch for that emulator 29 # Sets $gxtexec to the "execute" switch for that emulator 30 # May clobber $gtx* 31 # Calls mywhich 32 getxterm() { 33 # gnome-terminal uses -e differently to other emulators 34 for gxti in "gnome-terminal --title -x" "konsole --title -e" "xterm -T -e"; do 35 set $gxti 36 gxtpath="`mywhich $1`" 37 case "$gxtpath" in ?*) 38 gxttitle=$2 39 gxtexec=$3 40 return 41 ;; 42 esac 43 done 44 } 45 46 # Quotes its argument by inserting '\' in front of every character save 47 # for 'A-Za-z0-9/'. Prints the result to stdout. 48 quotify() { 49 echo "$1" | sed -e 's/\([^a-zA-Z0-9/]\)/\\\1/g' 50 } 21 #include sh-utils.sh 51 22 52 23 ostype=`uname -s` -
trunk/src/VBox/Installer/linux/runasroot.sh
r36626 r36658 1 1 #!/bin/sh 2 # $Id$ 2 3 ## @file 3 4 # VirtualBox privileged execution helper script for Linux and Solaris … … 16 17 # 17 18 18 # Deal with differing "which" semantics 19 mywhich() { 20 which "$1" 2>/dev/null | grep -v "no $1" 21 } 22 23 # Get the name and execute switch for a useful terminal emulator 24 # 25 # Sets $gxtpath to the emulator path or empty 26 # Sets $gxttitle to the "title" switch for that emulator 27 # Sets $gxtexec to the "execute" switch for that emulator 28 # May clobber $gtx* 29 # Calls mywhich 30 getxterm() { 31 # gnome-terminal uses -e differently to other emulators 32 for gxti in "gnome-terminal --title -x" "konsole --title -e" "xterm -T -e"; do 33 set $gxti 34 gxtpath="`mywhich $1`" 35 case "$gxtpath" in ?*) 36 gxttitle=$2 37 gxtexec=$3 38 return 39 ;; 40 esac 41 done 42 } 43 44 # Quotes its argument by inserting '\' in front of every character save 45 # for 'A-Za-z0-9/'. Prints the result to stdout. 46 quotify() { 47 echo $1 | sed -e 's/\([^a-zA-Z0-9/]\)/\\\1/g' 48 } 19 #include sh-utils.sh 49 20 50 21 ostype=`uname -s` -
trunk/src/VBox/Installer/linux/sh-utils.sh
r36626 r36658 1 #!/bin/sh 1 # $Id$ 2 # Shell script include file 2 3 ## @file 3 # VirtualBox privileged execution helper script for Linux and Solaris4 # Shell script routines which are likely to be useful for different scripts 4 5 # 5 6 … … 45 46 # for 'A-Za-z0-9/'. Prints the result to stdout. 46 47 quotify() { 47 echo $1| sed -e 's/\([^a-zA-Z0-9/]\)/\\\1/g'48 echo "$1" | sed -e 's/\([^a-zA-Z0-9/]\)/\\\1/g' 48 49 } 49 50 ostype=`uname -s`51 if test "$ostype" != "Linux" && test "$ostype" != "SunOS" ; then52 echo "Linux/Solaris not detected."53 exit 154 fi55 56 case "$#" in "2"|"3")57 ;;58 *)59 echo "Usage: `basename $0` DESCRIPTION COMMAND [ADVICE]" >&260 echo >&261 echo "Attempt to execute COMMAND with root privileges, displaying DESCRIPTION if" >&262 echo "possible and displaying ADVICE if possible if no su(1)-like tool is available." >&263 exit 164 ;;65 esac66 67 DESCRIPTION=$168 COMMAND=$269 ADVICE=$370 PATH=$PATH:/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin:/usr/X11/bin71 72 case "$ostype" in SunOS)73 PATH=$PATH:/usr/sfw/bin:/usr/gnu/bin:/usr/xpg4/bin:/usr/xpg6/bin:/usr/openwin/bin:/usr/ucb74 GKSU_SWITCHES="-au root"75 ;;76 *)77 GKSU_SWITCHES=""78 ;;79 esac80 81 case "$DISPLAY" in ?*)82 KDESUDO="`mywhich kdesudo`"83 case "$KDESUDO" in ?*)84 eval "`quotify "$KDESUDO"` --comment `quotify "$DESCRIPTION"` -- $COMMAND"85 exit86 ;;87 esac88 89 GKSU="`mywhich gksu`"90 case "$GKSU" in ?*)91 # Older gksu does not grok --description nor '--' and multiple args.92 # @todo which versions do?93 # "$GKSU" --description "$DESCRIPTION" -- "$@"94 # Note that $GKSU_SWITCHES is NOT quoted in the following95 "$GKSU" $GKSU_SWITCHES "$COMMAND"96 exit97 ;;98 esac99 ;;100 esac # $DISPLAY101 102 # pkexec may work for ssh console sessions as well if the right agents103 # are installed. However it is very generic and does not allow for any104 # custom messages. Thus it comes after gksu.105 PKEXEC="`mywhich pkexec`"106 case "$PKEXEC" in ?*)107 eval "\"$PKEXEC\" $COMMAND"108 exit109 ;;110 esac111 112 # The ultimate fallback is running 'su -' within an xterm. We use the113 # title of the xterm to tell what is going on.114 case "$DISPLAY" in ?*)115 SU="`mywhich su`"116 case "$SU" in ?*)117 getxterm118 case "$gxtpath" in ?*)119 "$gxtpath" "$gxttitle" "$DESCRIPTION - su" "$gxtexec" su - root -c "$COMMAND"120 exit121 ;;122 esac123 esac124 esac # $DISPLAY125 126 # Failure...127 case "$DISPLAY" in ?*)128 echo "Unable to locate 'pkexec', 'gksu' or 'su+xterm'. $ADVICE" >&2129 ;;130 *)131 echo "Unable to locate 'pkexec'. $ADVICE" >&2132 ;;133 esac134 135 exit 1
Note:
See TracChangeset
for help on using the changeset viewer.