summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rwxr-xr-xlib/common35
1 files changed, 30 insertions, 5 deletions
diff --git a/lib/common b/lib/common
index 2214480..f44dde8 100755
--- a/lib/common
+++ b/lib/common
@@ -9,7 +9,17 @@ then
exit 1
fi
-PATH=$APPSH_HOME:$PATH
+#####################################################################
+# Common init
+
+PATH=$APPSH_HOME:$APPSTORE_HOME:$PATH
+
+# Save for later
+usage_app=${0##*/}
+echo_debug=${echo_debug-no}
+
+#####################################################################
+# Utilities
show_help() {
message=${1-}
@@ -66,13 +76,28 @@ grep_path() {
assert_valid_app_name() {
local app="$1"; shift
- local re="^[a-zA-Z][a-zA-Z0-9]*$"
+ local re="^[a-zA-Z][-_a-zA-Z0-9]*$"
if [[ ! $app =~ $re ]]
then
fatal "Invalid app name: \"$app\""
fi
}
-# Save for later
-usage_app=${0##*/}
-echo_debug=${echo_debug-no}
+#####################################################################
+#
+
+make_absolute() {
+ local name=$1; shift
+ local value=${!name}
+
+ if [[ $value = "." ]]
+ then
+ eval ${name}="$(pwd)"
+ elif [[ -e ${value} ]]
+ then
+ bn=$(basename ${value})
+ path=$(cd ${value}/.. && pwd)
+
+ eval ${name}=${path}/${bn}
+ fi
+}