feat: add install script
This commit is contained in:
parent
2e066bbbc1
commit
c7ff10bb3f
3 changed files with 227 additions and 3 deletions
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
/hypr/hyprland/overrides.conf
|
||||
/hypr/scheme/current.conf
|
||||
/hypr/hyprlock.conf
|
||||
|
||||
/spicetify/config-xpui.ini
|
||||
/spicetify/Themes/caelestia/color.ini
|
||||
3
hypr/.gitignore
vendored
3
hypr/.gitignore
vendored
|
|
@ -1,3 +0,0 @@
|
|||
/hyprland/overrides.conf
|
||||
/scheme/current.conf
|
||||
/hyprlock.conf
|
||||
221
install.fish
Executable file
221
install.fish
Executable file
|
|
@ -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!'
|
||||
Loading…
Add table
Add a link
Reference in a new issue