Commit 5dbf407c authored by Michael Shigorin's avatar Michael Shigorin

features.in/Makefile: src/dst tweaks

Introduced support for hooks to be added to every derivative substage of a "base" stage (think stage2/*). Specific hooks for e.g. stage2/live would live in features.in/*/live/*scripts.d/ while generic for stage2/* in features.in/*/stage2/*scripts.d/
parent 74e81984
...@@ -10,33 +10,30 @@ include $(BUILDDIR)/distcfg.mk ...@@ -10,33 +10,30 @@ include $(BUILDDIR)/distcfg.mk
# first rsync what's static, and make backups (*~) -- # first rsync what's static, and make backups (*~) --
# these might signal of file clashes (or plain dirt); # these might signal of file clashes (or plain dirt);
# then handle two more ways of implementing a feature # then handle two more ways of implementing a feature
# NB: some subprofiles will be specified as src/dest # NB: some subprofiles will be specified as "src/dst"
# (then both src/ and dst/ can hold the addons)
all: all:
@echo "** starting feature configuration" @echo "** starting feature configuration"
@if test -n "$(GLOBAL_DEBUG)"; then \ @if [ -n "$(GLOBAL_DEBUG)" ]; then \
echo "** target subprofiles: $(notdir $(SUBPROFILES))"; \ echo "** target subprofiles: $(SUBPROFILES)"; \
echo "** requested features: $(FEATURES)"; \ echo "** requested features: $(FEATURES)"; \
fi fi
@for dir in $(FEATURES); do \ @for dir in $(FEATURES); do \
pushd "$$dir" && \
for sub in $(SUBPROFILES); do \ for sub in $(SUBPROFILES); do \
dst="$${sub#*/}" && \ src="$${sub%/*}/"; \
if test -d "$$dir/$$dst/"; then \ dst="$${sub#*/}/"; \
if rsync -qab "$$dir/$$dst/" \ if [ -d "$$src/" ]; then rsync -qab "$$src" "$(BUILDDIR)/$$dst/"; fi; \
"$(BUILDDIR)/$$dst/"; \ if [ -d "$$dst/" ]; then rsync -qab "$$dst" "$(BUILDDIR)/$$dst/"; fi; \
then \ type -t git >&/dev/null && \
type -t git >&/dev/null && \ pushd "$(BUILDDIR)/$$dst/" && \
pushd "$(BUILDDIR)/$$dst/" && \ git add . && \
git add . && \ git commit -qam "$$dir feature ($$sub subprofile part)" ||:; \
git commit -qam "$$dir feature ($$dst subprofile part)" ||:; \ popd; \
popd; \
fi; \
fi; \
done; \ done; \
for scripts in scripts.d image-scripts.d; do \ for scripts in scripts.d image-scripts.d; do \
if test -d "$(BUILDDIR)/$$scripts" -a \ if [ -d "$(BUILDDIR)/$$scripts" -a -d "$$scripts" ]; then \
-d "$$dir/$$scripts"; then \ if rsync -qab "$$scripts/" "$(BUILDDIR)/$$scripts/"; then \
if rsync -qab "$$dir/$$scripts/" \
"$(BUILDDIR)/$$scripts/"; then \
type -t git >&/dev/null && \ type -t git >&/dev/null && \
pushd "$(BUILDDIR)/$$scripts/" && \ pushd "$(BUILDDIR)/$$scripts/" && \
git add . && \ git add . && \
...@@ -45,19 +42,14 @@ all: ...@@ -45,19 +42,14 @@ all:
fi; \ fi; \
fi; \ fi; \
done; \ done; \
if test -x "$$dir/generate.sh"; then \ if [ -x "generate.sh" ]; then sh generate.sh; fi; \
pushd "$$dir" && \ if [ -s "generate.mk" ]; then $(MAKE) -f generate.mk; fi; \
sh generate.sh; \
popd; \
fi; \
if test -s "$$dir/generate.mk"; then \
$(MAKE) -C "$$dir" -f generate.mk; \
fi; \
type -t git >&/dev/null && \ type -t git >&/dev/null && \
pushd "$(BUILDDIR)/" && \ pushd "$(BUILDDIR)/" && \
git add . && \ git add . && \
git commit -qam "$$dir feature generation complete" ||:; \ git commit -qam "$$dir feature generation complete" ||:; \
popd; \ popd; \
popd; \
done done
@find "$(BUILDDIR)/" -name '*~' \ @find "$(BUILDDIR)/" -name '*~' \
| sed "s,$(BUILDDIR)/,** warning: file clash: ," >&2 | sed "s,$(BUILDDIR)/,** warning: file clash: ," >&2
......
...@@ -16,5 +16,9 @@ ...@@ -16,5 +16,9 @@
а также выполняется скрипт generate.sh и задействуется generate.mk а также выполняется скрипт generate.sh и задействуется generate.mk
(при их наличии). (при их наличии).
Если фича дополняет хуками семейство целевых субпрофилей,
построенных на одном базовом, можно воспользоваться подкаталогом
с именем исходного базового субпрофиля (см. $src, $dst в Makefile).
Несложный пример содержится в 00example/, более близкий к жизни Несложный пример содержится в 00example/, более близкий к жизни
и нынешним пределам возможностей метапрофиля -- в syslinux/. и нынешним пределам возможностей метапрофиля -- в syslinux/.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment