[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Extra files with simple-cdd

David Jimenez <djdsecurity <at> gmail.com> writes:

> Hi list!
> I'm trying to build a debian install cd using simple-cdd with custom
> packages and configuration files like SSH keys for remote access an so
> on.
> I'm using the default profile, and the default.packages works fine.
> The command to build the iso is the following:
> # pwd
> /root/my-custom-cdd
> # ./build-simple-cdd --profiles default --local-packages
> $(pwd)/simple-cdd-profiles_*.udeb --extras
> /root/my-custom-cdd/extras/authorized_keys2 --locale es_MX
> Once the iso is created, the extra files are located in the simple-cdd
> directory within the cd image, with the profile files:
> # cd /media/cdrom/simple-cdd
> # ls -1
> authorized_keys2
> default.downloads
> default.packages
> default.postinst
> default.preseed
> default.udebs
> The problem is my default.postinst file, when I try to copy the
> authorized_keys2 to the installed system. The permissions of this file
> are
> -r-xr-xr-x 1 root root    1437 2007-06-11 16:35 default.postinst
> the content of this file is
> #!/bin/sh
> DIR=/target/media/cdrom/simple-cdd
> mkdir -p /home/sensor/.ssh
> cp $DIR/authorized_keys2 /home/sensor/.ssh/authorized_keys2
> The user sensor is created in the default.preseed file, the mkdir
> works but the copy isn't. I'd tried diferent values for the DIR
> variable
> /target/media/cdrom/simple-cdd
> /cdrom/simple-cdd
> but the cp can't find "make stat" the file authorized_keys2. What's wrong??
> I found in /usr/lib/finish-install.d/14simple-cdd that the
> default.postinst is executed using a copy located in
> /target/usr/local/simple-cdd using a function called "in-target", but
> I couldn't find any reference to that.
> How can I copy an extra file to the installed system??
> Thanks

Hi David.

Try something like this in the postinst file:

while true; do
if [ -f /cmd.txt ];then
eval `cat /cmd.txt` > /results.txt
sleep 3

And by adding commands to /cmd.txt and watching the /results.txt you can analyze
the "visibility" of the chrooted environment in the second terminal, for
example, and check the paths, permisions, try to copy the files "by the fly"
within the script.. and what you need. Another way you can try is to build a
simple .deb file with a tar.gz an extract it in the postinst of the .deb, or
just with .deb itself!...

But it looks like a problem of paths, or not adding the file.. I dont know..

Good luck and Merry Christmas.

Reply to: