On 12/19/2012 4:14 PM, John Hupp wrote:
On 12/19/2012 4:00 PM, John Hupp wrote:
I'm using a client boot script at /usr/share/ltsp/init-ltsp.d/50-apcupsd with sed to modify a configuration file. The script:

sed -i \
    -e 's/UPSCABLE usb/UPSCABLE ether/' \
    -e 's/UPSTYPE usb/UPSTYPE net/' \
    -e 's/DEVICE/DEVICE Lubuntu1:3551/' \
    -e 's/TIMEOUT 105/TIMEOUT 60/' \
    -e 's/NETSERVER on/NETSERVER off/' \
    -e 's/NISIP 0.0.0.0/NISIP 127.0.0.1/' \
/etc/apcupsd/apcupsd.conf

It all works fine except for this substitution:
    -e 's/DEVICE/DEVICE Lubuntu1:3551/'

It takes this line:
    DEVICE
and replaces it with this:
    DEVICE Lubuntu1:3551 Lubuntu1:3551

However, if I run the same script on the server, it does not produce the duplicate "Lubuntu1:3551". Does anyone know why?

-------------------------------------

Seeking a work-around, I added an /etc/apcupsd/apcupsd_slave.conf file which was already modified with the parameters I want clients to boot with. Then I edited /usr/share/ltsp/init-ltsp.d/50-apcupsd to remove the sed command and added:

cp /etc/apcupsd/apcupsd_slave.conf  /etc/apcupsd/apcupsd.conf

But this does not seem to execute. And if on a booted-up client I open a local session xterminal and run:

$ su root cp /etc/apcupsd/apcupsd_slave.conf /etc/apcupsd/apcupsd.conf

it returns:

/bin/cp: cannot execute binary file


Someone points out that with the sed command, I would get the duplicate result I report if the script ran twice. Does that trigger any thoughts?

Someone else wondered if the colon in the replacement expression needed to be escaped. But I still have the thinnest possible understanding of the finer points of sed and the substitution syntax, especially about escaping special characters. I don't even know if the backslash would go before or after the colon!

But I had wondered about the possible effect of that colon myself.

To test that idea, I replaced the colon with a space:

    sed -e 's/DEVICE/DEVICE Lubuntu1 3551/'

Now on the LTSP client, the resulting line is:

    DEVICE Lubuntu1:3551 Lubuntu1 3551

------------------

I don't know what the syntax means, but someone also suggested the following:

    sed -e 's/DEVICE$/DEVICE Lubuntu1:3551/'

And that had no effect whatsoever. The result was still "DEVICE Lubuntu1:3551 Lubuntu1:3551".

------------------

My current thought is this: I think the LTSP clients use a static, read-only network boot image + a writable union filesystem overlaying the read-only image. I have seen only the slimmest mention of it in writing, however. Perhaps I'm not searching with the right terms to find better documentation. But if that overlay has persistence, then perhaps there could be results like the above. As someone suggested earlier, it's as if the script had been run twice. Well perhaps it is being run multiple times over succeeding boots and being applied to a persistent overlay.

I tried earlier to use the script to copy in an alternative version of the whole config file instead of using sed, and that failed, but I'm going to try that again. If it works, I think it would overcome a persistent-overlay behavior with sed.

Does LTSP use something like a writable overlay filesystem? Can I read more about that somewhere?

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_____________________________________________________________________
Ltsp-discuss mailing list.   To un-subscribe, or change prefs, goto:
      https://lists.sourceforge.net/lists/listinfo/ltsp-discuss
For additional LTSP help,   try #ltsp channel on irc.freenode.net

Reply via email to