]> www.vanbest.org Git - motioneye-debian/commitdiff
Create motioneye user in postinst and run motioneye as that user
authorJan-Pascal van Best <janpascal@vanbest.org>
Sat, 23 Jun 2018 14:40:52 +0000 (16:40 +0200)
committerJan-Pascal van Best <janpascal@vanbest.org>
Sat, 23 Jun 2018 14:40:52 +0000 (16:40 +0200)
debian/control
debian/init
debian/patches/add_private_log_and_run_dirs [new file with mode: 0644]
debian/patches/series [new file with mode: 0644]
debian/postinst [new file with mode: 0644]

index 37d85233bde9ba16328b4741949302d5affed96f..660139c08ce466b6a8d6241b6da0c88d82eda8d8 100644 (file)
@@ -5,13 +5,20 @@ Maintainer: Christian Marillat <marillat@deb-multimedia.org>
 Bugs: mailto:marillat@deb-multimedia.org
 Homepage: https://github.com/ccrisan/motioneye
 X-Python-Version: >= 2.7
-Standards-Version: 4.1.4
+Standards-Version: 3.9.8
 Build-Depends: debhelper (>= 11), python | python-all | python-dev | python-all-dev,
- dh-python
+ dh-python, python-jsmin, python-cssmin, fontmake, fontforge-nox, gmsl
 
 Package: motioneye
 Architecture: all
-Depends: ${python:Depends}, ${misc:Depends}, libjs-jquery, libjs-jquery-mousewheel, python-tornado, python-jinja2, python-pil, python-pycurl, python-pkg-resources, lsb-base
+Depends: ${python:Depends}, ${misc:Depends}, adduser, libjs-jquery, libjs-jquery-mousewheel, python-tornado, python-jinja2, python-pil, python-pycurl, python-pkg-resources, lsb-base
 Suggests: motion, ffmpeg, v4l-utils
 Description: web-based frontend for motion
- A web frontend for the motion daemon, written in Python.
+ A web frontend for the motion daemon, written in Python:
+  - web-based, mobile/tablet-friendly user interface
+  - compatible with most USB cameras and the Raspberry PI camera module
+  - support for IP (network) cameras
+  - motion detection with email notifications and working schedule
+  - JPEG files for still images, AVI files for videos
+  - timelapse movies
+  - uploading media files to Google Drive and Dropbox
index c9f7f3a8180cf7646a1b734cefba91a22ea8d9d8..fed3d7829256333ee554dc333ec18cd2e6b6439f 100755 (executable)
 
 NAME="motioneye"
 PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
-DAEMON="/usr/local/bin/meyectl"
-PIDFILE="/var/run/$NAME.pid"
+DAEMON="/usr/bin/meyectl"
+RUNDIR="/var/run/$NAME"
+PIDFILE="$RUNDIR/$NAME.pid"
 DESC="motionEye server"
-USER="root"
+USER="motioneye"
 OPTIONS="startserver -c /etc/motioneye/motioneye.conf -l -b"
 
 . /lib/lsb/init-functions
@@ -28,6 +29,10 @@ RET=0
 
 case "$1" in
     start)
+        if [ ! -d "$RUNDIR" ]; then
+            mkdir -p "$RUNDIR"
+        fi
+        chown $USER "$RUNDIR"
         log_daemon_msg "Starting $DESC"
         if start-stop-daemon --start --oknodo --exec $DAEMON --chuid $USER -- $OPTIONS; then
             log_end_msg 0
diff --git a/debian/patches/add_private_log_and_run_dirs b/debian/patches/add_private_log_and_run_dirs
new file mode 100644 (file)
index 0000000..49cef13
--- /dev/null
@@ -0,0 +1,34 @@
+Description: Use private log and run directories
+Last-Update: 2018-06-04
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: motioneye-dmo-0.39/extra/motioneye.conf.sample
+===================================================================
+--- motioneye-dmo-0.39.orig/extra/motioneye.conf.sample        2018-06-04 10:20:43.710359615 +0200
++++ motioneye-dmo-0.39/extra/motioneye.conf.sample     2018-06-04 10:20:43.706359602 +0200
+@@ -3,10 +3,10 @@
+ conf_path /etc/motioneye
+ # path to the directory where pid files go (must be writable by motionEye)
+-run_path /var/run
++run_path /var/run/motioneye
+ # path to the directory where log files go (must be writable by motionEye)
+-log_path /var/log
++log_path /var/log/motioneye
+ # default output path for media files (must be writable by motionEye)
+ media_path /var/lib/motioneye
+Index: motioneye-dmo-0.39/extra/motioneye.systemd-unit
+===================================================================
+--- motioneye-dmo-0.39.orig/extra/motioneye.systemd-unit       2018-03-31 22:21:38.000000000 +0200
++++ motioneye-dmo-0.39/extra/motioneye.systemd-unit    2018-06-04 10:22:57.514714185 +0200
+@@ -3,6 +3,8 @@
+ [Service]
+ ExecStart=/usr/bin/meyectl startserver -c /etc/motioneye/motioneye.conf
++User=motioneye
++RuntimeDirectory=motioneye
+ Restart=on-abort
+ [Install]
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644 (file)
index 0000000..ec367da
--- /dev/null
@@ -0,0 +1 @@
+add_private_log_and_run_dirs
diff --git a/debian/postinst b/debian/postinst
new file mode 100644 (file)
index 0000000..12743a8
--- /dev/null
@@ -0,0 +1,54 @@
+#!/bin/sh
+# postinst script for motioneye
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <postinst> `abort-remove'
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+# source debconf library
+. /usr/share/debconf/confmodule
+
+case "$1" in
+
+  configure)
+    # Create motioneye account and add to 'video' group
+    adduser --system --home /var/lib/motioneye motioneye
+    usermod --append --groups video motioneye
+
+    # Fix directory ownership
+    chown motioneye /var/lib/motioneye
+    chown motioneye /var/log/motioneye
+    chown motioneye /etc/motioneye
+  ;;
+
+  abort-upgrade|abort-remove|abort-deconfigure)
+    exit 0
+  ;;
+
+  *)
+    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#
+
+db_stop
+
+exit 0