Krolyxon
Commit 489744d

Branches

Refs →

aurorainstall.sh

114 lines · 3.4 KB · Bourne Again Shell (bash)

1#!/bin/env bash
2
3currentDir="$(dirname "$(readlink -f "$0")")"
4cd "$currentDir"
5
6## Install necessary desktop packages
7source "$currentDir/packages/pkg_desktop.sh"
8source "$currentDir/packages/pkg_utils.sh"
9sudo pacman -S --needed "${pkg_desktop[@]}" "${pkg_utils[@]}"
10
11## Install dev tools
12read -rp "Do you wish to install development tools? [y/N]" install_dev_tools
13source "$currentDir/packages/pkg_dev_tools.sh"
14if [[ $install_dev_tools == y ]]; then
15 sudo pacman -S --needed "${pkg_dev_tools[@]}"
16fi
17
18## Install optional packages
19read -rp "Do you wish to install optional packages? [y/N]" install_optional_pkg
20if [[ $install_optional_pkg == y ]]; then
21 source "$currentDir/packages/pkg_optional.sh"
22 sudo pacman -S --needed "${pkg_optional[@]}"
23fi
24
25## Install nvidia drivers
26read -rp "Do you wish to install Nvidia drivers? [y/N]" install_nvidia_drivers
27if [[ $install_nvidia_drivers == y ]]; then
28 source "$currentDir/packages/pkg_nvidia.sh"
29 sudo pacman -S --needed "${pkg_nvidia[@]}"
30fi
31
32
33## Install aur packages
34read -rp "Do you wish to install aur packages? [y/N]" install_aur_pkg
35if [[ $install_aur_pkg == y ]]; then
36 ## Install paru if it isn't already installed
37 if ! command -v paru >/dev/null 2>&1; then
38 echo "Installing paru..."
39 git clone https://aur.archlinux.org/paru-bin.git
40 cd paru-bin
41 makepkg -sri
42 cd ..
43 rm -rf paru-bin
44 else
45 echo "Skipping paru (already in PATH)"
46 fi
47 ## Install aur packages
48 source "$currentDir/packages/pkg_aur.sh"
49 paru -S --needed "${pkg_aur[@]}"
50fi
51
52
53## Setup dotfiles
54echo "⚠️ WARNING: This will DELETE any conflicting files and replace them with symlinks from this repo."
55echo "Make sure you have already backed up all your existing config files (~/.config)"
56read -rp "Continue with stow (y/N): " confirm
57if [[ "$confirm" =~ ^[Yy]$ ]]; then
58 echo "Detecting conflicts..."
59 conflicts=$(stow . --no-folding -nv 2>&1 | \
60 sed -n 's/.*existing target \(.*\) since neither.*/\1/p')
61
62 if [[ -z "$conflicts" ]]; then
63 echo "No conflicts. Running stow normally..."
64 stow . --no-folding
65 echo "✅ Done."
66 else
67 echo "These paths conflict and will be removed:"
68 printf ' %s\n' $conflicts
69 read -rp "Proceed with deleting these files? (y/N): " ok
70 if [[ ! "$ok" =~ ^[Yy]$ ]]; then
71 echo "Aborted."
72 fi
73
74 # Remove conflicts relative to $HOME
75 for path in $conflicts; do
76 echo "Removing $HOME/$path"
77 rm -rf "$HOME/$path"
78 done
79
80 echo "Running stow..."
81 stow . --no-folding
82 echo "✅ Dotfiles stowed with overwrite."
83 fi
84else
85 echo "Aborted stow"
86fi
87
88
89## Setup neovim dotfiles
90read -rp "Clone neovim dotfiles as well? (y/N): " confirm
91if [[ "$confirm" =~ ^[Yy]$ ]]; then
92 echo "Taking backup of neovim config (if already exists)"
93 mv ~/.config/nvim{,.bak}
94 mv ~/.local/share/nvim{,.bak}
95 mv ~/.local/state/nvim{,.bak}
96 mv ~/.cache/nvim{,.bak}
97 git clone --depth=1 git@github.com:krolyxon/nvim.git ~/.config/nvim
98fi
99
100## Change default shell to zsh
101if [[ "$SHELL" != "$(which zsh)" ]]; then
102 read -rp "Change default shell to ZSH? (y/N): " confirm
103 if [[ "$confirm" =~ ^[Yy]$ ]]; then
104 echo "Changing default shell to zsh..."
105 chsh -s $(which zsh)
106 fi
107else
108 echo "Skipping: zsh is already the default shell"
109fi
110
111
112printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
113echo ""
114echo "Done! 😊"