Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=90568078ed9028bdcfe96644b2f9d8065e1a4dff
commit 90568078ed9028bdcfe96644b2f9d8065e1a4dff Author: Michel Hermier <[email protected]> Date: Mon Dec 3 07:35:36 2012 +0100 scripts/makepkg * Add --sudo flag to makepkg_shell to specify the need to run the command as a super user. * Implement spawning the shell on blank line. diff --git a/scripts/makepkg b/scripts/makepkg index 29beb50..6924ef4 100755 --- a/scripts/makepkg +++ b/scripts/makepkg @@ -2758,17 +2758,20 @@ makepkg_shell_usage() { $ECHO $ECHO "Options for chroot command:" $ECHO " -h, --help This help" + $ECHO " -s, --sudo Command requires super user rigths" $ECHO $ECHO "If no command is given, run '\${SHELL} -i' (default: '/bin/sh -i')." } makepkg_shell() { + local sudo=0 local consumed i ret while [ $# -gt 0 ]; do consumed=1 case "$1" in -h|--help) makepkg_shell_usage; return 0 ;; + -s|--sudo) sudo=1 ;; # special options --) shift; break ;; # End of options --*|-?) makepkg_shell_usage; return 1 ;; @@ -2790,11 +2793,19 @@ makepkg_shell() { done if [ $# -eq 0 ]; then - error "IMPLEMENT ME: Spawn an interactive shell" - return 1 - else - "$@" + if [ -v SHELL ]; then + set -- "$SHELL" + else + set -- /bin/sh + fi + set -- "$@" -i fi + + if [ "$sudo" -eq 1 -a "$(id -u)" -ne 0 ]; then + set -- sudo "$@" + fi + + "$@" return $? } _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
