|
@@ -9,9 +9,9 @@
|
|
# without calling erlang.
|
|
# without calling erlang.
|
|
|
|
|
|
usage() {
|
|
usage() {
|
|
- cat <<EOF
|
|
|
|
|
|
+ cat <<EOF
|
|
Usage:
|
|
Usage:
|
|
- $0 library
|
|
|
|
|
|
+ $0 library
|
|
Look for Erlang's library in TARGET_DIR/usr/lib/erlang/lib.
|
|
Look for Erlang's library in TARGET_DIR/usr/lib/erlang/lib.
|
|
|
|
|
|
If the library is found, it returns the path to the latest version,
|
|
If the library is found, it returns the path to the latest version,
|
|
@@ -24,15 +24,15 @@ EOF
|
|
}
|
|
}
|
|
|
|
|
|
die () {
|
|
die () {
|
|
- echo "$@" >&2
|
|
|
|
- exit 1
|
|
|
|
|
|
+ echo "$@" >&2
|
|
|
|
+ exit 1
|
|
}
|
|
}
|
|
|
|
|
|
if [ $# -ne 1 ]; then
|
|
if [ $# -ne 1 ]; then
|
|
- usage
|
|
|
|
- exit 0
|
|
|
|
|
|
+ usage
|
|
|
|
+ exit 0
|
|
else
|
|
else
|
|
- library="$1"
|
|
|
|
|
|
+ library="$1"
|
|
fi
|
|
fi
|
|
|
|
|
|
target_dir="${TARGET_DIR:-output/target}"
|
|
target_dir="${TARGET_DIR:-output/target}"
|
|
@@ -40,16 +40,17 @@ target_dir="${TARGET_DIR:-output/target}"
|
|
[ -d "$target_dir" ] || die "TARGET_DIR is not a directory. Please \
|
|
[ -d "$target_dir" ] || die "TARGET_DIR is not a directory. Please \
|
|
specify the TARGET_DIR environment variable."
|
|
specify the TARGET_DIR environment variable."
|
|
|
|
|
|
-case "$(ls -1d -- "$target_dir/usr/lib/erlang/lib/$library-"* | wc -l)" in
|
|
|
|
- 0)
|
|
|
|
- echo "not found"
|
|
|
|
- ;;
|
|
|
|
- 1)
|
|
|
|
- echo "$target_dir/usr/lib/erlang/lib/$library-"* \
|
|
|
|
- | sed -e "s,^$target_dir,,"
|
|
|
|
- ;;
|
|
|
|
- *)
|
|
|
|
- die "Several versions of $library have been found. Please \
|
|
|
|
- remove the unused ones."
|
|
|
|
- ;;
|
|
|
|
|
|
+case "$(find "$target_dir/usr/lib/erlang/lib" -maxdepth 1 \
|
|
|
|
+ -name "$library-*" -type d | wc -l)" in
|
|
|
|
+ 0)
|
|
|
|
+ echo "not found"
|
|
|
|
+ ;;
|
|
|
|
+ 1)
|
|
|
|
+ echo "$target_dir/usr/lib/erlang/lib/$library-"* \
|
|
|
|
+ | sed -e "s,^$target_dir,,"
|
|
|
|
+ ;;
|
|
|
|
+ *)
|
|
|
|
+ die "Several versions of $library have been found. Please \
|
|
|
|
+ remove the unused ones."
|
|
|
|
+ ;;
|
|
esac
|
|
esac
|