File: preinstall.in

package info (click to toggle)
nut 2.8.4%2Breally-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,720 kB
  • sloc: ansic: 132,030; sh: 17,256; cpp: 12,566; makefile: 5,646; python: 1,114; perl: 856; xml: 47
file content (23 lines) | stat: -rwxr-xr-x 588 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
#!/bin/sh

# Preinstall script for Network UPS Tools package
NUT_DIR="@prefix@"

# Create group nut

grep -w "@RUN_AS_GROUP@" /etc/group
if [ "$?" != 0 ]; then
	/usr/sbin/groupadd "@RUN_AS_GROUP@"
fi

# Create user for installing "Network UPS Tools"

grep -w "@RUN_AS_USER@" /etc/passwd
if [ "$?" != 0 ]; then
	/usr/sbin/useradd -c "Network UPS Tools" -g "@RUN_AS_GROUP@" -G root -d "@STATEPATH@" -s /bin/false "@RUN_AS_USER@"
fi

res="`groups "@RUN_AS_GROUP@" | grep -w "@RUN_AS_USER@"`" || res=""
if [ -z "$res" ]; then
	/usr/sbin/usermod -g "@RUN_AS_GROUP@" -G root "@RUN_AS_USER@"
fi