Skip to content

Commit 9731225

Browse files
committed
fix: AppImage does not run when invoked in unpacked form
Closes #592
1 parent e99047d commit 9731225

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

.idea/dictionaries/develar.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
]
106106
},
107107
"devDependencies": {
108-
"@develar/semantic-release": "^6.3.5",
108+
"@develar/semantic-release": "^6.3.6",
109109
"@types/debug": "0.0.28",
110110
"@types/mime": "0.0.28",
111111
"@types/progress": "^1.1.27",

src/targets/appImage.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,19 @@ export default class AppImageTarget extends TargetEx {
3434
await unlinkIfExists(image)
3535

3636
const appImagePath = await appImagePathPromise
37+
const appExecutableImagePath = `/usr/bin/${appInfo.name}`
3738
const args = [
3839
"-joliet", "on",
3940
"-volid", "AppImage",
4041
"-dev", image,
4142
"-padding", "0",
4243
"-map", appOutDir, "/usr/bin",
43-
"-map", path.join(__dirname, "..", "..", "templates", "linux", "AppRun.sh"), `/AppRun`,
44+
"-map", path.join(__dirname, "..", "..", "templates", "linux", "AppRun.sh"), "/AppRun",
4445
"-map", await this.desktopEntry, `/${appInfo.name}.desktop`,
45-
"-move", `/usr/bin/${appInfo.productFilename}`, `/usr/bin/${appInfo.name}`,
46+
"-move", `/usr/bin/${appInfo.productFilename}`, appExecutableImagePath,
47+
// 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
48+
"-chmod", "+x", appExecutableImagePath, "--",
49+
"-chmod", "+x", "/AppRun", appExecutableImagePath, "--",
4650
]
4751
for (let [from, to] of (await this.helper.icons)) {
4852
args.push("-map", from, `/usr/share/icons/default/${to}`)

templates/linux/AppRun.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
set -e
44

5+
if [ -z "$APPDIR" ] ; then
6+
APPDIR=$(dirname $(readlink -f "${0}"))
7+
fi
8+
59
echo "$APPDIR"
610

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

0 commit comments

Comments
 (0)