From c7ff10bb3f91ca50a6eb586582d048abfa8aba56 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Sun, 15 Jun 2025 22:44:28 +1000 Subject: [PATCH] feat: add install script --- .gitignore | 6 ++ hypr/.gitignore | 3 - install.fish | 221 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 227 insertions(+), 3 deletions(-) create mode 100644 .gitignore delete mode 100644 hypr/.gitignore create mode 100755 install.fish diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9a0433b --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +/hypr/hyprland/overrides.conf +/hypr/scheme/current.conf +/hypr/hyprlock.conf + +/spicetify/config-xpui.ini +/spicetify/Themes/caelestia/color.ini diff --git a/hypr/.gitignore b/hypr/.gitignore deleted file mode 100644 index ddb8cb7..0000000 --- a/hypr/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/hyprland/overrides.conf -/scheme/current.conf -/hyprlock.conf diff --git a/install.fish b/install.fish new file mode 100755 index 0000000..c07c2c8 --- /dev/null +++ b/install.fish @@ -0,0 +1,221 @@ +#!/usr/bin/env fish + +argparse -n 'install.fish' -X 0 \ + 'h/help' \ + 'noconfirm' \ + 'spotify' \ + 'vscode=?!contains -- "$_flag_value" codium code' \ + 'discord' \ + -- $argv +or exit + + +# Print help +if set -q _flag_h + echo 'usage: ./install.sh [-h] [--noconfirm] [--spotify] [--vscode] [--discord]' + echo + echo 'options:' + echo ' -h, --help show this help message and exit' + echo ' --noconfirm do not confirm package installation' + echo ' --spotify install Spotify (Spicetify)' + echo ' --vscode=[codium|code] install VSCodium (or VSCode)' + echo ' --discord install Discord (OpenAsar + Equicord)' + + exit +end + + +# Helper funcs +function _out -a colour text + set_color $colour + # Pass arguments other than text to echo + echo $argv[3..] -- ":: $text" + set_color normal +end + +function log -a text + _out cyan $text $argv[2..] +end + +function input -a text + _out blue $text $argv[2..] +end + +function confirm-overwrite -a path + if test -e $path -o -L $path + # No prompt if noconfirm + if set -q noconfirm + log 'Removing...' + rm -rf $path + else + # Prompt user + read -l -p "input '$path already exists. Overwrite? [Y/n] ' -n" confirm + + if test "$confirm" = 'n' -o "$confirm" = 'N' + log 'Skipping...' + return 1 + else + log 'Removing...' + rm -rf $path + end + end + end + + return 0 +end + + +# Variables +set -q _flag_noconfirm && set noconfirm '--noconfirm' +set -q XDG_CONFIG_HOME && set -l config $XDG_CONFIG_HOME || set -l config $HOME/.config + +# Startup prompt +set_color magenta +echo '╭─────────────────────────────────────────────────╮' +echo '│ ______ __ __ _ │' +echo '│ / ____/___ ____ / /__ _____/ /_(_)___ _ │' +echo '│ / / / __ `/ _ \/ / _ \/ ___/ __/ / __ `/ │' +echo '│ / /___/ /_/ / __/ / __(__ ) /_/ / /_/ / │' +echo '│ \____/\__,_/\___/_/\___/____/\__/_/\__,_/ │' +echo '│ │' +echo '╰─────────────────────────────────────────────────╯' +set_color normal +log 'Welcome to the Caelestia dotfiles installer!' +log 'Before continuing, please ensure you have made a backup of your config directory.' + +# Prompt for backup +if ! set -q _flag_noconfirm + log '[1] Two steps ahead of you! [2] Make one for me please!' + read -l -p "input '=> ' -n" choice + + if contains -- "$choice" 1 2 + if test $choice = 2 + log "Backing up $config..." + + if test -e $config.bak -o -L $config.bak + read -l -p "input 'Backup already exists. Overwrite? [Y/n] ' -n" overwrite + + if test "$overwrite" = 'n' -o "$overwrite" = 'N' + log 'Skipping...' + else + rm -rf $config.bak + cp -r $config $config.bak + end + else + cp -r $config $config.bak + end + end + else + log 'No choice selected. Exiting...' + exit 1 + end +end + + +# Install yay if not already installed +if ! pacman -Q yay &> /dev/null + log 'Yay not installed. Installing...' + + # Install + sudo pacman -S --needed git base-devel $noconfirm + cd /tmp + git clone https://aur.archlinux.org/yay.git + cd yay + makepkg -si + cd .. + rm -rf yay + + # Setup + yay -Y --gendb + yay -Y --devel --save +end + +# Install metapackage for deps +log 'Installing metapackage...' +yay -S caelestia-meta $noconfirm + +# Install hypr* configs +if confirm-overwrite $config/hypr + log 'Installing hypr* configs...' + ln -s hypr $config/hypr +end + +# Starship +if confirm-overwrite $config/starship.toml + log 'Installing starship config...' + ln -s starship.toml $config/starship.toml +end + +# Foot +if confirm-overwrite $config/foot + log 'Installing foot config...' + ln -s foot $config/foot +end + +# Fish +if confirm-overwrite $config/fish + log 'Installing fish config...' + ln -s fish $config/fish +end + +# Fastfetch +if confirm-overwrite $config/fastfetch + log 'Installing fastfetch config...' + ln -s fastfetch $config/fastfetch +end + +# Uwsm +if confirm-overwrite $config/uwsm + log 'Installing uwsm config...' + ln -s uwsm $config/uwsm +end + +# Install spicetify +if set -q _flag_spotify + log 'Installing spotify (spicetify)...' + yay -S --needed spotify spicetify-cli spicetify-marketplace-bin $noconfirm + + # Install configs + if confirm-overwrite $config/spicetify + log 'Installing spicetify config...' + ln -s spicetify $config/spicetify + + # Set spicetify configs + spicetify config current_theme caelestia color_scheme caelestia custom_apps marketplace 2> /dev/null + spicetify apply + end +end + +# Install vscode +if set -q _flag_vscode + test "$_flag_vscode" = 'code' && set -l prog 'code' || set -l prog 'codium' + test "$_flag_vscode" = 'code' && set -l packages 'code' || set -l packages 'vscodium-bin' 'vscodium-bin-marketplace' + test "$_flag_vscode" = 'code' && set -l folder 'Code' || set -l folder 'VSCodium' + + log "Installing vs$prog..." + yay -S --needed $packages $noconfirm + + # Install configs + if confirm-overwrite $config/$folder + log "Installing vs$prog config..." + ln -s $folder $config/$folder + + # Install extension + $prog --install-extension $config/$folder/caelestia-vscode-integration/caelestia-vscode-integration-*.vsix + end +end + +# Install discord +if set -q _flag_discord + log 'Installing discord...' + yay -S --needed discord equicord-installer-bin $noconfirm + + # Install OpenAsar and Equicord + sudo Equilotl -install -location /opt/discord + sudo Equilotl -install-openasar -location /opt/discord + + # Remove installer + yay -Rns equicord-installer-bin $noconfirm +end + +log 'Done!'