diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2011-11-14 12:15:55 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2011-11-14 12:15:55 +0100 |
commit | 4ed3369c8188d4beafc33cee4185f971a81fd8f5 (patch) | |
tree | cb86e934c3e101b77756c038c81accc3b513b90b | |
parent | bf25f1a0171f7a87527e0039a76d5d6dfe812b66 (diff) | |
download | bin-4ed3369c8188d4beafc33cee4185f971a81fd8f5.zip bin-4ed3369c8188d4beafc33cee4185f971a81fd8f5.tar.gz |
easy_e17.sh: add --sudopwd option
-rwxr-xr-x | easy_e17.sh | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/easy_e17.sh b/easy_e17.sh index 2eac793..b0570e0 100755 --- a/easy_e17.sh +++ b/easy_e17.sh @@ -192,6 +192,7 @@ function help () echo " --srcrev=<revision> = set the default source revision" echo " --asuser = do everything as the user, not as root" echo " --no-sudopwd = sudo don't need a password..." + echo " --sudopwd = provide sudo password" echo " -c, --clean = clean the sources before building" echo " (more --cleans means more cleaning, up" echo " to a maximum of three, which will" @@ -395,6 +396,7 @@ function parse_args () ;; --asuser) asuser=1 ;; --no-sudopwd) no_sudopwd=1 ;; + --sudopwd) sudopwd=$value ;; -c|--clean) clean=$(($clean + 1)) ;; -d|--docs) gen_docs=1 ;; --postscript) easy_e17_post_script="$value" ;; @@ -560,6 +562,13 @@ function check_build_user () if [ -e "$tmp_path/sudo.test" ]; then rm -f "$tmp_path/sudo.test" fi + # check cmdline provided password + if [ -n "sudopwd" ]; then + echo "$sudopwd" | sudo -S touch "$tmp_path/sudo.test" &>/dev/null + if [ ! -e "$tmp_path/sudo.test" ]; then + error "cmdline provided sudo password failed!" + fi + fi while [ -z "$sudopwd" ]; do echo -n "enter sudo-password: " stty -echo |