Subject: [alpine-aports] [PATCH] Adding the possibility to override defaults config

From: Laurent B <[email-masked]>
Date: Wed, 1 May 2019 10:25:00 +0200

This allow to override default config files with custom, simply define
values in mkinitfs.conf:
* init: path to initramfs-init
* fstab: path to fstab
* passwd: path to passwd
* group: path to group
So, it's possible to customize the boot, and allow the busybox trigger
to use the customized configuration file
---
 Makefile    | 1 +
 mkinitfs.in | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 53c71ea..c5e7372 100644
--- a/Makefile
+++ b/Makefile
@@ -134,3 +134,4 @@ install: $(SBIN_FILES) $(SHARE_FILES) $(CONF_FILES)
 
 mkinitfs.conf:
 	echo 'features="$(DEFAULT_FEATURES)"' > $@
+	echo '#init="/$(datadir)/initramfs-init"' >> $@
diff --git a/mkinitfs.in b/mkinitfs.in
index 8cd3de3..8c7aa66 100755
--- a/mkinitfs.in
+++ b/mkinitfs.in
@@ -5,10 +5,6 @@ sysconfdir=@sysconfdir@
 datadir=@datadir@
 
 config="$sysconfdir"/mkinitfs.conf
-init="$datadir"/initramfs-init
-fstab="$datadir"/fstab
-passwd="$datadir"/passwd
-group="$datadir"/group
 
 startdir=$PWD
 
@@ -222,6 +218,10 @@ shift $(( $OPTIND - 1 ))
 
 . $(readlink -f "$config")
 [ -n "$myfeatures" ] && features="$myfeatures"
+[ -z "$init" ] && init="$datadir"/initramfs-init
+[ -z "$fstab" ] && fstab="$datadir"/fstab
+[ -z "$passwd" ] && passwd="$datadir"/passwd
+[ -z "$group" ] && group="$datadir"/group
 
 if [ -n "$list_features" ]; then
 	for dir in $features_dirs; do
-- 
2.21.0.windows.1

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---