27
27
exit 1
28
28
fi
29
29
30
- raspbian=0
31
- raspbian_buster=0
32
- if [ -f /etc/os-release ]
33
- then
34
- pretty=` cat /etc/os-release | grep PRETTY`
35
- if [[ " $pretty " == * " Raspbian" * ]]
36
- then
37
- raspbian=1
30
+ rpios=0
31
+ rpios_recent=0
32
+ if [ -f /etc/os-release ]; then
33
+ if [[ -e /etc/rpi-issue ]]; then
34
+ rpios=1
38
35
fi
39
- if (( raspbian )) && [[ " $pretty " == * " buster " * ]]
40
- then
41
- raspbian_buster =1
36
+ pretty= " $( cat /etc/os-release | grep PRETTY ) "
37
+ if (( rpios )) && [[ ! " $pretty " =~ wheezy | jessie | stretch ]] ; then
38
+ rpios_recent =1
42
39
fi
43
40
fi
44
41
@@ -224,7 +221,7 @@ qecho()
224
221
echo " $@ "
225
222
fi
226
223
}
227
-
224
+
228
225
qprintf ()
229
226
{
230
227
if (( ! quiet))
971
968
cp $fstab_tmp $fstab
972
969
printf " Your original fstab is backed up to $fstab_save \n"
973
970
974
- cmdline_txt=/boot/cmdline.txt
971
+ cmdline_txt=$( realpath /boot/cmdline.txt)
975
972
cmdline_save=$cmdline_txt .${PGM} -save
976
973
if [ -f $cmdline_txt ] && grep -q " $src_root_dev " $cmdline_txt
977
974
then
@@ -1320,7 +1317,7 @@ Use -U for unattended even if initializing.
1320
1317
then
1321
1318
printf " %-22s : %s\n" " " \
1322
1319
" Possible options:"
1323
- if (( raspbian ))
1320
+ if (( rpios ))
1324
1321
then
1325
1322
printf " %-22s : %s\n" " " \
1326
1323
" Use -f2 to force a two partition initialize clone."
@@ -1338,14 +1335,14 @@ Use -U for unattended even if initializing.
1338
1335
1339
1336
readable_MiB $(( last_part_sectors + 7812 )) " 512" image_space_readable
1340
1337
1341
- echo " == Initialize: IMAGE partition table - $reason =="
1338
+ echo " == Initialize: IMAGE partition table - $reason =="
1342
1339
print_image_actions
1343
1340
print_options
1344
1341
1345
1342
printf " %-22s : %s\n" " ** WARNING **" \
1346
1343
" All destination disk $dst_disk data will be overwritten!"
1347
1344
1348
- if (( raspbian_buster && p1 _size_new == 0 && src_size_sectors[1 ] < 400000 ))
1345
+ if (( rpios_recent && p1 _size_new == 0 && src_size_sectors[1 ] < 400000 ))
1349
1346
then
1350
1347
printf " %-22s : %s\n" " ** WARNING **" \
1351
1348
" Your source /boot partition is smaller than the"
@@ -1530,7 +1527,7 @@ Use -U for unattended even if initializing.
1530
1527
else
1531
1528
src_sync_part[p]=1
1532
1529
fi
1533
- fi
1530
+ fi
1534
1531
else
1535
1532
printf " => dd if=${src_device[$p]} of=$dst_dev bs=1M ..."
1536
1533
dd if=${src_device[$p]} of=$dst_dev bs=1M & >> /tmp/$PGM -output
@@ -1606,7 +1603,7 @@ else
1606
1603
exit 1
1607
1604
fi
1608
1605
1609
- if (( raspbian_buster && dst_size_sectors[1 ] < 500000 ))
1606
+ if (( rpios_recent && dst_size_sectors[1 ] < 500000 ))
1610
1607
then
1611
1608
qprintf " %-22s : %s\n" " ** WARNING **" \
1612
1609
" Your destination /boot partition is smaller than the"
@@ -1730,7 +1727,7 @@ qecho ""
1730
1727
# Fix PARTUUID or device name references in cmdline.txt and fstab
1731
1728
#
1732
1729
fstab=${clone} /etc/fstab
1733
- cmdline_txt=${clone} /boot/cmdline.txt
1730
+ cmdline_txt=${clone} $( realpath /boot/cmdline.txt)
1734
1731
1735
1732
if [ -f $cmdline_txt ]
1736
1733
then
@@ -1814,7 +1811,7 @@ qprintf " Start - %s End - %s Elapsed Time - %d:%02d\n" \
1814
1811
if (( ! unattended))
1815
1812
then
1816
1813
echo -n $"
1817
- Cloned partitions are mounted on $clone for inspection or customizing.
1814
+ Cloned partitions are mounted on $clone for inspection or customizing.
1818
1815
1819
1816
Hit Enter when ready to unmount the /dev/$dst_disk partitions ..."
1820
1817
0 commit comments