Commit 9b90a3c6 authored by nextime's avatar nextime

Add systemd startup files to Debian packages

- Create systemd service files for wssshd and wssshc
- Add conditions to prevent conflicts with sysv init
- Update debian/rules to install systemd services
- Update postinst scripts to enable systemd services
- Ensure sysv init has precedence over systemd
parent 8faacbfb
......@@ -73,6 +73,13 @@ EOF
update-rc.d wssshd defaults >/dev/null 2>&1 || true
fi
# Enable systemd service if available and sysv init is not active
if [ -f /lib/systemd/system/wssshd.service ] && command -v systemctl >/dev/null 2>&1; then
if ! systemctl is-active wssshd >/dev/null 2>&1 && [ ! -f /var/run/wssshd-watchdog.pid ]; then
systemctl enable wssshd.service >/dev/null 2>&1 || true
fi
fi
# Set proper permissions on binary
if [ -f /usr/bin/wssshd ]; then
chown wssshd:wssshd /usr/bin/wssshd
......
......@@ -133,6 +133,10 @@ override_dh_auto_install:
# Install logrotate configuration
install -m 644 debian/wssshd.logrotate debian/wsssh-server/etc/logrotate.d/wssshd
# Install systemd service file
mkdir -p debian/wsssh-server/lib/systemd/system
install -m 644 debian/wssshd.service debian/wsssh-server/lib/systemd/system/
# Install web templates and static files
cp -r ../templates/* debian/wsssh-server/usr/share/wsssh/templates/
cp -r ../logos/* debian/wsssh-server/usr/share/wsssh/logos/
......
[Unit]
Description=WebSocket SSH Daemon
After=network.target syslog.target
Requires=network.target
ConditionPathExists=!/etc/init.d/wssshd
ConditionPathExists=!/var/run/wssshd-watchdog.pid
[Service]
Type=forking
User=wssshd
Group=wssshd
EnvironmentFile=-/etc/default/wssshd
ExecStart=/usr/sbin/wssshd-watchdog start
ExecStop=/usr/sbin/wssshd-watchdog stop
ExecReload=/usr/sbin/wssshd-watchdog restart
PIDFile=/var/run/wssshd-watchdog.pid
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
\ No newline at end of file
......@@ -72,6 +72,13 @@ EOF
if [ -x /etc/init.d/wssshc ]; then
update-rc.d wssshc defaults >/dev/null 2>&1 || true
fi
# Enable systemd service if available and sysv init is not active
if [ -f /lib/systemd/system/wssshc.service ] && command -v systemctl >/dev/null 2>&1; then
if ! systemctl is-active wssshc >/dev/null 2>&1 && [ ! -f /var/run/wssshc-watchdog.pid ]; then
systemctl enable wssshc.service >/dev/null 2>&1 || true
fi
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
......
......@@ -47,6 +47,10 @@ override_dh_auto_install:
# Install logrotate configuration
install -m 644 debian/wssshc.logrotate debian/wsssh-tools/etc/logrotate.d/wssshc
# Install systemd service file
mkdir -p debian/wsssh-tools/lib/systemd/system
install -m 644 debian/wssshc.service debian/wsssh-tools/lib/systemd/system/
# Install Python scripts
install -m 755 ../wssshc.py debian/wsssh-tools/usr/bin/
install -m 755 ../wssshd.py debian/wsssh-tools/usr/bin/
......
[Unit]
Description=WebSocket SSH Client
After=network.target syslog.target
Requires=network.target
ConditionPathExists=!/etc/init.d/wssshc
ConditionPathExists=!/var/run/wssshc-watchdog.pid
[Service]
Type=forking
User=wssshc
Group=wssshc
EnvironmentFile=-/etc/default/wssshc
ExecStart=/usr/sbin/wssshc-watchdog start
ExecStop=/usr/sbin/wssshc-watchdog stop
ExecReload=/usr/sbin/wssshc-watchdog restart
PIDFile=/var/run/wssshc-watchdog.pid
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment