Commit 87eceb96 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Enable systemd units on update

parent 508fa0c1
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -142,6 +142,7 @@ do_update()
	local now=`date +%s` updated=`date -r $timestamp +%s 2>/dev/null`
	local BOLD_BLUE=$'\033[34;1m' DEFAULT=$'\033[m'
	local prompt="${BOLD_BLUE}Would you like to update dotfiles?${DEFAULT} "
	local unit

	if [ -n "$USE_PROMPT" ]; then
		if [ $now -lt $((updated + 604800)) ]; then
@@ -171,4 +172,14 @@ do_update()
	# re-source this file
	unset SOURCED_SHELL_FUNCS
	. ~/.shell/funcs

	# ensure systemd units are enabled
	if type systemctl >/dev/null 2>&1; then
		systemctl --user daemon-reload
		for unit in ~/.config/systemd/user/*; do
			if [ -d "$unit" ]; then continue; fi
			echo "Enabling $unit"
			systemctl --user enable "${unit##*/}" 2>/dev/null
		done
	fi
}