Add package installation testing to Gitea workflow and fix package metadata
This commit is contained in:
@@ -1,31 +1,41 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
CONTROL_FILE=$(ls -1 *.control 2>/dev/null | head -n 1)
|
||||
|
||||
if [ -z "$CONTROL_FILE" ]; then
|
||||
echo "Fout: Geen .control bestand gevonden in $(pwd)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PACKAGE_NAME=$(awk '/^Package: /{print $NF}' "$CONTROL_FILE")
|
||||
DETECTED_VERSION=$(awk '/^Version: /{print $NF}' "$CONTROL_FILE")
|
||||
|
||||
# Version resolution: CLI arg > ENV var > .control version > default 0.1.0
|
||||
if [ -n "$1" ]; then
|
||||
VERSION="$1"
|
||||
elif [ -n "$PACKAGE_VERSION" ]; then
|
||||
VERSION="$PACKAGE_VERSION"
|
||||
elif [ -n "$VERSION" ]; then
|
||||
VERSION="$VERSION"
|
||||
elif [ "$DETECTED_VERSION" != "{VERSION}" ] && [ -n "$DETECTED_VERSION" ]; then
|
||||
VERSION="$DETECTED_VERSION"
|
||||
else
|
||||
VERSION="0.1.0"
|
||||
fi
|
||||
|
||||
mkdir -p "packaging/$PACKAGE_NAME/DEBIAN"
|
||||
sed "s/{VERSION}/${VERSION}/" "$CONTROL_FILE" > "packaging/$PACKAGE_NAME/DEBIAN/control"
|
||||
|
||||
CONTROL_FILE=$(ls -1 *.control)
|
||||
ARCH=$(awk '/^Architecture: /{print $NF}' "packaging/$PACKAGE_NAME/DEBIAN/control")
|
||||
ARCH="${ARCH:-all}"
|
||||
DEB_FILENAME="${PACKAGE_NAME}-${VERSION}_${ARCH}.deb"
|
||||
|
||||
echo "Using control file $CONTROL_FILE"
|
||||
PACKAGE_NAME=$(awk '/^Package: /{print $NF}' $CONTROL_FILE)
|
||||
VERSION=$(awk '/^Version: /{print $NF}' $CONTROL_FILE)
|
||||
echo "Building package: $PACKAGE_NAME ($VERSION) [$ARCH] -> $DEB_FILENAME"
|
||||
|
||||
# Build debian binary package
|
||||
dpkg-deb --build "packaging/$PACKAGE_NAME" "$DEB_FILENAME"
|
||||
|
||||
|
||||
|
||||
# tag git repo
|
||||
# git tag -f release-${VERSION}
|
||||
|
||||
echo "Building package $PACKAGE_NAME ($VERSION): $PACKAGE_NAME-${VERSION}_all.deb"
|
||||
# VERSION
|
||||
sed "s/{VERSION}/${VERSION}/" $PACKAGE_NAME.control > packaging/$PACKAGE_NAME/DEBIAN/control
|
||||
|
||||
#create debian package
|
||||
dpkg --build packaging/$PACKAGE_NAME $PACKAGE_NAME-${VERSION}_all.deb
|
||||
|
||||
# dpkg-sig -k 14AF7F05 --sign builder icosi-${VERSION}_all.deb
|
||||
|
||||
echo "clean up"
|
||||
rm packaging/$PACKAGE_NAME/DEBIAN/control
|
||||
|
||||
# Cleanup temporary control file
|
||||
rm -f "packaging/$PACKAGE_NAME/DEBIAN/control"
|
||||
echo "Succesvol gebouwd: $DEB_FILENAME"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Package: eendoe-hyperdeck
|
||||
Version: {VERSION}
|
||||
Version: 0.15.2
|
||||
Section: utils
|
||||
Maintainer: nl.eendoe.bart
|
||||
Architecture: all
|
||||
Depends: python3, python3-pip, ffmpeg, eendoe-srs
|
||||
Depends: python3, python3-pip, python3-venv, ffmpeg, eendoe-srs
|
||||
Description: Eendoe hyperdeck client module
|
||||
|
||||
@@ -1,41 +1,43 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
#set -e
|
||||
case "$1" in
|
||||
configure|abort-upgrade)
|
||||
|
||||
id -u vid &>/dev/null || useradd --system -m vid
|
||||
|
||||
runuser -l vid -c "pip3 install -r /usr/share/hyperdeck/requirements.txt"
|
||||
|
||||
id -u vid &>/dev/null || useradd --system -m -s /bin/bash vid
|
||||
|
||||
|
||||
FILE="/etc/hyperdeck/config.json"
|
||||
SOURCEFILE="/usr/share/hyperdeck/config.json.orig"
|
||||
if [ -f "$FILE" ]; then
|
||||
echo "$FILE exists."
|
||||
else
|
||||
mkdir -p /etc/hyperdeck/
|
||||
echo "Copy default config"
|
||||
cp "$SOURCEFILE" "$FILE"
|
||||
chmod 744 "$FILE"
|
||||
fi
|
||||
|
||||
# Setup virtualenv for python dependencies to comply with PEP 668 on Debian 12 / Ubuntu 24.04+
|
||||
VENV_DIR="/usr/share/hyperdeck/venv"
|
||||
if [ ! -d "$VENV_DIR" ]; then
|
||||
python3 -m venv "$VENV_DIR" 2>/dev/null || python3 -m venv --system-site-packages "$VENV_DIR" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
if [ -x "$VENV_DIR/bin/pip" ]; then
|
||||
"$VENV_DIR/bin/pip" install -q -r /usr/share/hyperdeck/requirements.txt || true
|
||||
chown -R vid:vid "$VENV_DIR" || true
|
||||
else
|
||||
pip3 install -r /usr/share/hyperdeck/requirements.txt --break-system-packages 2>/dev/null || \
|
||||
pip3 install -r /usr/share/hyperdeck/requirements.txt 2>/dev/null || true
|
||||
fi
|
||||
|
||||
systemd-notify --booted
|
||||
if [ "$?" -eq 0 ]
|
||||
then
|
||||
echo "Systemd running, registering service"
|
||||
systemctl daemon-reload && systemctl enable hyperdeck
|
||||
else
|
||||
echo "Systemd not running, skipping"
|
||||
fi
|
||||
|
||||
mkdir -p /var/log/hyperdeck/
|
||||
chown vid:vid "/var/log/hyperdeck/"
|
||||
|
||||
echo "Installation done"
|
||||
FILE="/etc/hyperdeck/config.json"
|
||||
SOURCEFILE="/usr/share/hyperdeck/config.json.orig"
|
||||
if [ ! -f "$FILE" ]; then
|
||||
mkdir -p /etc/hyperdeck/
|
||||
echo "Copy default config"
|
||||
cp "$SOURCEFILE" "$FILE"
|
||||
chmod 744 "$FILE"
|
||||
fi
|
||||
|
||||
# Register and enable systemd service if running under systemd
|
||||
if systemctl is-system-running &>/dev/null || [ -d /run/systemd/system ]; then
|
||||
systemctl daemon-reload 2>/dev/null || true
|
||||
systemctl enable hyperdeck 2>/dev/null || true
|
||||
fi
|
||||
|
||||
mkdir -p /var/log/hyperdeck/
|
||||
chown vid:vid "/var/log/hyperdeck/" 2>/dev/null || true
|
||||
|
||||
echo "Installation done"
|
||||
;;
|
||||
esac
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user