diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-02-22 14:25:41 +1100 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-02-22 14:25:41 +1100 |
| commit | 669eaa61cbead28957c0b541212e05a8ca8c7a7f (patch) | |
| tree | 064b476d7757cd8abb19faddff67defba0c538bf /install/util.fish | |
| parent | readme: update help message (diff) | |
| download | caelestia-cli-669eaa61cbead28957c0b541212e05a8ca8c7a7f.tar.gz caelestia-cli-669eaa61cbead28957c0b541212e05a8ca8c7a7f.tar.bz2 caelestia-cli-669eaa61cbead28957c0b541212e05a8ca8c7a7f.zip | |
install: better install + use data and state
Don't complete remove repos, use git pull instead
Use XDG_DATA_HOME and XDG_STATE_HOME
Diffstat (limited to 'install/util.fish')
| -rw-r--r-- | install/util.fish | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/install/util.fish b/install/util.fish index 6fca2f9..ad62230 100644 --- a/install/util.fish +++ b/install/util.fish @@ -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 |