Doors/setup

132 lines
3.7 KiB
Text
Raw Normal View History

2024-01-08 18:17:59 -05:00
#!/bin/sh
2023-06-17 19:32:45 -04:00
set -e
2024-01-10 00:21:14 -05:00
cd
2023-06-17 19:32:45 -04:00
2024-01-14 21:17:17 -05:00
HEADER=':::::::-. ... ... :::::::.. .::::::.
;;, `'\'';, .;;;;;;;. .;;;;;;;. ;;;;``;;;; ;;;` `
`[[ [[,[[ \[[,,[[ \[[,[[[,/[[['\'' '\''[==/[[[[,
$$, $$$$$, $$$$$$, $$$$$$$$$c '\'''\'''\'' $
888_,o8P'\''"888,_ _,88P"888,_ _,88P888b "88bo,88b dP
MMMMP"` "YMMMMMP" "YMMMMMP" MMMM "W" "YMmMY"
Doors are sturdier than windows.
-------------------------------------------------------'
2024-01-07 03:25:55 -05:00
clear &&
2024-01-14 21:17:17 -05:00
echo "$HEADER"
2024-01-07 02:24:12 -05:00
echo "Choose your adventure:
============================
1. Shell/CLI stuff only
2024-01-08 18:17:59 -05:00
2. Above plus basic GUI
2024-01-07 02:24:12 -05:00
3. Above plus extras like steam, messengers (bloat)
2024-01-14 21:47:32 -05:00
4. Clean neovim data (only if you have problems or still have pre-2024 setup)
2024-01-08 18:17:59 -05:00
2024-01-14 21:47:32 -05:00
Enter number: "
2024-01-08 18:17:59 -05:00
read -r input
2024-01-07 02:24:12 -05:00
if ! [ "$input" -eq "$input" ] 2> /dev/null; then
echo "Error: Not a number"
exit 1
2024-01-14 21:47:32 -05:00
elif [ "$input" -lt 1 ] || [ "$input" -gt 4 ]; then
2024-01-07 02:24:12 -05:00
echo "Error: Input out of range"
exit 1
fi
2024-12-15 17:58:32 -05:00
clear
2024-01-14 21:47:32 -05:00
2024-12-15 17:52:17 -05:00
# # Trigger sudo prompt before less can block password input
# sudo echo ''
# Detect OS and act accordingly
. /etc/os-release
OS=$NAME
2024-12-15 18:09:31 -05:00
echo "$HEADER"
2024-01-09 07:17:22 -05:00
printf "\nSetup for %s\n" "$OS"
2023-06-15 16:36:30 -04:00
2024-01-08 18:17:59 -05:00
case "$OS" in
*Arch*)
2024-12-15 17:52:17 -05:00
# # Check for less and install if not found
# if ! type "less" > /dev/null 2>&1; then
# echo "less not found, installing..."
# sudo pacman -S --noconfirm less # <<< should handle other distros here
# fi
# clear &&
# # Execute in less with a header for style points
# exec > >(less +F -X --header 8) 2>&1
# trap 'exec >&- 2>&-; wait' EXIT
echo "Enabling Pacman colors..."
sudo sed '/Color/s/^#//' -i /etc/pacman.conf
2023-06-15 16:36:30 -04:00
2024-01-10 00:21:14 -05:00
printf "Upgrading system...\n"
sudo pacman -Syyu --noconfirm
2024-01-08 18:17:59 -05:00
printf '\nVerifying base requirements...'
sudo pacman -S --needed --noconfirm git base-devel
2023-06-15 16:36:30 -04:00
if test -d .doors; then
2024-01-08 18:17:59 -05:00
printf '\n%s/.doors found, checking for updates...' "$HOME"
cd .doors
git pull
cd
2023-06-15 16:36:30 -04:00
else
2024-01-08 18:17:59 -05:00
printf '\n%s/.doors not found, creating...' "$HOME"
2024-01-09 16:44:06 -05:00
git clone https://git.doordesk.net/adam/Doors.git .doors
fi
2023-06-15 16:36:30 -04:00
2024-01-14 21:47:32 -05:00
if [ "$input" -eq 4 ]; then
echo "Cleaning nvim..."
"$HOME"/.doors/scripts/nvim_clean
echo "Done! Run setup to refresh"
2024-12-15 17:52:17 -05:00
# # Give less time to catch up and tell it we're done
# sleep .5 && killall -s SIGINT less
2024-01-14 21:47:32 -05:00
exit 0
fi
2024-01-08 18:17:59 -05:00
"$HOME"/.doors/scripts/install_arch "$input"
;;
*)
echo "$OS is not supported by this script at this time."
exit 1
;;
esac
2023-06-15 16:36:30 -04:00
2024-01-09 11:33:15 -05:00
# TODO: Add "Arch ARM"
2024-01-09 07:17:22 -05:00
2023-12-30 19:50:42 -05:00
# These are broken for now
# elif [[ $OS == *buntu* ]]; then
# cd
# sudo apt-get -y install git rsync
2024-01-09 16:45:22 -05:00
# git clone https://git.doordesk.net/adam/Doors.git .doors
2023-12-30 19:50:42 -05:00
# $HOME/.doors/scripts/install_min_ubuntu
2024-01-08 18:17:59 -05:00
#
2023-12-30 19:50:42 -05:00
# elif [[ $OS == *Fedora* ]]; then
# cd
# sudo dnf install -y git rsync
2024-01-09 16:45:22 -05:00
# git clone https://git.doordesk.net/adam/Doors.git .doors
2023-12-30 19:50:42 -05:00
# $HOME/.doors/scripts/install_min_fedora
# Copy and link files
2024-01-08 18:17:59 -05:00
cd "$HOME"/.doors &&
"$HOME"/.doors/scripts/copy_and_link "$input"
2023-06-18 21:16:12 -04:00
2024-01-03 02:49:28 -05:00
# Copy default wallpaper
2024-01-11 02:52:02 -05:00
if ! test -f "$HOME"/Pictures/Wallpapers/door2.jpg; then
2024-01-25 02:04:35 -05:00
if ! test -d "$HOME"/Pictures/Wallpapers; then
mkdir -p "$HOME"/Pictures/Wallpapers
2024-01-11 02:52:02 -05:00
printf "Downloading default wallpaper...\n"
2024-01-11 02:53:05 -05:00
curl -so "$HOME"/Pictures/Wallpapers/door2.jpg https://old.doordesk.net/door2.jpg &&
2024-01-11 02:52:02 -05:00
wal -ensqi "$HOME"/Pictures/Wallpapers
2024-01-25 02:04:35 -05:00
fi
2024-01-03 02:49:28 -05:00
fi
# Wrap up
2024-12-17 23:51:24 -05:00
printf "\nDone!\nLog out and back in for changes to take effect.\n"
2023-06-17 19:32:45 -04:00
2024-12-15 17:52:17 -05:00
# # Give less time to catch up and tell it we're done
# sleep .5 && killall -s SIGINT less