#!/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 DIR2 VERBOSELEVEL # Defaults for options # Process options miniade_process_options MY_ARGS "$@" && set -- "${MY_ARGS[@]}" # Process arguments [ $# = 0 ] || usage # Sanity checks and derivations DIRS=( /mnt /media /srv ) miniade_get_verboselevel VERBOSELEVEL # Guts for DIR in "${DIRS[@]}"; do miniade_debug 10 "main: calling [find "$DIR" -maxdepth 2 -type d] ..." # With the move from Debian 11 to Debian 12, /media/ # became unreadable to unless there was something # mounted below it. Hence we discard find's stderr. find "$DIR" -maxdepth 2 -type d 2>/dev/null | while read DIR2; do miniade_debug 10 "main: $DIR2: checking ..." if ! $LABELTOOL_CMD --debug=$VERBOSELEVEL is-labelled medium $DIR2 2>/dev/null; then continue fi echo "$($LABELTOOL_CMD --debug=$VERBOSELEVEL read medium $DIR2) $DIR2" done done } main "$@"