diff --git a/etc/ubuntu/config.mk.in b/etc/ubuntu/config.mk.in new file mode 100644 index 0000000..07ef7bf --- /dev/null +++ b/etc/ubuntu/config.mk.in @@ -0,0 +1,28 @@ +#(@)config.mk for Ubuntu 25.10 (x86_64, aarch64, armhf) + +INSTALLDIR = /usr/ +CONFIGFILE = /etc/default/ot-recorder +FREEBSD ?= no + +WITH_MQTT ?= yes +WITH_HTTP ?= yes +WITH_TOURS ?= yes +WITH_LUA ?= yes +WITH_PING ?= yes +WITH_KILL ?= yes +WITH_ENCRYPT ?= yes +WITH_TZ ?= yes + +STORAGEDEFAULT = /var/spool/owntracks/recorder/store +DOCROOT = /usr/share/owntracks/recorder/htdocs +TZDATADB = /usr/share/owntracks/recorder/timezone16.bin +GHASHPREC = 7 +JSON_INDENT ?= no +MOSQUITTO_CFLAGS = +MOSQUITTO_LIBS = -lmosquitto +LUA_CFLAGS = `pkg-config --cflags lua` +LUA_LIBS = `pkg-config --libs lua` +SODIUM_CFLAGS = `pkg-config --cflags libsodium` +SODIUM_LIBS = `pkg-config --libs libsodium` + +GEOCODE_TIMEOUT = 4000 diff --git a/etc/ubuntu/fpm-make.sh b/etc/ubuntu/fpm-make.sh new file mode 100755 index 0000000..aadd015 --- /dev/null +++ b/etc/ubuntu/fpm-make.sh @@ -0,0 +1,54 @@ +#!/bin/sh + +set -e + +tempdir=$(mktemp -d /tmp/ot-XXX) + +make install DESTDIR=$tempdir + +install -D -m644 README.md $tempdir/usr/share/doc/ot-recorder/README.md +install -D -m644 etc/ot-recorder.service $tempdir/etc/systemd/system/ot-recorder.service + +name="ot-recorder" +version="$(awk 'NR==1 {print $NF;}' version.h | sed -e 's/"//g' )-0-deb" +arch=$(uname -m) + +case $arch in + armv7l) arch=armhf;; +esac + +debfile="${name}_${version}_${arch}.deb" + +rm -f "${debfile}" + +libcurl='libcurl4t64' +libsodium='libsodium23' +liblua='liblua5.4-0' +libconfig='libconfig11' + +fpm -s dir \ + -t deb \ + -n ${name} \ + -v ${version} \ + --vendor "OwnTracks.org" \ + -a "${arch}" \ + --maintainer 'jpmens@gmail.com' \ + --deb-no-default-config-files \ + --description "A lightweight back-end for consuming OwnTracks data from an MQTT broker" \ + --license "https://github.com/owntracks/recorder/blob/master/LICENSE" \ + --url "http://owntracks.org" \ + -C $tempdir \ + -p ${debfile} \ + -d "${libcurl}" \ + -d "libmosquitto1" \ + -d "${liblua}" \ + -d "${libconfig}" \ + -d "${libsodium}" \ + -d "liblmdb0" \ + -d "libuuid1" \ + --config-files etc/default/ot-recorder \ + --post-install etc/debian/postinst \ + usr var etc + +echo "${debfile}" > package.name +rm -rf "${tempdir}" diff --git a/etc/ubuntu/postinst b/etc/ubuntu/postinst new file mode 100644 index 0000000..b5fba94 --- /dev/null +++ b/etc/ubuntu/postinst @@ -0,0 +1,49 @@ +#!/bin/sh +# postinstall for UBU25 +# +# Create owntracks user & group +# binaries are setuid to owntracks +# storage belongs to owntracks:owntracks + +set -e + +case "$1" in + configure) + getent group owntracks > /dev/null || /usr/sbin/groupadd --system owntracks + getent passwd owntracks > /dev/null || adduser --system --disabled-password --disabled-login --ingroup owntracks --no-create-home owntracks + mkdir -p /var/spool/owntracks/recorder/store/last + mkdir -p /var/spool/owntracks/recorder/store/ghash + chown -R owntracks:owntracks /var/spool/owntracks/recorder/store + chown owntracks:owntracks /etc/default/ot-recorder + chown -R owntracks:owntracks /var/spool/owntracks/ + chown owntracks:owntracks /usr/bin/ocat /usr/sbin/ot-recorder + + chmod a+rX -R /usr/share/owntracks/ + chmod 444 /usr/share/owntracks/recorder/timezone16.bin + + chmod 4555 /usr/bin/ocat /usr/sbin/ot-recorder + /usr/sbin/ot-recorder --initialize + + + if [ -x /bin/systemctl ]; then + # fpm installed unit file into /etc/systemd/system/ot-recorder.service + systemctl --system daemon-reload || exit 0 # catch failure in docker setup + systemctl restart ot-recorder || exit 0 + fi + ;; + + 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