/usr/share/ltsp/plugins/functions is in ltsp-server 5.3.7-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | ##################################
### Methods to be called by plugins
##################################
. /usr/share/ltsp/ltsp-server-functions
# Load plugins.
#
# Params:
# $1 - mode (configure|run)
# needs variable PLUGIN_DIRS defined
load_plugins() {
set -- "$@"
MODE=$1
debug "Loading plugins in MODE=$MODE:"
FILENAMES=""
NAMES=""
for dir in $PLUGIN_DIRS ; do
if [ -d "$dir" ]; then
FILENAMES="$FILENAMES $(run_parts_list $dir)"
fi
done
for file in $FILENAMES ; do
NAMES="$NAMES $(basename $file)"
done
NAMES="$(echo $NAMES | tr "\t " "\n" | sort -u)"
for name in $NAMES ; do
for dir in $PLUGIN_DIRS ; do
filename="$dir/$name"
if [ -f "$filename" ]; then
debug "Loading plugin: $MODE: $filename"
. "$filename"
break
fi
done
done
}
# Confirms that ROOT is a chroot
# Success: return 0
# Failure: exit 1
# return 1 if --return-on-fail
confirm_chroot() {
if [ -z $ROOT ]; then
echo "ERROR: ROOT is not defined."
exit 1
fi
if [ ! -e $ROOT/bin/true ]; then
[ "$1" = "--return-on-fail" ] && return 1
echo "ERROR: $ROOT is not a valid chroot."
exit 1
fi
return 0
}
# Detect latest installed kernel
# Outputs version to $kernelversion
detect_latest_kernel() {
confirm_chroot
# If /dev/null does not exist, create it (basename needs it)
[ ! -e /dev/null ] && /sbin/MAKEDEV null
# If not already specified by the command line, try to find the latest kernel automatically
unset kernelversion
kernelversion="`ls -d $ROOT/lib/modules/2* | sort -nr | head -n1 | xargs basename`"
if [ ! -d $ROOT/lib/modules/$kernelversion ]; then
echo "ERROR: $0: Unable to detect installed kernel version."
exit 1
fi
return 0
}
|