forked from Shinonome/caelestia-cli
install: better link install
Remove links if not already linked before linking
This commit is contained in:
@@ -20,7 +20,6 @@ update-repo discord $dist
|
||||
setup-systemd-monitor discord $dist
|
||||
|
||||
# Link themes to client config
|
||||
confirm-overwrite $client/themes
|
||||
ln -s $dist/themes $client/themes
|
||||
install-link $dist/themes $client/themes
|
||||
|
||||
log 'Done.'
|
||||
|
||||
+4
-8
@@ -10,20 +10,16 @@ set -l dist $C_DATA/fish
|
||||
update-repo fish $dist
|
||||
|
||||
# Install fish config
|
||||
confirm-overwrite $CONFIG/fish/config.fish
|
||||
ln -s $dist/config.fish $CONFIG/fish/config.fish
|
||||
install-link $dist/config.fish $CONFIG/fish/config.fish
|
||||
|
||||
# Install fish greeting
|
||||
confirm-overwrite $CONFIG/fish/functions/fish_greeting.fish
|
||||
mkdir -p $CONFIG/fish/functions
|
||||
ln -s $dist/fish_greeting.fish $CONFIG/fish/functions/fish_greeting.fish
|
||||
install-link $dist/fish_greeting.fish $CONFIG/fish/functions/fish_greeting.fish
|
||||
|
||||
# Install starship config
|
||||
confirm-overwrite $CONFIG/starship.toml
|
||||
ln -s $dist/starship.toml $CONFIG/starship.toml
|
||||
install-link $dist/starship.toml $CONFIG/starship.toml
|
||||
|
||||
# Install fastfetch config
|
||||
confirm-overwrite $CONFIG/fastfetch/config.jsonc
|
||||
ln -s $dist/fastfetch.jsonc $CONFIG/fastfetch/config.jsonc
|
||||
install-link $dist/fastfetch.jsonc $CONFIG/fastfetch/config.jsonc
|
||||
|
||||
log 'Done.'
|
||||
|
||||
+1
-2
@@ -25,8 +25,7 @@ else
|
||||
end
|
||||
|
||||
# Install uwsm envs
|
||||
confirm-overwrite $uwsm
|
||||
ln -s $hypr/uwsm $uwsm
|
||||
install-link $hypr/uwsm $uwsm
|
||||
|
||||
# Enable ydotool if installed
|
||||
pacman -Q ydotool &> /dev/null && systemctl --user enable --now ydotool.service
|
||||
|
||||
@@ -12,9 +12,10 @@ update-repo scripts $dist
|
||||
|
||||
# Install to path
|
||||
mkdir -p ~/.local/bin
|
||||
ln -sf $dist/main.fish ~/.local/bin/caelestia
|
||||
install-link $dist/main.fish ~/.local/bin/caelestia
|
||||
|
||||
# Install completions
|
||||
test -e $CONFIG/fish/completions/caelestia.fish && rm $CONFIG/fish/completions/caelestia.fish
|
||||
mkdir -p $CONFIG/fish/completions
|
||||
cp $dist/completions/caelestia.fish $CONFIG/fish/completions/caelestia.fish
|
||||
|
||||
|
||||
@@ -108,3 +108,10 @@ WantedBy=default.target" > $systemd/$module-monitor-scheme.path
|
||||
systemctl --user start $module-monitor-scheme.service
|
||||
end
|
||||
end
|
||||
|
||||
function install-link -a from to
|
||||
if ! test -L $to -a (realpath $to) = (realpath $from)
|
||||
confirm-overwrite $to
|
||||
ln -s $from $to
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
. (dirname (status filename))/util.fish
|
||||
|
||||
function confirm-copy -a from to
|
||||
test -L $to -a (realpath $to) = (realpath $from) && return
|
||||
if test -e $to
|
||||
read -l -p "input '$(realpath $to) already exists. Overwrite? [y/N] ' -n" confirm
|
||||
test "$confirm" = 'y' -o "$confirm" = 'Y' && log 'Continuing.' || return
|
||||
|
||||
Reference in New Issue
Block a user