conf/jcs, scripts: Move jcs over from ytools

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2017-04-12 12:12:07 +00:00
commit 9c4db07ac6
7 changed files with 161 additions and 2 deletions

7
conf/jcs/Makefile Normal file
View file

@ -0,0 +1,7 @@
TOPDIR = ../..
SUBTREE_INSTALL_PREFIX ?= /etc/jcs
include $(TOPDIR)/make/proj.mk
include $(MODDIR)/make/subtree.mk

8
conf/jcs/jcs.conf Normal file
View file

@ -0,0 +1,8 @@
jcs_dir=$HOME/local/src/cvs.stable/conf/`hostname -d`/`hostname -s`/`/opt/jw-build/bin/get_os.sh`
jcs_owner=root
jcs_group=root
jcs_log_dir=$jcs_dir/log
jcs_file_extension=inf
use_checksum=false
update_checksum_command="/home/tripwire/bin/fs_checksum.sh update"
jcs_http_path=http://www.jannet.de

121
conf/jcs/jcs.mk Normal file
View 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

View file

@ -0,0 +1,5 @@
# jannet configuration shadow
# (c) 2000 - 2001 jannet
# contact@jannet.de
include /etc/jcs/jcs.mk

View file

@ -0,0 +1,15 @@
# jannet configuration shadow
# (c) 2000 jannet
# contact@jannet.de
MAKE_SH := jcs smake
SUBDIRS = cur
setup:
$(MAKE_SH) setup $(SUBDIRS)
install:
$(MAKE_SH) install $(SUBDIRS)
clean:
$(MAKE_SH) clean $(SUBDIRS)

View file

@ -2,7 +2,7 @@ TOPDIR = ..
include $(TOPDIR)/make/proj.mk
EXE_SH += jannet
EXE_SH += jannet jcs
include $(MODDIR)/make/scripts.mk

View file

@ -127,6 +127,9 @@ usage() {
txtout "usage init"
}
echo "Since jcs is installed with jw-build, jcs init is disabled for now, ignoring" >&2
return 0
TODO=0
LOCAL_JCS_DIR=""
@ -2033,7 +2036,7 @@ JNT_JCSDIR=/tmp
--<<<-- jcs.conf.oldstyle --
-->>>-- jcs.conf --
jcs_dir=$HOME/local/src/jw.dev/conf/`hostname -d`/`hostname -s`/`/opt/ytools/bin/get_os.sh`
jcs_dir=$HOME/local/src/jw.dev/conf/`hostname -d`/`hostname -s`/`/opt/jw-build/bin/get_os.sh`
jcs_owner=root
jcs_group=root
jcs_log_dir=$jcs_dir/log