From 669eaa61cbead28957c0b541212e05a8ca8c7a7f Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Sat, 22 Feb 2025 14:25:41 +1100 Subject: install: better install + use data and state Don't complete remove repos, use git pull instead Use XDG_DATA_HOME and XDG_STATE_HOME --- install/util.fish | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'install/util.fish') 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 -- cgit v1.2.3-freya