[PLUG] Can I make a link happen automatically?

John Jason Jordan johnxj at comcast.net
Thu Mar 9 21:32:43 UTC 2006


On Thu, 9 Mar 2006 10:45:58 -0800 (PST)
"Michael Rasmussen" <mikeraz at patch.com> wrote:

> All it needs to contain is:
> 
>   #!/bin/bash
>   ln -f /etc/resolv.conf /chroot/breezy/32bits/etc/resolv.conf
> 
> sudo's not needed becuase the thing will be run as root.

OK, did that. There is now a file called resolv.conf_up_to_date
containing the above two lines in /etc/network/if-up.d. I checked in
Konqueror and its properties shows that it's a shell script. I guess
that happens automatically to anything in that folder, because all I
did was save it there from gedit (had to launch gedit as root in order
to write to that folder).

Wait ... I just discovered something. In a terminal window I navigated
to /etc/network/if-up.d and did an ls command. It showed postfix and
resolv.conf_up_to_date. But postfix displayed in green, and
resolv.conf_up_to_date was just black and white. After more checking in
Konqueror I discovered that the difference was file permissions, plus
the "executable" box was not checked on resolv.conf_up_to_date. I shut
down and relaunched Konqueror with sudo, then changed the permissions
to match postfix, and checked the executable box.

Then, with root-gedit I opened resolv.conf in chroot and deleted the
entries under server, and resaved. And then I tried to go somewhere
with Firefox-32, and was satisfied when it couldn't go anywhere. 

At that point I figured I was ready to test the new script, so I shut
down and restarted. As soon as everything was up I launched Firefox-32,
expecting that it would work fine. It did not. I opened resolv.conf in
gedit and noted that the server addresses had not been replaced. So the
script didn't do anything. However, there were no error messages during
the boot process. And when I run the command from a terminal, as I have
been doing, it then adds the correct entries to resolv.conf in chroot.

> Now, some error checking would be nice, maybe log a message stating whether or not
> the action was successful.  I'll leave those modifications as an exercise for the
> reader.

Maybe I need to figure that out in order to see what is going wrong.




More information about the PLUG mailing list