burrow-pi-img/export-noobs/00-release/files/partition_setup.sh

37 lines
745 B
Bash
Raw Normal View History

2016-05-27 10:56:23 +00:00
#!/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
2017-03-07 15:13:22 +00:00
sed /tmp/1/cmdline.txt -i -e "s|root=[^ ]*|root=${part2}|"
2016-05-27 10:56:23 +00:00
sed /tmp/2/etc/fstab -i -e "s|^.* / |${part2} / |"
sed /tmp/2/etc/fstab -i -e "s|^.* /boot |${part1} /boot |"
2017-03-06 11:58:32 +00:00
if [ -f /mnt/ssh ]; then
2017-03-03 13:22:06 +00:00
cp /mnt/ssh /tmp/1/
fi
2017-03-06 11:58:32 +00:00
if [ -f /mnt/ssh.txt ]; then
2017-03-03 13:22:06 +00:00
cp /mnt/ssh.txt /tmp/1/
fi
2017-03-06 11:58:32 +00:00
if [ -f /settings/wpa_supplicant.conf ]; then
2017-03-06 11:49:13 +00:00
cp /settings/wpa_supplicant.conf /tmp/1/
fi
2016-05-27 10:56:23 +00:00
if ! grep -q resize /proc/cmdline; then
sed -i 's| quiet init=/usr/lib/raspi-config/init_resize.sh||' /tmp/1/cmdline.txt
2016-05-27 10:56:23 +00:00
fi
umount /tmp/1
umount /tmp/2