Skip to content

Commit

Permalink
fix: AppImage does not run when invoked in unpacked form
Browse files Browse the repository at this point in the history
Closes #592
  • Loading branch information
develar committed Aug 2, 2016
1 parent e99047d commit 9731225
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions .idea/dictionaries/develar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
]
},
"devDependencies": {
"@develar/semantic-release": "^6.3.5",
"@develar/semantic-release": "^6.3.6",
"@types/debug": "0.0.28",
"@types/mime": "0.0.28",
"@types/progress": "^1.1.27",
Expand Down
8 changes: 6 additions & 2 deletions src/targets/appImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,19 @@ export default class AppImageTarget extends TargetEx {
await unlinkIfExists(image)

const appImagePath = await appImagePathPromise
const appExecutableImagePath = `/usr/bin/${appInfo.name}`
const args = [
"-joliet", "on",
"-volid", "AppImage",
"-dev", image,
"-padding", "0",
"-map", appOutDir, "/usr/bin",
"-map", path.join(__dirname, "..", "..", "templates", "linux", "AppRun.sh"), `/AppRun`,
"-map", path.join(__dirname, "..", "..", "templates", "linux", "AppRun.sh"), "/AppRun",
"-map", await this.desktopEntry, `/${appInfo.name}.desktop`,
"-move", `/usr/bin/${appInfo.productFilename}`, `/usr/bin/${appInfo.name}`,
"-move", `/usr/bin/${appInfo.productFilename}`, appExecutableImagePath,
// http://stackoverflow.com/questions/13633488/can-i-store-unix-permissions-in-a-zip-file-built-with-apache-ant, xorriso doesn't preserve it for zip, but we set it in any case
"-chmod", "+x", appExecutableImagePath, "--",
"-chmod", "+x", "/AppRun", appExecutableImagePath, "--",
]
for (let [from, to] of (await this.helper.icons)) {
args.push("-map", from, `/usr/share/icons/default/${to}`)
Expand Down
8 changes: 6 additions & 2 deletions templates/linux/AppRun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

set -e

if [ -z "$APPDIR" ] ; then
APPDIR=$(dirname $(readlink -f "${0}"))
fi

echo "$APPDIR"

THIS="$0"
Expand Down Expand Up @@ -170,9 +174,9 @@ if [ -z "$SKIP" ] ; then
# and to /usr/share/applications if run as root
# but that does not really work for me...
desktop-file-install --rebuild-mime-info-cache \
--vendor=$VENDORPREFIX --set-key=Exec --set-value="$APPIMAGE %U" \
--vendor=$VENDORPREFIX --set-key=Exec --set-value="\"${APPIMAGE}\" %U" \
--set-key=X-AppImage-Comment --set-value="Generated by ${THIS}" \
--set-icon="$VENDORPREFIX-$APP" --set-key=TryExec --set-value="$APPIMAGE" "$DESKTOP_FILE" \
--set-icon="$VENDORPREFIX-$APP" --set-key=TryExec --set-value=${APPIMAGE// /\\s} "$DESKTOP_FILE" \
--dir "$DESTINATION_DIR_DESKTOP"
chmod a+x "$DESTINATION_DIR_DESKTOP/"*
RESOURCE_NAME=$(echo "$VENDORPREFIX-$DESKTOP_FILE_NAME" | sed -e 's/.desktop//g')
Expand Down

0 comments on commit 9731225

Please sign in to comment.