summaryrefslogtreecommitdiff
path: root/osi-mk.d/systemd-lukeshu-debug.sh
blob: f7556098e3d0f0aa6a44a4a1c8c8de90e921df62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/hint/bash -euE
# Copyright (C) 2018  Luke Shumaker
# SPDX-License-Identifier: AGPL-3.0-or-later

packages+=(
	socat
)

post_install+=(10:lukeshu-debug:post_install)
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
}