Skip to content

Commit b0758a0

Browse files
authored
Merge pull request billw2#2 from martignoni/151-rpios
Update RPi OS logic detection (issue 152)
2 parents 6e869a5 + e2ed30c commit b0758a0

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

rpi-clone

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,15 @@ then
2727
exit 1
2828
fi
2929

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
3835
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
4239
fi
4340
fi
4441

@@ -1320,7 +1317,7 @@ Use -U for unattended even if initializing.
13201317
then
13211318
printf "%-22s : %s\n" " " \
13221319
"Possible options:"
1323-
if ((raspbian))
1320+
if ((rpios))
13241321
then
13251322
printf "%-22s : %s\n" " " \
13261323
" Use -f2 to force a two partition initialize clone."
@@ -1345,7 +1342,7 @@ Use -U for unattended even if initializing.
13451342
printf "%-22s : %s\n" "** WARNING **" \
13461343
"All destination disk $dst_disk data will be overwritten!"
13471344

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))
13491346
then
13501347
printf "%-22s : %s\n" "** WARNING **" \
13511348
"Your source /boot partition is smaller than the"
@@ -1606,7 +1603,7 @@ else
16061603
exit 1
16071604
fi
16081605

1609-
if ((raspbian_buster && dst_size_sectors[1] < 500000))
1606+
if ((rpios_recent && dst_size_sectors[1] < 500000))
16101607
then
16111608
qprintf "%-22s : %s\n" "** WARNING **" \
16121609
"Your destination /boot partition is smaller than the"

0 commit comments

Comments
 (0)