From 3b3a5c205acd9f53e3dc7d56561045dbf5b67986 Mon Sep 17 00:00:00 2001 From: Yasen Pramatarov Date: Tue, 9 Jul 2024 13:51:03 +0300 Subject: [PATCH] Initial deb packaging --- packaging/build-deb | 31 ++++++++++ packaging/deb-README.debian | 7 +++ packaging/deb-config | 10 ++++ packaging/deb-control | 12 ++++ packaging/deb-postinst | 114 ++++++++++++++++++++++++++++++++++++ packaging/deb-templates | 9 +++ packaging/man-jilo-web.8 | 23 ++++++++ 7 files changed, 206 insertions(+) create mode 100755 packaging/build-deb create mode 100644 packaging/deb-README.debian create mode 100755 packaging/deb-config create mode 100644 packaging/deb-control create mode 100644 packaging/deb-postinst create mode 100644 packaging/deb-templates create mode 100644 packaging/man-jilo-web.8 diff --git a/packaging/build-deb b/packaging/build-deb new file mode 100755 index 0000000..e5739e9 --- /dev/null +++ b/packaging/build-deb @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +VERSION=$1 + +mkdir -p deb-package +cd deb-package + +mkdir -p "jilo-web-$VERSION/DEBIAN" +cp ../deb-control "jilo-web-$VERSION/DEBIAN/control" +cp ../deb-postinst "jilo-web-$VERSION/DEBIAN/postinst" +cp ../deb-templates "jilo-web-$VERSION/DEBIAN/templates" + +mkdir -p "jilo-web-$VERSION/etc/jilo-web" +cp ../../jilo-web.conf.php "jilo-web-$VERSION/etc/jilo-web/jilo-web.conf.php" +cp ../../jilo-web.schema "jilo-web-$VERSION/etc/jilo-web/jilo-web.schema" + +mkdir -p "jilo-web-$VERSION/usr/share/jilo-web" +cp -r ../../public_html "jilo-web-$VERSION/usr/share/jilo-web" + +mkdir -p "jilo-web-$VERSION/usr/share/doc/jilo-web" +cp ../../CHANGELOG.md "jilo-web-$VERSION/usr/share/doc/jilo-web/" +cp ../../LICENSE "jilo-web-$VERSION/usr/share/doc/jilo-web/" +cp ../../README.md "jilo-web-$VERSION/usr/share/doc/jilo-web/" +cp ../../TODO.md "jilo-web-$VERSION/usr/share/doc/jilo-web/" + +mkdir -p "jilo-web-$VERSION/usr/share/man/man8" +cp ../man-jilo-web.8 "jilo-web-$VERSION/usr/share/man/man8/jilo-web.8" + +dpkg-deb --build "jilo-web-$VERSION" + +rm -rf "jilo-web-$VERSION/" diff --git a/packaging/deb-README.debian b/packaging/deb-README.debian new file mode 100644 index 0000000..3d94ec5 --- /dev/null +++ b/packaging/deb-README.debian @@ -0,0 +1,7 @@ +Jilo-Web for Debian +------------------- + +This is a PHP frontend to Jilo (JItsi Logs Observer). It needs access to +the database, generated by the 'jilo' program. + + -- Yasen Pramatarov Tue, 9 Jul 2024 19:02:00 +0300 diff --git a/packaging/deb-config b/packaging/deb-config new file mode 100755 index 0000000..8387da6 --- /dev/null +++ b/packaging/deb-config @@ -0,0 +1,10 @@ +#!/bin/sh +set -e + +. /usr/share/debconf/confmodule + +db_input medium jilo-web/domain || true +db_input medium jilo-web/folder || true +db_go + +exit 0 diff --git a/packaging/deb-control b/packaging/deb-control new file mode 100644 index 0000000..b0d23a0 --- /dev/null +++ b/packaging/deb-control @@ -0,0 +1,12 @@ +Package: jilo-web +Version: 0.1 +Section: web +Priority: optional +Architecture: all +Maintainer: Yasen Pramatarov +Description: Jitsi logs web observer + PHP web interface to Jilo (JItsi Logs Observer) + To use this you need a webserver with php and sqlite support, and you need a database previously + generated by 'jilo' +Homepage: https://lindeas.com/jilo +Depends: nginx|apache2, php, php-db, php-sqlite3, debconf (>=0.5) | debconf-2.0 diff --git a/packaging/deb-postinst b/packaging/deb-postinst new file mode 100644 index 0000000..56058bb --- /dev/null +++ b/packaging/deb-postinst @@ -0,0 +1,114 @@ +#!/bin/bash +# postinst script for jilo-web +# +# see: dh_installdeb(1) + +set -e + +case "$1" in + configure) + + # loading debconf + . /usr/share/debconf/confmodule + + # get the domain and web folder + db_get jilo-web/domain + if [ -z "$RET" ] ; then + db_get jilo-web/domain "localhost" + db_input critical jilo-web/domain || true + db_go + db_get jilo-web/domain + fi + DOMAIN=$(echo "$RET" | xargs echo -n) + +# FIXME use this for subfolder install, if given + db_get jilo-web/folder + WEB_DIR="$RET" + + INSTALL_DIR="/usr/share/jilo-web" + + # store the info for later reconfiguration + db_set jilo-web/domain $DOMAIN + db_set jilo-web/folder $WEB_DIR + + # we need a webserver, check for Apache and Nginx + WEB_SERVER="" + if dpkg-query -W -f='${status}' apache2 2>/dev/null | grep -q "ok installed"; then + WEB_SERVER="apache2" + elif + WEB_SERVER="nginx" + else + echo "Nginx or Apache is needed, please install one of them first." + exit 1 + fi + + # finish configuration depending on web server + if [ "$WEB_SERVER" = "apache2" ]; then + + # vhost file + VHOST_APACHE="/etc/apache2/sites-available/jilo-web.conf" + cat < "$VHOST_APACHE" + + ServerName $DOMAIN + DocumentRoot $INSTALL_DIR + + CustomLog \${APACHE_LOG_DIR}/jilo-web_access.log combined + ErrorLog \${APACHE_LOG_DIR}/jilo-web_error.log + +EOF + + # enable vhost and reload + a2ensite jilo-web.conf + /etc/init.d/apache2 reload + + elif [ "$WEB_SERVER" = "nginx" ]; then + + # vhost file + VHOST_NGINX="/etc/nginx/sites-available/jilo-web" + cat < "$VHOST_NGINX" +server { + listen 80; + server_name $DOMAIN; + + root $INSTALL_DIR; + index index.php; + + location / { + try_files \$uri \$uri/ /index.php?\$args; + } + + location ~ /\.ht { + deny all; + } +} +EOF + + # enable vhost and reload + ln -s /etc/nginx/sites-available/jilo-web /etc/nginx/sites-enabled/ + /etc/init.d/nginx reload + + fi + + # permissions for web folder + chown -R www-data:www-data "$INSTALL_DIR" + chmod -R ug+rw "$INSTALL_DIR" + + # stopping debconf + db_stop + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/packaging/deb-templates b/packaging/deb-templates new file mode 100644 index 0000000..1f314a4 --- /dev/null +++ b/packaging/deb-templates @@ -0,0 +1,9 @@ +Template: jilo-web/domain +Type: string +Default: localhost +Description: Please enter the domain name for the Jilo-web app. + +Template: jilo-web/folder +Type: string +Default: jilo-web +Description: Please enter the web folder for Jilo-web. diff --git a/packaging/man-jilo-web.8 b/packaging/man-jilo-web.8 new file mode 100644 index 0000000..955bf93 --- /dev/null +++ b/packaging/man-jilo-web.8 @@ -0,0 +1,23 @@ +.TH JILO-WEB "8" "July 2024" "jilo-web 0.1" +.SH NAME +jilo-web \- PHP frontent to jilo (jitsi logs observer) database. +.SH DESCRIPTION +.B jilo-web +is a PHP app for searching through a jilo database. + +You need a jilo database to have this package working. You can create the jilo database with the program 'jilo'. + +.SH CONFIGURATION +The configuration file is /etc/jilo-web/jilo-web.conf.php. + +.SH AUTHOR +Written and maintained by Yasen Pramatarov + +.SH HOMEPAGE +https://lindeas.com/jilo + +.SH VERSION +0.1 + +.SH SEE ALSO +jilo(8), jilo-cli(8)