Merge "Add --list support to dib-run-parts."
This commit is contained in:
commit
d339f9b25e
@ -17,13 +17,15 @@
|
||||
# under the License.
|
||||
|
||||
allowed_regex=${RUN_PARTS_REGEX:-"^[0-9A-Za-z_-]+$"}
|
||||
show_list=
|
||||
|
||||
set -ue
|
||||
|
||||
name=$(basename $0)
|
||||
|
||||
usage() {
|
||||
echo "usage: $name scripts_directory" >&2
|
||||
echo "usage: $name [OPTION] scripts_directory" >&2
|
||||
echo " --list print names of all valid files" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
@ -35,6 +37,11 @@ if [ $# -lt 1 ] ; then
|
||||
usage
|
||||
fi
|
||||
|
||||
if [ "$1" == "--list" ] ; then
|
||||
show_list="1"
|
||||
shift
|
||||
fi
|
||||
|
||||
target_dir=$1
|
||||
|
||||
if ! [ -d $target_dir ] ; then
|
||||
@ -49,6 +56,13 @@ fi
|
||||
# subdirectories) are run, which is the way run-parts behaves.
|
||||
targets=$(find $target_dir -maxdepth 1 -type f -executable -printf '%f\n' | grep -E "$allowed_regex" | LANG=C sort -n)
|
||||
|
||||
if [ "$show_list" == "1" ] ; then
|
||||
for target in $targets ; do
|
||||
echo "${target_dir}/${target}"
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
PROFILE_DIR=$(mktemp -d /tmp/profiledir.XXXXXX)
|
||||
|
||||
if [ -d /tmp/in_target.d/environment.d ] ; then
|
||||
|
Loading…
Reference in New Issue
Block a user