Skip to content

Instantly share code, notes, and snippets.

@gdunstone
Created April 14, 2015 07:45
Show Gist options
  • Save gdunstone/bf5fad5ab0b28c9c6c4d to your computer and use it in GitHub Desktop.
Save gdunstone/bf5fad5ab0b28c9c6c4d to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ $# -lt 1 ]
then
echo "USAGE: $0 <block device> $1 <name>"
exit 1
fi
tmp=/tmp/SPC-OS_rename-$RANDOM
mkdir -p $tmp/root
mount $1 $tmp/root
echo $2 > $tmp/root/etc/hostname
sed -i "/127.0.0.1/c\127.0.0.1 localhost.localdomain localhost $2" $tmp/root/etc/hosts
sed -i "/::1/c\::1 localhost.localdomain localhost $2" $tmp/root/etc/hosts
sed -i "/name/c\name=$2-Picam" $tmp/root/home/spc-eyepi/picam.ini
sed -i "/name/c\name=$2" $tmp/root/home/spc-eyepi/eyepi.ini
umount $tmp/root
rm -rf $tmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment