Skip to content

Commit

Permalink
Add PINN restore support
Browse files Browse the repository at this point in the history
  • Loading branch information
XECDesign authored and fuji246 committed Sep 13, 2019
1 parent dc5596c commit 0404b76
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions export-noobs/00-release/files/partition_setup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
#supports_backup in PINN

set -ex

Expand All @@ -13,23 +14,25 @@ mount "$part1" /tmp/1
mount "$part2" /tmp/2

sed /tmp/1/cmdline.txt -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 |"
sed /tmp/2/etc/fstab -i -e "s|^[^#].* / |${part2} / |"
sed /tmp/2/etc/fstab -i -e "s|^[^#].* /boot |${part1} /boot |"

if [ -f /mnt/ssh ]; then
cp /mnt/ssh /tmp/1/
fi
if [ -z $restore ]; then
if [ -f /mnt/ssh ]; then
cp /mnt/ssh /tmp/1/
fi

if [ -f /mnt/ssh.txt ]; then
cp /mnt/ssh.txt /tmp/1/
fi
if [ -f /mnt/ssh.txt ]; then
cp /mnt/ssh.txt /tmp/1/
fi

if [ -f /settings/wpa_supplicant.conf ]; then
cp /settings/wpa_supplicant.conf /tmp/1/
fi
if [ -f /settings/wpa_supplicant.conf ]; then
cp /settings/wpa_supplicant.conf /tmp/1/
fi

if ! grep -q resize /proc/cmdline; then
sed -i 's| init=/usr/lib/raspi-config/init_resize.sh||;s| quiet||2g' /tmp/1/cmdline.txt
if ! grep -q resize /proc/cmdline; then
sed -i 's| init=/usr/lib/raspi-config/init_resize.sh||;s| quiet||2g' /tmp/1/cmdline.txt
fi
fi

umount /tmp/1
Expand Down

0 comments on commit 0404b76

Please sign in to comment.