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