diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 898c9c1..a36d7d4 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -159,33 +159,14 @@ jobs: cp tools/AppRun-x86_64 ~/.cache/tauri/AppRun-x86_64 chmod +x ~/.cache/tauri/AppRun-x86_64 - # Download and extract linuxdeploy without FUSE. - # Tauri also runs `dd if=/dev/zero bs=1 count=3 seek=8` on the cached file - # to hide AppImage magic bytes — this corrupts a shell script's shebang. - # A compiled ELF binary is safe: bytes 8-10 (EI_OSABI/EI_ABIVERSION/pad) - # are already zero in standard ELF and survive the dd no-op. wget -q \ "https://github.com/tauri-apps/binary-releases/releases/download/linuxdeploy/linuxdeploy-x86_64.AppImage" \ -O /tmp/linuxdeploy.AppImage - # Find squashfs at a page-aligned boundary after the ELF runtime - OFFSET=$(python3 -c " -d=open('/tmp/linuxdeploy.AppImage','rb').read() -for i in range(4096,len(d),4096): - if d[i:i+4] in (b'hsqs',b'sqsh'): - print(i); break -") + OFFSET=$(python3 -c "d=open('/tmp/linuxdeploy.AppImage','rb').read();next(print(i) for i in range(4096,len(d),4096) if d[i:i+4] in (b'hsqs',b'sqsh'))") unsquashfs -d /tmp/linuxdeploy-root -offset "$OFFSET" /tmp/linuxdeploy.AppImage - # Compile a tiny ELF forwarder as the cached AppImage entry point - cat > /tmp/ld_wrapper.c << 'CSRC' -#include -int main(int argc, char** argv) { - execv("/tmp/linuxdeploy-root/AppRun", argv); - return 1; -} -CSRC - gcc -o ~/.cache/tauri/linuxdeploy-x86_64.AppImage /tmp/ld_wrapper.c + gcc -o ~/.cache/tauri/linuxdeploy-x86_64.AppImage tools/ld_wrapper.c chmod +x ~/.cache/tauri/linuxdeploy-x86_64.AppImage - name: Build diff --git a/tools/ld_wrapper.c b/tools/ld_wrapper.c new file mode 100644 index 0000000..083bc1b --- /dev/null +++ b/tools/ld_wrapper.c @@ -0,0 +1,5 @@ +#include +int main(int argc, char **argv) { + execv("/tmp/linuxdeploy-root/AppRun", argv); + return 1; +}