Jack Bates <q34yzh@nottheoilrig.com> writes:
> Hi,
>
> How can I use sed in preseed/late_command to insert a new line, two
> lines after the line which contains "<!-- Volume definitions -->", in
> pam_mount.conf.xml?
>
> Normally I'd use something like the following, but I think the sed
> append command must be terminated with a newline?
>
> > in-target sed -i '/<!-- Volume definitions -->/ {
> > n
> > a <volume fstype="cifs" mountpoint="~/earth"
> path="students/%(USER)" pgrp="users" server="earth.lan" />
> > }' etc/security/pam_mount.conf.xml
>
> Is there any way to express this script ^ without newline characters? Is
> there any way to embed newline characters in preseed/late_command
> value?
You may be able to do:
in-target sed -i "$(echo '/<!-- Volume definitions -->/ {\nn\na <volume fstype="cifs" mountpoint="~/earth" path="students/%(USER)" pgrp="users" server="earth.lan" />\n}')" etc/security/pam_mount.conf.xml
also, I don't see why you need to run this in the target chroot, so you
can probably avoid some quoting problems with something like:
sed -i "$(echo '/<!-- Volume definitions -->/ {\nn\na <volume fstype="cifs" mountpoint="~/earth" path="students/%(USER)" pgrp="users" server="earth.lan" />\n}')" /target/etc/security/pam_mount.conf.xml
or, even, just as you'd normally do it, with the embedded newlines
(which you were presumably avoiding because of the in-target, which you
don't need as it turns out)
Cheers, Phil.
--
|)| Philip Hands [+44 (0)20 8530 9560] http://www.hands.com/
|-| HANDS.COM Ltd. http://www.uk.debian.org/
|(| 10 Onslow Gardens, South Woodford, London E18 1NE ENGLAND
Attachment:
pgpYXF_mc6Ew7.pgp
Description: PGP signature