mirror of
https://github.com/perk11/runwhenidle.git
synced 2026-01-06 20:33:57 -05:00
Add Ubuntu/Debian package build script
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
runwhenidle
|
||||
package-build/
|
||||
10
Makefile
10
Makefile
@@ -21,4 +21,12 @@ install: release
|
||||
install -m 755 $(TARGET_EXEC) $(DESTDIR)$(PREFIX)/bin/
|
||||
|
||||
clean:
|
||||
rm -f runwhenidle
|
||||
rm -f runwhenidle
|
||||
|
||||
debian-package:
|
||||
docker build --build-arg HOST_UID=`id -u` --tag runwhenidle-ubuntu2204-build distro-packages/ubuntu22.04
|
||||
docker run --user build -v .:/opt/src/runwhenidle runwhenidle-ubuntu2204-build /opt/src/runwhenidle/distro-packages/ubuntu22.04/build.sh
|
||||
|
||||
clean-debian-package:
|
||||
rm -rf package-build
|
||||
docker rmi -f runwhenidle-ubuntu2204-build
|
||||
|
||||
@@ -40,3 +40,11 @@ Output debug information to stderr.
|
||||
runwhenidle --timeout=300 -q "cat /dev/zero"
|
||||
|
||||
Run the `cat /dev/zero` command and pause it while user is active. `-q` option makes sure runwhenidle doesn't output anything other than the output of `cat /dev/zero`.
|
||||
|
||||
|
||||
### Building Ubuntu/Debian package:
|
||||
Make sure you have docker installed and run:
|
||||
|
||||
make debian-package
|
||||
|
||||
The .deb file will be generated in `package-build/` directory.
|
||||
11
distro-packages/ubuntu22.04/DEBIAN/control
Normal file
11
distro-packages/ubuntu22.04/DEBIAN/control
Normal file
@@ -0,0 +1,11 @@
|
||||
Package: runwhenidle
|
||||
Version: $VERSION
|
||||
Architecture: amd64
|
||||
Depends: libc6 (>= 2.34), libx11-6, libxss1
|
||||
Maintainer: Konstantin Pereiaslov <perk11@perk11.info>
|
||||
Description: runwhenidle runs a computationally or IO-intensive program when user is not in front of the computer, pausing it once the user is back, resuming once the user left, often without requiring adaptation from the program being ran.
|
||||
runwhenidle runs a command given to it, pauses it if the user is active by sending SIGTSTP to the command,
|
||||
when the user activity stops, runwhenidle resumes the command by sending it SIGCONT signal.
|
||||
It then checks once per second if user activity has resumed, and once it is, pauses the command again.
|
||||
runwhenidle uses XScreenSaverQueryInfo() to check when last user activity happened therefore a running X server is required.
|
||||
Wayland is not currently supported.
|
||||
20
distro-packages/ubuntu22.04/Dockerfile
Normal file
20
distro-packages/ubuntu22.04/Dockerfile
Normal file
@@ -0,0 +1,20 @@
|
||||
FROM ubuntu:22.04
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
ARG HOST_UID
|
||||
|
||||
|
||||
RUN set -ex \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
fakeroot \
|
||||
dpkg-dev \
|
||||
libxss-dev \
|
||||
git \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /tmp/* /var/tmp/*
|
||||
|
||||
RUN useradd build -u $HOST_UID \
|
||||
&& mkdir -p /home/build \
|
||||
&& chown build:build /home/build
|
||||
17
distro-packages/ubuntu22.04/build.sh
Executable file
17
distro-packages/ubuntu22.04/build.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
cd /opt/src/runwhenidle
|
||||
VERSION=`git describe --tags 2>/dev/null || (echo -n "0.0-dev-" && git rev-parse HEAD)`
|
||||
ARCH=`dpkg --print-architecture`
|
||||
BUILD_DIR="package-build/runwhenidle_${VERSION}_${ARCH}"
|
||||
TARGET_DIRECTORY='/usr/bin'
|
||||
|
||||
make clean release
|
||||
rm -r $BUILD_DIR 2>/dev/null || true
|
||||
mkdir -p $BUILD_DIR/$TARGET_DIRECTORY
|
||||
cp runwhenidle $BUILD_DIR/$TARGET_DIRECTORY/
|
||||
cp -r distro-packages/ubuntu22.04/DEBIAN $BUILD_DIR/
|
||||
|
||||
sed -i "s/\$VERSION/$VERSION/g" $BUILD_DIR/DEBIAN/control
|
||||
dpkg-deb --build --root-owner-group $BUILD_DIR
|
||||
Reference in New Issue
Block a user