From 777e35ba292d6861c995c065bfbf4e8d8ede35ec Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sat, 23 Mar 2024 16:31:10 +0100 Subject: [PATCH] Simplify Arch installation script --- profiles/DerGeret/Arch/install.sh | 16 +++++++--------- profiles/ManuSurface/Arch/install.sh | 21 +++++++++++++-------- scripts/Arch/OS/install.sh | 28 +++++++++++++++++++++++++++- 3 files changed, 47 insertions(+), 18 deletions(-) diff --git a/profiles/DerGeret/Arch/install.sh b/profiles/DerGeret/Arch/install.sh index e5e2a6b8..b2b72cf2 100755 --- a/profiles/DerGeret/Arch/install.sh +++ b/profiles/DerGeret/Arch/install.sh @@ -1,15 +1,13 @@ #!/bin/bash pushd "${BASH_SOURCE%/*}" > /dev/null; -. "../../../scripts/Arch/OS/install.sh"; -. "../../../scripts/Arch/Config/SecureBoot/install.sh"; -. "../../../scripts/Arch/Software/nvidia-dkms/install.sh"; -. "../../../scripts/Arch/Software/xone/install.sh"; -. "../../../scripts/Arch/Software/bt-dualboot/install.sh"; -. "../../../scripts/Arch/Collections/personal.sh"; +function installDrivers() { + . "../../../scripts/Arch/Config/SecureBoot/install.sh"; + . "../../../scripts/Arch/Software/nvidia-dkms/install.sh"; + . "../../../scripts/Arch/Software/xone/install.sh"; + . "../../../scripts/Arch/Software/bt-dualboot/install.sh"; +} -NEXTCLOUD_DIR="${NEXTCLOUD_DIR}" \ -INSTALL_FONTS=0 \ - . "../../../scripts/Common/Config/UserProfile/install.sh"; +. "../../../scripts/Arch/OS/install.sh"; popd > /dev/null; diff --git a/profiles/ManuSurface/Arch/install.sh b/profiles/ManuSurface/Arch/install.sh index bfaa866a..2a0ffc4c 100755 --- a/profiles/ManuSurface/Arch/install.sh +++ b/profiles/ManuSurface/Arch/install.sh @@ -1,15 +1,20 @@ #!/bin/bash pushd "${BASH_SOURCE%/*}" > /dev/null; +function installDrivers() { + . "../../../scripts/Arch/Config/SecureBoot/install.sh"; + . "../../../scripts/Arch/Devices/SurfaceBook2/install.sh"; +} + +function installSoftware() { + . "../../../scripts/Arch/Collections/school.sh"; +} + +function initializeConfig() { + . "../../../scripts/Common/Config/Steam/hidpi.sh"; +} + . "../../../scripts/Arch/OS/install.sh"; -. "../../../scripts/Arch/Config/SecureBoot/install.sh"; -. "../../../scripts/Arch/Devices/SurfaceBook2/install.sh"; -. "../../../scripts/Arch/Collections/school.sh"; -NEXTCLOUD_DIR="${NEXTCLOUD_DIR}" \ -INSTALL_FONTS=0 \ - . "../../../scripts/Common/Config/UserProfile/install.sh"; - -. "../../../scripts/Common/Config/Steam/hidpi.sh"; popd > /dev/null; diff --git a/scripts/Arch/OS/install.sh b/scripts/Arch/OS/install.sh index d6794bb4..d7e5566c 100755 --- a/scripts/Arch/OS/install.sh +++ b/scripts/Arch/OS/install.sh @@ -1,5 +1,6 @@ #!/bin/bash -pushd "${BASH_SOURCE%/*}" > /dev/null; +$rootDir="${BASH_SOURCE%/*}"; +pushd "$rootDir" > /dev/null; . "../Software/base-devel/install.sh"; . "../Config/pacman/install.sh"; @@ -7,4 +8,29 @@ pushd "${BASH_SOURCE%/*}" > /dev/null; sudo pacman --noconfirm -Syu pacman-contrib; +function runHook() { + function fallback() { + ${@:2}; + } + + if command -v $1 > /dev/null + then + $1 fallback; + else + fallback; + fi; +} + +runHook installDrivers; + +runHook installSoftware \ + . "$(pwd)/../Collections/personal.sh"; + +runHook initializeConfig; + +runHook initializeProfile \ + NEXTCLOUD_DIR="${NEXTCLOUD_DIR}" \ + INSTALL_FONTS=0 \ + . "$(pwd)/../../../scripts/Common/Config/UserProfile/install.sh"; + popd > /dev/null;