jcs: Ongoing improvements

- Add option -p <prefix> to jcs install
  - Replace jcs install by sudo jcs install here and there
  - Remove /etc/jcs/jcs.mk on init
This commit is contained in:
Jan Lindemann 2006-10-12 18:56:10 +00:00 committed by Jan Lindemann
commit d36841a7df

View file

@ -188,6 +188,11 @@ usage() {
echo done echo done
fi fi
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 <
# --- be downward compatible > # --- be downward compatible >
if [ -f /etc/jcs/jcs.mk ] ; then if [ -f /etc/jcs/jcs.mk ] ; then
@ -317,23 +322,25 @@ usage() {
# ============================ here we go! # ============================ here we go!
# ================================================ # ================================================
set -- `getopt b:htf $*` set -- `getopt b:p:htf $*`
while [ ! "$1" = "--" ] ; do while [ ! "$1" = "--" ] ; do
case $1 in case $1 in
-b) -b)
BCKPDIR=$2 BCKPDIR=$2
shift 2;;
-f)
FORCE=1
shift;; shift;;
-f)
FORCE=1;;
-t) -t)
TEST=1 TEST=1;;
-p)
PREFIX=$2
shift;; shift;;
-h) -h)
usage; exit 0;; usage; exit 0;;
*) *)
usage; exit 1;; usage; exit 1;;
esac esac
shift
done done
shift shift
@ -408,6 +415,9 @@ for NEXT_SECTION in $SECTIONS "$LAST_LINE_MARKER"; do
BACKUP_GROUP=$cfg_jcs_group BACKUP_GROUP=$cfg_jcs_group
fi fi
fi fi
if [ -n "$PREFIX" ]; then
TARGET_DIR=$PREFIX/$TARGET_DIR
fi
if [ ! -d "$TARGET_DIR" ] ; then if [ ! -d "$TARGET_DIR" ] ; then
if [ -z "$TARGET_DIR_MODE" ] ; then if [ -z "$TARGET_DIR_MODE" ] ; then
echo "Don't know how to create target directory \"$TARGET_DIR\". TARGET_DIR_MODE not specified." 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 # ------------ execute shell scripts
exec_scripts $SECTION exec_scripts $SECTION
if [ -n "$PREFIX" ]; then
TARGET_DIR=$PREFIX/$TARGET_DIR
fi
echo "---- Section [$SECTION] -- installing $INSTALLATION_SUBJECT ----" echo "---- Section [$SECTION] -- installing $INSTALLATION_SUBJECT ----"
echo " ($SOURCE_DIR -> $TARGET_DIR)" echo " ($SOURCE_DIR -> $TARGET_DIR)"
@ -1873,11 +1887,11 @@ define recurse_subdirs
endef endef
%.done: %.inf %.done: %.inf
jcs install $< sudo jcs install $<
touch $@ touch $@
%.su_done: %.inf %.su_done: %.inf
jcs install -b setup -f $< sudo jcs install -b setup -f $<
touch $@ touch $@
install_inf: $(INF_DONE) install_inf: $(INF_DONE)
@ -1885,7 +1899,7 @@ install_inf: $(INF_DONE)
install_inf.old: checkroot checkdirs install_inf.old: checkroot checkdirs
@echo "####" checking installation information files ... ;\ @echo "####" checking installation information files ... ;\
if [ -n "`find . -name '*.inf' -maxdepth 1`" ] ; then \ if [ -n "`find . -name '*.inf' -maxdepth 1`" ] ; then \
jcs install *.inf ;\ sudo jcs install *.inf ;\
fi | $(TEE) -a $(INSTALL_LOG) fi | $(TEE) -a $(INSTALL_LOG)
install_link: install_link:
@ -1901,7 +1915,7 @@ setup_inf: $(INF_SU_DONE)
setup_inf.old: checkroot checkdirs setup_inf.old: checkroot checkdirs
@echo "####" checking installation information files ... ;\ @echo "####" checking installation information files ... ;\
if [ -n "`find . -name '*.inf' -maxdepth 1`" ] ; then \ 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) fi | $(TEE) -a $(SETUP_LOG)
setup_link: checkroot checkdirs setup_link: checkroot checkdirs
@ -1913,7 +1927,7 @@ setup_link: checkroot checkdirs
test_inf: checkdirs test_inf: checkdirs
@echo "####" testing installation information files ... ;\ @echo "####" testing installation information files ... ;\
if [ -n "`find . -name '*.inf' -maxdepth 1`" ] ; then \ if [ -n "`find . -name '*.inf' -maxdepth 1`" ] ; then \
jcs install *.inf -t ;\ sudo jcs install *.inf -t ;\
fi | $(TEE) -a $(INSTALL_LOG) fi | $(TEE) -a $(INSTALL_LOG)
test_link: checkdirs test_link: checkdirs
@ -1952,7 +1966,7 @@ dist: clean
mv $(MOD).tar.gz $(MOD) mv $(MOD).tar.gz $(MOD)
checkroot: 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: checkdirs:
@test -f /etc/jcs/jcs.conf || exit 1 ;\ @test -f /etc/jcs/jcs.conf || exit 1 ;\