install.fairie/home/dot_ssh/endlessh/run_onchange_after_endlessh.tmpl
Brian Zalewski e602f32170 Update 6 files
- /home/dot_ssh/fail2ban/run_onchanges_after_fail2ban.tmpl
- /home/dot_ssh/endlessh/run_onchanges_after_endlessh.tmpl
- /home/dot_ssh/system/run_onchanges_after_sshd.tmpl
- /home/dot_ssh/fail2ban/run_onchange_after_fail2ban.tmpl
- /home/dot_ssh/endlessh/run_onchange_after_endlessh.tmpl
- /home/dot_ssh/system/run_onchange_after_sshd.tmpl
2023-01-30 08:34:22 +00:00

31 lines
1.1 KiB
Cheetah

{{- if eq .host.distro.family "linux" }}
#!/usr/bin/env bash
# endlessh config hash: {{ include (joinPath .host.home ".ssh" "endlessh" "config") | sha256sum }}
{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}
### Update /etc/endlessh/config if environment is not WSL
if [[ ! "$(grep Microsoft /proc/version)" ]]; then
if command -v endlessh > /dev/null; then
if [ -d /etc/endlessh ]; then
logg info 'Copying ~/.ssh/endlessh/config to /etc/endlessh/config'
sudo cp -f "$HOME/.ssh/endlessh/config" /etc/endlessh/config
### Restart / enable Endlessh
logg info 'Enabling the `endlessh` service'
sudo systemctl enable endlessh
logg info 'Restarting the `endlessh` service'
sudo systemctl restart endlessh
else
logg warn 'The /etc/endlessh folder does not exist'
fi
else
logg info 'Skipping Endlessh configuration because the `endlessh` executable is not available in the PATH'
fi
else
logg info 'Skipping Endlessh configuration since environment is WSL'
fi
{{ end -}}