Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update RPi OS logic detection #152

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 15 additions & 18 deletions rpi-clone
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,15 @@ then
exit 1
fi

raspbian=0
raspbian_buster=0
if [ -f /etc/os-release ]
then
pretty=`cat /etc/os-release | grep PRETTY`
if [[ "$pretty" == *"Raspbian"* ]]
then
raspbian=1
rpios=0
rpios_recent=0
if [ -f /etc/os-release ]; then
if [[ -e /etc/rpi-issue ]]; then
rpios=1
fi
if ((raspbian)) && [[ "$pretty" == *"buster"* ]]
then
raspbian_buster=1
pretty="$(cat /etc/os-release | grep PRETTY)"
if ((rpios)) && [[ ! "$pretty" =~ wheezy|jessie|stretch ]]; then
rpios_recent=1
fi
fi

Expand Down Expand Up @@ -224,7 +221,7 @@ qecho()
echo "$@"
fi
}

qprintf()
{
if ((!quiet))
Expand Down Expand Up @@ -1320,7 +1317,7 @@ Use -U for unattended even if initializing.
then
printf "%-22s : %s\n" " " \
"Possible options:"
if ((raspbian))
if ((rpios))
then
printf "%-22s : %s\n" " " \
" Use -f2 to force a two partition initialize clone."
Expand All @@ -1338,14 +1335,14 @@ Use -U for unattended even if initializing.

readable_MiB $((last_part_sectors + 7812)) "512" image_space_readable

echo "== Initialize: IMAGE partition table - $reason =="
echo "== Initialize: IMAGE partition table - $reason =="
print_image_actions
print_options

printf "%-22s : %s\n" "** WARNING **" \
"All destination disk $dst_disk data will be overwritten!"

if ((raspbian_buster && p1_size_new == 0 && src_size_sectors[1] < 400000))
if ((rpios_recent && p1_size_new == 0 && src_size_sectors[1] < 400000))
then
printf "%-22s : %s\n" "** WARNING **" \
"Your source /boot partition is smaller than the"
Expand Down Expand Up @@ -1530,7 +1527,7 @@ Use -U for unattended even if initializing.
else
src_sync_part[p]=1
fi
fi
fi
else
printf " => dd if=${src_device[$p]} of=$dst_dev bs=1M ..."
dd if=${src_device[$p]} of=$dst_dev bs=1M &>> /tmp/$PGM-output
Expand Down Expand Up @@ -1606,7 +1603,7 @@ else
exit 1
fi

if ((raspbian_buster && dst_size_sectors[1] < 500000))
if ((rpios_recent && dst_size_sectors[1] < 500000))
then
qprintf "%-22s : %s\n" "** WARNING **" \
"Your destination /boot partition is smaller than the"
Expand Down Expand Up @@ -1814,7 +1811,7 @@ qprintf " Start - %s End - %s Elapsed Time - %d:%02d\n" \
if ((!unattended))
then
echo -n $"
Cloned partitions are mounted on $clone for inspection or customizing.
Cloned partitions are mounted on $clone for inspection or customizing.

Hit Enter when ready to unmount the /dev/$dst_disk partitions ..."

Expand Down