VirtualBox

Ignore:
Timestamp:
Nov 5, 2012 1:33:03 PM (12 years ago)
Author:
vboxsync
Message:

Installer/Linux: use newgrp to become a member of user group vboxusers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Installer/linux/VBox.sh

    r42119 r43801  
    7878fi
    7979
     80run_in_group()
     81{
     82    if id -G -n $(id -u -n) | tr ' ' '\n' | grep -q "vboxusers"; then
     83        AWK_SCRIPT='BEGIN { for ( i=1; i < ARGC; i++) {gsub(/'\''/, "'\''\\'\''", ARGV[i]); printf "'\''%s'\'' ", ARGV[i]}}'
     84        AWK_SCRIPT="BEGIN { for ( i=1; i < ARGC; i++) {gsub(/'/, \"'\\\\'\", ARGV[i]); printf \"'%s' \", ARGV[i]}}"
     85        ARGS="$(awk "$AWK_SCRIPT" "$@")"
     86        echo ${ARGS} ";" "exit" | exec newgrp vboxusers
     87    else
     88        exec "$@"
     89    fi
     90}
     91
    8092APP=`basename $0`
    8193case "$APP" in
    8294    VirtualBox|virtualbox)
    83         exec "$INSTALL_DIR/VirtualBox" "$@"
     95        run_in_group "$INSTALL_DIR/VirtualBox" "$@"
    8496        ;;
    8597    VBoxManage|vboxmanage)
    86         exec "$INSTALL_DIR/VBoxManage" "$@"
     98        run_in_group "$INSTALL_DIR/VBoxManage" "$@"
    8799        ;;
    88100    VBoxSDL|vboxsdl)
    89         exec "$INSTALL_DIR/VBoxSDL" "$@"
     101        run_in_group "$INSTALL_DIR/VBoxSDL" "$@"
    90102        ;;
    91103    VBoxVRDP|VBoxHeadless|vboxheadless)
    92         exec "$INSTALL_DIR/VBoxHeadless" "$@"
     104        run_in_group "$INSTALL_DIR/VBoxHeadless" "$@"
    93105        ;;
    94106    VBoxAutostart|vboxautostart)
    95         exec "$INSTALL_DIR/VBoxAutostart" "$@"
     107        run_in_group "$INSTALL_DIR/VBoxAutostart" "$@"
    96108        ;;
    97109    VBoxBalloonCtrl|vboxballoonctrl)
    98         exec "$INSTALL_DIR/VBoxBalloonCtrl" "$@"
     110        run_in_group "$INSTALL_DIR/VBoxBalloonCtrl" "$@"
    99111        ;;
    100112    vboxwebsrv)
    101         exec "$INSTALL_DIR/vboxwebsrv" "$@"
     113        run_in_group "$INSTALL_DIR/vboxwebsrv" "$@"
    102114        ;;
    103115    VBoxBFE|vboxbfe)
    104         exec "$INSTALL_DIR/VBoxBFE" "$@"
     116        run_in_group "$INSTALL_DIR/VBoxBFE" "$@"
    105117        ;;
    106118    *)
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