Merged enhancements submitted by Stereo, thanks, closes #188 and #189
[openwrt/svn-archive/archive.git] / openwrt / package / quagga / ipkg / quagga.postinst
1 #!/bin/sh
2
3 name=quagga
4 id=51
5
6 # do not change below
7 # check if we are on real system
8 if [ -z "${IPKG_INSTROOT}" ]; then
9 # create copies of passwd and group, if we use squashfs
10 rootfs=`mount |awk '/root/ { print $5 }'`
11 if [ "$rootfs" = "squashfs" ]; then
12 if [ -h /etc/group ]; then
13 rm /etc/group
14 cp /rom/etc/group /etc/group
15 fi
16 if [ -h /etc/passwd ]; then
17 rm /etc/passwd
18 cp /rom/etc/passwd /etc/passwd
19 fi
20 fi
21 fi
22
23 echo ""
24 if [ -z "$(grep ^\\${name}: ${IPKG_INSTROOT}/etc/group)" ]; then
25 echo "adding group $name to /etc/group"
26 echo "${name}:x:${id}:" >> ${IPKG_INSTROOT}/etc/group
27 fi
28
29 if [ -z "$(grep ^\\${name}: ${IPKG_INSTROOT}/etc/passwd)" ]; then
30 echo "adding user $name to /etc/passwd"
31 echo "${name}:x:${id}:${id}:${name}:/tmp/.${name}:/bin/false" >> ${IPKG_INSTROOT}/etc/passwd
32 fi
33
34 grep -q '^zebra[[:space:]]*2601/tcp' ${IPKG_INSTROOT}/etc/services 2>/dev/null
35 if [ $? -ne 0 ]; then
36 echo "zebrasrv 2600/tcp" >>${IPKG_INSTROOT}/etc/services
37 echo "zebra 2601/tcp" >>${IPKG_INSTROOT}/etc/services
38 echo "ripd 2602/tcp" >>${IPKG_INSTROOT}/etc/services
39 echo "ripngd 2603/tcp" >>${IPKG_INSTROOT}/etc/services
40 echo "ospfd 2604/tcp" >>${IPKG_INSTROOT}/etc/services
41 echo "bgpd 2605/tcp" >>${IPKG_INSTROOT}/etc/services
42 echo "ospf6d 2606/tcp" >>${IPKG_INSTROOT}/etc/services
43 echo "ospfapi 2607/tcp" >>${IPKG_INSTROOT}/etc/services
44 echo "isisd 2608/tcp" >>${IPKG_INSTROOT}/etc/services
45 fi