Skip to content

Instantly share code, notes, and snippets.

Created May 31, 2015 12:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/bcc0d20020e2b163dfca to your computer and use it in GitHub Desktop.
Save anonymous/bcc0d20020e2b163dfca to your computer and use it in GitHub Desktop.
#!/bin/sh
set -ex
if [ -z "$part1" ] || [ -z "$part2" ]; then
printf "Error: missing environment variable part1 or part2\n" 1>&2
exit 1
fi
mkdir -p /tmp/1 /tmp/2
mount "$part1" /tmp/1
mount "$part2" /tmp/2
sed /tmp/1/cmdline.txt -i -e "s|root=/dev/[^ ]*|root=${part2}|"
sed /tmp/2/etc/fstab -i -e "s|^.* / |${part2} / |"
sed /tmp/2/etc/fstab -i -e "s|^.* /boot |${part1} /boot |"
umount /tmp/1
umount /tmp/2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment