mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
Clarify & Clean 1-prep/templates/iiab-rpi-max-rootfs.sh for PR #3121
This commit is contained in:
parent
01dc89f2ca
commit
38eb8868e3
1 changed files with 9 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash -x
|
||||
|
||||
# Resize rootfs and its partition on the rpi SD card (or external USB
|
||||
# Resize rootfs and its partition on the RPi SD card (or external USB
|
||||
# disk if possible, e.g. with Raspberry Pi OS) to maximum size.
|
||||
|
||||
# To be used by /etc/systemd/system/iiab-rpi-root-resize.service on boot.
|
||||
|
@ -15,13 +15,18 @@ if [ -f /.resize-rootfs ]; then
|
|||
# just microSD cards). IF ONLY THIS ALSO WORKED ON Ubuntu/Mint/etc !
|
||||
raspi-config --expand-rootfs
|
||||
else
|
||||
# Assumes sd card style partition name like <device>p<partition number>
|
||||
# 2022-02-17 PR #3121: This 2-line explanation appears stale...
|
||||
# Assumes SD card style partition name like <device>p<partition number>
|
||||
# Only works on F22 + where resizepart command exists
|
||||
|
||||
# Calculate root partition
|
||||
root_part=`lsblk -aP -o NAME,MOUNTPOINT | grep 'MOUNTPOINT="/"' | awk -F\" '{ print $2 }'`
|
||||
root_part=`lsblk -aP -o NAME,MOUNTPOINT | grep 'MOUNTPOINT="/"' | awk -F\" '{ print $2 }'`
|
||||
root_dev=${root_part:0:-2}
|
||||
root_part_no=${root_part: (-1)}
|
||||
# bash substring expansion: "negative offset [below, but not above]
|
||||
# must be separated from the colon by at least one space to avoid
|
||||
# being confused with the ‘:-’ expansion"
|
||||
# https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html
|
||||
root_part_no=${root_part: -1}
|
||||
|
||||
# Resize partition
|
||||
growpart /dev/$root_dev $root_part_no
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue