Debian/Ubuntu set preseed mirror variable via early/run command

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 !