diff options
| -rwxr-xr-x | .install/aur | 14 | ||||
| -rwxr-xr-x | .install/install | 14 | ||||
| -rwxr-xr-x | .install/runall | 65 | ||||
| -rwxr-xr-x | installer | 2 |
4 files changed, 84 insertions, 11 deletions
diff --git a/.install/aur b/.install/aur index 51dba03..dca59f0 100755 --- a/.install/aur +++ b/.install/aur @@ -8,6 +8,12 @@ if [[ "$(id -u)" -eq 0 ]]; then exit 1 fi +if [[ "${1:-}" == "--noconfirm" ]]; then + confirm_flags=(--noconfirm) +else + confirm_flags=() +fi + if ! command -v pacman >/dev/null 2>&1; then echo "This script requires pacman. Are you on Arch or an Arch-based distro?" exit 1 @@ -17,7 +23,7 @@ if command -v paru >/dev/null 2>&1; then echo "paru is already installed." else echo "Installing required packages..." - sudo pacman -S --needed --noconfirm base-devel git + sudo pacman -S --needed "${confirm_flags[@]}" base-devel git tmpdir="$(mktemp -d)" trap 'rm -rf "$tmpdir"' EXIT @@ -28,11 +34,11 @@ else cd "$tmpdir/paru" echo "Building and installing paru..." - makepkg -si --noconfirm + makepkg -si "${confirm_flags[@]}" fi echo "Cleaning paru cache..." -paru -Scc --noconfirm || true +paru -Scc "${confirm_flags[@]}" || true echo "Done." @@ -44,4 +50,4 @@ packages=( dropbox ) -paru -S --needed "${packages[@]}" +paru -S --needed "${confirm_flags[@]}" "${packages[@]}" diff --git a/.install/install b/.install/install index 1b5668e..7bc5951 100755 --- a/.install/install +++ b/.install/install @@ -1,4 +1,16 @@ #!/usr/bin/env bash +set -euo pipefail + +if ! command -v pacman >/dev/null 2>&1; then + echo "This script requires pacman (Arch/Arch-based distro)." >&2 + exit 1 +fi + +if [[ "${1:-}" == "--noconfirm" ]]; then + pacman_flags=(--needed --noconfirm) +else + pacman_flags=(--needed) +fi packages=( # Base @@ -197,4 +209,4 @@ packages=( rmpc ) -sudo pacman -S --needed "${packages[@]}" +sudo pacman -S "${pacman_flags[@]}" "${packages[@]}" diff --git a/.install/runall b/.install/runall index d8e2502..4cdba8c 100755 --- a/.install/runall +++ b/.install/runall @@ -1,8 +1,61 @@ -./install -./aur -./aetherfox +#!/usr/bin/env bash +set -euo pipefail -sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" -sh -c "$(curl -sS https://vencord.dev/install.sh)" +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" +DOTFILES_DIR="$(cd -- "$SCRIPT_DIR/.." && pwd)" -./stowall +noninteractive=0 +install_ohmyzsh=0 +install_vencord=0 + +while [[ $# -gt 0 ]]; do + case "$1" in + --noconfirm) + noninteractive=1 + shift + ;; + --with-ohmyzsh) + install_ohmyzsh=1 + shift + ;; + --with-vencord) + install_vencord=1 + shift + ;; + *) + echo "Unknown argument: $1" >&2 + echo "Usage: $0 [--noconfirm] [--with-ohmyzsh] [--with-vencord]" >&2 + exit 1 + ;; + esac +done + +if [[ "$noninteractive" -eq 1 ]]; then + "$SCRIPT_DIR/install" --noconfirm + "$SCRIPT_DIR/aur" --noconfirm +else + "$SCRIPT_DIR/install" + "$SCRIPT_DIR/aur" +fi + +"$SCRIPT_DIR/aetherfox" + +if [[ "$install_ohmyzsh" -eq 1 ]]; then + if [[ -d "$HOME/.oh-my-zsh" ]]; then + echo "oh-my-zsh already installed at $HOME/.oh-my-zsh" + else + echo "Installing oh-my-zsh via git clone..." + git clone --depth=1 https://github.com/ohmyzsh/ohmyzsh.git "$HOME/.oh-my-zsh" + fi +fi + +if [[ "$install_vencord" -eq 1 ]]; then + tmp_script="$(mktemp)" + trap 'rm -f "$tmp_script"' EXIT + + echo "Fetching Vencord installer script..." + curl -fsSL https://vencord.dev/install.sh -o "$tmp_script" + sh "$tmp_script" +fi + +"$SCRIPT_DIR/stowall" "$DOTFILES_DIR" diff --git a/installer b/installer new file mode 100755 index 0000000..6b987cc --- /dev/null +++ b/installer @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +.install/runall --noconfirm --with-ohmyzsh --with-vencord |
