Re: interfaces, mapping, etc
Anthony Towns wrote:
> I think you're misunderstanding the way mappings work. Basically
> they're totally scriptable, so "when the scheme changes" is, in general,
> undeterminable. There are a few reasonable ways (IMO) that you can do
> * scheme based -- setup a file /etc/network/scheme, and change it
> by hand whenever you go somewhere else
No, I think I understand it. I'm only interested in this one right now,
and I want it to work as close to cardctl scheme as I can manage.
> It sounds kinda like you just want some utilities to support "scheme
> based" configuration easily. I don't think that should go into ifupdown
> proper (ie, it should just be some separate scripts), but it'd probably
> make more sense to put it in ifupdown.deb than anywhere else.
Yes that was my thought as well.
> Something like:
> mapping eth0
> script network-scheme
> iface eth0-home inet static
> iface eth0-work inet static
> should be able to be made work pretty easily, without any changes to
Hmm, without any map lines? I must not understand this entirely, then.
Oh do the map lines just literally map script output to interface block
names? That makes sense.
Alright, rough draft attached.
see shy jo
while [ ! -z "$1" ] ; do
case "$1" in
echo "Usage: ifscheme [-v] [-s newscheme]" >&2
if [ ! -z "$newscheme" ]; then
if [ -e /etc/network/scheme ]; then
if [ "$oldscheme" = "$newscheme" ]; then
echo "Scheme unchanged."
echo $newscheme > /etc/network/scheme
echo "Scheme changed to $newscheme."
if [ ! -z "$oldscheme" ] && [ -e /etc/network/ifstate ]; then
for match in $(grep -- "-$oldscheme" /etc/network/ifstate | \
cut -d = -f 1); do
printf "Reinitializing $match.."
ifdown $verbose $match || echo "failed!"
ifup $verbose $match || echo "failed!"
if [ ! -e /etc/network/scheme ]; then
echo $iface-$(cat /etc/network/scheme)
echo $iface-$(cat /etc/network/scheme) >&2