mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 03:53:32 +01:00
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:
parent
26532f41db
commit
d36841a7df
1 changed files with 25 additions and 11 deletions
36
scripts/jcs
36
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 ;\
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue