mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 12:03:31 +01:00
conf/jcs, scripts: Move jcs over from ytools
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
e36edb06ab
commit
9c4db07ac6
7 changed files with 161 additions and 2 deletions
121
conf/jcs/jcs.mk
Normal file
121
conf/jcs/jcs.mk
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
SHELL = /bin/sh
|
||||
|
||||
WD := $(shell pwd)
|
||||
MOD := $(shell pwd | xargs basename)
|
||||
LOG_DIR := $(shell . /etc/jcs/jcs.conf; echo $$jcs_log_dir)
|
||||
INSTALL_LOG := $(LOG_DIR)/install.log
|
||||
SETUP_LOG := $(LOG_DIR)/setup.log
|
||||
TEE := /usr/bin/tee
|
||||
BINDIR := /usr/local/bin
|
||||
SBINDIR := /usr/local/bin
|
||||
INF := $(wildcard *.inf)
|
||||
INF_DONE := $(addsuffix .done,$(basename $(INF)))
|
||||
INF_SU_DONE := $(addsuffix .su_done,$(basename $(INF)))
|
||||
JCS_HTTP_PATH := $(shell . /etc/jcs/jcs.conf; echo $$jcs_http_path)
|
||||
|
||||
export SETUP_LOG INSTALL_LOG TEE BINDIR SBINDIR
|
||||
|
||||
all:
|
||||
|
||||
define recurse_subdirs
|
||||
@set -e ;\
|
||||
TARGET=$@ ;\
|
||||
N="`echo $(SUBDIRS) | wc -w`" ;\
|
||||
I=1 ;\
|
||||
while [ $$I -le $$N ] ; do \
|
||||
SUBDIR="`echo $(SUBDIRS) | cut -d' ' -f$$I`" ;\
|
||||
$(MAKE) -C $$SUBDIR $$TARGET;\
|
||||
I=`expr $$I + 1`;\
|
||||
done
|
||||
endef
|
||||
|
||||
%.done: %.inf
|
||||
sudo jcs install $<
|
||||
touch $@
|
||||
|
||||
%.su_done: %.inf
|
||||
sudo jcs install -b setup -f $<
|
||||
touch $@
|
||||
|
||||
install_inf: $(INF_DONE)
|
||||
|
||||
install_inf.old: checkroot checkdirs
|
||||
@echo "####" checking installation information files ... ;\
|
||||
if [ -n "`find . -name '*.inf' -maxdepth 1`" ] ; then \
|
||||
sudo jcs install *.inf ;\
|
||||
fi | $(TEE) -a $(INSTALL_LOG)
|
||||
|
||||
install_link:
|
||||
|
||||
install_link.old: checkroot checkdirs
|
||||
@echo "####" checking link information files ... ;\
|
||||
if [ -e link.sh ] ; then \
|
||||
jcs linkout link.sh -b install ;\
|
||||
fi | $(TEE) -a $(INSTALL_LOG)
|
||||
|
||||
setup_inf: $(INF_SU_DONE)
|
||||
|
||||
setup_inf.old: checkroot checkdirs
|
||||
@echo "####" checking installation information files ... ;\
|
||||
if [ -n "`find . -name '*.inf' -maxdepth 1`" ] ; then \
|
||||
sudo jcs install -b setup -f *.inf ;\
|
||||
fi | $(TEE) -a $(SETUP_LOG)
|
||||
|
||||
setup_link: checkroot checkdirs
|
||||
@echo "####" checking link information files ... ;\
|
||||
if [ -e link.sh ] ; then \
|
||||
jcs linkout -f -b setup link.sh ;\
|
||||
fi | $(TEE) -a $(SETUP_LOG)
|
||||
|
||||
test_inf: checkdirs
|
||||
@echo "####" testing installation information files ... ;\
|
||||
if [ -n "`find . -name '*.inf' -maxdepth 1`" ] ; then \
|
||||
sudo jcs install *.inf -t ;\
|
||||
fi | $(TEE) -a $(INSTALL_LOG)
|
||||
|
||||
test_link: checkdirs
|
||||
@echo "####" testing link information files ... ;\
|
||||
if [ -e link.sh ] ; then \
|
||||
jcs linkout -t link.sh ;\
|
||||
fi | $(TEE) -a $(INSTALL_LOG)
|
||||
|
||||
get: checkdirs
|
||||
@echo "####" getting files. ;\
|
||||
if [ -n "$(GETFILES)" ] ; then jcs get $(GETFILES) ; fi
|
||||
|
||||
getall: $(LOCAL_GET) get $(LOCAL_POST_GET)
|
||||
$(recurse_subdirs)
|
||||
|
||||
checksum: checkroot # TODO integrate tripwire
|
||||
@if [ "$$cfg_use_checksum" = TRUE ] ; then \
|
||||
echo "####" updating checksum database ... ;\
|
||||
$$update_checksum_command ;\
|
||||
fi
|
||||
|
||||
install: checkroot $(LOCAL_INSTALL) install_inf install_link $(LOCAL_POST_INSTALL) checksum
|
||||
$(recurse_subdirs)
|
||||
|
||||
setup: checkroot $(LOCAL_SETUP) setup_inf setup_link $(LOCAL_POST_SETUP) checksum
|
||||
$(recurse_subdirs)
|
||||
|
||||
test: $(LOCAL_TEST) test_inf test_link $(LOCAL_POST_TEST)
|
||||
$(recurse_subdirs)
|
||||
|
||||
dist: clean
|
||||
cd ..;\
|
||||
find $(MOD) -type f -o -type l | \
|
||||
grep -ve "CVS\|trash\|$(MOD)/setup" | \
|
||||
xargs tar -cvzf $(MOD).tar.gz ;\
|
||||
mv $(MOD).tar.gz $(MOD)
|
||||
|
||||
checkroot:
|
||||
# @if [ `whoami` != root ] ; then echo "Only root can do this." >&2; exit 1; fi
|
||||
|
||||
checkdirs:
|
||||
@test -f /etc/jcs/jcs.conf || exit 1 ;\
|
||||
test -d `dirname $(SETUP_LOG)` || mkdir -p `dirname $(SETUP_LOG)` ;\
|
||||
test -d `dirname $(INSTALL_LOG)` || mkdir -p `dirname $(INSTALL_LOG)`
|
||||
|
||||
clean: $(LOCAL_CLEAN)
|
||||
$(recurse_subdirs) ;\
|
||||
rm -f *~ *.swp *.rep .\#* *.done *.su_done $(MOD).tar.gz default.cache 2>/dev/null
|
||||
Loading…
Add table
Add a link
Reference in a new issue