diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2013-11-01 16:24:26 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2013-11-01 19:58:08 +0100 |
commit | ba7820b18c0ee8631505f7a2a764f7222a732d44 (patch) | |
tree | 82bc1d530e1f815e8d8687fa642dd5c84a59c114 /bin | |
parent | 93e2978fbe5582440d79c47b5975659d9cbf701b (diff) | |
download | app.sh-v0.2-dev.tar.gz app.sh-v0.2-dev.tar.bz2 app.sh-v0.2-dev.tar.xz app.sh-v0.2-dev.zip |
bin/app-upgrade: Removing unreachable code. Fixing it so it comparesv0.2-dev
against the currently installed version instead of the last resolved
version which makes it possible to retry installation of the same
version.
libexec/app-install-file: Allowing installation of the same file
twice. Checks if the file has been unpacked earlier or not. Removes
the unpacked version on failure.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/app-upgrade | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/bin/app-upgrade b/bin/app-upgrade index 1a8329a..db40f4e 100755 --- a/bin/app-upgrade +++ b/bin/app-upgrade @@ -19,40 +19,34 @@ fi assert_is_app +version=`app-conf get app.version` +installed_version=`app-conf get app.installed_version` + +# TODO: should this explicitly check for a discrepancy between +# resolved_version and installed_version? This indicates an app that's +# not completely installed. + +# Find the resolver and resolve the version resolver_name=`app-conf get app.resolver` resolver=`find_resolver "$resolver_name"` -old_version=`app-conf get app.resolved_version` -echo "Resolving version $old_version" +echo "Resolving version $version" "$resolver" resolve-version -new_version=`app-conf get app.resolved_version` +resolved_version=`app-conf get app.resolved_version` -if [[ $new_version == $old_version ]] +if [[ $resolved_version == $installed_version ]] then echo "No new version available" 2>&1 exit fi -echo "Resolved version to $new_version" - -if [ "$new_version" = "" ] -then - new_version=`app-conf get app.resolved_version` -fi - -if [ "$new_version" = "" ] +if [ "$resolved_version" = "" ] then fatal "app.resolved_version is not set." fi -installed_version=`app-conf get app.installed_version` - -if [ "$new_version" = "$installed_version" ] -then - echo "$new_version is already installed" - exit 0 -fi +echo "Resolved version to $resolved_version" -"$resolver" download-version -v "$new_version" -f .app/latest.zip +"$resolver" download-version -v "$resolved_version" -f .app/latest.zip -app-install-file -v "$new_version" -f .app/latest.zip +app-install-file -v "$resolved_version" -f .app/latest.zip |