configs/arch-config/scripts/arch-config.sh

91 lines
2.2 KiB
Bash
Raw Normal View History

2023-11-18 13:27:52 +01:00
#!/usr/bin/env bash
set -euo pipefail
# function to keep sudo from timing out
function func_dont_timeout {
while true; do
sudo -v
sleep 60
done
}
# check if user is root
if [ "$EUID" -ne 0 ]; then
sudo -v
fi
# keep sudo active in background
func_dont_timeout &
cat <<EOF
############################################################
###################### INSTALL CONFIG ######################
############################################################
EOF
2023-11-18 13:27:52 +01:00
cat <<EOF
########################################
################ Setup ################
########################################
EOF
# get script directory
scriptloc="$BASH_SOURCE"
Integrate changes to enable temporary directories commit 4462f39a8e18bfb5a48b8277bbceb4cf8128c18d Author: exu <mrc@frm01.net> Date: Fri Dec 8 20:08:49 2023 +0100 Fix paths for bash-cat commit a3e4d5d4bbd3c7bef4026d40905db004fbc9171f Author: exu <mrc@frm01.net> Date: Fri Dec 8 20:07:29 2023 +0100 Subfolder for bash cat commit eef11cf2ce3eb3c14d9a2d5716551d5082b25b98 Author: exu <mrc@frm01.net> Date: Fri Dec 8 20:06:02 2023 +0100 Missed some paths commit cf669bf340e58637a4f550245e0866d05f9f69b9 Author: exu <mrc@frm01.net> Date: Fri Dec 8 20:05:01 2023 +0100 Fix paths commit c084949ab35f8e231bc8341a4501d7ac7c1a57ef Author: exu <mrc@frm01.net> Date: Fri Dec 8 20:00:19 2023 +0100 Fix git clone commit 0aaa00b93097c2173d40d4dec687f8b6c7f5a9b1 Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:58:54 2023 +0100 Don't anymore commit 9a7fef2bbb5b62206a3015c1c2dd858ed84aba1c Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:54:06 2023 +0100 Debugging commit 9071e13f4b5beeed762d3765e8bdeeb558133161 Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:53:34 2023 +0100 Revert mode change commit 1432f707ea1f34592a71827074e6a39b622b8861 Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:53:06 2023 +0100 Don't need to rm commit 2ee39a346c7a36095fc8c81de918ab1bef919a00 Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:51:45 2023 +0100 Correctly launch new config commit 9f0fbac8cfa27973b358aa1c9bc02d887c8d2252 Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:49:37 2023 +0100 Debug echo commit cf373cd9e2fddbd220271796921734c953e10c56 Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:47:11 2023 +0100 Remove old configs just in case commit 9fab9d135877d903bbfed0a3bc0f68588e1fbbf8 Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:15:34 2023 +0100 Don't cd commit 14066cad62127d601400bc91716941e48bd0d772 Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:14:33 2023 +0100 Use new path for gsettings commit 837d8e41b98051824d438803b15ebb937c75fe1e Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:10:48 2023 +0100 Remove arco linux config commit bd58b886d20b52a48d240d8c0e27c3cc302454df Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:10:24 2023 +0100 Modify path to (hopefully) all file/dir sources commit afbce1bffb81012b6e189d1f41a8b5b975674938 Author: exu <mrc@frm01.net> Date: Fri Dec 8 18:19:36 2023 +0100 Specify branch for download commit 67ec900d851be292d91fdc22f93b0b19927c9028 Author: exu <mrc@frm01.net> Date: Fri Dec 8 18:19:01 2023 +0100 Start of changing to temporary directories as base
2023-12-08 20:11:16 +01:00
# Use temporary directory for download
tempdir="$(mktemp -d)"
2023-11-18 13:27:52 +01:00
echo "Checking config file"
#clone this repo
git clone -b rewrite-in-python https://gitea.exu.li/realstickman/configs.git "$tempdir" &>/dev/null
2023-11-18 13:27:52 +01:00
# check if the install scripts are the same
# NOTE Arguments get passed automatically now
Integrate changes to enable temporary directories commit 4462f39a8e18bfb5a48b8277bbceb4cf8128c18d Author: exu <mrc@frm01.net> Date: Fri Dec 8 20:08:49 2023 +0100 Fix paths for bash-cat commit a3e4d5d4bbd3c7bef4026d40905db004fbc9171f Author: exu <mrc@frm01.net> Date: Fri Dec 8 20:07:29 2023 +0100 Subfolder for bash cat commit eef11cf2ce3eb3c14d9a2d5716551d5082b25b98 Author: exu <mrc@frm01.net> Date: Fri Dec 8 20:06:02 2023 +0100 Missed some paths commit cf669bf340e58637a4f550245e0866d05f9f69b9 Author: exu <mrc@frm01.net> Date: Fri Dec 8 20:05:01 2023 +0100 Fix paths commit c084949ab35f8e231bc8341a4501d7ac7c1a57ef Author: exu <mrc@frm01.net> Date: Fri Dec 8 20:00:19 2023 +0100 Fix git clone commit 0aaa00b93097c2173d40d4dec687f8b6c7f5a9b1 Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:58:54 2023 +0100 Don't anymore commit 9a7fef2bbb5b62206a3015c1c2dd858ed84aba1c Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:54:06 2023 +0100 Debugging commit 9071e13f4b5beeed762d3765e8bdeeb558133161 Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:53:34 2023 +0100 Revert mode change commit 1432f707ea1f34592a71827074e6a39b622b8861 Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:53:06 2023 +0100 Don't need to rm commit 2ee39a346c7a36095fc8c81de918ab1bef919a00 Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:51:45 2023 +0100 Correctly launch new config commit 9f0fbac8cfa27973b358aa1c9bc02d887c8d2252 Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:49:37 2023 +0100 Debug echo commit cf373cd9e2fddbd220271796921734c953e10c56 Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:47:11 2023 +0100 Remove old configs just in case commit 9fab9d135877d903bbfed0a3bc0f68588e1fbbf8 Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:15:34 2023 +0100 Don't cd commit 14066cad62127d601400bc91716941e48bd0d772 Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:14:33 2023 +0100 Use new path for gsettings commit 837d8e41b98051824d438803b15ebb937c75fe1e Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:10:48 2023 +0100 Remove arco linux config commit bd58b886d20b52a48d240d8c0e27c3cc302454df Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:10:24 2023 +0100 Modify path to (hopefully) all file/dir sources commit afbce1bffb81012b6e189d1f41a8b5b975674938 Author: exu <mrc@frm01.net> Date: Fri Dec 8 18:19:36 2023 +0100 Specify branch for download commit 67ec900d851be292d91fdc22f93b0b19927c9028 Author: exu <mrc@frm01.net> Date: Fri Dec 8 18:19:01 2023 +0100 Start of changing to temporary directories as base
2023-12-08 20:11:16 +01:00
if ! cmp --silent "$scriptloc" "$HOME/scripts/arch-config.sh"; then
2023-11-18 13:27:52 +01:00
echo Removed old config file and launched new one.
Integrate changes to enable temporary directories commit 4462f39a8e18bfb5a48b8277bbceb4cf8128c18d Author: exu <mrc@frm01.net> Date: Fri Dec 8 20:08:49 2023 +0100 Fix paths for bash-cat commit a3e4d5d4bbd3c7bef4026d40905db004fbc9171f Author: exu <mrc@frm01.net> Date: Fri Dec 8 20:07:29 2023 +0100 Subfolder for bash cat commit eef11cf2ce3eb3c14d9a2d5716551d5082b25b98 Author: exu <mrc@frm01.net> Date: Fri Dec 8 20:06:02 2023 +0100 Missed some paths commit cf669bf340e58637a4f550245e0866d05f9f69b9 Author: exu <mrc@frm01.net> Date: Fri Dec 8 20:05:01 2023 +0100 Fix paths commit c084949ab35f8e231bc8341a4501d7ac7c1a57ef Author: exu <mrc@frm01.net> Date: Fri Dec 8 20:00:19 2023 +0100 Fix git clone commit 0aaa00b93097c2173d40d4dec687f8b6c7f5a9b1 Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:58:54 2023 +0100 Don't anymore commit 9a7fef2bbb5b62206a3015c1c2dd858ed84aba1c Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:54:06 2023 +0100 Debugging commit 9071e13f4b5beeed762d3765e8bdeeb558133161 Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:53:34 2023 +0100 Revert mode change commit 1432f707ea1f34592a71827074e6a39b622b8861 Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:53:06 2023 +0100 Don't need to rm commit 2ee39a346c7a36095fc8c81de918ab1bef919a00 Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:51:45 2023 +0100 Correctly launch new config commit 9f0fbac8cfa27973b358aa1c9bc02d887c8d2252 Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:49:37 2023 +0100 Debug echo commit cf373cd9e2fddbd220271796921734c953e10c56 Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:47:11 2023 +0100 Remove old configs just in case commit 9fab9d135877d903bbfed0a3bc0f68588e1fbbf8 Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:15:34 2023 +0100 Don't cd commit 14066cad62127d601400bc91716941e48bd0d772 Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:14:33 2023 +0100 Use new path for gsettings commit 837d8e41b98051824d438803b15ebb937c75fe1e Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:10:48 2023 +0100 Remove arco linux config commit bd58b886d20b52a48d240d8c0e27c3cc302454df Author: exu <mrc@frm01.net> Date: Fri Dec 8 19:10:24 2023 +0100 Modify path to (hopefully) all file/dir sources commit afbce1bffb81012b6e189d1f41a8b5b975674938 Author: exu <mrc@frm01.net> Date: Fri Dec 8 18:19:36 2023 +0100 Specify branch for download commit 67ec900d851be292d91fdc22f93b0b19927c9028 Author: exu <mrc@frm01.net> Date: Fri Dec 8 18:19:01 2023 +0100 Start of changing to temporary directories as base
2023-12-08 20:11:16 +01:00
cp "$tempdir/arch-config/scripts/arch-config.sh" "$HOME/scripts/" && bash ~/scripts/arch-config.sh "$@"
2023-11-18 13:27:52 +01:00
fi
cat <<EOF
########################################
############## Start Setup #############
2023-11-18 13:27:52 +01:00
########################################
EOF
# Collect all PIDs of background processes that should be waited for
pids=""
2023-11-18 13:27:52 +01:00
# call user script
python "$tempdir/arch-config/scripts/config-user.py" &
pids="$pids $!"
2023-11-18 13:27:52 +01:00
# call root script
bash "$tempdir/arch-config/scripts/config-root.sh" &
pids="$pids $!"
2023-11-18 13:27:52 +01:00
# wait for all background jobs to finish
wait $pids && echo "Finished background jobs"
cat <<EOF
########################################
############### Finished ###############
########################################
EOF
#output
echo -e "\033[38;2;20;200;20mFinished updating everything!\033[0m"
echo Launching new shell!
# reminder for enable additional gpu features for corectrl with amd gpus
if [[ $(pacman -Q corectrl) ]]; then
echo -e "\033[38;2;200;20;20mRemember to set \"amdgpu.ppfeaturemask=0xffffffff\" in the kernel!!\033[0m"
fi
# reload user default shell
exec "$(getent passwd $LOGNAME | cut -d: -f7)"
# exit successfully
exit 0