fix installer to work with new upstream location on github
[debian/openrocket] / update-openrocket
index 79c85e07fb159ead3d4692a486dbf4e1f370ca54..0e908d83291d9ba8be311c7ff3e9d1f88cf8a9bd 100755 (executable)
@@ -122,16 +122,16 @@ wgetprogress=' -v --progress=dot:default '
 
 get_installed_version() {
 
-       installed=`unzip -p /usr/lib/openrocket/*.jar ReleaseNotes | head -1 | awk '{ print $2 }'`
+       installed=`unzip -p /usr/lib/openrocket/*.jar build.properties | grep build.version= | awk -F\= '{ print $2 }'`
 }
 
 get_download_url() {
-       url=`wget -qO - http://openrocket.sourceforge.net | grep https | grep download | awk -F\" '{ print $4 }'`
+       url=`wget --no-check-certificate -qO - https://openrocket.info | grep https | grep download | awk '{ print $5 }' | grep https | sed -e 's/href=\"//g' -e 's/\"//g'`
 }
 
 get_upstream_version() {
        get_download_url
-       upstream=`echo $url | awk -F/ '{ print $8 }'`
+       upstream=`echo $url | awk -F/ '{ print $8 }' | sed -e 's/release-//g'`
 }
 
 case "$ACTION" in
@@ -169,7 +169,7 @@ case "$ACTION" in
                        rm -f $targetdir/*.jar
 
                        [ "$verbose" != "yes" ] || echo "moving download to $targetdir ..."
-                       mv -f download $targetdir/OpenRocket-$upstream.jar
+                       mv -f OpenRocket-$upstream.jar $targetdir/OpenRocket-$upstream.jar
 
                        [ "$verbose" != "yes" ] || ( get_installed_version && echo "create /usr/bin/openrocket wrapper" )