File: motion.postinst

package info (click to toggle)
motion 3.2.12-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 2,152 kB
  • ctags: 1,688
  • sloc: ansic: 16,212; sh: 345; makefile: 209
file content (52 lines) | stat: -rw-r--r-- 923 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh
# postinst script for motion
# Made by Angel Carpintero

set -e


. /usr/share/debconf/confmodule

add_group_if_missing() {
    if [ -x /usr/sbin/addgroup ]; then
        if ! getent group motion >/dev/null; then
                addgroup --force-badname motion || true
        fi
    fi
}

add_user_if_missing() {
    if [ -x /usr/sbin/adduser ]; then
        if ! id -u motion > /dev/null 2>&1; then
            adduser --system --no-create-home \
		--disabled-password \
		--force-badname motion \
		--ingroup motion
	    adduser motion video
        fi
    fi
}

create_pid_dir(){
        if ! [ -d /var/run/motion ]; then
                mkdir /var/run/motion
        fi
        chown motion:motion /var/run/motion
}

add_group_if_missing
add_user_if_missing
create_pid_dir

# Fix motion.conf permission
chmod 0640 /etc/motion/motion.conf
chgrp motion /etc/motion/motion.conf


db_stop

#DEBHELPER#

exit 0