Improved quoting of variables.
This commit is contained in:
parent
35fc5eccd6
commit
ff41ffabaf
@ -28,8 +28,8 @@ trap cleanup EXIT # make sure the script cleans up after itself before closing.
|
||||
cleanup() {
|
||||
if [[ $mounted -eq 0 ]]; then
|
||||
umount -R /mnt
|
||||
partx -d ${loopdev}
|
||||
losetup --detach ${loopdev}
|
||||
partx -d "${loopdev}"
|
||||
losetup --detach "${loopdev}"
|
||||
fi
|
||||
exit 0
|
||||
}
|
||||
@ -123,12 +123,12 @@ url[4]="http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-aarch64-latest.tar.gz"
|
||||
|
||||
fallocate -l $imageSize "$imageName"
|
||||
loopdev="$(losetup --find --show "${imageName}")"
|
||||
parted --script ${loopdev} mklabel msdos mkpart primary fat32 0% 100M mkpart primary ext4 100M 100%
|
||||
mkfs.vfat -F32 ${loopdev}p1
|
||||
mkfs.ext4 -F ${loopdev}p2
|
||||
mount ${loopdev}p2 /mnt
|
||||
parted --script "${loopdev}" mklabel msdos mkpart primary fat32 0% 100M mkpart primary ext4 100M 100%
|
||||
mkfs.vfat -F32 "${loopdev}p1"
|
||||
mkfs.ext4 -F "${loopdev}p2"
|
||||
mount "${loopdev}p2" /mnt
|
||||
mkdir /mnt/boot
|
||||
mount ${loopdev}p1 /mnt/boot
|
||||
mount "${loopdev}p1" /mnt/boot
|
||||
# Things are mounted now, so set mounted to 0 (bash true)
|
||||
mounted=0
|
||||
wget "${url[$imageVersion]}" -O- | bsdtar -xpf - -C /mnt
|
||||
|
Loading…
Reference in New Issue
Block a user