diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3b8ed2a..322fc39 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,8 +2,8 @@ name: release on: push: - tags: - - 'v*.*.*' + branch: + - 'issue_10_debian_packaging' jobs: build: @@ -11,50 +11,20 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - - - name: Create package structure - run: | - mkdir -p .debpkg/usr/bin .rpmpkg/usr/bin - cp -p screen-* .debpkg/usr/bin/ - cp -p screen-* .rpmpkg/usr/bin/ - name: Create DEB package - uses: jiro4989/build-deb-action@v3 + uses: jtdor/build-deb-action@v1 + env: + DEB_BUILD_OPTIONS: noautodbgsym with: - package: screen-save - package_root: .debpkg - maintainer: Simon Walz - version: ${{ github.ref }} # refs/tags/v*.*.* - arch: 'all' - depends: 'screen' - desc: 'A tool to make screen sessions persistent = survive system reboots.' - homepage: 'https://github.com/simonwalz/screen-save' - - name: Create RPM package - uses: jiro4989/build-rpm-action@v2 - with: - summary: 'A tool to make screen sessions persistent = survive system reboots.' - package: screen-save - package_root: .rpmpkg - maintainer: Simon Walz - version: ${{ github.ref }} # refs/tags/v*.*.* - arch: 'x86_64' - desc: 'A tool to make screen sessions persistent = survive system reboots.' - + buildpackage-opts: --build=binary --no-sign - name: Upload DEB package uses: actions/upload-artifact@v4 with: - name: artifact-deb - path: | - ./*.deb - - name: Upload RPM package - uses: actions/upload-artifact@v4 - with: - name: artifact-rpm - path: | - ./*.rpm - !./*-debuginfo-*.rpm + path: debian/artifacts/ + name: debian_package - name: Remove debuginfo file run: | - rm *-debuginfo-*.rpm + rm *-debuginfo-*.rpm || true - name: Release package files uses: softprops/action-gh-release@v2 with: diff --git a/.gitignore b/.gitignore index 1377554..64e9518 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,8 @@ *.swp +debian/.debhelper/ +debian/*.debhelper +debian/debhelper-build-stamp +debian/files +debian/*.log +debian/*.substvars +debian/screen-save/ diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..e5517f4 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +screen-save (1.2.6) UNRELEASED; urgency=medium + + * Last version provided from github + + -- Simon Walz Sat, 20 Jul 2024 12:25:00 +0200 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..48082f7 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +12 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..f0e4855 --- /dev/null +++ b/debian/control @@ -0,0 +1,17 @@ +Source: screen-save +Section: admin +Priority: optional +Maintainer: Simon Walz +Build-Depends: debhelper (>= 8) +Standards-Version: 3.9.8 + +Package: screen-save +Priority: optional +Section: admin +Architecture: all +Depends: screen +Description: A tool to make screen sessions persistent = survive system reboot. + . + This package is an optional module to complete screen feature + . + More information at https://github.com/simonwalz/screen-save diff --git a/debian/copyright b/debian/copyright new file mode 120000 index 0000000..ea5b606 --- /dev/null +++ b/debian/copyright @@ -0,0 +1 @@ +../LICENSE \ No newline at end of file diff --git a/debian/cron.d b/debian/cron.d new file mode 100644 index 0000000..41804a8 --- /dev/null +++ b/debian/cron.d @@ -0,0 +1,3 @@ +##Save and autostart all screen sesssion +@reboot root if [ -x /usr/bin/screen-auto-start ]; then /usr/bin/screen-auto-start; fi +*/5 * * * * root if [ -x /usr/bin/screen-save-all-sessions ]; then /usr/bin/screen-save-all-sessions -d; fi diff --git a/debian/install b/debian/install new file mode 100644 index 0000000..d3ae129 --- /dev/null +++ b/debian/install @@ -0,0 +1,3 @@ +./screen-auto-start /usr/bin/ +./screen-save /usr/bin/ +./screen-save-all-sessions /usr/bin/ \ No newline at end of file diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..1fe14a0 --- /dev/null +++ b/debian/rules @@ -0,0 +1,13 @@ +#!/usr/bin/make -f +#export DH_VERBOSE = 1 + + +override_dh_installsystemduser: + dh_installsystemduser --name=screen-save-autostart + +override_dh_installsystemd: + dh_installsystemd --name=screen-save-all + dh_installsystemd --name=screen-save-all-shutdown + +%: + dh $@ diff --git a/debian/screen-save.screen-save-all-shutdown.service b/debian/screen-save.screen-save-all-shutdown.service new file mode 100644 index 0000000..d0a0262 --- /dev/null +++ b/debian/screen-save.screen-save-all-shutdown.service @@ -0,0 +1,14 @@ +[Unit] +Description=Save all screen session on shutdown event +DefaultDependencies=no +Before=shutdown.target + +[Service] +Type=oneshot +ExecStart=/usr/bin/screen-save-all-sessions -d +User=root +TimeoutStartSec=0 + + +[Install] +WantedBy=shutdown.target \ No newline at end of file diff --git a/debian/screen-save.screen-save-all.service b/debian/screen-save.screen-save-all.service new file mode 100644 index 0000000..c43c41d --- /dev/null +++ b/debian/screen-save.screen-save-all.service @@ -0,0 +1,7 @@ +[Unit] +Description=Save all screen session + +[Service] +Type=oneshot +ExecStart=/usr/bin/screen-save-all-sessions +User=root diff --git a/debian/screen-save.screen-save-all.timer b/debian/screen-save.screen-save-all.timer new file mode 100644 index 0000000..4d255aa --- /dev/null +++ b/debian/screen-save.screen-save-all.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Save all 5' minutes all screen session + +[Timer] +OnCalendar=*:0/15 +OnStartupSec=15min + +[Install] +WantedBy=timers.target diff --git a/debian/screen-save.screen-save-autostart.user.service b/debian/screen-save.screen-save-autostart.user.service new file mode 100644 index 0000000..9a408ff --- /dev/null +++ b/debian/screen-save.screen-save-autostart.user.service @@ -0,0 +1,8 @@ +[Unit] +Description=Auto start all saved screen session + +[Service] +ExecStart=/usr/bin/screen-auto-start + +[Install] +WantedBy=default.target \ No newline at end of file diff --git a/screen-save-all-sessions b/screen-save-all-sessions index 1e1223c..7a29680 100755 --- a/screen-save-all-sessions +++ b/screen-save-all-sessions @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # save all my screen sessions # Simon Walz, 2018 @@ -6,6 +6,7 @@ SCRIPTPATH="$(readlink -f 2>/dev/null || perl -MCwd -e 'print Cwd::abs_path shif SCRIPTDIR="$(dirname "${SCRIPTPATH}")" set -e +shopt -s nullglob savedir="$1" @@ -16,23 +17,30 @@ then echo " savedir - save to directory" >&2 exit 2 fi -if test "$savedir" = "-d" -then - savedir="$HOME/.screen-save/$(date +%Y-%m-%d)/" -fi - -if test "$savedir" != "" -then - savedir="${savedir}/" - mkdir -p "${savedir}" -fi -SCREEN_PID=$(screen -ls | \ - grep -oE "^\s+[0-9]+\." | \ - grep -oE "[0-9]+") +screen_sockets=(/var/run/screen/S-*/*); -for i in ${SCREEN_PID} +for screen_info in "${screen_sockets[@]#*S-}"; do - "${SCRIPTDIR}/screen-save" "$i" "$savedir"