aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2013-04-20 21:26:52 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2013-04-20 21:26:52 +0200
commit875716dc48cd5c485d2342c9e5bb1d461bc64b6d (patch)
treee8429406bfb43f593008375b673c6669c72f32f2 /bin
parent32826f3c989e63f53510a9bdccd1855a9ae00636 (diff)
downloadapp.sh-875716dc48cd5c485d2342c9e5bb1d461bc64b6d.tar.gz
app.sh-875716dc48cd5c485d2342c9e5bb1d461bc64b6d.tar.bz2
app.sh-875716dc48cd5c485d2342c9e5bb1d461bc64b6d.tar.xz
app.sh-875716dc48cd5c485d2342c9e5bb1d461bc64b6d.zip
o Making the resolvers use app.resolved_version instead of app.version.
o Making set-version update app.version.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/app-init12
-rwxr-xr-xbin/app-upgrade40
2 files changed, 46 insertions, 6 deletions
diff --git a/bin/app-init b/bin/app-init
index c59ba77..8e571e8 100755
--- a/bin/app-init
+++ b/bin/app-init
@@ -40,7 +40,7 @@ then
fatal "Already initialized: $dir" 2>&1
fi
-resolver=`grep_path "/app-resolver-$resolver_name$" "$PATH" | head -n 1`
+resolver=`find_resolver "$resolver_name"`
if [ -z "$resolver" ]
then
@@ -61,18 +61,18 @@ app-conf set app.resolver "$resolver_name"
"$resolver" init "$@"
"$resolver" resolve-version
-version=`app-conf get app.version`
+resolved_version=`app-conf get app.resolved_version`
-if [[ $version == "" ]]
+if [[ $resolved_version == "" ]]
then
echo "Unable to resolve version" 2>&1
exit
fi
-echo "Resolved version to $version"
+echo "Resolved version to $resolved_version"
-"$resolver" download-version -v "$version" -f .app/latest.zip
+"$resolver" download-version -v "$resolved_version" -f .app/latest.zip
-app-install-file -v "$version" -f .app/latest.zip
+app-install-file -v "$resolved_version" -f .app/latest.zip
ok=yes
diff --git a/bin/app-upgrade b/bin/app-upgrade
new file mode 100755
index 0000000..2ca84e0
--- /dev/null
+++ b/bin/app-upgrade
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+set -e
+set -u
+
+APPSH_HOME=$(cd $(dirname "$0")/.. && pwd)
+
+. $APPSH_HOME/lib/common
+# HEADER END
+
+usage_text() {
+ echo "usage: $usage_app"
+}
+
+if [ $# != 0 ]
+then
+ usage
+fi
+
+assert_is_app
+
+resolver_name=`app-conf get app.resolver`
+resolver=`find_resolver "$resolver_name"`
+
+old_version=`app-conf get app.version`
+echo "Resolving version $old_version"
+"$resolver" resolve-version
+new_version=`app-conf get app.version`
+
+if [[ $new_version == $old_version ]]
+then
+ echo "No new version available" 2>&1
+ exit
+fi
+
+echo "Resolved version to $new_version"
+
+"$resolver" download-version -v "$new_version" -f .app/latest.zip
+
+app-install-file -v "$new_version" -f .app/latest.zip