27
27
exit 1
28
28
fi
29
29
30
- raspbian =0
31
- raspbian_buster =0
32
- if [ -f /etc/os-release ]
30
+ rpios =0
31
+ rpios_recent =0
32
+ if [ -f /etc/os-release ] && [ -f /proc/device-tree/model ]
33
33
then
34
34
pretty=` cat /etc/os-release | grep PRETTY`
35
- if [[ " $pretty " == * " Raspbian" * ]]
35
+ osversion=` cat /etc/os-release | grep VERSION_ID | cut -d' "' -f2`
36
+ model=` tr -d ' \0' < /proc/device-tree/model`
37
+ if [[ " $pretty " == * " Raspbian" * || (" $model " == * " Raspberry" * && " $pretty " == * " Debian" * ) ]]
36
38
then
37
- raspbian =1
39
+ rpios =1
38
40
fi
39
- if (( raspbian )) && [[ " $pretty " == * " buster " * ]]
41
+ if (( rpios )) && (( osversion >= 10 ))
40
42
then
41
- raspbian_buster =1
43
+ rpios_recent =1
42
44
fi
43
45
fi
44
46
@@ -224,7 +226,7 @@ qecho()
224
226
echo " $@ "
225
227
fi
226
228
}
227
-
229
+
228
230
qprintf ()
229
231
{
230
232
if (( ! quiet))
@@ -1320,7 +1322,7 @@ Use -U for unattended even if initializing.
1320
1322
then
1321
1323
printf " %-22s : %s\n" " " \
1322
1324
" Possible options:"
1323
- if (( raspbian ))
1325
+ if (( rpios ))
1324
1326
then
1325
1327
printf " %-22s : %s\n" " " \
1326
1328
" Use -f2 to force a two partition initialize clone."
@@ -1338,14 +1340,14 @@ Use -U for unattended even if initializing.
1338
1340
1339
1341
readable_MiB $(( last_part_sectors + 7812 )) " 512" image_space_readable
1340
1342
1341
- echo " == Initialize: IMAGE partition table - $reason =="
1343
+ echo " == Initialize: IMAGE partition table - $reason =="
1342
1344
print_image_actions
1343
1345
print_options
1344
1346
1345
1347
printf " %-22s : %s\n" " ** WARNING **" \
1346
1348
" All destination disk $dst_disk data will be overwritten!"
1347
1349
1348
- if (( raspbian_buster && p1 _size_new == 0 && src_size_sectors[1 ] < 400000 ))
1350
+ if (( rpios_recent && p1 _size_new == 0 && src_size_sectors[1 ] < 400000 ))
1349
1351
then
1350
1352
printf " %-22s : %s\n" " ** WARNING **" \
1351
1353
" Your source /boot partition is smaller than the"
@@ -1530,7 +1532,7 @@ Use -U for unattended even if initializing.
1530
1532
else
1531
1533
src_sync_part[p]=1
1532
1534
fi
1533
- fi
1535
+ fi
1534
1536
else
1535
1537
printf " => dd if=${src_device[$p]} of=$dst_dev bs=1M ..."
1536
1538
dd if=${src_device[$p]} of=$dst_dev bs=1M & >> /tmp/$PGM -output
@@ -1606,7 +1608,7 @@ else
1606
1608
exit 1
1607
1609
fi
1608
1610
1609
- if (( raspbian_buster && dst_size_sectors[1 ] < 500000 ))
1611
+ if (( rpios_recent && dst_size_sectors[1 ] < 500000 ))
1610
1612
then
1611
1613
qprintf " %-22s : %s\n" " ** WARNING **" \
1612
1614
" Your destination /boot partition is smaller than the"
@@ -1814,7 +1816,7 @@ qprintf " Start - %s End - %s Elapsed Time - %d:%02d\n" \
1814
1816
if (( ! unattended))
1815
1817
then
1816
1818
echo -n $"
1817
- Cloned partitions are mounted on $clone for inspection or customizing.
1819
+ Cloned partitions are mounted on $clone for inspection or customizing.
1818
1820
1819
1821
Hit Enter when ready to unmount the /dev/$dst_disk partitions ..."
1820
1822
0 commit comments