Commit 17285f04 authored by Michael Shigorin's avatar Michael Shigorin Committed by Anton Midyukov

e2k: generate.mk fixes and tweaks

This is a cumulative patch starting with a typo fix and ending with intentation fix, but there's a missing "-n" bugfix in the middle along with assorted stylistic improvements (at least to me :). "condition && action" lines tend to be less readable when conditions and/or actions become more than a few characters (especially when these come in packs); condition && action form is less prone to some forms of human errors, and if condition; then action fi is a guard against "just add one more action" which gets added *unconditionally* often when the original construct was meant as a one-liner with strictly one action. Making code fit 80 columns helps fit more tall xterms horizontally when merging that code, and less than four tends to be harmful for merge performance (takes two FullHD displays or a 4K one for me these days).
parent 42242fd3
...@@ -9,7 +9,7 @@ RESULTCFG := $(DSTDIR)/boot.conf ...@@ -9,7 +9,7 @@ RESULTCFG := $(DSTDIR)/boot.conf
all: debug prep config timeout all: debug prep config timeout
# integerity check # integrity check
timeout: config timeout: config
@TIMEOUT=3; \ @TIMEOUT=3; \
sed -i "s,@timeout@,$$TIMEOUT," $(RESULTCFG) sed -i "s,@timeout@,$$TIMEOUT," $(RESULTCFG)
...@@ -18,41 +18,50 @@ config: prep ...@@ -18,41 +18,50 @@ config: prep
@mv $(DSTDIR)/head.conf $(RESULTCFG); \ @mv $(DSTDIR)/head.conf $(RESULTCFG); \
DEFAULT=""; \ DEFAULT=""; \
MENU_ITEMS=""; \ MENU_ITEMS=""; \
[ -n "$(STAGE2_ALTINST)" ] && [ "$(STAGE2_LIVE_INST)" ] && \ error() { echo "Error: $$@" >&2; exit 1; }; \
echo "Error: STAGE2_ALTINST and STAGE2_LIVE_INST is set!!!" >&2 && exit 1; \ [ -n "$(STAGE2_ALTINST)" ] && [ -n "$(STAGE2_LIVE_INST)" ] && \
[ -n "$(STAGE2_RESCUE)" ] && [ "$(STAGE2_LIVE_RESCUE)" ] && \ error "both STAGE2_ALTINST and STAGE2_LIVE_INST set"; \
echo "Error: STAGE2_RESCUE and STAGE2_LIVE_RESCUE is set!!!" >&2 && exit 1; \ [ -n "$(STAGE2_RESCUE)" ] && [ -n "$(STAGE2_LIVE_RESCUE)" ] && \
[ -z "$(STAGE2_ALTINST)" ] || MENU_ITEMS="altinst"; \ error "both STAGE2_RESCUE and STAGE2_LIVE_RESCUE set"; \
[ -z "$(STAGE2_LIVE_INST)" ] || MENU_ITEMS="$$MENU_ITEMS liveinst"; \ [ -z "$(STAGE2_ALTINST)" ] || \
[ -z "$(STAGE2_LIVE)" ] || MENU_ITEMS="$$MENU_ITEMS live"; \ MENU_ITEMS="altinst"; \
[ -z "$(STAGE2_LIVE_RESCUE)" ] || MENU_ITEMS="$$MENU_ITEMS liverescue"; \ [ -z "$(STAGE2_LIVE_INST)" ] || \
[ -z "$(STAGE2_RESCUE)" ] || MENU_ITEMS="$$MENU_ITEMS rescue"; \ MENU_ITEMS="$$MENU_ITEMS liveinst"; \
[ -z "$(STAGE2_LIVE)" ] || \
MENU_ITEMS="$$MENU_ITEMS live"; \
[ -z "$(STAGE2_LIVE_RESCUE)" ] || \
MENU_ITEMS="$$MENU_ITEMS liverescue"; \
[ -z "$(STAGE2_RESCUE)" ] || \
MENU_ITEMS="$$MENU_ITEMS rescue"; \
for i in $$MENU_ITEMS; do \ for i in $$MENU_ITEMS; do \
if [ "$$i" = altinst ]; then \ if [ "$$i" = altinst ]; then \
LABEL="install"; \ LABEL="install"; \
STAGE2="stagename=altinst"; \ STAGE2="stagename=altinst"; \
INIT=""; \ INIT=""; \
elif [ "$$i" = liveinst ]; then \ elif [ "$$i" = liveinst ]; then \
LABEL="install"; \ LABEL="install"; \
STAGE2="stagename=live"; \ STAGE2="stagename=live"; \
INIT=" init=/usr/sbin/install2-init"; \ INIT=" init=/usr/sbin/install2-init"; \
elif [ "$$i" = liverescue ]; then \ elif [ "$$i" = liverescue ]; then \
LABEL=rescue; \ LABEL=rescue; \
STAGE2="stagename=live"; \ STAGE2="stagename=live"; \
INIT=" systemd.unit=live-rescue.target"; \ INIT=" systemd.unit=live-rescue.target"; \
else \ else \
LABEL="$$i"; \ LABEL="$$i"; \
STAGE2="stagename=$$i"; \ STAGE2="stagename=$$i"; \
INIT=""; \ INIT=""; \
fi; \ fi; \
[ -n "$$DEFAULT" ] || DEFAULT="$$LABEL"; \ [ -n "$$DEFAULT" ] || DEFAULT="$$LABEL"; \
cat $(DSTDIR)/body.conf | sed -e "s,@stage2@,$$STAGE2$$INIT," -e "s,@label@,$$LABEL," >> $(RESULTCFG); \ sed -e "s,@stage2@,$$STAGE2$$INIT," \
-e "s,@label@,$$LABEL," \
< $(DSTDIR)/body.conf \
>> $(RESULTCFG); \
done; \ done; \
sed -i "s,@default@,$$DEFAULT," $(RESULTCFG); \ sed -i "s,@default@,$$DEFAULT," $(RESULTCFG); \
sed -i "s,@lang@,lang=$(LOCALE)," $(RESULTCFG); \ sed -i "s,@lang@,lang=$(LOCALE)," $(RESULTCFG); \
sed -i "s;@initrd_typeargs@;$(STAGE1_INITRD_TYPEARGS);" $(RESULTCFG); \ sed -i "s;@initrd_typeargs@;$(STAGE1_INITRD_TYPEARGS);" $(RESULTCFG); \
sed -i "s;@stage2_bootargs@;$(STAGE2_BOOTARGS);" $(RESULTCFG); \ sed -i "s;@stage2_bootargs@;$(STAGE2_BOOTARGS);" $(RESULTCFG); \
rm -f $(DSTDIR)/{body,head}.conf rm -f $(DSTDIR)/body.conf
clean: clean:
@rm -f $(RESULTCFG) @rm -f $(RESULTCFG)
...@@ -63,11 +72,16 @@ prep: ...@@ -63,11 +72,16 @@ prep:
debug: debug:
@if [ -n "$(DEBUG)" ]; then \ @if [ -n "$(DEBUG)" ]; then \
[ -z "$(STAGE2_ALTINST)" ] || echo "** STAGE2_ALTINST: $(STAGE2_ALTINST)"; \ [ -z "$(STAGE2_ALTINST)" ] || \
[ -z "$(STAGE2_LIVE)" ] || echo "** LIVE: $(STAGE2_LIVE)"; \ echo "** STAGE2_ALTINST: $(STAGE2_ALTINST)"; \
[ -z "$(STAGE2_LIVE_INST)" ] || echo "** LIVE_INST: $(STAGE2_LIVE_INST)"; \ [ -z "$(STAGE2_LIVE)" ] || \
[ -z "$(STAGE2_LIVE_RESCUE)" ] || echo "** LIVE_RESCUE: $(STAGE2_LIVE_RESCUE)"; \ echo "** LIVE: $(STAGE2_LIVE)"; \
[ -z "$(STAGE2_RESCUE)" ] || echo "** RESCUE: $(STAGE2_RESCUE)"; \ [ -z "$(STAGE2_LIVE_INST)" ] || \
echo "** LIVE_INST: $(STAGE2_LIVE_INST)"; \
[ -z "$(STAGE2_LIVE_RESCUE)" ] || \
echo "** LIVE_RESCUE: $(STAGE2_LIVE_RESCUE)"; \
[ -z "$(STAGE2_RESCUE)" ] || \
echo "** RESCUE: $(STAGE2_RESCUE)"; \
fi fi
endif endif
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