diff --git a/.gitignore b/.gitignore
index 382f7c07cfc68672dbbb1df883e6f50a52466d56..dbbe22c9f9ed5f0f4db646793f34e4aef4aefc4d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@ dist
 
 *.log
 *.tgz
+*.AppImage
diff --git a/appimage.sh b/appimage.sh
new file mode 100755
index 0000000000000000000000000000000000000000..a29370bceb65ed444ea8e76f661b5d61841b9431
--- /dev/null
+++ b/appimage.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+YARN=${YARN:-yarnpkg}
+
+[ ! -d dist ] && mkdir dist
+
+# DL the appimagetool
+URL_APPIMAGETOOL="https://github.com/probonopd/AppImageKit/releases/download/continuous/appimagetool-`arch`.AppImage"
+APPIMAGETOOL="dist/appimagetool-`arch`.AppImage"
+WGET=`which wget 2>/dev/null`
+[ $? -ne 0 ] && exit 1
+echo "wget: $WGET"
+[ -e "$APPIMAGETOOL" ] || { wget "$URL_APPIMAGETOOL" -O "$APPIMAGETOOL" || exit 1; }
+chmod +x "$APPIMAGETOOL"
+
+# Build initial AppImage
+rm -rf dist/squashfs-root dist/Amadeus dist/[aA]madeus-*.AppImage dist/*.fs
+
+$YARN dist
+
+[ ! -f dist/lektord-`arch`.AppImage ] && { cp "$(which lektord-`arch`.AppImage)" dist/ || exit 1; }
+
+# Extract AppImages
+(cd dist && ./lektord-`arch`.AppImage --appimage-extract && mv squashfs-root lektord.fs)
+(cd dist && ./amadeus-?.?.?.AppImage --appimage-extract && mv squashfs-root amadeus.fs)
+
+cp -rf dist/amadeus.fs/* dist/lektord.fs/
+rm -rf dist/amadeus.fs
+mv dist/lektord.fs dist/Amadeus
+
+# Clean and setup
+(cd dist/Amadeus/usr/ && ln -s bin sbin)
+(cd dist/Amadeus && rm lektor* AppRun.wrapped)
+
+# Package
+$APPIMAGETOOL dist/Amadeus
diff --git a/package.json b/package.json
index 48e99f8eb694d99ddce3827be573d7dc73829045..f6bdfefb89ca355a648e93ae28fa8a8c1f82adf0 100644
--- a/package.json
+++ b/package.json
@@ -13,13 +13,8 @@
     "license": "ISC",
     "scripts": {
         "start": "electron .",
-        "pack": "electron-builder",
-
-        "linux-dist": "yarn pack && yarn linux-extract-clean && yarn linux-extract-lektor && yarn linux-extract-amadeus && yarn linux-extract-links",
-        "linux-extract-links": "cd dist/squashfs-root/usr && ln -s bin sbin; cd ../../..",
-        "linux-extract-clean": "cd dist && rm -rf squashfs-root; cd ..",
-        "linux-extract-lektor": "cd dist && ./lektord-`arch`.AppImage --appimage-extract; cd ..",
-        "linux-extract-amadeus": "cd dist && ./amadeus*.AppImage --appimage-extract; cd .."
+        "dist": "electron-builder",
+        "linux-dist": "./appimage.sh"
     },
     "dependencies": {
         "ejs": "^3.1.5",