{
for n in $ntpsrv; do
echo "let cfg=cfg+1"
- echo "ntpip[\$cfg]='$n'";
+ echo "ntpip[\$cfg]='$n'"
done
} >"$1"
file_ipconf="$service.ipconf"
file_ntpconf="$service.ntpconf"
dir_ipconf="/var/run/service/fw"
-dir_ntpconf="/var/run/service/ntp"
+dir_ntpconf="/var/run/service/ntpd"
exec >/dev/null
#exec >>"$0.out" #debug
if test x"$1" != x"bound" && test x"$1" != x"renew" ; then
# Reconfigure network with this interface disabled
echo "Deconfiguring"
- rm "$service.out"
+ rm "env.out"
rm "$file_ipconf"
rm "$file_ntpconf"
rm "$dir_ipconf/$file_ipconf"
fi
# Bound: we've got the lease
-#env >"$service.out" # debug
+# Record information for e.g. dhcp_$IF_pinger service
+env >"env.out"
./convert2ipconf "$file_ipconf"
# Reconfigure routing and firewall if needed
sv u /var/service/fw
fi
-if test -d /var/service/ntp; then
+if test -d /var/service/ntpd; then
./convert2ntpconf "$file_ntpconf"
# Reconfigure ntp server addresses if needed
diff --brief "$file_ntpconf" "$dir_ntpconf/$file_ntpconf" >/dev/null 2>&1
echo "Reconfiguring ntp"
mkdir -p "$dir_ntpconf" 2>/dev/null
cp "$file_ntpconf" "$dir_ntpconf/$file_ntpconf"
- sv t /var/service/ntp
- sv u /var/service/ntp
+ sv t /var/service/ntpd
+ sv u /var/service/ntpd
fi
fi
--- /dev/null
+#!/bin/sh
+# executed when service is taken down ("sv d .")
+
+service=${PWD##*/}
+file_ipconf="$service.ipconf"
+file_ntpconf="$service.ntpconf"
+dir_ipconf="/var/run/service/fw"
+dir_ntpconf="/var/run/service/ntpd"
+
+# Reconfigure network with this interface disabled
+echo "Finish: deconfiguring"
+rm "env.out"
+rm "$file_ipconf"
+rm "$file_ntpconf"
+rm "$dir_ipconf/$file_ipconf"
+rm "$dir_ntpconf/$file_ntpconf"
+sv u /var/service/fw
mkdir -p "$logdir" 2>/dev/null
chown -R "$user": "$logdir"
chmod -R go-rwxst,u+rwX "$logdir"
-rm logdir
+rm -rf logdir
ln -s "$logdir" logdir
# make this dir accessible to logger
mv "$0.log.new" "$0.log"
fi
-test -f "/var/service/dhcp_$if/dhcp_$if.out" || exec env - sleep "$ping_time"
+test -f "/var/service/dhcp_$if/env.out" || exec env - sleep "$ping_time"
-. "/var/service/dhcp_$if/dhcp_$if.out"
+. "/var/service/dhcp_$if/env.out"
test x"$router" != x"" || exec env - sleep "$ping_time"
#msg "Pinging $router"
mkdir -p "$logdir" 2>/dev/null
chown -R "$user": "$logdir"
chmod -R go-rwxst,u+rwX "$logdir"
-rm logdir
+rm -rf logdir
ln -s "$logdir" logdir
# make this dir accessible to logger
# Make sure rundir/ exists
mkdir -p "$rundir" 2>/dev/null
-chown -R "$user:" "$rundir"
+chown -R "$user": "$rundir"
chmod -R a=rX "$rundir"
rm -rf rundir 2>/dev/null
ln -s "$rundir" rundir
mkdir -p "$logdir" 2>/dev/null
chown -R "$user": "$logdir"
chmod -R go-rwxst,u+rwX "$logdir"
-rm logdir
+rm -rf logdir
ln -s "$logdir" logdir
# make this dir accessible to logger
mkdir -p "$logdir" 2>/dev/null
chown -R "$user": "$logdir"
chmod -R go-rwxst,u+rwX "$logdir"
-rm logdir
+rm -rf logdir
ln -s "$logdir" logdir
# make this dir accessible to logger
if="${PWD##*/ifplugd_}"
+echo "* Upping iface $if"
+ip link set dev "$if" up
+
echo "* Starting ifplugd on $if [$$]"
exec \
env - PATH="$PATH" \
mkdir -p "$logdir" 2>/dev/null
chown -R "$user": "$logdir"
chmod -R go-rwxst,u+rwX "$logdir"
-rm logdir
+rm -rf logdir
ln -s "$logdir" logdir
# make this dir accessible to logger
mkdir -p "$logdir" 2>/dev/null
chown -R "$user": "$logdir"
chmod -R go-rwxst,u+rwX "$logdir"
-rm logdir
+rm -rf logdir
ln -s "$logdir" logdir
# make this dir accessible to logger
# Make sure rundir/ exists
mkdir -p "$rundir" 2>/dev/null
-chown -R "$user:" "$rundir"
+chown -R "$user": "$rundir"
chmod -R a=rX "$rundir"
rm -rf rundir 2>/dev/null
ln -s "$rundir" rundir
mkdir -p "$logdir" 2>/dev/null
chown -R "$user": "$logdir"
chmod -R go-rwxst,u+rwX "$logdir"
-rm logdir
+rm -rf logdir
ln -s "$logdir" logdir
# make this dir accessible to logger
--- /dev/null
+#!/bin/sh
+# executed when service is taken down ("sv d .")
+
+service=${PWD##*/}
+file_ipconf="$service.ipconf"
+dir_ipconf="/var/run/service/fw"
+
+# Reconfigure network with this interface disabled
+echo "Finish: deconfiguring"
+rm "env.out"
+rm "$file_ipconf"
+rm "$dir_ipconf/$file_ipconf"
+sv u /var/service/fw
mkdir -p "$logdir" 2>/dev/null
chown -R "$user": "$logdir"
chmod -R go-rwxst,u+rwX "$logdir"
-rm logdir
+rm -rf logdir
ln -s "$logdir" logdir
# make this dir accessible to logger
fi
# "config": we've got the address
-#env # debug
+# Record information for e.g. dhcp_$IF_pinger service
+env >"env.out"
./convert2ipconf "$file_ipconf"
# Reconfigure routing and firewall if needed