From 4ed3369c8188d4beafc33cee4185f971a81fd8f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Mon, 14 Nov 2011 12:15:55 +0100 Subject: easy_e17.sh: add --sudopwd option --- easy_e17.sh | 9 +++++++++ 1 file changed, 9 insertions(+) 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= = 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 -- cgit v1.1-2-g2b99