From 7e52878f0aaad5256a01581f11338c47d69d5fbb Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Fri, 24 Oct 2025 11:59:28 +0200 Subject: kbuild: move profiles into .config/kbuild MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of inlining shell scripts inside of the `kbuild` one, move them into subdirectories inside of the new $HOME/.config/kbuild directory. Each subdirectory will match a profile (i.e. no more hacky hardcoded values on `kbuild`), and it will contain the relevant install.sh/uninstall.sh files which matter for that profile. This also allows us more flexibility when it comes to GRUB configuration (e.g. picking the right UUID value without having to re-invent the wheel via esoteric new parameters). Signed-off-by: Miquel Sabaté Solà --- bin/kbuild | 195 ++++++------------------------------------------------------- 1 file changed, 18 insertions(+), 177 deletions(-) (limited to 'bin') diff --git a/bin/kbuild b/bin/kbuild index 38093f3..d60ed8f 100755 --- a/bin/kbuild +++ b/bin/kbuild @@ -42,14 +42,10 @@ # *NOTE*: this script expects the `ARCH` environment variable to be set, and if # that doesn't match the current architecture, then it will expect to have # `CROSS_COMPILE` set as well. -# *NOTE*: it's assumed that either `update-initramfs` or `dracut` exist. If you -# are using something else, send me a patch. ##### set -e -# TODO: add a -u/--uuid flag, which can specify: suse-virt, suse-vf2 - ## # Arguments that can be passed. @@ -103,19 +99,19 @@ HERE exit 0 fi -# Hard check on the profile being picked. -case "$PROFILE" in - "debian" | "suse") - ;; - "") - echo "kbuild (error): you have to profile one of these profiles: debian, suse." - exit 1 - ;; - *) - echo "kbuild (error): uknown profile '$PROFILE'. Possible values: debian, suse." - exit 1 - ;; -esac +## +# Profile select. + +if [ -z "$PROFILE" ]; then + echo "kbuild (error): you have to provide a profile." + exit 1 +fi + +PROFILE_DIR="$HOME/.config/kbuild/$PROFILE" +if [ ! -d "$PROFILE_DIR" ]; then + echo "kbuild (error): given profile does not exist." + exit 1 +fi ## # Initial checks. @@ -206,166 +202,11 @@ cp .config "$INSTALL_PATH/boot/config-$name" find "$INSTALL_PATH" -type f -printf "/%P\n" >files.txt mv files.txt "$INSTALL_PATH/files.txt" -# Now write the actual install script. -cat <