Skip to content

Commit 64a0599

Browse files
authored
Merge pull request #106 from UbiquitousPhoton/fix_systemd_install
Fix systemd unit install on clean system
2 parents fc2f31d + 3d10915 commit 64a0599

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)