Installation manual
6. 2. Network Profile Management 57
case "$SCRIPT" in
(*.sh)
/bin/sh ./$SCRIPT stop &> /dev/null
;;
(*)
./$SCRIPT stop &> /dev/null
;;
esac
fi
done
#Copy all profile specific files for the new profile
cd $PROFILE_DIR/$PROFILE_NEW/files.d
tar cf − . | (cd /; tar xf −)
#Run the Start−Scripts for the new profile
cd $PROFILE_DIR/$PROFILE_NEW/rc.d
for SCRIPT in $(echo S[0−9][0−9]*); do
if [ −n "$SCRIPT" ]; then
echo −n "."
case "$SCRIPT" in
(*.sh)
/bin/sh ./$SCRIPT start &> /dev/null
;;
(*)
./$SCRIPT start &> /dev/null
;;
esac
fi
done
#Save new profile
echo $PROFILE_CUR" −−> "$PROFILE_NEW > $PROFILE_STATE_FILE
echo " done."
In contrast to the laptop-net package, where a special daemon is supposed to watch the ethernet interface for net-
work connects and disconnects, we have tobring up our interfaces manually using the twoscripts eth0 and
wlan0. This is no great inconvenience, since this ifd daemon is one part of the laptop-net package, which does
not work as advertised.
The actual network profiles are defined in the directory /etc/network/profiles. Each profile corresponds to a sub-
directory,whose name is the name of the profile. Within this subdirectory,there are twomore subdirectories
named files.d and rc.d, repectively,aswell as one text file name patters.
The patterns file is a simple list of IP numbers (possibly containing the wildcard *, one IP number per line), to
which the corresponding profile should apply:
/etc/network/profiles/at-work/patterns:
xxx.yyy.zzz.*
XXX.YYY.ZZZ.34
The files.d subdirectory contains a tree of more subdirectories and files. This tree is copied as a whole into the
root directory / using the tar command just after the network interface has been brought up. Subsequently,all
system services named Snn_service in the rc.d directory are started. After the interface has been brought down,
all system services named Knn_service are stopped.
The offline profile is special and gets selected if no network scheme is active.This profile may contain the files.d
and rc.d directories. The patterns file is not necessary.
Nowwewant to transfer control of all network related system startup scripts to our network profile management
—without confusing the Debian package management of course. Todoso, we have toremove the symlinks
from the /etc/rcN.d directories and install them in the /etc/network/profiles/XXXX/rc.d, where XXXX is the
name of our profiles. Since the Debian boot-script manager update-rc.d will reinstall these links as long as it find
the corresponding script in /etc/init.d, we have todiv ert these to a different location.