From 159446b4b5687af00f9e847ef64c95a41bfaeed0 Mon Sep 17 00:00:00 2001 From: develar <develar@gmail.com> Date: Wed, 6 Jul 2016 09:39:26 +0200 Subject: [PATCH] fix(AppImage): use app name as a executable name --- .travis.yml | 2 +- src/targets/appImage.ts | 11 ++++++----- templates/linux/AppRun.sh | 6 ++---- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index c02bd007160..33e26096904 100755 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,7 @@ install: - nvm install $NODE_VERSION - nvm use --delete-prefix $NODE_VERSION - if [[ "$TRAVIS_OS_NAME" == "osx" && "$NODE_VERSION" == "4" ]]; then npm install npm -g ; fi -- npm install --registry http://registry.npmjs.eu +- npm install - npm prune script: diff --git a/src/targets/appImage.ts b/src/targets/appImage.ts index 614103c0a7f..2ed7cfec7ce 100644 --- a/src/targets/appImage.ts +++ b/src/targets/appImage.ts @@ -39,7 +39,7 @@ export default class AppImageTarget extends TargetEx { "-map", appOutDir, "/usr/bin", "-map", path.join(__dirname, "..", "..", "templates", "linux", "AppRun.sh"), `/AppRun`, "-map", await this.desktopEntry, `/${appInfo.name}.desktop`, - "-move", `/usr/bin/${appInfo.productFilename}`, "/usr/bin/app", + "-move", `/usr/bin/${appInfo.productFilename}`, `/usr/bin/${appInfo.name}`, ] for (let [from, to] of (await this.helper.icons)) { args.push("-map", from, `/usr/share/icons/default/${to}`) @@ -51,15 +51,16 @@ export default class AppImageTarget extends TargetEx { } args.push("-map", this.helper.maxIconPath, "/.DirIcon") - // args.push("-zisofs", `level=0:block_size=128k:by_magic=off`, "-chown_r", "0") - // args.push("/", "--", "set_filter_r", "--zisofs", "/") + args.push("-chown_r", "0", "/", "--") + args.push("-zisofs", `level=0:block_size=128k:by_magic=off`) + args.push("set_filter_r", "--zisofs", "/") await exec(process.platform === "darwin" ? path.join(appImagePath, "xorriso") : "xorriso", args) await new BluebirdPromise((resolve, reject) => { const rd = createReadStream(path.join(appImagePath, arch === Arch.ia32 ? "32" : "64", "runtime")) rd.on("error", reject) - const wr = createWriteStream(image) + const wr = createWriteStream(image, {flags: "r+"}) wr.on("error", reject) wr.on("finish", resolve) rd.pipe(wr) @@ -83,6 +84,6 @@ export default class AppImageTarget extends TargetEx { stdio: ["ignore", debug.enabled ? "inherit" : "ignore", "inherit"], }) - packager.dispatchArtifactCreated(image) + packager.dispatchArtifactCreated(`${image}.xz`) } } \ No newline at end of file diff --git a/templates/linux/AppRun.sh b/templates/linux/AppRun.sh index f159dd2bafb..cd2e7dd5bbe 100755 --- a/templates/linux/AppRun.sh +++ b/templates/linux/AppRun.sh @@ -33,8 +33,6 @@ NUMBER_OF_ARGS="$#" # such as desktop integration daemons VENDORPREFIX=appimagekit -BIN="${APPDIR}/usr/bin/app" - trap atexit EXIT # Note that the following handles 0, 1 or more arguments (file paths) @@ -126,6 +124,8 @@ check_dep xdg-desktop-menu DESKTOP_FILE=$(find "$APPDIR" -maxdepth 1 -name "*.desktop" | head -n 1) DESKTOP_FILE_NAME=$(basename "${DESKTOP_FILE}") +APP=$(echo "$DESKTOP_FILE_NAME" | sed -e 's/.desktop//g') +BIN="$APPDIR/usr/bin/$APP" if [ ! -f "$DESKTOP_FILE" ] ; then echo "Desktop file is missing. Please run ${THIS} from within an AppImage." @@ -165,8 +165,6 @@ fi # If the user has agreed, rewrite and install the desktop file, and the MIME information if [ -z "$SKIP" ] ; then - APP=$(echo "$DESKTOP_FILE_NAME" | sed -e 's/.desktop//g') - # desktop-file-install is supposed to install .desktop files to the user's # applications directory when run as a non-root user, # and to /usr/share/applications if run as root