-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set BUILD_WORKING_DIRECTORY also during APPIMAGE_EXTRACT_AND_RUN
- Loading branch information
Showing
5 changed files
with
101 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
load("@rules_appimage//appimage:appimage.bzl", "appimage") | ||
|
||
sh_binary( | ||
name = "entrypoint", | ||
srcs = ["entrypoint.sh"], | ||
) | ||
|
||
appimage( | ||
name = "test.appimage", | ||
binary = ":entrypoint", | ||
) | ||
|
||
sh_test( | ||
name = "test", | ||
timeout = "short", | ||
srcs = ["test.sh"], | ||
data = [":test.appimage"], | ||
tags = ["requires-fakeroot"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
env | sort |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
set -euxo pipefail | ||
|
||
actual_wd="$(pwd)" | ||
|
||
# BUILD_WORKING_DIRECTORY is not set when running the appimage directly | ||
unset BUILD_WORKING_DIRECTORY | ||
|
||
# BUILD_WORKING_DIRECTORY is set inside the appimage when libfuse-mounted | ||
env="$(env -i -- PATH="/bin" tests/build_working_directory/test.appimage)" | ||
grep -q OWD= <<<"$env" | ||
bwd="$(grep BUILD_WORKING_DIRECTORY= <<<"$env" | cut -d= -f2-)" | ||
[ "$bwd" = "$actual_wd" ] | ||
|
||
# BUILD_WORKING_DIRECTORY is set inside the appimage when using APPIMAGE_EXTRACT_AND_RUN | ||
env="$(env -i -- PATH="/bin" APPIMAGE_EXTRACT_AND_RUN=1 tests/build_working_directory/test.appimage)" | ||
grep -q OWD= <<<"$env" && exit 1 # https://github.com/AppImage/type2-runtime/issues/23 | ||
bwd="$(grep BUILD_WORKING_DIRECTORY= <<<"$env" | cut -d= -f2-)" | ||
[ "$bwd" = "$actual_wd" ] |