From 833d0efb9042185f30d31e38ecd21a13b7a9b045 Mon Sep 17 00:00:00 2001 From: Arne Fitzenreiter Date: Tue, 7 Jul 2009 23:07:20 +0200 Subject: [PATCH 1/1] Motion tuning (don't run as root, backup include, config...) --- config/backup/includes/motion | 1 + config/motion/motion.conf | 20 ++++++++++---------- config/rootfiles/packages/motion | 2 +- lfs/motion | 4 ++-- src/initscripts/init.d/motion | 5 ++++- src/paks/motion/install.sh | 27 +++++++++++++++++++++++++++ src/paks/motion/uninstall.sh | 26 ++++++++++++++++++++++++++ src/paks/motion/update.sh | 26 ++++++++++++++++++++++++++ 8 files changed, 97 insertions(+), 14 deletions(-) create mode 100644 config/backup/includes/motion create mode 100644 src/paks/motion/install.sh create mode 100644 src/paks/motion/uninstall.sh create mode 100644 src/paks/motion/update.sh diff --git a/config/backup/includes/motion b/config/backup/includes/motion new file mode 100644 index 0000000000..79652aa30d --- /dev/null +++ b/config/backup/includes/motion @@ -0,0 +1 @@ +/etc/motion.conf diff --git a/config/motion/motion.conf b/config/motion/motion.conf index 4d8777279d..a97762cc57 100644 --- a/config/motion/motion.conf +++ b/config/motion/motion.conf @@ -109,13 +109,13 @@ netcam_tolerant_check off # The auto_brightness feature uses the brightness option as its target value. # If brightness is zero auto_brightness will adjust to average brightness value 128. # Only recommended for cameras without auto brightness -auto_brightness off +auto_brightness on # Set the initial brightness of a video device. # If auto_brightness is enabled, this value defines the average brightness level # which Motion will try and adjust to. # Valid range 0-255, default 0 = disabled -brightness 0 +brightness 128 # Set the contrast of a video device. # Valid range 0-255, default 0 = disabled @@ -195,20 +195,20 @@ minimum_motion_frames 1 # Recommended range: 0 to 5 (default: 0) # Do not use large values! Large values will cause Motion to skip video frames and # cause unsmooth mpegs. To smooth mpegs use larger values of post_capture instead. -pre_capture 0 +pre_capture 5 # Number of frames to capture after motion is no longer detected (default: 0) -post_capture 0 +post_capture 5 # Gap is the seconds of no motion detection that triggers the end of an event # An event is defined as a series of motion images taken within a short timeframe. # Recommended value is 60 seconds (Default). The value 0 is allowed and disables # events causing all Motion to be written to one single mpeg file and no pre_capture. -gap 60 +gap 0 # Maximum length in seconds of an mpeg movie # When value is exceeded a new mpeg file is created. (Default: 0 = infinite) -max_mpeg_time 0 +max_mpeg_time 86400 # Always save images even if there was no motion (default: off) output_all off @@ -279,7 +279,7 @@ ffmpeg_variable_bitrate 0 # flv - gives you a flash video with extension .flv # ffv1 - FF video codec 1 for Lossless Encoding ( experimental ) # mov - QuickTime ( testing ) -ffmpeg_video_codec mpeg4 +ffmpeg_video_codec msmpeg4 # Use ffmpeg to deinterlace video. Necessary if you use an analog camera # and see horizontal combing on moving objects in video or pictures. @@ -321,7 +321,7 @@ text_right %Y-%m-%d\n%T-%q # Draw a user defined text on the images using same options as C function strftime(3) # Default: Not defined = no text # Text is placed in lower left corner -; text_left CAMERA %t +text_left CAMERA %t\nhttp://nwww.ipfire.org # Draw the number of changed pixed on the images (default: off) # Will normally be set to off except when you setup and adjust the motion settings @@ -356,7 +356,7 @@ text_double off # Target base directory for pictures and films # Recommended to use absolute path. (Default: current working directory) -target_dir /srv/motion/cam1 +target_dir /var/motion/cam1 # File path for snapshots (jpeg or ppm) relative to target_dir # Default: %v-%Y%m%d%H%M%S-snapshot @@ -397,7 +397,7 @@ timelapse_filename %Y%m%d-timelapse ############################################################ # The mini-http server listens to this port for requests (default: 0 = disabled) -webcam_port 36000 +webcam_port 2500 # Quality of the jpeg images produced (default: 50) webcam_quality 75 diff --git a/config/rootfiles/packages/motion b/config/rootfiles/packages/motion index d3a6785003..3e1c3f5fc9 100644 --- a/config/rootfiles/packages/motion +++ b/config/rootfiles/packages/motion @@ -4,7 +4,7 @@ etc/rc.d/init.d/motion etc/rc.d/rc0.d/K01motion etc/rc.d/rc6.d/K01motion etc/rc.d/rc3.d/S99motion -srv/motion/cam1/info +var/ipfire/backup/addons/includes/motion #usr/share/doc/motion-3.2.11 #usr/share/doc/motion-3.2.11/CHANGELOG #usr/share/doc/motion-3.2.11/COPYING diff --git a/lfs/motion b/lfs/motion index d6d0bcc90c..d42abaf0ae 100644 --- a/lfs/motion +++ b/lfs/motion @@ -81,7 +81,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) cd $(DIR_APP) && make $(MAKETUNING) cd $(DIR_APP) && make install cp -vf $(DIR_SRC)/config/motion/motion.conf /etc - mkdir -pv /srv/motion/cam1 - echo Folder for cam1 images > /srv/motion/cam1/info + install -v -m 644 $(DIR_SRC)/config/backup/includes/motion \ + /var/ipfire/backup/addons/includes/motion @rm -rf $(DIR_APP) @$(POSTBUILD) diff --git a/src/initscripts/init.d/motion b/src/initscripts/init.d/motion index 78633f21d4..642272c144 100644 --- a/src/initscripts/init.d/motion +++ b/src/initscripts/init.d/motion @@ -6,7 +6,10 @@ case "$1" in start) boot_mesg "Starting motion webcam server..." - loadproc /usr/bin/motion + chown :video /dev/video* + mkdir -p /var/motion/cam1 + chown -R video: /var/motion/cam1 + loadproc sudo -u video /usr/bin/motion ;; stop) diff --git a/src/paks/motion/install.sh b/src/paks/motion/install.sh new file mode 100644 index 0000000000..f9c2000ba4 --- /dev/null +++ b/src/paks/motion/install.sh @@ -0,0 +1,27 @@ +#!/bin/bash +############################################################################ +# # +# This file is part of the IPFire Firewall. # +# # +# IPFire is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either version 2 of the License, or # +# (at your option) any later version. # +# # +# IPFire is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with IPFire; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# # +# Copyright (C) 2007 IPFire-Team . # +# # +############################################################################ +# +. /opt/pakfire/lib/functions.sh +extract_files +restore_backup ${NAME} +useradd -s /bin/false video diff --git a/src/paks/motion/uninstall.sh b/src/paks/motion/uninstall.sh new file mode 100644 index 0000000000..66f4344eb1 --- /dev/null +++ b/src/paks/motion/uninstall.sh @@ -0,0 +1,26 @@ +#!/bin/bash +############################################################################ +# # +# This file is part of the IPFire Firewall. # +# # +# IPFire is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either version 2 of the License, or # +# (at your option) any later version. # +# # +# IPFire is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with IPFire; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# # +# Copyright (C) 2007 IPFire-Team . # +# # +############################################################################ +# +. /opt/pakfire/lib/functions.sh +make_backup ${NAME} +remove_files diff --git a/src/paks/motion/update.sh b/src/paks/motion/update.sh new file mode 100644 index 0000000000..89c40d0d7c --- /dev/null +++ b/src/paks/motion/update.sh @@ -0,0 +1,26 @@ +#!/bin/bash +############################################################################ +# # +# This file is part of the IPFire Firewall. # +# # +# IPFire is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either version 2 of the License, or # +# (at your option) any later version. # +# # +# IPFire is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with IPFire; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# # +# Copyright (C) 2007 IPFire-Team . # +# # +############################################################################ +# +. /opt/pakfire/lib/functions.sh +./uninstall.sh +./install.sh -- 2.39.2