
There were problems with these tools if the path had a space. This should make these tools safe. There are others that still have problems.
32 lines
686 B
Bash
Executable File
32 lines
686 B
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
find_root() {
|
|
local topd
|
|
if [ -z "${CLOUD_INIT_TOP_D}" ]; then
|
|
topd=$(cd "$(dirname "${0}")" && cd .. && pwd)
|
|
else
|
|
topd=$(cd "${CLOUD_INIT_TOP_D}" && pwd)
|
|
fi
|
|
[ $? -eq 0 -a -f "${topd}/setup.py" ] || return
|
|
ROOT_DIR="$topd"
|
|
}
|
|
|
|
if ! find_root; then
|
|
echo "Unable to locate 'setup.py' file that should" \
|
|
"exist in the cloud-init root directory." 1>&2
|
|
exit 1;
|
|
fi
|
|
|
|
REQUIRES="$ROOT_DIR/Requires"
|
|
|
|
if [ ! -e "$REQUIRES" ]; then
|
|
echo "Unable to find 'Requires' file located at $REQUIRES"
|
|
exit 1
|
|
fi
|
|
|
|
# Filter out comments and empty liens
|
|
DEPS=$(grep -Pv "^\s*#" "$REQUIRES" | grep -Pv '^\s*$')
|
|
echo "$DEPS" | sort -d -f
|