-
Notifications
You must be signed in to change notification settings - Fork 364
Update RPi OS logic detection #152
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
Open
martignoni
wants to merge
3
commits into
billw2:master
Choose a base branch
from
martignoni:151-rpios
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,18 +27,20 @@ then | |
exit 1 | ||
fi | ||
|
||
raspbian=0 | ||
raspbian_buster=0 | ||
if [ -f /etc/os-release ] | ||
rpios=0 | ||
rpios_recent=0 | ||
if [ -f /etc/os-release ] && [ -f /proc/device-tree/model ] | ||
then | ||
pretty=`cat /etc/os-release | grep PRETTY` | ||
if [[ "$pretty" == *"Raspbian"* ]] | ||
osversion=`cat /etc/os-release | grep VERSION_ID | cut -d'"' -f2` | ||
model=`tr -d '\0' < /proc/device-tree/model` | ||
if [[ "$pretty" == *"Raspbian"* || ("$model" == *"Raspberry"* && "$pretty" == *"Debian"*) ]] | ||
then | ||
raspbian=1 | ||
rpios=1 | ||
fi | ||
if ((raspbian)) && [[ "$pretty" == *"buster"* ]] | ||
if ((rpios)) && ((osversion >= 10)) | ||
|
||
then | ||
raspbian_buster=1 | ||
rpios_recent=1 | ||
fi | ||
fi | ||
|
||
|
@@ -224,7 +226,7 @@ qecho() | |
echo "$@" | ||
fi | ||
} | ||
|
||
qprintf() | ||
{ | ||
if ((!quiet)) | ||
|
@@ -1320,7 +1322,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." | ||
|
@@ -1338,14 +1340,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" | ||
|
@@ -1530,7 +1532,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 | ||
|
@@ -1606,7 +1608,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" | ||
|
@@ -1814,7 +1816,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 ..." | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I see this test should check whether it's a Raspberry HW. Are you sure /proc/device-tree/model is an unique idetifier for a Raspberry HW?
/etc/rpi-issue
exists on Raspberry OS Builds only.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm rather sure, but your proposition with
/etc/rpi-issue
is cleaner and easier to understand, I'll change.