WizardKit/archlive/airootfs/usr/local/bin/mount-all-volumes
Alan Mason 077401ef85 2017-06: Retroactive Updates
* Include extras/* in ISO
  * build-wk modifies build.sh before it is called
* NetworkManager is back
* Switched to Numix-Square icons
* Added remount-rw script
  * Accessible in Thunar as custom action
* Readded mesa-demos to fix inxi message
* Removed xorg-video-ati (conflicts with AMDGPU)
* Swapping nvidia in for nouveau (attempt to fix X for newer macs)
* Added mbpfan-git
* Added Mac fans script (set all fans to auto/max)
* Fixed issue where udevil would use /media/$USER/Name for the first call
2017-12-06 17:58:25 -08:00

28 lines
1.1 KiB
Bash

#!/bin/bash
#
## Mount all volumes read-only
# 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 WK_ARCH boot device
echo "$volume: (Already) mounted $(mount | grep "$volume" | sed -r 's/^\S+ (on.*) type .*/\1/') ($(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 $(mount | grep "$volume" | sed -r 's/^\S+ (on.*) type .*/\1/') ($(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
# Open folder?
if echo "$0" | grep -iq foh; then
thunar /media
fi
echo "Done."