Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need to know how can I add this to preseeding via d-i early/command or d-i preseed/run to set my mirror inside preseed.cfg from /proc/cmdline argument.

If I do:

d-i preseed/run string ws/ubuntu.sh

#!/bin/sh
     for x in `cat /proc/cmdline`; do
             case $x in RPHOST*)
                     eval $x

                     d-i mirror/http/hostname string ${RPHOST}
                     d-i mirror/http/mirror string ${RPHOST}
                     d-i apt-setup/security_host string ${RPHOST}
                     ;;
             esac; 
done

it fails.

It works well in the CentOS kickstart %pre section but i have no clue how to do it via debian/ubuntu preseeding.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

after some research on debconf i came up with this solution:

in your preseed.cfg you call the script via:

d-i preseed/run string ws/ubuntu.sh    // subdir from preseed file location

content of ubuntu.sh:

#!/bin/sh
echo "Start ubuntu.sh runscript" >> /var/log/syslog
for x in `cat /proc/cmdline`; do
        case $x in RPHOST*)
                eval $x
                HOST=$RPHOST
                echo "d-i mirror/http/hostname string ${HOST}" > /tmp/mirror.cfg
                echo "d-i mirror/http/mirror string ${HOST}" >> /tmp/mirror.cfg
                echo "d-i apt-setup/security_host string ${HOST}" >> /tmp/mirror.cfg
                ;;
        esac;
done
// add´s values to /var/lib/cdebconf/question.dat
debconf-set-selections /tmp/mirror.cfg

works good @ 12.04.2 LTS !

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.