diff --git a/play.d/freeplane.sh b/play.d/freeplane.sh
old mode 100644
new mode 100755
index d376e5b1282c2ecf92e9e65d0422c4491ff3b135..63b47f8a526a39f4eccaabb806b20f95762a4566
--- a/play.d/freeplane.sh
+++ b/play.d/freeplane.sh
@@ -2,15 +2,14 @@
 
 PKGNAME=freeplane
 SUPPORTEDARCHES="x86_64 x86"
+VERSION="$2"
 DESCRIPTION="FreePlane from the official site"
 URL="http://freeplane.sourceforge.net"
 
 . $(dirname $0)/common.sh
 
-PKGURL="https://nav.dl.sourceforge.net/project/freeplane/freeplane%20stable/freeplane_1.11.2~upstream-1_all.deb"
+[ "$VERSION" = "*" ] && VERSION="$(eget -O- https://sourceforge.net/projects/$PKGNAME/best_release.json | sed -e 's|.*freeplane_bin-||g' -e 's|\.zip.*||')"
 
-if [ "$(epm print info -s)" = "alt" ] ; then
-    repack="--repack"
-fi
+PKGURL="https://nav.dl.sourceforge.net/project/freeplane/freeplane%20stable/freeplane_$VERSION~upstream-1_all.deb"
 
-epm install $repack "$PKGURL"
+epm install "$PKGURL"
diff --git a/repack.d/freeplane.sh b/repack.d/freeplane.sh
new file mode 100755
index 0000000000000000000000000000000000000000..5b7d06aea466011639c1cc7a9e5395733526a26c
--- /dev/null
+++ b/repack.d/freeplane.sh
@@ -0,0 +1,17 @@
+#!/bin/sh -x
+# It will run with two args: buildroot spec
+BUILDROOT="$1"
+SPEC="$2"
+
+. $(dirname $0)/common.sh
+
+subst '1iAutoReq:no' $SPEC
+subst '1iAutoProv:no' $SPEC
+
+move_to_opt
+ln -sf $PRODUCTDIR/$PRODUCT.sh usr/bin/$PRODUCT
+fix_desktop_file "/usr/bin/freeplane/$PRODUCT"
+
+remove_dir /usr/lib/mime
+
+add_requires java-openjdk