Skip to content

Commit 3d10915

Browse files
Fix systemd unit install on clean system
If the .config/systemd/user directory did not exist, it would not get created, as the mkdir command was inside the function systemd_unit_file() which is piped into the target file. The shell determined that file could not be created first (as the directory did not exist), so never called the function. Signed-off-by: Paul Elliott <paul@niburu.org>
1 parent fc2f31d commit 3d10915

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

scripts/handle_tmux_automatic_start/systemd_enable.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ systemd_unit_file() {
5151
local systemd_tmux_server_start_cmd="$(get_tmux_option "${systemd_tmux_server_start_cmd_option}" "${systemd_tmux_server_start_cmd_default}" )"
5252
local tmux_start_script_path="${CURRENT_DIR}/linux_start_tmux.sh"
5353
local systemd_unit_file=$(template "${tmux_start_script_path}" "${options}")
54-
mkdir -p "$(dirname ${systemd_unit_file_path})"
5554
echo "$systemd_unit_file"
5655
}
5756

@@ -60,8 +59,13 @@ write_unit_file() {
6059
}
6160

6261
write_unit_file_unless_exists() {
63-
if ! [ -e "${systemd_unit_file_path}" ]; then
64-
write_unit_file
62+
63+
local systemd_unit_file_dir=$(dirname ${systemd_unit_file_path})
64+
if ! [ -d $systemd_unit_file_dir ]; then
65+
mkdir -p $systemd_unit_file_dir
66+
write_unit_file
67+
elif ! [ -e "${systemd_unit_file_path}" ]; then
68+
write_unit_file
6569
fi
6670
}
6771

0 commit comments

Comments
 (0)