#!/bin/sh set -ex if [ -z "$part1" ] || [ -z "$part2" ] || [ -z "$part3" ]; then printf "Error: missing environment variable part1, part2 or part3\n" 1>&2 exit 1 fi mkdir -p /tmp/1 /tmp/2 /tmp/3 mount "$part1" /tmp/1 mount "$part2" /tmp/2 mount "$part3" /tmp/3 bootuuid=$(blkid $part1 -o value -s UUID) sed /tmp/1/cmdline -i -e "s|root=[^ ]*|root=UUID=${bootuuid}|" #sed /tmp/1/cmdline -i -e "s|root=[^ ]*|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 umount /tmp/3