mirror of
https://github.com/tmux-plugins/tmux-continuum.git
synced 2024-12-22 07:28:47 +00:00
Merge pull request #53 from andydna/andydna
don't overwrite systemd unit file if it already exists
This commit is contained in:
commit
c02b4ec711
@ -46,13 +46,27 @@ enable_tmux_unit_on_boot() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
systemd_unit_file() {
|
||||||
local options="$(get_tmux_option "$auto_start_config_option" "${auto_start_config_default}")"
|
local options="$(get_tmux_option "$auto_start_config_option" "${auto_start_config_default}")"
|
||||||
local systemd_tmux_server_start_cmd="$(get_tmux_option "${systemd_tmux_server_start_cmd_option}" "${systemd_tmux_server_start_cmd_default}" )"
|
local systemd_tmux_server_start_cmd="$(get_tmux_option "${systemd_tmux_server_start_cmd_option}" "${systemd_tmux_server_start_cmd_default}" )"
|
||||||
local tmux_start_script_path="${CURRENT_DIR}/linux_start_tmux.sh"
|
local tmux_start_script_path="${CURRENT_DIR}/linux_start_tmux.sh"
|
||||||
local systemd_unit_file=$(template "${tmux_start_script_path}" "${options}")
|
local systemd_unit_file=$(template "${tmux_start_script_path}" "${options}")
|
||||||
mkdir -p "$(dirname ${systemd_unit_file_path})"
|
mkdir -p "$(dirname ${systemd_unit_file_path})"
|
||||||
echo "$systemd_unit_file" > "${systemd_unit_file_path}"
|
echo "$systemd_unit_file"
|
||||||
|
}
|
||||||
|
|
||||||
|
write_unit_file() {
|
||||||
|
systemd_unit_file > "${systemd_unit_file_path}"
|
||||||
|
}
|
||||||
|
|
||||||
|
write_unit_file_unless_exists() {
|
||||||
|
if ! [ -e "${systemd_unit_file_path}" ]; then
|
||||||
|
write_unit_file
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
write_unit_file_unless_exists
|
||||||
enable_tmux_unit_on_boot
|
enable_tmux_unit_on_boot
|
||||||
}
|
}
|
||||||
main
|
main
|
||||||
|
Loading…
Reference in New Issue
Block a user