Skip to content

Commit

Permalink
fix(AppImage): use app name as a executable name
Browse files Browse the repository at this point in the history
  • Loading branch information
develar committed Jul 6, 2016
1 parent 0b0ed62 commit 159446b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
11 changes: 6 additions & 5 deletions src/targets/appImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
Expand All @@ -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)
Expand All @@ -83,6 +84,6 @@ export default class AppImageTarget extends TargetEx {
stdio: ["ignore", debug.enabled ? "inherit" : "ignore", "inherit"],
})

packager.dispatchArtifactCreated(image)
packager.dispatchArtifactCreated(`${image}.xz`)
}
}
6 changes: 2 additions & 4 deletions templates/linux/AppRun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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."
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 159446b

Please sign in to comment.