File: ifetch-tools.postinst

package info (click to toggle)
ifetch-tools 0.18.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 596 kB
  • sloc: ruby: 895; sh: 349; makefile: 4
file content (50 lines) | stat: -rw-r--r-- 1,305 bytes parent folder | download | duplicates (3)
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
#!/bin/sh

set -e

. /usr/share/debconf/confmodule

# Set the prompt to remove data, logs, and settings each removal.
db_fset ifetch-tools/remove seen false

case "${1}" in
	configure)
		if ! getent passwd "ifetch-tools" > /dev/null 2>&1
		then
			# Add new user account
			adduser --system --shell /bin/false --disabled-password --home /var/lib/ifetch-tools --gecos 'ifetch-tools account' --group --quiet ifetch-tools
			if ! getent group "ifetch-tools" > /dev/null 2>&1
			then
				# Add existing user to new new group
				addgroup --system --quiet ifetch-tools
				gpasswd -a ifetch-tools ifetch-tools
			fi
		fi

		mkdir -p /etc/ifetch-tools/cameras
		mkdir -p /var/log/ifetch-tools

		chown ifetch-tools:ifetch-tools /var/log/ifetch-tools /etc/ifetch-tools /etc/ifetch-tools/cameras
		chmod 700 /etc/ifetch-tools /etc/ifetch-tools/cameras /var/lib/ifetch-tools

		if [ ! -e /etc/ifetch-tools/ifetch-tools.conf ]
		then
			cp /usr/share/ifetch-tools/examples/ifetch-tools.conf /etc/ifetch-tools/ifetch-tools.conf
			chmod 600 /etc/ifetch-tools/ifetch-tools.conf
			chown ifetch-tools:ifetch-tools /etc/ifetch-tools/ifetch-tools.conf
		fi
		;;

	abort-upgrade|abort-remove|abort-deconfigure)

		;;

	*)
		echo "postinst called with unknown argument \`${1}'" >&2
		exit 1
		;;
esac

#DEBHELPER#

exit 0