Commit 1e572a66 authored by Vitaly Lipatov's avatar Vitaly Lipatov

loginhsh: add -o option for run as root

parent 98fae9bc
...@@ -18,7 +18,7 @@ SAVEOPT=$@ ...@@ -18,7 +18,7 @@ SAVEOPT=$@
############################# #############################
Usage="Usage: $name [-t -i -h -r] [-$CURRENTBRANCHNAME] bin.rpm..." Usage="Usage: $name [-t -i -h -r -c] [-$CURRENTBRANCHNAME] bin.rpm..."
function mygetopts() function mygetopts()
{ {
name=${0##*/} name=${0##*/}
...@@ -31,18 +31,20 @@ phelp() ...@@ -31,18 +31,20 @@ phelp()
echog "Options:" echog "Options:"
echog " -i - initialize hasher" echog " -i - initialize hasher"
echog " -c - cleanup hasher" echog " -c - cleanup hasher"
echog " -o - log in as root user"
echog " -t - use test hasher dir" echog " -t - use test hasher dir"
echog " -r - remote login to hasher" echog " -r - remote login to hasher"
echog " -M?? - branch name" echog " -M?? - branch name"
} }
while getopts :chitr opt; do while getopts :chito opt; do
case $opt in case $opt in
h) phelp; exit 0;; h) phelp; exit 0;;
t) HASHERDIR=$HASHERDIR-test; TESTMODE=1 ;; t) HASHERDIR=$HASHERDIR-test; TESTMODE=1 ;;
i) INITIALIZE=1 ;; i) INITIALIZE=1 ;;
c) CLEANUP=1 ;; c) CLEANUP=1 ;;
r) REMOTE=1 ;; r) REMOTE=1 ;;
o) ROOTER="--rooter" ;;
+?) echog "$name: options should not be preceded by a '+'." 1>&2; exit 2;; +?) echog "$name: options should not be preceded by a '+'." 1>&2; exit 2;;
# ?) echog "$name: $OPTARG: bad option. Use -h for help." 1>&2 ; exit 2;; # ?) echog "$name: $OPTARG: bad option. Use -h for help." 1>&2 ; exit 2;;
?) OPTIND=$((OPTIND-1)); break; ?) OPTIND=$((OPTIND-1)); break;
...@@ -70,7 +72,7 @@ fi ...@@ -70,7 +72,7 @@ fi
# export OURAPTCONF with temp. file contains correct path to sources.list # export OURAPTCONF with temp. file contains correct path to sources.list
prepare_aptconfig prepare_aptconfig
HASHERARG="--apt-config=$OURAPTCONF --target $DEFAULTARCH" HASHERARG="$HASHERARG --apt-config=$OURAPTCONF --target $DEFAULTARCH"
mygetopts $LISTARGS mygetopts $LISTARGS
...@@ -107,7 +109,7 @@ else ...@@ -107,7 +109,7 @@ else
fi fi
$HSH-install $HASHERDIR --wait-lock $UTILPKG $LISTRPMARGS $LISTNAMES || fatal "Error with install" $HSH-install $HASHERDIR --wait-lock $UTILPKG $LISTRPMARGS $LISTNAMES || fatal "Error with install"
echog "You are in hasher shell" echog "You are in hasher shell"
$HSH-shell $HASHERDIR $SHELLHASHERARG -Y --shell $HSH-shell $HASHERDIR $SHELLHASHERARG $ROOTER -Y --shell
if [ -n "$TESTMODE" ] ; then if [ -n "$TESTMODE" ] ; then
echo "Remove package for test preun scripts" echo "Remove package for test preun scripts"
$HSH-run --rooter $HASHERDIR -- rpm -e $(drop_pkg_extensions $LISTNAMES) $HSH-run --rooter $HASHERDIR -- rpm -e $(drop_pkg_extensions $LISTNAMES)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment