From d36841a7dfddbd0f29c322b106115815f619773c Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Thu, 12 Oct 2006 18:56:10 +0000 Subject: [PATCH] jcs: Ongoing improvements - Add option -p to jcs install - Replace jcs install by sudo jcs install here and there - Remove /etc/jcs/jcs.mk on init --- scripts/jcs | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/scripts/jcs b/scripts/jcs index 041ac992..5449f61c 100644 --- a/scripts/jcs +++ b/scripts/jcs @@ -188,6 +188,11 @@ usage() { echo done fi fi + if [ -f /etc/jcs/jcs.mk ]; then + echo -n " + removing /etc/jcs/jcs.mk ... " + rm /etc/jcs/jcs.mk + echo done + fi # --- be downward compatible < # --- be downward compatible > if [ -f /etc/jcs/jcs.mk ] ; then @@ -317,23 +322,25 @@ usage() { # ============================ here we go! # ================================================ -set -- `getopt b:htf $*` +set -- `getopt b:p:htf $*` while [ ! "$1" = "--" ] ; do case $1 in -b) BCKPDIR=$2 - shift 2;; - -f) - FORCE=1 shift;; + -f) + FORCE=1;; -t) - TEST=1 + TEST=1;; + -p) + PREFIX=$2 shift;; -h) usage; exit 0;; *) usage; exit 1;; esac +shift done shift @@ -408,6 +415,9 @@ for NEXT_SECTION in $SECTIONS "$LAST_LINE_MARKER"; do BACKUP_GROUP=$cfg_jcs_group fi fi + if [ -n "$PREFIX" ]; then + TARGET_DIR=$PREFIX/$TARGET_DIR + fi if [ ! -d "$TARGET_DIR" ] ; then if [ -z "$TARGET_DIR_MODE" ] ; then echo "Don't know how to create target directory \"$TARGET_DIR\". TARGET_DIR_MODE not specified." @@ -484,6 +494,10 @@ for NEXT_SECTION in $SECTIONS "$LAST_LINE_MARKER"; do # ------------ execute shell scripts exec_scripts $SECTION + if [ -n "$PREFIX" ]; then + TARGET_DIR=$PREFIX/$TARGET_DIR + fi + echo "---- Section [$SECTION] -- installing $INSTALLATION_SUBJECT ----" echo " ($SOURCE_DIR -> $TARGET_DIR)" @@ -1873,11 +1887,11 @@ define recurse_subdirs endef %.done: %.inf - jcs install $< + sudo jcs install $< touch $@ %.su_done: %.inf - jcs install -b setup -f $< + sudo jcs install -b setup -f $< touch $@ install_inf: $(INF_DONE) @@ -1885,7 +1899,7 @@ install_inf: $(INF_DONE) install_inf.old: checkroot checkdirs @echo "####" checking installation information files ... ;\ if [ -n "`find . -name '*.inf' -maxdepth 1`" ] ; then \ - jcs install *.inf ;\ + sudo jcs install *.inf ;\ fi | $(TEE) -a $(INSTALL_LOG) install_link: @@ -1901,7 +1915,7 @@ setup_inf: $(INF_SU_DONE) setup_inf.old: checkroot checkdirs @echo "####" checking installation information files ... ;\ if [ -n "`find . -name '*.inf' -maxdepth 1`" ] ; then \ - jcs install -b setup -f *.inf ;\ + sudo jcs install -b setup -f *.inf ;\ fi | $(TEE) -a $(SETUP_LOG) setup_link: checkroot checkdirs @@ -1913,7 +1927,7 @@ setup_link: checkroot checkdirs test_inf: checkdirs @echo "####" testing installation information files ... ;\ if [ -n "`find . -name '*.inf' -maxdepth 1`" ] ; then \ - jcs install *.inf -t ;\ + sudo jcs install *.inf -t ;\ fi | $(TEE) -a $(INSTALL_LOG) test_link: checkdirs @@ -1952,7 +1966,7 @@ dist: clean mv $(MOD).tar.gz $(MOD) checkroot: - @if [ `whoami` != root ] ; then echo "Only root can do this." >&2; exit 1; fi +# @if [ `whoami` != root ] ; then echo "Only root can do this." >&2; exit 1; fi checkdirs: @test -f /etc/jcs/jcs.conf || exit 1 ;\