aboutsummaryrefslogtreecommitdiffstats
path: root/kerl
diff options
context:
space:
mode:
Diffstat (limited to 'kerl')
-rwxr-xr-xkerl214
1 files changed, 107 insertions, 107 deletions
diff --git a/kerl b/kerl
index 552b2fb..c7669be 100755
--- a/kerl
+++ b/kerl
@@ -23,11 +23,11 @@
ERLANG_DOWNLOAD_URL=http://www.erlang.org/download
-KERL_BASE_DIR="$HOME/.kerl"
-KERL_CONFIG="$HOME/.kerlrc"
-KERL_DOWNLOAD_DIR="$KERL_BASE_DIR/archives"
-KERL_BUILD_DIR="$KERL_BASE_DIR/builds"
-KERL_GIT_DIR="$KERL_BASE_DIR/gits"
+KERL_BASE_DIR="$HOME"/.kerl
+KERL_CONFIG="$HOME"/.kerlrc
+KERL_DOWNLOAD_DIR="${KERL_BASE_DIR:?}"/archives
+KERL_BUILD_DIR="${KERL_BASE_DIR:?}"/builds
+KERL_GIT_DIR="${KERL_BASE_DIR:?}"/gits
if [ -n "$KERL_CONFIGURE_OPTIONS" ]; then
_KCO="$KERL_CONFIGURE_OPTIONS"
fi
@@ -56,10 +56,10 @@ KERL_SASL_STARTUP=
KERL_INSTALL_MANPAGES=
# ensure the base dir exsists
-mkdir -p "$KERL_BASE_DIR"
+mkdir -p "$KERL_BASE_DIR" || exit 1
# source the config file if available
-if [ -f "$KERL_CONFIG" ]; then . "$KERL_CONFIG"; fi
+if [ -f "$KERL_CONFIG" ]; then source "$KERL_CONFIG"; fi
if [ -n "$_KCO" ]; then
KERL_CONFIGURE_OPTIONS="$_KCO"
@@ -89,7 +89,7 @@ else
INSTALL_OPT=-sasl
fi
-KERL_SYSTEM=`uname -s`
+KERL_SYSTEM=$(uname -s)
case "$KERL_SYSTEM" in
Darwin|FreeBSD|OpenBSD)
MD5SUM="openssl md5"
@@ -107,7 +107,7 @@ usage()
{
echo "kerl: build and install Erlang/OTP"
echo "usage: $0 <command> [options ...]"
- echo "\n <command> Command to be executed\n"
+ printf "\n <command> Command to be executed\n\n"
echo "Valid commands are:"
echo " build Build specified release or git repository"
echo " install Install the specified release at the given location"
@@ -135,21 +135,21 @@ get_releases()
update_checksum_file()
{
echo "Getting the checksum file from erlang.org..."
- curl -L $ERLANG_DOWNLOAD_URL/MD5 > "$KERL_DOWNLOAD_DIR/MD5" || exit 1
+ curl -L $ERLANG_DOWNLOAD_URL/MD5 > "$KERL_DOWNLOAD_DIR"/MD5 || exit 1
}
ensure_checksum_file()
{
- if [ ! -f "$KERL_DOWNLOAD_DIR/MD5" ]; then
+ if [ ! -f "$KERL_DOWNLOAD_DIR"/MD5 ]; then
update_checksum_file
fi
}
check_releases()
{
- if [ ! -f "$KERL_BASE_DIR/otp_releases" ]; then
+ if [ ! -f "$KERL_BASE_DIR"/otp_releases ]; then
echo "Getting the available releases from erlang.org..."
- get_releases > "$KERL_BASE_DIR/otp_releases"
+ get_releases > "$KERL_BASE_DIR"/otp_releases
fi
}
@@ -169,17 +169,17 @@ lion_support() {
is_valid_release()
{
check_releases
- for rel in `cat $KERL_BASE_DIR/otp_releases`; do
+ while read -r rel; do
if [ "$1" = "$rel" ]; then
return 0
fi
- done
+ done < "$KERL_BASE_DIR"/otp_releases
return 1
}
assert_valid_release()
{
- if ! is_valid_release $1; then
+ if ! is_valid_release "$1"; then
echo "$1 is not a valid Erlang/OTP release"
exit 1
fi
@@ -188,15 +188,15 @@ assert_valid_release()
get_release_from_name()
{
- if [ -f "$KERL_BASE_DIR/otp_builds" ]; then
- for l in `cat "$KERL_BASE_DIR/otp_builds"`; do
- rel=`echo $l | cut -d "," -f 1`
- name=`echo $l | cut -d "," -f 2`
+ if [ -f "$KERL_BASE_DIR"/otp_builds ]; then
+ while read -r l; do
+ rel=$(echo "$l" | cut -d "," -f 1)
+ name=$(echo "$l" | cut -d "," -f 2)
if [ "$name" = "$1" ]; then
echo "$rel"
return 0
fi
- done
+ done < "$KERL_BASE_DIR"/otp_builds
fi
return 1
}
@@ -204,18 +204,18 @@ get_release_from_name()
get_newest_valid_release()
{
check_releases
- for rel in `cat $KERL_BASE_DIR/otp_releases | tail -1`; do
+ while read -r rel; do
if [ ! -z "$rel" ]; then
echo "$rel"
return 0
fi
- done
+ done < "$KERL_BASE_DIR"/otp_releases | tail -1
return 1
}
is_valid_installation()
{
- if [ -f "$1/activate" ]; then
+ if [ -f "$1"/activate ]; then
return 0
fi
return 1
@@ -223,7 +223,7 @@ is_valid_installation()
assert_valid_installation()
{
- if ! is_valid_installation $1; then
+ if ! is_valid_installation "$1"; then
echo "$1 is not a kerl-managed Erlang/OTP installation"
exit 1
fi
@@ -232,24 +232,24 @@ assert_valid_installation()
assert_build_name_unused()
{
- if [ -f "$KERL_BASE_DIR/otp_builds" ]; then
- for l in `cat "$KERL_BASE_DIR/otp_builds"`; do
- name=`echo $l | cut -d "," -f 2`
+ if [ -f "$KERL_BASE_DIR"/otp_builds ]; then
+ while read -r l; do
+ name=$(echo "$l" | cut -d "," -f 2)
if [ "$name" = "$1" ]; then
echo "There's already a build named $1"
exit 1
fi
- done
+ done < "$KERL_BASE_DIR"/otp_builds
fi
}
do_git_build()
{
- assert_build_name_unused $3
+ assert_build_name_unused "$3"
- GIT=`echo -n "$1" | $MD5SUM | cut -d " " -f $MD5SUM_FIELD`
+ GIT=$(echo -n "$1" | $MD5SUM | cut -d ' ' -f $MD5SUM_FIELD)
mkdir -p "$KERL_GIT_DIR"
- cd "$KERL_GIT_DIR"
+ cd "$KERL_GIT_DIR" || exit 1
echo "Checking Erlang/OTP git repository from $1..."
if [ ! -d "$GIT" ]; then
git clone -q --mirror "$1" "$GIT" > /dev/null 2>&1
@@ -258,37 +258,37 @@ do_git_build()
exit 1
fi
fi
- cd "$GIT"
+ cd "$GIT" || exit 1
git remote update --prune > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Error updating remote git repository"
exit 1
fi
- rm -Rf "$KERL_BUILD_DIR/$3"
+ rm -Rf "${KERL_BUILD_DIR:?}/$3"
mkdir -p "$KERL_BUILD_DIR/$3"
- cd "$KERL_BUILD_DIR/$3"
+ cd "$KERL_BUILD_DIR/$3" || exit 1
git clone -l "$KERL_GIT_DIR/$GIT" otp_src_git > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Error cloning local git repository"
exit 1
fi
- cd otp_src_git
- git checkout $2 > /dev/null 2>&1
+ cd otp_src_git || exit 1
+ git checkout "$2" > /dev/null 2>&1
if [ $? -ne 0 ]; then
- git checkout -b $2 $2 > /dev/null 2>&1
+ git checkout -b "$2" "$2" > /dev/null 2>&1
fi
if [ $? -ne 0 ]; then
echo "Couldn't checkout specified version"
- rm -Rf "$KERL_BUILD_DIR/$3"
+ rm -Rf "${KERL_BUILD_DIR:?}/$3"
exit 1
fi
if [ ! -x otp_build ]; then
echo "Not a valid Erlang/OTP repository"
- rm -Rf "$KERL_BUILD_DIR/$3"
+ rm -Rf "${KERL_BUILD_DIR:?}/$3"
exit 1
fi
- LOGFILE="$KERL_BUILD_DIR/$3/otp_build.log"
+ LOGFILE="$KERL_BUILD_DIR/$3"/otp_build.log
echo "Building Erlang/OTP $3 from git, please wait..."
./otp_build autoconf $KERL_CONFIGURE_OPTIONS > "$LOGFILE" 2>&1 && \
./otp_build configure $KERL_CONFIGURE_OPTIONS > "$LOGFILE" 2>&1
@@ -299,7 +299,7 @@ do_git_build()
if [ -n "$KERL_CONFIGURE_APPLICATIONS" ]; then
find ./lib -maxdepth 1 -type d -exec touch -f {}/SKIP \;
for i in $KERL_CONFIGURE_APPLICATIONS; do
- rm ./lib/$i/SKIP
+ rm ./lib/"$i"/SKIP
if [ $? -ne 0 ]; then
echo "Couldn't prepare '$i' application for building"
exit 1
@@ -308,7 +308,7 @@ do_git_build()
fi
if [ -n "$KERL_CONFIGURE_DISABLE_APPLICATIONS" ]; then
for i in $KERL_CONFIGURE_DISABLE_APPLICATIONS; do
- touch -f ./lib/$i/SKIP
+ touch -f ./lib/"$i"/SKIP
if [ $? -ne 0 ]; then
echo "Couldn't disable '$i' application for building"
exit 1
@@ -321,9 +321,9 @@ do_git_build()
exit 1
fi
rm -f "$LOGFILE"
- ./otp_build release -a "$KERL_BUILD_DIR/$3/release_git" > /dev/null 2>&1
- cd "$KERL_BUILD_DIR/$3/release_git"
- ./Install $INSTALL_OPT "$KERL_BUILD_DIR/$3/release_git" > /dev/null 2>&1
+ ./otp_build release -a "$KERL_BUILD_DIR/$3"/release_git > /dev/null 2>&1
+ cd "$KERL_BUILD_DIR/$3"/release_git || exit 1
+ ./Install $INSTALL_OPT "$KERL_BUILD_DIR/$3"/release_git > /dev/null 2>&1
echo "Erlang/OTP $3 from git has been successfully built"
list_add builds "git,$3"
}
@@ -332,11 +332,11 @@ do_build()
{
case "$KERL_SYSTEM" in
Darwin)
- if [ `gcc --version 2>/dev/null | grep -i llvm | wc -l` = "1" ]; then
- if lion_support $1; then
+ if [ "$(gcc --version 2>/dev/null | grep -i -c llvm)" = "1" ]; then
+ if lion_support "$1"; then
KERL_CONFIGURE_OPTIONS="CFLAGS=-O0 $KERL_CONFIGURE_OPTIONS"
else
- if [ -x "`which gcc-4.2`" ]; then
+ if [ -x "$(which gcc-4.2)" ]; then
KERL_CONFIGURE_OPTIONS="CC=gcc-4.2 $KERL_CONFIGURE_OPTIONS"
else
KERL_CONFIGURE_OPTIONS="CC=llvm-gcc-4.2 CFLAGS=-O0 $KERL_CONFIGURE_OPTIONS"
@@ -348,8 +348,8 @@ do_build()
;;
esac
- assert_valid_release $1
- assert_build_name_unused $2
+ assert_valid_release "$1"
+ assert_build_name_unused "$2"
FILENAME=otp_src_$1.tar.gz
download "$FILENAME"
@@ -359,12 +359,12 @@ do_build()
UNTARDIRNAME="$KERL_BUILD_DIR/$2/otp_src_$1-kerluntar-$$"
rm -rf "$UNTARDIRNAME"
mkdir -p "$UNTARDIRNAME"
- (cd "$UNTARDIRNAME" && tar xfz "$KERL_DOWNLOAD_DIR/$FILENAME" && mv * "$KERL_BUILD_DIR/$2/otp_src_$1")
+ (cd "$UNTARDIRNAME" && tar xfz "$KERL_DOWNLOAD_DIR/$FILENAME" && mv ./* "$KERL_BUILD_DIR/$2/otp_src_$1")
rm -rf "$UNTARDIRNAME"
fi
echo "Building Erlang/OTP $1 ($2), please wait..."
ERL_TOP="$KERL_BUILD_DIR/$2/otp_src_$1"
- cd "$ERL_TOP"
+ cd "$ERL_TOP" || exit 1
LOGFILE="$KERL_BUILD_DIR/$2/otp_build_$1.log"
if [ -n "$KERL_USE_AUTOCONF" ]; then
./otp_build autoconf $KERL_CONFIGURE_OPTIONS > "$LOGFILE" 2>&1 && \
@@ -381,7 +381,7 @@ do_build()
if [ -n "$KERL_CONFIGURE_APPLICATIONS" ]; then
find ./lib -maxdepth 1 -type d -exec touch -f {}/SKIP \;
for i in $KERL_CONFIGURE_APPLICATIONS; do
- rm ./lib/$i/SKIP
+ rm ./lib/"$i"/SKIP
if [ $? -ne 0 ]; then
echo "Couldn't prepare '$i' application for building"
list_remove builds "$1 $2"
@@ -391,7 +391,7 @@ do_build()
fi
if [ -n "$KERL_CONFIGURE_DISABLE_APPLICATIONS" ]; then
for i in $KERL_CONFIGURE_DISABLE_APPLICATIONS; do
- touch -f ./lib/$i/SKIP
+ touch -f ./lib/"$i"/SKIP
if [ $? -ne 0 ]; then
echo "Couldn't disable '$i' application for building"
exit 1
@@ -406,7 +406,7 @@ do_build()
fi
rm -f "$LOGFILE"
ERL_TOP="$ERL_TOP" ./otp_build release -a "$KERL_BUILD_DIR/$2/release_$1" > /dev/null 2>&1
- cd "$KERL_BUILD_DIR/$2/release_$1"
+ cd "$KERL_BUILD_DIR/$2/release_$1" || exit 1
./Install $INSTALL_OPT "$KERL_BUILD_DIR/$2/release_$1" > /dev/null 2>&1
echo "Erlang/OTP $1 ($2) has been successfully built"
list_add builds "$1,$2"
@@ -414,7 +414,7 @@ do_build()
do_install()
{
- rel=`get_release_from_name $1`
+ rel=$(get_release_from_name "$1")
if [ $? -ne 0 ]; then
echo "No build named $1"
exit 1
@@ -424,10 +424,10 @@ do_install()
echo "Destination is not a directory"
exit 1
fi
- absdir=`cd "$2" && pwd`
+ absdir=$(cd "$2" && pwd)
echo "Installing Erlang/OTP $rel ($1) in $absdir..."
ERL_TOP="$KERL_BUILD_DIR/$1/otp_src_$rel"
- cd "$ERL_TOP"
+ cd "$ERL_TOP" || exit 1
ERL_TOP="$ERL_TOP" ./otp_build release -a "$absdir" > /dev/null 2>&1 &&
cd "$absdir" && ./Install $INSTALL_OPT "$absdir" > /dev/null 2>&1
if [ $? -ne 0 ]; then
@@ -435,7 +435,7 @@ do_install()
exit 1
fi
list_add installations "$1 $absdir";
- cat <<ACTIVATE > "$absdir/activate"
+ cat <<ACTIVATE > "$absdir"/activate
# credits to virtualenv
kerl_deactivate()
{
@@ -512,7 +512,7 @@ ACTIVATE
tar -C "$absdir/html" -xzf "$KERL_DOWNLOAD_DIR/$FILENAME")
fi
else
- rel=`get_newest_valid_release`
+ rel=$(get_newest_valid_release)
if [ $? -ne 0 ]; then
echo "No newest valid release"
exit 1
@@ -548,18 +548,18 @@ do_deploy()
echo "No host given"
exit 1
fi
- host=$1
+ host="$1"
assert_valid_installation "$2"
- rel=`get_name_from_install_path "$2"`
- path=$2
- remotepath=$path
+ rel="$(get_name_from_install_path "$2")"
+ path="$2"
+ remotepath="$path"
if [ ! -z "$3" ]; then
- remotepath=$3
+ remotepath="$3"
fi
- ssh $KERL_DEPLOY_SSH_OPTIONS $host true > /dev/null 2>&1
+ ssh $KERL_DEPLOY_SSH_OPTIONS "$host" true > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Couldn't ssh to $host"
exit 1
@@ -573,13 +573,13 @@ do_deploy()
exit 1
fi
- ssh $KERL_DEPLOY_SSH_OPTIONS $host "cd \"$remotepath\" && env ERL_TOP=\`pwd\` ./Install $INSTALL_OPT \`pwd\` > /dev/null 2>&1"
+ ssh $KERL_DEPLOY_SSH_OPTIONS "$host" "cd \"$remotepath\" && env ERL_TOP=\"\`pwd\`\" ./Install $INSTALL_OPT \"\`pwd\`\" > /dev/null 2>&1"
if [ $? -ne 0 ]; then
echo "Couldn't install Erlang/OTP $rel to $host ($remotepath)"
exit 1
fi
- ssh $KERL_DEPLOY_SSH_OPTIONS $host "cd \"$remotepath\" && sed -i -e \"s#$path#\`pwd\`#g\" activate"
+ ssh $KERL_DEPLOY_SSH_OPTIONS "$host" "cd \"$remotepath\" && sed -i -e \"s#$path#\"\`pwd\`\"#g\" activate"
if [ $? -ne 0 ]; then
echo "Couldn't completely install Erlang/OTP $rel to $host ($remotepath)"
exit 1
@@ -593,8 +593,8 @@ do_deploy()
list_print()
{
- if [ -f $KERL_BASE_DIR/otp_$1 ]; then
- if [ "`cat "$KERL_BASE_DIR/otp_$1" | wc -l`" != "0" ]; then
+ if [ -f "$KERL_BASE_DIR/otp_$1" ]; then
+ if [ "$(wc -l "$KERL_BASE_DIR/otp_$1")" != "0" ]; then
if [ -z "$2" ]; then
cat "$KERL_BASE_DIR/otp_$1"
else
@@ -609,11 +609,11 @@ list_print()
list_add()
{
if [ -f "$KERL_BASE_DIR/otp_$1" ]; then
- for l in `cat "$KERL_BASE_DIR/otp_$1"`; do
+ while read -r l; do
if [ "$l" = "$2" ]; then
return 1
fi
- done
+ done < "$KERL_BASE_DIR/otp_$1"
echo "$2" >> "$KERL_BASE_DIR/otp_$1"
else
echo "$2" > "$KERL_BASE_DIR/otp_$1"
@@ -630,7 +630,7 @@ list_remove()
list_has()
{
if [ -f "$KERL_BASE_DIR/otp_$1" ]; then
- grep $2 "$KERL_BASE_DIR/otp_$1" > /dev/null 2>&1 && return 0
+ grep "$2" "$KERL_BASE_DIR/otp_$1" > /dev/null 2>&1 && return 0
fi
return 1
}
@@ -658,25 +658,25 @@ update_usage()
get_active_path()
{
if [ -n "$_KERL_ACTIVE_DIR" ]; then
- echo $_KERL_ACTIVE_DIR
+ echo "$_KERL_ACTIVE_DIR"
fi
return 0
}
get_name_from_install_path()
{
- if [ -f "$KERL_BASE_DIR/otp_installations" ]; then
- grep -F "$1" "$KERL_BASE_DIR/otp_installations" | cut -d ' ' -f 1
+ if [ -f "$KERL_BASE_DIR"/otp_installations ]; then
+ grep -F "$1" "$KERL_BASE_DIR"/otp_installations | cut -d ' ' -f 1
fi
return 0
}
do_active()
{
- ACTIVE_PATH=`get_active_path`
+ ACTIVE_PATH="$(get_active_path)"
if [ -n "$ACTIVE_PATH" ]; then
echo "The current active installation is:"
- echo $ACTIVE_PATH
+ echo "$ACTIVE_PATH"
return 0
else
echo "No Erlang/OTP kerl installation is currently active"
@@ -694,8 +694,8 @@ download()
fi
ensure_checksum_file
echo "Verifying archive checksum..."
- SUM=`$MD5SUM "$KERL_DOWNLOAD_DIR/$1" | cut -d " " -f $MD5SUM_FIELD`
- ORIG_SUM=`grep -F "$1" "$KERL_DOWNLOAD_DIR/MD5" | cut -d " " -f 2`
+ SUM="$($MD5SUM "$KERL_DOWNLOAD_DIR/$1" | cut -d ' ' -f $MD5SUM_FIELD)"
+ ORIG_SUM="$(grep -F "$1" "$KERL_DOWNLOAD_DIR"/MD5 | cut -d ' ' -f 2)"
if [ "$SUM" != "$ORIG_SUM" ]; then
echo "Checksum error, check the files in $KERL_DOWNLOAD_DIR"
exit 1
@@ -710,13 +710,13 @@ case "$1" in
echo "usage: $0 $1 $2 <git_url> <git_version> <build_name>"
exit 1
fi
- do_git_build $3 $4 $5
+ do_git_build "$3" "$4" "$5"
else
if [ $# -lt 3 ]; then
echo "usage: $0 $1 <release> <build_name>"
exit 1
fi
- do_build $2 $3
+ do_build "$2" "$3"
fi
;;
install)
@@ -729,7 +729,7 @@ case "$1" in
echo "Refusing to install in $HOME, this is a bad idea."
exit 1
else
- do_install $2 "$3"
+ do_install "$2" "$3"
fi
else
if [ -z "$KERL_DEFAULT_INSTALL_DIR" ]; then
@@ -737,10 +737,10 @@ case "$1" in
echo "Refusing to install in $HOME, this is a bad idea."
exit 1
else
- do_install $2 .
+ do_install "$2" .
fi
else
- do_install $2 "$KERL_DEFAULT_INSTALL_DIR/$2"
+ do_install "$2" "$KERL_DEFAULT_INSTALL_DIR/$2"
fi
fi
;;
@@ -750,12 +750,12 @@ case "$1" in
exit 1
fi
if [ $# -eq 4 ]; then
- do_deploy $2 "$3" "$4"
+ do_deploy "$2" "$3" "$4"
else
if [ $# -eq 3 ]; then
- do_deploy $2 "$3"
+ do_deploy "$2" "$3"
else
- do_deploy $2 .
+ do_deploy "$2" '.'
fi
fi
;;
@@ -766,7 +766,7 @@ case "$1" in
fi
case "$2" in
releases)
- rm -f "$KERL_BASE_DIR/otp_releases"
+ rm -f "${KERL_BASE_DIR:?}"/otp_releases
check_releases
echo "The available releases are:"
list_print releases spaces
@@ -785,14 +785,14 @@ case "$1" in
case "$2" in
releases)
check_releases
- list_print $2 space
- echo "Run \"$0 update releases\" to update this list from erlang.org"
+ list_print "$2" space
+ echo "Run '$0 update releases' to update this list from erlang.org"
;;
builds)
- list_print $2
+ list_print "$2"
;;
installations)
- list_print $2
+ list_print "$2"
;;
*)
echo "Cannot list $2"
@@ -808,23 +808,23 @@ case "$1" in
fi
case "$2" in
build)
- rel=`get_release_from_name $3`
- if [ -d "$KERL_BUILD_DIR/$3" ]; then
- rm -Rf "$KERL_BUILD_DIR/$3"
+ rel="$(get_release_from_name "$3")"
+ if [ -d "${KERL_BUILD_DIR:?}/$3" ]; then
+ rm -Rf "${KERL_BUILD_DIR:?}/$3"
else
if [ -z "$rel" ]; then
echo "No build named $3"
exit 1
fi
fi
- list_remove $2s "$rel,$3"
+ list_remove "$2"s "$rel,$3"
echo "The $3 build has been deleted"
;;
installation)
assert_valid_installation "$3"
rm -Rf "$3"
- escaped=`echo "$3" | sed $SED_OPT -e 's#/$##' -e 's#\/#\\\/#g'`
- list_remove $2s "$escaped"
+ escaped="$(echo "$3" | sed $SED_OPT -e 's#/$##' -e 's#\/#\\\/#g')"
+ list_remove "$2"s "$escaped"
echo "The installation in $3 has been deleted"
;;
*)
@@ -854,11 +854,11 @@ case "$1" in
if [ -n "$2" ]; then
FMT="$2"
fi
- ACTIVE_PATH=`get_active_path`
+ ACTIVE_PATH="$(get_active_path)"
if [ -n "$ACTIVE_PATH" ]; then
- ACTIVE_NAME=`get_name_from_install_path "$ACTIVE_PATH"`
+ ACTIVE_NAME="$(get_name_from_install_path "$ACTIVE_PATH")"
if [ -z "$ACTIVE_NAME" ]; then
- VALUE="`basename "$ACTIVE_PATH"`*"
+ VALUE="$(basename "$ACTIVE_PATH")*"
else
VALUE="$ACTIVE_NAME"
fi
@@ -874,14 +874,14 @@ case "$1" in
case "$2" in
all)
echo "Cleaning up compilation products for ALL builds"
- rm -rf $KERL_BUILD_DIR/*
- rm -rf $KERL_DOWNLOAD_DIR/*
- rm -rf $KERL_GIT_DIR/*
+ rm -rf "${KERL_BUILD_DIR:?}"/*
+ rm -rf "${KERL_DOWNLOAD_DIR:?}"/*
+ rm -rf "${KERL_GIT_DIR:?}"/*
echo "Cleaned up all compilation products under $KERL_BUILD_DIR"
;;
*)
echo "Cleaning up compilation products for $3"
- rm -rf $KERL_BUILD_DIR/$3
+ rm -rf "${KERL_BUILD_DIR:?}/$3"
echo "Cleaned up all compilation products under $KERL_BUILD_DIR"
;;
esac