From 9c4db07ac68464f0528422f1cdbfb2e9090e4849 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Wed, 12 Apr 2017 12:12:07 +0000 Subject: [PATCH] conf/jcs, scripts: Move jcs over from ytools Signed-off-by: Jan Lindemann --- conf/jcs/Makefile | 7 ++ conf/jcs/jcs.conf | 8 ++ conf/jcs/jcs.mk | 121 +++++++++++++++++++++++++ conf/jcs/templates/dir/module/Makefile | 5 + conf/jcs/templates/dir/src/Makefile | 15 +++ scripts/Makefile | 2 +- scripts/jcs | 5 +- 7 files changed, 161 insertions(+), 2 deletions(-) create mode 100644 conf/jcs/Makefile create mode 100644 conf/jcs/jcs.conf create mode 100644 conf/jcs/jcs.mk create mode 100644 conf/jcs/templates/dir/module/Makefile create mode 100644 conf/jcs/templates/dir/src/Makefile diff --git a/conf/jcs/Makefile b/conf/jcs/Makefile new file mode 100644 index 00000000..42a14bff --- /dev/null +++ b/conf/jcs/Makefile @@ -0,0 +1,7 @@ +TOPDIR = ../.. + +SUBTREE_INSTALL_PREFIX ?= /etc/jcs + +include $(TOPDIR)/make/proj.mk +include $(MODDIR)/make/subtree.mk + diff --git a/conf/jcs/jcs.conf b/conf/jcs/jcs.conf new file mode 100644 index 00000000..695c2523 --- /dev/null +++ b/conf/jcs/jcs.conf @@ -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 diff --git a/conf/jcs/jcs.mk b/conf/jcs/jcs.mk new file mode 100644 index 00000000..6de673f2 --- /dev/null +++ b/conf/jcs/jcs.mk @@ -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 diff --git a/conf/jcs/templates/dir/module/Makefile b/conf/jcs/templates/dir/module/Makefile new file mode 100644 index 00000000..483f821a --- /dev/null +++ b/conf/jcs/templates/dir/module/Makefile @@ -0,0 +1,5 @@ +# jannet configuration shadow +# (c) 2000 - 2001 jannet +# contact@jannet.de + +include /etc/jcs/jcs.mk diff --git a/conf/jcs/templates/dir/src/Makefile b/conf/jcs/templates/dir/src/Makefile new file mode 100644 index 00000000..a4ee2c0d --- /dev/null +++ b/conf/jcs/templates/dir/src/Makefile @@ -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) diff --git a/scripts/Makefile b/scripts/Makefile index 924505ae..0b9f4e6f 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -2,7 +2,7 @@ TOPDIR = .. include $(TOPDIR)/make/proj.mk -EXE_SH += jannet +EXE_SH += jannet jcs include $(MODDIR)/make/scripts.mk diff --git a/scripts/jcs b/scripts/jcs index b1406f3c..69e4f6ab 100644 --- a/scripts/jcs +++ b/scripts/jcs @@ -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