From a08edc2071c60cb81044aaf17f1889bff5b3c2e1 Mon Sep 17 00:00:00 2001 From: Nicholas Date: Thu, 28 Oct 2021 20:28:07 -0700 Subject: [PATCH] Adds $SCRIPTHOME var, replacing hardcoded file paths Just adds dynamic file repo naming for people forking the project. When they rename their repository, it will maintain the validity of the file paths, which used to be hard coded, hopefully this makes forking the project less error prone, and increases portability --- 0-preinstall.sh | 2 +- 1-setup.sh | 6 +++--- 2-user.sh | 4 ++-- 3-post-setup.sh | 5 ----- archtitus.sh | 18 ++++++++++++++---- kderice-backup.sh | 2 +- kderice-restore.sh | 4 ++-- 7 files changed, 23 insertions(+), 18 deletions(-) diff --git a/0-preinstall.sh b/0-preinstall.sh index 557574b..b96b396 100755 --- a/0-preinstall.sh +++ b/0-preinstall.sh @@ -122,7 +122,7 @@ linux /vmlinuz-linux initrd /initramfs-linux.img options root=LABEL=ROOT rw rootflags=subvol=@ EOF -cp -R ${SCRIPT_DIR} /mnt/root/ArchTitus +cp -R ${SCRIPT_DIR} /mnt/root/$SCRIPTHOME cp /etc/pacman.d/mirrorlist /mnt/etc/pacman.d/mirrorlist echo "--------------------------------------" echo "-- Check for low memory systems <8G --" diff --git a/1-setup.sh b/1-setup.sh index 9787056..3bf8f12 100755 --- a/1-setup.sh +++ b/1-setup.sh @@ -219,14 +219,14 @@ fi echo -e "\nDone!\n" if ! source install.conf; then read -p "Please enter username:" username -echo "username=$username" >> ${HOME}/ArchTitus/install.conf +echo "username=$username" >> ${HOME}/$SCRIPTHOME/install.conf fi if [ $(whoami) = "root" ]; then useradd -m -G wheel,libvirt -s /bin/bash $username passwd $username - cp -R /root/ArchTitus /home/$username/ - chown -R $username: /home/$username/ArchTitus + cp -R /root/$SCRIPTHOME /home/$username/ + chown -R $username: /home/$username/$SCRIPTHOME read -p "Please name your machine:" nameofmachine echo $nameofmachine > /etc/hostname else diff --git a/2-user.sh b/2-user.sh index 841f04a..a89aaab 100755 --- a/2-user.sh +++ b/2-user.sh @@ -55,9 +55,9 @@ for PKG in "${PKGS[@]}"; do done export PATH=$PATH:~/.local/bin -cp -r $HOME/ArchTitus/dotfiles/* $HOME/.config/ +cp -r $HOME/$SCRIPTHOME/dotfiles/* $HOME/.config/ pip install konsave -konsave -i $HOME/ArchTitus/kde.knsv +konsave -i $HOME/$SCRIPTHOME/kde.knsv sleep 1 konsave -a kde diff --git a/3-post-setup.sh b/3-post-setup.sh index 12c73f4..e636006 100755 --- a/3-post-setup.sh +++ b/3-post-setup.sh @@ -46,8 +46,3 @@ sed -i 's/^# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/' /etc/sudoers # Replace in the same state cd $pwd -echo " -############################################################################### -# Done - Please Eject Install Media and Reboot -############################################################################### -" diff --git a/archtitus.sh b/archtitus.sh index db537b3..c981a50 100755 --- a/archtitus.sh +++ b/archtitus.sh @@ -1,7 +1,17 @@ #!/bin/bash +# Find the name of the folder the scripts are in +export SCRIPTHOME="$(basename -- $PWD)" +echo "Scripts are in dir named $SCRIPTHOME" + bash 0-preinstall.sh - arch-chroot /mnt /root/ArchTitus/1-setup.sh - source /mnt/root/ArchTitus/install.conf - arch-chroot /mnt /usr/bin/runuser -u $username -- /home/$username/ArchTitus/2-user.sh - arch-chroot /mnt /root/ArchTitus/3-post-setup.sh \ No newline at end of file + arch-chroot /mnt /root/$SCRIPTHOME/1-setup.sh + source /mnt/root/$SCRIPTHOME/install.conf + arch-chroot /mnt /usr/bin/runuser -u $username -- /home/$username/$SCRIPTHOME/2-user.sh + arch-chroot /mnt /root/$SCRIPTHOME/3-post-setup.sh + +echo " +############################################################################### +# Done - Please Eject Install Media and Reboot +############################################################################### +" \ No newline at end of file diff --git a/kderice-backup.sh b/kderice-backup.sh index dbc109f..883e40a 100755 --- a/kderice-backup.sh +++ b/kderice-backup.sh @@ -1,5 +1,5 @@ #!/bin/bash -cp -r $HOME/.config/kitty $HOME/ArchTitus/dotfiles/kitty +cp -r $HOME/.config/kitty $HOME/$SCRIPTHOME/dotfiles/kitty konsave -s kde konsave -e kde \ No newline at end of file diff --git a/kderice-restore.sh b/kderice-restore.sh index ee2b8aa..4b3a481 100755 --- a/kderice-restore.sh +++ b/kderice-restore.sh @@ -1,8 +1,8 @@ #!/bin/bash export PATH=$PATH:~/.local/bin -cp -r $HOME/ArchTitus/dotfiles/* $HOME/.config/ +cp -r $HOME/$SCRIPTHOME/dotfiles/* $HOME/.config/ pip install konsave -konsave -i $HOME/ArchTitus/kde.knsv +konsave -i $HOME/$SCRIPTHOME/kde.knsv sleep 1 konsave -a kde