Commit 83373db0 authored by Vitaly Lipatov's avatar Vitaly Lipatov

loginhsh: add -d, -q -r params

parent 58544cb5
#!/bin/sh #!/bin/sh
# 2005-2006 (c) Etersoft www.etersoft.ru # 2005-2006, 2012 (c) Etersoft www.etersoft.ru
# Author: Vitaly Lipatov <lav@etersoft.ru> # Author: Vitaly Lipatov <lav@etersoft.ru>
# Public domain # Public domain
# #
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
# -t - use test hasher # -t - use test hasher
# -i - initialize hasher # -i - initialize hasher
# -M? - set target distro # -M? - set target distro
# Public domain
# TODO: -r
# load common functions, compatible with local and installed script # load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common . `dirname $0`/../share/eterbuild/functions/common
...@@ -18,7 +16,7 @@ SAVEOPT=$@ ...@@ -18,7 +16,7 @@ SAVEOPT=$@
############################# #############################
Usage="Usage: $name [-t -i -h -r -c] [-$CURRENTBRANCHNAME] bin.rpm..." Usage="Usage: $name [-t -i -h -r -c -b -i] [package name] [package file bin.rpm] ..."
function mygetopts() function mygetopts()
{ {
name=${0##*/} name=${0##*/}
...@@ -33,26 +31,30 @@ phelp() ...@@ -33,26 +31,30 @@ phelp()
echog " -i initialize hasher" echog " -i initialize hasher"
echog " -b REPONAME binary repository name (4.1, p5, t6 and so on)" echog " -b REPONAME binary repository name (4.1, p5, t6 and so on)"
echog " -c cleanup hasher" echog " -c cleanup hasher"
echog " -q quiet mode (don't run anything)"
echog " -r run command"
echog " -o log in as root user" echog " -o log in as root user"
echog " -v verbose" echog " -v verbose"
echog " -x allow run X program (set DISPLAY and use xauth)" echog " -x allow run X program (set DISPLAY and use xauth)"
echog " -t use test hasher dir (different to build hasher)" echog " -t use test hasher dir (different to build hasher)"
echog " -M?? branch name"
echo echo
echog "Extra options:" echog "Extra options:"
echog " -a auto test mode for post myhsh build checking" echog " -a auto test mode for post myhsh build checking"
echog " -r remote login to hasher" echog " -d print hasher dir"
echog " -M?? branch name"
} }
while getopts :chitoavb:x opt; do while getopts :chitoadvqr:b:x opt; do
case $opt in case $opt in
h) phelp; exit 0;; h) phelp; exit 0;;
t) TESTMODE=1 ;; t) TESTMODE=1 ;;
i) INITIALIZE=1 ;; i) INITIALIZE=1 ;;
c) CLEANUP=1 ;; c) CLEANUP=1 ;;
a) AUTOMODE=1 ;; a) AUTOMODE=1 ;;
d) PRINTHASHERDIR=1 ;;
q) QUIETMODE=1 ;;
b) BINARYREPONAME=$OPTARG ;; b) BINARYREPONAME=$OPTARG ;;
r) REMOTE=1 ;; r) RUNCOMMAND=$OPTARG ;;
x) ALLOWX=1 ;; x) ALLOWX=1 ;;
v) VERBOSE="-v" ;; v) VERBOSE="-v" ;;
o) ROOTER="--rooter" ;; o) ROOTER="--rooter" ;;
...@@ -87,14 +89,12 @@ if [ -n "$TESTMODE" ] || [ -n "$AUTOMODE" ] ; then ...@@ -87,14 +89,12 @@ if [ -n "$TESTMODE" ] || [ -n "$AUTOMODE" ] ; then
HASHERDIR=$HASHERDIR-test HASHERDIR=$HASHERDIR-test
fi fi
if [ "$PRINTHASHERDIR" = "1" ] ; then
if [ -n "$REMOTE" ] ; then echo $HASHERDIR
check_ssh_key
test -n "$BUILDSERVER" || fatal "Please set BUILDSERVER in config file"
ssh -t $BUILDSERVER loginhsh ${SAVEOPT/-r/}
exit exit
fi fi
if [ "$CLEANUP" = "1" ] ; then if [ "$CLEANUP" = "1" ] ; then
echog "Cleanup hasher in $HASHERDIR..." echog "Cleanup hasher in $HASHERDIR..."
docmd $HSH --cleanup-only $HASHERDIR $HASHERARG || fatal "cleanup" docmd $HSH --cleanup-only $HASHERDIR $HASHERARG || fatal "cleanup"
...@@ -111,6 +111,23 @@ SHELLHASHERARG="--mountpoints=/proc" ...@@ -111,6 +111,23 @@ SHELLHASHERARG="--mountpoints=/proc"
check_locking check_locking
UTILPKG=
if [ -n "$ALLOWX" ] ; then
UTILPKG="$UTILPKG xauth fonts-ttf-liberation"
fi
if [ -n "$RUNCOMMAND" ] ; then
docmd $HSH-install $HASHERDIR --wait-lock $UTILPKG $LISTRPMARGS $LISTNAMES || fatal "Error with install"
docmd $HSH-run $ROOTER $HASHERDIR -- $RUNCOMMAND
exit
fi
if [ -n "$QUIETMODE" ] ; then
docmd $HSH-install $HASHERDIR --wait-lock $UTILPKG $LISTRPMARGS $LISTNAMES || fatal "Error with install"
echog "Exiting (quiet mode)..."
exit
fi
echog "Prepare hasher in $HASHERDIR ..." echog "Prepare hasher in $HASHERDIR ..."
# there is package names in LISTRPMARGS # there is package names in LISTRPMARGS
UTILPKG="mc" UTILPKG="mc"
......
...@@ -90,6 +90,7 @@ prepare_aptconfig() ...@@ -90,6 +90,7 @@ prepare_aptconfig()
$ETERBUILD_APTREPO $ETERBUILD_APTREPO
EOF EOF
fi fi
[ -n "$QUIETMODE" ] || return
echo echo
echog "Apt sources from $OURSOURCES:" echog "Apt sources from $OURSOURCES:"
cat $OURSOURCES | grep -v "^#" | grep -v "^\$" | grep rpm cat $OURSOURCES | grep -v "^#" | grep -v "^\$" | grep rpm
......
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