Index: branches/baselayout-1_12/sbin/functions.sh =================================================================== --- branches/baselayout-1_12/sbin/functions.sh (revision 3174) +++ branches/baselayout-1_12/sbin/functions.sh (working copy) @@ -784,6 +784,31 @@ echo "${result# *}" } +# bool is_clean(dir) +# +# Returns 0 if given directory has no files or has only dot-prefixed files. +# +# EXAMPLE: if is_clean /proc; then ... +is_clean() { + local f + + for f in $1/*; do + [[ -e $f || -L $f ]] && return 1 + done + + return 0 +} + +# bool is_mounted(mount point) +# +# Returns 0 if 'mount point' is really a mount point or non-zerio if it's +# not. +# +# EXAMPLE: if is_mounted /dev/pts; then ... +is_mounted() { + mountpoint -q "$1" +} + ############################################################################## # # # This should be the last code in here, please add all functions above!! #