mirror of
https://github.com/caelestia-dots/cli.git
synced 2026-06-07 15:59:28 -05:00
install: better install + use data and state
Don't complete remove repos, use git pull instead Use XDG_DATA_HOME and XDG_STATE_HOME
This commit is contained in:
@@ -64,3 +64,47 @@ function install-optional-deps
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function update-repo -a module dir
|
||||
set -l remote https://github.com/caelestia-dots/$module.git
|
||||
if test -d $dir
|
||||
cd $dir || exit
|
||||
if test "$(git config --get remote.origin.url)" != $remote
|
||||
cd .. || exit
|
||||
confirm-overwrite $dir
|
||||
git clone $remote $dir
|
||||
else
|
||||
git pull
|
||||
end
|
||||
else
|
||||
git clone $remote $dir
|
||||
end
|
||||
end
|
||||
|
||||
function setup-systemd-monitor -a module dir
|
||||
set -l systemd $CONFIG/systemd/user
|
||||
if which systemctl &> /dev/null
|
||||
log 'Installing systemd service...'
|
||||
|
||||
mkdir -p $systemd
|
||||
echo "[Unit]
|
||||
Description=Sync $module and caelestia schemes
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=$dir/monitor/update.fish" > $systemd/$module-monitor-scheme.service
|
||||
echo "[Unit]
|
||||
Description=Sync $module and caelestia schemes (monitor)
|
||||
|
||||
[Path]
|
||||
PathModified=%S/caelestia/scheme/current.txt
|
||||
Unit=$module-monitor-scheme.service
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target" > $systemd/$module-monitor-scheme.path
|
||||
|
||||
systemctl --user daemon-reload
|
||||
systemctl --user enable --now $module-monitor-scheme.path
|
||||
systemctl --user start $module-monitor-scheme.service
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user