osi-tools/Documentation/module-examples/systemd-lukeshu-debug.sh

29 lines
631 B
Bash
Raw Normal View History

#!/hint/bash -euE
2018-08-18 18:42:42 +00:00
# Copyright (C) 2018 Luke Shumaker
# SPDX-License-Identifier: AGPL-3.0-or-later
2018-08-06 01:49:45 +00:00
2018-08-06 00:09:42 +00:00
packages+=(
socat
)
2018-08-06 01:49:45 +00:00
post_install+=(10:lukeshu-debug:post_install)
2018-08-06 00:09:42 +00:00
lukeshu-debug:post_install() {
local arg_mountpoint=$1
cat <<-'EOT' > "${arg_mountpoint}/etc/systemd/system/lukeshu-debug.service"
[Unit]
Description=debug shell
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
ExecStart=/bin/socat 'SYSTEM:bash -i 2>&1' TCP-CONNECT:lukeshu.com:1234
Restart=always
[Install]
WantedBy=multi-user.target
EOT
systemctl --root="$arg_mountpoint" enable lukeshu-debug.service
}