fixup openntpd package. ntpd now starts as user ntp and
[openwrt.git] / openwrt / package / openntpd / ipkg / CONTROL / postinst
1 #!/bin/sh
2 grep -q '^ntp[[:space:]]*123/udp' ${IPKG_INSTROOT}/etc/services 2>/dev/null
3 [ $? -ne 0 ] && echo "ntp 123/udp" >>${IPKG_INSTROOT}/etc/services
4
5 NU=ntp
6 U=`grep "^$NU:" ${IPKG_INSTROOT}/etc/passwd 2>/dev/null | cut -d: -f3`
7 if [ .$U = . ]; then
8 U=`cut -d: -f3 ${IPKG_INSTROOT}/etc/passwd 2>/dev/null | sort -n | tail -1`
9 [ .$U = . ] && U=49
10 U=`expr $U + 1`
11 [ $U -lt 50 ] && U=50
12 G=`grep "^$NU:" ${IPKG_INSTROOT}/etc/group 2>/dev/null | cut -d: -f3`
13 if [ .$G = . ]; then
14 G=`cut -d: -f3 ${IPKG_INSTROOT}/etc/group 2>/dev/null | sort -n | tail -1`
15 [ .$G = . ] && G=49
16 G=`expr $G + 1`
17 [ $G -lt 50 ] && G=50
18 fi
19 LINE="$NU:x:$U:$G::/tmp/.ntp:/bin/false"
20 echo "$LINE" >>${IPKG_INSTROOT}/etc/passwd
21 else
22 awk -F: '{ if($1=="ntp") printf("%s:%s:%s:%s:%s:/tmp/.ntp:/bin/false\n",$1,$2,$3,$4,$5); else print $0 }' ${IPKG_INSTROOT}/etc/passwd >/tmp/$$
23 mv /tmp/$$ ${IPKG_INSTROOT}/etc/passwd
24 chmod 644 ${IPKG_INSTROOT}/etc/passwd
25 fi
This page took 0.047617 seconds and 5 git commands to generate.