I have an image of a Debian Squeeze system that I want to put onto multiple systems (flash-based disks for a single-board computer). I'd like each system to have a different hostname, but have that hostname persist across subsequent reboots.
My first thought was that I could remove "/etc/hostname" from the image, and modify /etc/init.d/hostname.sh to something like: do_start () { if [ ! -f /etc/hostname ]; then RANDOM_MAGIC="$(cat /dev/urandom | tr -dc '0-9A-Z' | head -c 6)" echo "prefix-${RANDOM_MAGIC}" > /etc/hostname fi HOSTNAME="$(cat /etc/hostname)" [ "$VERBOSE" != no ] && log_action_begin_msg "Setting hostname to '$HOSTNAME'" hostname "$HOSTNAME" ES=$? [ "$VERBOSE" != no ] && log_action_end_msg $ES exit $ES } Then, upon the first boot AFTER imaging, this script would see that there's no /etc/hostname, generate one, write the new value to the file and I'd be done. The problem is that the root FS is not mounted writeable at this stage of the boot process! Is there another point in the rcS.d script sequence where I can persist the current hostname? After S10mountall.sh? Or is there a better way to achieve this that I'm missing? — Jason -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/CA+Zd3FeXx7CRzXHM6ozpOMUdkQvxi2-=2zmhxxr5oht8nel...@mail.gmail.com