diff --git a/debian/changelog b/debian/changelog index 6d3a937..f08654f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -keyboard-hook (0.1.0-1) UNRELEASED; urgency=medium +keyboard-hook (0.1.0-1) experimental; urgency=medium * Initial release (Closes: #nnnn) diff --git a/debian/conffiles b/debian/conffiles new file mode 100644 index 0000000..e69de29 diff --git a/debian/debhelper-build-stamp b/debian/debhelper-build-stamp new file mode 100644 index 0000000..b6851e4 --- /dev/null +++ b/debian/debhelper-build-stamp @@ -0,0 +1 @@ +keyboard-hook diff --git a/debian/files b/debian/files new file mode 100644 index 0000000..303af09 --- /dev/null +++ b/debian/files @@ -0,0 +1,2 @@ +keyboard-hook_0.1.0-1_arm64.buildinfo unknown optional +keyboard-hook_0.1.0-1_arm64.deb unknown optional diff --git a/debian/install b/debian/install index 30dc56c..7d7c33e 100644 --- a/debian/install +++ b/debian/install @@ -1,2 +1 @@ usr/bin/* usr/bin/ -etc/init.d/* etc/init.d/ diff --git a/debian/keyboard-hook-server.service b/debian/keyboard-hook-server.service new file mode 100644 index 0000000..102b1fd --- /dev/null +++ b/debian/keyboard-hook-server.service @@ -0,0 +1,16 @@ +[Unit] +Description=keyboard-hook +After=network-online.target +Wants=network-online.target systemd-networkd-wait-online.service + +StartLimitIntervalSec=500 +StartLimitBurst=5 + +[Service] +Restart=on-failure +RestartSec=5s + +ExecStart=/usr/bin/python /usr/bin/server.py + +[Install] +WantedBy=multi-user.target diff --git a/debian/keyboard-hook.debhelper.log b/debian/keyboard-hook.debhelper.log new file mode 100644 index 0000000..836d43e --- /dev/null +++ b/debian/keyboard-hook.debhelper.log @@ -0,0 +1,2 @@ +dh_installsystemd +dh_installsystemd diff --git a/debian/keyboard-hook.postrm.debhelper b/debian/keyboard-hook.postrm.debhelper new file mode 100644 index 0000000..b60756b --- /dev/null +++ b/debian/keyboard-hook.postrm.debhelper @@ -0,0 +1,38 @@ +# Automatically added by dh_installsystemd/13.3.4 +if [ -d /run/systemd/system ] && [ "$1" = remove ]; then + systemctl --system daemon-reload >/dev/null || true +fi +# End automatically added section +# Automatically added by dh_installsystemd/13.3.4 +if [ "$1" = "remove" ]; then + if [ -x "/usr/bin/deb-systemd-helper" ]; then + deb-systemd-helper mask 'keyboard-hook-server.service' >/dev/null || true + fi +fi + +if [ "$1" = "purge" ]; then + if [ -x "/usr/bin/deb-systemd-helper" ]; then + deb-systemd-helper purge 'keyboard-hook-server.service' >/dev/null || true + deb-systemd-helper unmask 'keyboard-hook-server.service' >/dev/null || true + fi +fi +# End automatically added section +# Automatically added by dh_installsystemd/13.3.4 +if [ -d /run/systemd/system ] && [ "$1" = remove ]; then + systemctl --system daemon-reload >/dev/null || true +fi +# End automatically added section +# Automatically added by dh_installsystemd/13.3.4 +if [ "$1" = "remove" ]; then + if [ -x "/usr/bin/deb-systemd-helper" ]; then + deb-systemd-helper mask 'keyboard-hook.service' >/dev/null || true + fi +fi + +if [ "$1" = "purge" ]; then + if [ -x "/usr/bin/deb-systemd-helper" ]; then + deb-systemd-helper purge 'keyboard-hook.service' >/dev/null || true + deb-systemd-helper unmask 'keyboard-hook.service' >/dev/null || true + fi +fi +# End automatically added section diff --git a/debian/keyboard-hook.service b/debian/keyboard-hook.service index 102b1fd..f6bec4a 100644 --- a/debian/keyboard-hook.service +++ b/debian/keyboard-hook.service @@ -7,10 +7,8 @@ StartLimitIntervalSec=500 StartLimitBurst=5 [Service] -Restart=on-failure -RestartSec=5s - -ExecStart=/usr/bin/python /usr/bin/server.py +Type=oneshot +ExecStart=/bin/bash /usr/bin/keyboard-hook.sh [Install] WantedBy=multi-user.target diff --git a/debian/keyboard-hook.substvars b/debian/keyboard-hook.substvars new file mode 100644 index 0000000..978fc8b --- /dev/null +++ b/debian/keyboard-hook.substvars @@ -0,0 +1,2 @@ +misc:Depends= +misc:Pre-Depends= diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..d023f0e --- /dev/null +++ b/debian/postinst @@ -0,0 +1,32 @@ +#!/bin/sh +set -e +# Automatically added by dh_installsystemd/13.3.4 +if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then + # This will only remove masks created by d-s-h on package removal. + deb-systemd-helper unmask 'keyboard-hook.service' >/dev/null || true + + # was-enabled defaults to true, so new installations run enable. + if deb-systemd-helper --quiet was-enabled 'keyboard-hook.service'; then + # Enables the unit on first installation, creates new + # symlinks on upgrades if the unit file has changed. + deb-systemd-helper enable 'keyboard-hook.service' >/dev/null || true + else + # Update the statefile to add new symlinks (if any), which need to be + # cleaned up on purge. Also remove old symlinks. + deb-systemd-helper update-state 'keyboard-hook.service' >/dev/null || true + fi +fi +# End automatically added section +# Automatically added by dh_installsystemd/13.3.4 +if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then + if [ -d /run/systemd/system ]; then + systemctl --system daemon-reload >/dev/null || true + if [ -n "$2" ]; then + _dh_action=restart + else + _dh_action=start + fi + deb-systemd-invoke $_dh_action 'keyboard-hook.service' >/dev/null || true + fi +fi +# End automatically added section diff --git a/debian/postinstall b/debian/postinstall deleted file mode 100644 index f7fb692..0000000 --- a/debian/postinstall +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -ln -s /etc/init.d/bootstrapping.sh ../rc3.d/S99bootstrapping -systemd daemon-load -systemd enable keyboard-hook.service diff --git a/debian/rules b/debian/rules index 5d846df..db9b426 100755 --- a/debian/rules +++ b/debian/rules @@ -22,3 +22,11 @@ #override_dh_auto_configure: # dh_auto_configure -- \ # -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) +override_dh_auto_install: + dh_auto_install + dh_systemd_enable || true + dh_systemd_start || true + +override_dh_installsystemd: + dh_installsystemd --name=keyboard-hook + dh_installsystemd --name=keyboard-hook-server diff --git a/debian/source/format b/debian/source/format index 163aaf8..89ae9db 100644 --- a/debian/source/format +++ b/debian/source/format @@ -1 +1 @@ -3.0 (quilt) +3.0 (native) diff --git a/usr/bin/easywifi-root.py b/usr/bin/easywifi-root.py old mode 100644 new mode 100755 diff --git a/etc/init.d/bootstrapping.sh b/usr/bin/keyboard-hook.sh old mode 100644 new mode 100755 similarity index 91% rename from etc/init.d/bootstrapping.sh rename to usr/bin/keyboard-hook.sh index a2dedfe..ef0f3a8 --- a/etc/init.d/bootstrapping.sh +++ b/usr/bin/keyboard-hook.sh @@ -1,5 +1,11 @@ #!/bin/bash - +### BEGIN INIT INFO +# Provides : keyboard-hook +# Required-Start : $all +# Required-Stop : +# Default-Start : 99 +# Default-Stop : +### END INIT INFO sleep 5 if [[ ! -f "~/debugwifi.log" ]];then touch ~/debugwifi.log diff --git a/usr/bin/server.py b/usr/bin/server.py old mode 100644 new mode 100755