File: ftp-cloudfs.postinst

package info (click to toggle)
ftp-cloudfs 0.25.2%2B20140217%2Bgit2a90c1a2eb-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 272 kB
  • ctags: 250
  • sloc: python: 2,032; sh: 120; makefile: 4
file content (34 lines) | stat: -rw-r--r-- 1,043 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
#!/bin/sh

set -e

if [ "$1" = "configure" ] ; then
	if ! getent group ftpcloudfs > /dev/null 2>&1 ; then
		addgroup --system ftpcloudfs >/dev/null
	fi
	if ! getent passwd ftpcloudfs > /dev/null 2>&1 ; then
		adduser --system --home /var/log/ftp-cloudfs --ingroup ftpcloudfs --no-create-home --shell /bin/false ftpcloudfs > /dev/null 2>&1
	fi

	# log directory
	mkdir -m 0700 -p /var/log/ftp-cloudfs
	touch /var/log/ftp-cloudfs/ftp-cloudfs.log
	chmod 0640 /var/log/ftp-cloudfs/ftp-cloudfs.log
	chown -R ftpcloudfs:ftpcloudfs /var/log/ftp-cloudfs

	# pid file directory
	mkdir -m 0700 -p /var/run/ftp-cloudfs
	chown -R ftpcloudfs:ftpcloudfs /var/run/ftp-cloudfs

	if [ ! -e /etc/ftpcloudfs.conf ] ; then
		install -D -m 0640 -g ftpcloudfs -o ftpcloudfs /usr/share/ftpcloudfs/ftpcloudfs.conf /etc/ftpcloudfs.conf
		MY_GID=`id -g ftpcloudfs`
		MY_UID=`id -u ftpcloudfs`
		sed -i -e "s#^[ \t]*uid[ \t]*=.*#uid = ${MY_UID}#" /etc/ftpcloudfs.conf
		sed -i -e "s#^[ \t]*gid[ \t]*=.*#gid = ${MY_GID}#" /etc/ftpcloudfs.conf
	fi
fi

#DEBHELPER#

exit 0