aboutsummaryrefslogtreecommitdiff
path: root/databases/firebird2-server/files/pkg-install.in
blob: d442ff99ee3f27ecd1a2cb25a4ce8f51072d36a1 (plain) (blame)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh

PATH=/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:%%PREFIX%%/bin
PREFIX=%%PREFIX%%
DB_DIR=%%PREFIX%%

USER=firebird
GROUP=${USER}
UID=3050
GID=${UID}
HOME=${DB_DIR}
DESCR="Firebird Database Administrator"

case $2 in
PRE-INSTALL)
	if pw group show "${GROUP}" 2> /dev/null; then
		echo "You already have a group \"${GROUP}\", so I will use it."
	else
		if pw groupadd ${GROUP} -g ${GID}; then
			echo "Added group \"${GROUP}\"."
		else
			echo "Adding group \"${GROUP}\" failed..."
			exit 1
		fi
	fi

	if pw user show "${USER}" 2> /dev/null; then
		echo "You already have a user \"${USER}\", so I will use it."

		if pw usermod ${USER} -d ${HOME}; then
			echo "Changed home directory of \"${USER}\" to \"${HOME}\""
		else
			echo "Changing home directory of \"${USER}\" to \"${HOME}\" failed..."
			exit 1
		fi
	else
		if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - -d ${NOME} -s /sbin/nologin -c "${DESCR}" ; then
			echo "Added user \"${USER}\"."
		else
			echo "Adding user \"${USER}\" failed..."
			exit 1
		fi
	fi
        ;;

POST-INSTALL)
	for f in isc_init1.`hostname` isc_lock1.`hostname` isc_event1.`hostname` firebird.log
	do
		touch ${PREFIX}/${f}
		chown ${USER}:${GROUP} ${PREFIX}/$f
		chmod 660 ${PREFIX}/${f}
	done

	# add the gds service and restart inetd
	cat /etc/services | grep -v gds_db > /etc/services.new
	cat >>/etc/services.new <<EOF
gds_db          3050/tcp  #InterBase Database Remote Protocol
EOF
	mv /etc/services.new /etc/services

	cat /etc/inetd.conf | grep -v gds_db > /etc/inetd.conf.new
	cat >>/etc/inetd.conf.new <<EOF
gds_db  stream  tcp     nowait  firebird        ${PREFIX}/bin/fb_inet_server  fb_inet_server
EOF
	mv /etc/inetd.conf.new /etc/inetd.conf

	if [ -f /var/run/inetd.pid ]; then
	        kill -HUP `cat /var/run/inetd.pid`
	fi
esac