#!/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 LABELTOOL_CMDLINE VERBOSELEVEL # Defaults for options # Process options miniade_process_options MY_ARGS "$@" && set -- "${MY_ARGS[@]}" # Process arguments [ $# = 0 ] || usage # Sanity checks and derivations DIRS=( ${FIND_MAP_IN_ENV_HINTS//:/ } ) for DIR in "${DIRS[@]}"; do [[ $DIR =~ ^/ ]] || miniade_error "$DIR: not absolute" done miniade_get_verboselevel VERBOSELEVEL # Guts for DIR in "${DIRS[@]}"; do miniade_debug 10 "main: $DIR: checking ..." if [ ! -d $DIR ]; then miniade_debug 10 "main: $DIR: not a directory" continue fi LABELTOOL_CMDLINE="$LABELTOOL_CMD --debug=$VERBOSELEVEL is-labelled medium $DIR" miniade_debug 10 "main: calling [$LABELTOOL_CMDLINE] ..." if ! eval "$LABELTOOL_CMDLINE"; then miniade_debug 10 "main: $DIR: no medium label; not an error (might need to de-error)" continue fi LABELTOOL_CMDLINE="$LABELTOOL_CMD --debug=$VERBOSELEVEL read medium $DIR" miniade_debug 10 "main: calling [$LABELTOOL_CMDLINE] ..." echo "$(eval "$LABELTOOL_CMDLINE") $DIR" done } main "$@"