From a48e7914ac6b305e8ad5bf86cba7d01b409a50d0 Mon Sep 17 00:00:00 2001 From: mfgbhatti Date: Sat, 12 Feb 2022 23:06:42 +0000 Subject: [PATCH] script dir --- 0-preinstall.sh | 3 ++- 1-setup.sh | 9 +++++---- 2-user.sh | 3 ++- 3-post-setup.sh | 3 ++- startup.sh | 1 - 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/0-preinstall.sh b/0-preinstall.sh index 3e549a3..533405c 100755 --- a/0-preinstall.sh +++ b/0-preinstall.sh @@ -1,8 +1,9 @@ #!/usr/bin/env bash # shellcheck disable=SC1091,SC2001 # shellcheck source=./setup.conf +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -CONFIG_FILE=$(pwd)/setup.conf +CONFIG_FILE="$SCRIPT_DIR"/setup.conf if [[ -f "$CONFIG_FILE" ]]; then source "$CONFIG_FILE" else diff --git a/1-setup.sh b/1-setup.sh index 8bf3567..5ab6fc8 100755 --- a/1-setup.sh +++ b/1-setup.sh @@ -1,8 +1,9 @@ #!/usr/bin/env bash # shellcheck disable=SC1091 # shellcheck source=./setup.conf +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -CONFIG_FILE=$(pwd)/setup.conf +CONFIG_FILE="$SCRIPT_DIR"/setup.conf if [[ -f "$CONFIG_FILE" ]]; then source "$CONFIG_FILE" else @@ -159,7 +160,7 @@ else echo "No graphics card found!" fi -ENCRYP_UUID=$(blkid -s UUID -o value "$PART2") +ENCRYPT_UUID=$(blkid -s UUID -o value "$PART2") PART_UUID=$(blkid -s PARTUUID -o value "$PART2") case "$BOOTLOADER" in @@ -168,7 +169,7 @@ grub) install_pkg grub os-prober if [[ "$LUKS" -eq 1 ]]; then echo "Installing GRUB for LUKS" - sed -i -e 's/GRUB_CMDLINE_LINUX="\(.\+\)"/GRUB_CMDLINE_LINUX="\1 cryptdevice=UUID='"${ENCRYP_UUID}"':luks"/g' -e 's/GRUB_CMDLINE_LINUX=""/GRUB_CMDLINE_LINUX="cryptdevice=UUID'"${ENCRYP_UUID}"':luks"/g' /etc/default/grub + sed -i -e 's/GRUB_CMDLINE_LINUX="\(.\+\)"/GRUB_CMDLINE_LINUX="\1 cryptdevice=UUID='"${ENCRYPT_UUID}"':luks"/g' -e 's/GRUB_CMDLINE_LINUX=""/GRUB_CMDLINE_LINUX="cryptdevice=UUID'"${ENCRYPT_UUID}"':luks"/g' /etc/default/grub fi if [[ "$UEFI" -eq 1 ]]; then grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB --recheck @@ -182,7 +183,7 @@ systemd) echo "Installing systemd-boot" bootctl --path=/boot install if [[ $LUKS -eq 1 ]]; then - echo -e "title\tArchTitus\nlinux\t/vmlinuz-linux\ninitrd\t/initramfs-linux.img\noptions\tcryptdevice=UUID=$ENCRYP_UUID:luks root=\/dev\/$LVM_VG\/${LVM_NAMES[0]} rw" >/boot/loader/entries/arch.conf + echo -e "title\tArchTitus\nlinux\t/vmlinuz-linux\ninitrd\t/initramfs-linux.img\noptions\tcryptdevice=UUID=$ENCRYPT_UUID:luks root=\/dev\/$LVM_VG\/${LVM_NAMES[0]} rw" >/boot/loader/entries/arch.conf elif [[ $LVM -eq 1 ]]; then echo -e "title\tArchTitus\nlinux\t/vmlinuz-linux\ninitrd\t/initramfs-linux.img\noptions\troot=\/dev\/$LVM_VG\/${LVM_NAMES[0]} rw" >/boot/loader/entries/arch.conf else diff --git a/2-user.sh b/2-user.sh index dede6e1..143e971 100755 --- a/2-user.sh +++ b/2-user.sh @@ -5,8 +5,9 @@ # However I will leave this up to you. # shellcheck disable=SC1091 # shellcheck source=./setup.conf +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -CONFIG_FILE=$(pwd)/setup.conf +CONFIG_FILE="$SCRIPT_DIR"/setup.conf if [[ -f "$CONFIG_FILE" ]]; then source "$CONFIG_FILE" else diff --git a/3-post-setup.sh b/3-post-setup.sh index 8d29a8e..473ceb3 100755 --- a/3-post-setup.sh +++ b/3-post-setup.sh @@ -1,8 +1,9 @@ #!/usr/bin/env bash # shellcheck disable=SC1091 # shellcheck source=./setup.conf +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -CONFIG_FILE=$(pwd)/setup.conf +CONFIG_FILE="$SCRIPT_DIR"/setup.conf if [[ -f "$CONFIG_FILE" ]]; then source "$CONFIG_FILE" else diff --git a/startup.sh b/startup.sh index ac362b8..6af4b7b 100644 --- a/startup.sh +++ b/startup.sh @@ -222,7 +222,6 @@ background_check() { echo -ne "ERROR! There seems to be no internet connection.\n" exit 1 fi - set_option "SCRIPT_DIR" "$SCRIPT_DIR" check_arch check_pacman efi_check