132 lines
3.7 KiB
Bash
Executable file
132 lines
3.7 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
set -e
|
|
cd
|
|
|
|
HEADER=':::::::-. ... ... :::::::.. .::::::.
|
|
;;, `'\'';, .;;;;;;;. .;;;;;;;. ;;;;``;;;; ;;;` `
|
|
`[[ [[,[[ \[[,,[[ \[[,[[[,/[[['\'' '\''[==/[[[[,
|
|
$$, $$$$$, $$$$$$, $$$$$$$$$c '\'''\'''\'' $
|
|
888_,o8P'\''"888,_ _,88P"888,_ _,88P888b "88bo,88b dP
|
|
MMMMP"` "YMMMMMP" "YMMMMMP" MMMM "W" "YMmMY"
|
|
|
|
Doors are sturdier than windows.
|
|
-------------------------------------------------------'
|
|
|
|
clear &&
|
|
echo "$HEADER"
|
|
echo "Choose your adventure:
|
|
============================
|
|
1. Shell/CLI stuff only
|
|
2. Above plus basic GUI
|
|
3. Above plus extras like steam, messengers (bloat)
|
|
4. Clean neovim data (only if you have problems or still have pre-2024 setup)
|
|
|
|
Enter number: "
|
|
|
|
read -r input
|
|
|
|
if ! [ "$input" -eq "$input" ] 2> /dev/null; then
|
|
echo "Error: Not a number"
|
|
exit 1
|
|
elif [ "$input" -lt 1 ] || [ "$input" -gt 4 ]; then
|
|
echo "Error: Input out of range"
|
|
exit 1
|
|
fi
|
|
|
|
clear
|
|
|
|
# # Trigger sudo prompt before less can block password input
|
|
# sudo echo ''
|
|
|
|
# Detect OS and act accordingly
|
|
. /etc/os-release
|
|
OS=$NAME
|
|
|
|
echo "$HEADER"
|
|
printf "\nSetup for %s\n\n" "$OS"
|
|
|
|
case "$OS" in
|
|
*Arch*)
|
|
# # 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
|
|
|
|
printf "Upgrading system...\n"
|
|
sudo pacman -Syyu --noconfirm
|
|
|
|
printf '\nVerifying base requirements...'
|
|
sudo pacman -S --needed --noconfirm git base-devel
|
|
|
|
if test -d .doors; then
|
|
printf '\n%s/.doors found, checking for updates...' "$HOME"
|
|
cd .doors
|
|
git pull
|
|
cd
|
|
else
|
|
printf '\n%s/.doors not found, creating...' "$HOME"
|
|
git clone https://git.doordesk.net/adam/Doors.git .doors
|
|
fi
|
|
|
|
if [ "$input" -eq 4 ]; then
|
|
echo "Cleaning nvim..."
|
|
"$HOME"/.doors/scripts/nvim_clean
|
|
echo "Done! Run setup to refresh"
|
|
|
|
# # Give less time to catch up and tell it we're done
|
|
# sleep .5 && killall -s SIGINT less
|
|
|
|
exit 0
|
|
fi
|
|
|
|
"$HOME"/.doors/scripts/install_arch "$input"
|
|
;;
|
|
*)
|
|
echo "$OS is not supported by this script at this time."
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
# TODO: Add "Arch ARM"
|
|
|
|
# These are broken for now
|
|
# elif [[ $OS == *buntu* ]]; then
|
|
# cd
|
|
# sudo apt-get -y install git rsync
|
|
# git clone https://git.doordesk.net/adam/Doors.git .doors
|
|
# $HOME/.doors/scripts/install_min_ubuntu
|
|
#
|
|
# elif [[ $OS == *Fedora* ]]; then
|
|
# cd
|
|
# sudo dnf install -y git rsync
|
|
# git clone https://git.doordesk.net/adam/Doors.git .doors
|
|
# $HOME/.doors/scripts/install_min_fedora
|
|
|
|
# Copy and link files
|
|
cd "$HOME"/.doors &&
|
|
"$HOME"/.doors/scripts/copy_and_link "$input"
|
|
|
|
# Copy default wallpaper
|
|
|
|
if ! test -f "$HOME"/Pictures/Wallpapers/door2.jpg; then
|
|
if ! test -d "$HOME"/Pictures/Wallpapers; then
|
|
mkdir -p "$HOME"/Pictures/Wallpapers
|
|
printf "Downloading default wallpaper...\n"
|
|
curl -so "$HOME"/Pictures/Wallpapers/door2.jpg https://old.doordesk.net/door2.jpg &&
|
|
wal -ensqi "$HOME"/Pictures/Wallpapers
|
|
fi
|
|
fi
|
|
|
|
# Wrap up
|
|
printf "\nDone!\nLog out and back in for changes to take effect.\n"
|
|
|
|
# # Give less time to catch up and tell it we're done
|
|
# sleep .5 && killall -s SIGINT less
|