WizardKit/archlive/airootfs/usr/local/bin/mount-all-volumes
Alan Mason f67cd37a38 2016-08: Retroactive Updates
* Added arch.conf file which is loaded from the UFD
  * Allows configuration without rebuilding the ISO
* Added connect-to-network script that uses arch.conf
  * Available for manual execution from the command line
  * Used by mount-backup-shares
* Added hardinfo with Conky hint and keyboard shortcut (Super+i)
* Avoid deleting a newly created iso right after building
* Conky
  * Settings can now be stored on the UFD
  * Transparancy fixed
* mount-all-volumes doesn't print the mountpoint for ARCH_HH
* NetworkManager should no longer hold up the boot time
* Prime95
  * Adjusted default length due to the summer heat
  * Fixed bug where hw-diags would let it run forever
* Removed extra themes to try and reduce the overall size
* Switching to nodm over lightdm
2017-12-06 17:52:21 -08:00

29 lines
1.3 KiB
Bash

#!/bin/bash
#
## Mount all volumes read-only
# Fix issue where first device is mounted under /media/wktech/
TMP_FILE=$(mktemp)
dd bs=1K count=64 if=/dev/zero of="$TMP_FILE" >/dev/null 2>&1
mkfs.msdos "$TMP_FILE" >/dev/null 2>&1
udevil mount -o ro "$TMP_FILE" >/dev/null 2>&1
udevil umount "$TMP_FILE" >/dev/null 2>&1
# Mount all volumes
echo "Mounting all volumes"
regex="/dev/((h|s)d[a-z]|md)[0-9]+"
for volume in $(inxi -Dopxx | grep -E "$regex" | sed -r "s#.*($regex).*#\1#" | sort); do
if grep -q "$volume" /proc/mounts; then
if ! mount | grep "/run/archiso/bootmnt" | grep -q "$volume"; then
# Show what's already mounted except the ARCH_WK boot device
echo "$volume: (Already) mounted at $(mount | grep "$volume" | awk '{print $3}') ($(df -h "$volume" | tail -1 | awk '{print $3, $4}' | sed -r 's/(K|M|G|T|) (.*[0-9])(K|M|G|T|)$/ \1b used, \2 \3b free/'))"
fi
else
if udevil mount -o ro $volume >/dev/null 2>&1; then
echo "$volume: Mounted at $(mount | grep "$volume" | awk '{print $3}') ($(df -h "$volume" | tail -1 | awk '{print $3, $4}' | sed -r 's/(K|M|G|T|) (.*[0-9])(K|M|G|T|)$/ \1b used, \2 \3b free/'))"
else
echo "$volume: Failed to mount"
fi
fi
done
echo "Done."