aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/app-foreach-app23
-rwxr-xr-xbin/app-init30
-rwxr-xr-xbin/app-ls-apps27
3 files changed, 77 insertions, 3 deletions
diff --git a/bin/app-foreach-app b/bin/app-foreach-app
new file mode 100755
index 0000000..5b5b108
--- /dev/null
+++ b/bin/app-foreach-app
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+set -e
+set -u
+
+APPSH_HOME=$(cd $(dirname "$0")/.. && pwd)
+
+. $APPSH_HOME/lib/common
+# HEADER END
+
+usage_text() {
+ echo "usage: $usage_app [args]"
+}
+
+IFS=" "
+app-ls-apps | while read app
+do
+ unset IFS
+ (cd $app; "$@") | while read line
+ do
+ echo "$app: $line"
+ done
+done
diff --git a/bin/app-init b/bin/app-init
index fb4f7cd..534a876 100755
--- a/bin/app-init
+++ b/bin/app-init
@@ -13,7 +13,9 @@ usage_text() {
}
dir=
-while getopts "d:" opt
+prepend_config=
+append_config=
+while getopts "d:C:c:" opt
do
case $opt in
d)
@@ -21,6 +23,24 @@ do
shift 2
OPTIND=1
;;
+ C)
+ prepend_config=$OPTARG
+ if [[ ! prepend_config =~ ^/ ]]
+ then
+ prepend_config="`pwd`/$prepend_config"
+ fi
+ shift 2
+ OPTIND=1
+ ;;
+ c)
+ append_config=$OPTARG
+ if [[ ! append_config =~ ^/ ]]
+ then
+ append_config="`pwd`/$append_config"
+ fi
+ shift 2
+ OPTIND=1
+ ;;
esac
done
@@ -52,7 +72,7 @@ fi
mkdir -p -- "$dir" "$dir/.app"
ok=no
-clean_dir=`cd "$dir">/dev/null; pwd`
+clean_dir=`cd "$dir" && pwd`
trap '[[ $ok == yes ]] || rm -rf "$clean_dir"' EXIT
cd "$dir"
@@ -74,6 +94,10 @@ echo "Resolved version to $resolved_version"
"$resolver" download-version -v "$resolved_version" -f .app/latest.zip
-app-install-file -v "$resolved_version" -f .app/latest.zip
+app-install-file \
+ -v "$resolved_version" \
+ ${prepend_config:+-C "$prepend_config"} \
+ ${append_config:+-c "$append_config"} \
+ -f .app/latest.zip
ok=yes
diff --git a/bin/app-ls-apps b/bin/app-ls-apps
new file mode 100755
index 0000000..4adc274
--- /dev/null
+++ b/bin/app-ls-apps
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+set -e
+set -u
+
+APPSH_HOME=$(cd $(dirname "$0")/.. && pwd)
+
+. $APPSH_HOME/lib/common
+# HEADER END
+
+usage_text() {
+ echo "usage: $usage_app [dir]"
+}
+
+case $# in
+ 0)
+ dir=*
+ ;;
+ 1)
+ dir="$1/*"; shift
+ ;;
+ *)
+ usage
+ ;;
+esac
+
+find $dir -type d -name .app | sed "s,/\.app$,,"