summaryrefslogtreecommitdiff
path: root/setup.sh
diff options
context:
space:
mode:
Diffstat (limited to 'setup.sh')
-rwxr-xr-xsetup.sh28
1 files changed, 27 insertions, 1 deletions
diff --git a/setup.sh b/setup.sh
index 249d7fd..0f1ad5b 100755
--- a/setup.sh
+++ b/setup.sh
@@ -84,7 +84,6 @@ sudo passwd -l root >/dev/null
# Copy basic configuration files safely
sudo cp -v ./etc/keyd/keyd.conf /etc/keyd/
sudo cp --backup=numbered -v ./etc/pacman.conf /etc/
-sudo cp --backup=numbered -v ./etc/kernel/cmdline /etc/kernel/
sudo cp -v ./etc/modprobe.d/blacklist-security.conf /etc/modprobe.d/
sudo cp -v ./etc/pam.d/system-local-login /etc/pam.d/
sudo cp -v ./etc/pam.d/system-login /etc/pam.d/
@@ -107,6 +106,33 @@ if [ -f "./etc/fstab" ]; then
fi
fi
+# Append kernel command-line parameters before 'quiet splash'
+EXTRA_PARAMS=$(tr '\n' ' ' < ./etc/kernel/cmdline | xargs)
+
+if [ -n "$EXTRA_PARAMS" ]; then
+ TARGET_CONTENT=$(cat /etc/kernel/cmdline)
+
+ # Check if the extra parameters are already present to ensure idempotency
+ if [[ "$TARGET_CONTENT" != *"$EXTRA_PARAMS"* ]]; then
+ log_info "Inserting custom parameters into /etc/kernel/cmdline..."
+
+ # Create a numbered backup before modifying
+ sudo cp --backup=numbered /etc/kernel/cmdline /etc/kernel/cmdline.bak
+
+ if [[ "$TARGET_CONTENT" == *"quiet splash"* ]]; then
+ NEW_CMDLINE="${TARGET_CONTENT/quiet splash/$EXTRA_PARAMS quiet splash}"
+ else
+ # Fallback: append to the end if 'quiet splash' is not found
+ NEW_CMDLINE="${TARGET_CONTENT} ${EXTRA_PARAMS}"
+ fi
+
+ # Normalize whitespace and save back to /etc/kernel/cmdline
+ echo "$NEW_CMDLINE" | xargs | sudo tee /etc/kernel/cmdline > /dev/null
+ else
+ log_info "Custom kernel parameters already present in /etc/kernel/cmdline. Skipping."
+ fi
+fi
+
# Configure UFW Firewall
log_info "Configuring UFW Firewall..."
sudo ufw default deny incoming