#!/bin/bash # $HeadURL$ $LastChangedRevision$ # Modules . $(miniade) || { echo "${0##*/}: ERROR: miniade failed (hint: run 'miniade' to see error)" >&2; exit 1; } . <(rdw2-config --format=shell) || { echo "${0##*/}: INTERNAL ERROR: failed to run rdw2-config" >&2; exit 3; } # Configurable stuff # Other globals LABELTOOL_CMD=$RDW2_SHARE_PREFIX/methods/Linux/label-tool main() { local MY_ARGS local DIRS DIR VERBOSELEVEL # Defaults for options # Process options miniade_process_options MY_ARGS "$@" && set -- "${MY_ARGS[@]}" # Process arguments [ $# = 0 ] || usage # Sanity checks and derivations DIRS=( $(mount -t nocgroup,tmpfs,sysfs,mqueue,hugetlbfs,debugfs,devtmpfs,proc,securityfs,cgroup2,cgroup2,efivarfs,bpf,autofs,rpc_pipefs,pstore,devpts | cut -d' ' -f3 | egrep -vx '(/|/boot|/boot/efi)') ) miniade_get_verboselevel VERBOSELEVEL # Guts # find may be running as non-root for tests and will complain a lot about # inaccessible stuff, so supress all of that. find "${DIRS[@]}" -maxdepth 2 -type d 2>/dev/null | while read DIR; do # Don't look under /home - it can take a while and there should be # no media mounts under there and if they are then another # accesspoint inspector can find them. { ! [[ $DIR =~ ^/home($|/) ]]; } || continue miniade_debug 10 "main: $DIR: checking ..." if ! $LABELTOOL_CMD --debug=$VERBOSELEVEL is-labelled medium $DIR 2>/dev/null; then continue fi echo "$($LABELTOOL_CMD --debug=$VERBOSELEVEL read medium $DIR) $DIR" done } main "$@"