rootfsinstall: -L option to specify the volume label for system partition

This commit is contained in:
Silvan Calarco 2016-07-19 14:04:15 +02:00
parent 3075ceeb20
commit 9934fafc05

View File

@ -8,6 +8,7 @@
SYSTEMFSTYPE=ext4 SYSTEMFSTYPE=ext4
# All targets are arm currently # All targets are arm currently
TARGET_ARCH=arm TARGET_ARCH=arm
VOLUME_LABEL="openmamba"
function usage() { function usage() {
echo "Usage: $0 device rootfs-archive [-bpi|-cubox|-rpi] [-a archive] [-c command] [-fs fstype] [-k kernel] [-p password] [-y]" echo "Usage: $0 device rootfs-archive [-bpi|-cubox|-rpi] [-a archive] [-c command] [-fs fstype] [-k kernel] [-p password] [-y]"
@ -28,6 +29,7 @@ function usage() {
echo "-k2 kernel : extract and use specified second kernel file from ROOTFS/boot/ for boot" echo "-k2 kernel : extract and use specified second kernel file from ROOTFS/boot/ for boot"
echo "-i packages : install packages using package manager in chroot" echo "-i packages : install packages using package manager in chroot"
echo "-l : force local installation only; don't perform installation from network" echo "-l : force local installation only; don't perform installation from network"
echo "-L : rootfs volume label (default: 'openmamba')"
echo "-p password : set given password for root user" echo "-p password : set given password for root user"
echo "-r mode : set given default video mode where applicable (e.g. -r 1920x1080-32@60)" echo "-r mode : set given default video mode where applicable (e.g. -r 1920x1080-32@60)"
echo "-y : assume yes to all questions (script mode)" echo "-y : assume yes to all questions (script mode)"
@ -108,6 +110,13 @@ while [ "$1" ]; do
shift shift
;; ;;
-l) LOCALONLY=1 ;; -l) LOCALONLY=1 ;;
-L) [ "$2" ] || {
echo "Error: -L option requires a volume label as argument; aborting."
exit 1
}
VOLUME_LABEL="$2"
shift
;;
-p) [ "$2" ] || { -p) [ "$2" ] || {
echo "Error: -p option requires a password as argument; aborting." echo "Error: -p option requires a password as argument; aborting."
exit 1 exit 1
@ -254,7 +263,7 @@ if [ "$BOOTFSTYPE" ]; then
fi fi
echo "Formatting $PARTITION2 ($SYSTEMFSTYPE)..." echo "Formatting $PARTITION2 ($SYSTEMFSTYPE)..."
mke2fs -q -F -t $SYSTEMFSTYPE -j -L "openmamba" $PARTITION2 || { mke2fs -q -F -t $SYSTEMFSTYPE -j -L "$VOLUME_LABEL" $PARTITION2 || {
echo "ERROR: unable to format $PARTITION2; aborting." echo "ERROR: unable to format $PARTITION2; aborting."
exit 1 exit 1
} }