1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
# Common functions shared by LTSP scripts
boolean_is_true(){
case $1 in
# match all cases of true|y|yes
[Tt][Rr][Uu][Ee]|[Yy]|[Yy][Ee][Ss]) return 0 ;;
*) return 1 ;;
esac
}
# list files in a directory consisting only of alphanumerics, hyphens and
# underscores
# $1 - directory to list
# $2 - optional prefix to limit which files are selected
run_parts_list() {
if [ $# -lt 1 ]; then
echo "ERROR: Usage: run_parts_list <dir>" > /dev/stderr
exit 1
fi
if [ ! -d "$1" ]; then
echo "ERROR: Not a directory: $1" > /dev/stderr
exit 1
fi
if [ -d "$1" ]; then
if [ -n "$2" ]; then
find_opts="-name $2*"
fi
find -L "$1" -mindepth 1 -maxdepth 1 -type f $find_opts | sed -n '/.*\/[0-9a-zA-Z_\-]\{1,\}$/p' | sort -n
fi
}
if [ -f /usr/share/ltsp/ltsp-vendor-functions ]; then
. /usr/share/ltsp/ltsp-vendor-functions
fi
|