Adding support for installing to sd cards as well as preventing unnecessary downloads. #2

Merged
depsterr merged 5 commits from master into master 2020-02-06 09:47:19 +00:00
depsterr commented 2020-02-05 20:48:23 +00:00 (Migrated from github.com)

Adding support for installing to sd cards as well as preventing unnecessary downloads

Support for installing to sd cards

The script currently assumes that partition names are named

${DEVICE_NODE}1
${DEVICE_NODE}2

However, memory cards, such as sd cards will have partitions ending in p1 and p2, to fix this I've added a check that sets the partition names accordingly.

# use p1, p2 extentions instead of 1, 2 when using sd drives
if [[ $(echo $DEVICE_NODE | grep mmcblk) ]]; then
	BOOTPART="${DEVICE_NODE}p1"
	DATAPART="${DEVICE_NODE}p2"
else
	BOOTPART="${DEVICE_NODE}1"
	DATAPART="${DEVICE_NODE}2"
fi

The rest of the script then uses these variables instead. This is especially important if someone tries to run this script from their phone to install to the internal storage as that is memory card device and the script wouldn't be able to install to it.

Preventing unnecessary downloads

I have realized my solution for this would only apply to the pinephone download and therefore undid these changes.

I found myself having to redownload files when something wouldn't work and I would cancel the script. To fix this the script simply checks if the files are present before downloading them.

ls pinephone-rootfs.zip || {
    # Download code is here
}
ls u-boot.zip || {
    # Download code is here
}
# Adding support for installing to sd cards as well as preventing unnecessary downloads ## Support for installing to sd cards The script currently assumes that partition names are named ```bash ${DEVICE_NODE}1 ${DEVICE_NODE}2 ``` However, memory cards, such as sd cards will have partitions ending in p1 and p2, to fix this I've added a check that sets the partition names accordingly. ```bash # use p1, p2 extentions instead of 1, 2 when using sd drives if [[ $(echo $DEVICE_NODE | grep mmcblk) ]]; then BOOTPART="${DEVICE_NODE}p1" DATAPART="${DEVICE_NODE}p2" else BOOTPART="${DEVICE_NODE}1" DATAPART="${DEVICE_NODE}2" fi ``` The rest of the script then uses these variables instead. This is especially important if someone tries to run this script from their phone to install to the internal storage as that is memory card device and the script wouldn't be able to install to it. ## ~~Preventing unnecessary downloads~~ I have realized my solution for this would only apply to the pinephone download and therefore undid these changes. ~~I found myself having to redownload files when something wouldn't work and I would cancel the script. To fix this the script simply checks if the files are present before downloading them.~~ ```bash ls pinephone-rootfs.zip || { # Download code is here } ``` ```bash ls u-boot.zip || { # Download code is here } ```
depsterr commented 2020-02-06 09:35:54 +00:00 (Migrated from github.com)

After realizing that the downloads will differ depending on platforms I have removed the download checks, however the SD card check remains.

After realizing that the downloads will differ depending on platforms I have removed the download checks, however the SD card check remains.
piggz commented 2020-02-06 09:47:45 +00:00 (Migrated from github.com)

The download code was a but i was unsure about but as thats been removed, LGTM!

The download code was a but i was unsure about but as thats been removed, LGTM!
Sign in to join this conversation.
No description provided.