Commit 08dcabb0 authored by Johannes Barthel's avatar Johannes Barthel
Browse files

debian packaging

parent aaafe135
\ No newline at end of file
#!/bin/bash -xe
# go to directory of this script
cd "$(dirname "$0")"
# determine variables
PKG_VERSION=$(git rev-list --count "$(git rev-parse HEAD)")
# cleanup if build exists
[ -e "${BUILD_DIR}" ] && echo "removing previous build dir" && rm -rf "$BUILD_DIR"
[ -e "${BUILD_DIR}.deb" ] && echo "removing previously built package" && rm "${BUILD_DIR}.deb"
# copy files to build dir
mkdir -p "./${BUILD_DIR}/opt/${PKG_NAME}"
mkdir -p "./${BUILD_DIR}/lib/systemd/system"
cp "./${BUILD_DIR}/opt/${PKG_NAME}/"
cp senfsip-moderated-mute.service "./${BUILD_DIR}/lib/systemd/system/"
# create bundled python venv
python3 -m venv "./${BUILD_DIR}/opt/${PKG_NAME}/venv"
( # use subshell for installing stuff into venv
source "./${BUILD_DIR}/opt/${PKG_NAME}/venv/bin/activate"
xargs -L 1 pip install < requirements.txt # hack because greenswitch needs wheel but doesn't specify it as a dependency, so the install order needs to be kept this way
# metadata, systemd service
mkdir -p "${BUILD_DIR}/DEBIAN"
cat > "${BUILD_DIR}/DEBIAN/postinst" <<EOL
#!/bin/bash -xe
chmod +x /opt/senfsip-moderated-mute/
systemctl daemon-reload
systemctl enable senfsip-moderated-mute.service
systemctl start senfsip-moderated-mute.service
cat > "${BUILD_DIR}/DEBIAN/prerm" <<EOL
systemctl disable senfsip-moderated-mute.service
systemctl stop senfsip-moderated-mute.service
cat > "${BUILD_DIR}/DEBIAN/postrm" <<EOL
systemctl daemon-reload
chmod +x "${BUILD_DIR}"/DEBIAN/*
cat > "${BUILD_DIR}/DEBIAN/control" <<EOL
Package: $PKG_NAME
Version: $PKG_VERSION-1
Section: httpd
Priority: optional
Architecture: $(dpkg --print-architecture)
Maintainer: Johannes Barthel <>
Description: enforce room microphone permissions for dial-in bbb users
Depends: bbb-freeswitch-core
fakeroot dpkg-deb --build "${BUILD_DIR}"
\ No newline at end of file
File mode changed from 100644 to 100755
Supports Markdown
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