better AppRun

This commit is contained in:
Chris Esposito 2019-04-23 19:59:06 +10:00
parent 0b12407307
commit e65c2573cc
5 changed files with 71 additions and 32 deletions

View File

@ -73,11 +73,10 @@ script:
# Workaround to increase compatibility with older systems; see https://github.com/darealshinji/AppImageKit-checkrt for details
mkdir -p appdir/usr/optional/ ; wget -c https://github.com/darealshinji/AppImageKit-checkrt/releases/download/continuous/exec-x86_64.so -O ./appdir/usr/optional/exec.so
mkdir -p appdir/usr/optional/libstdc++/ ; cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 ./appdir/usr/optional/libstdc++/
( cd appdir ; rm AppRun ; wget -c https://github.com/darealshinji/AppImageKit-checkrt/releases/download/continuous/AppRun-patched-x86_64 -O AppRun ; chmod a+x AppRun)
# Manually invoke appimagetool so that libstdc++ gets bundled and the modified AppRun stays intact
./linuxdeployqt*.AppImage --appimage-extract
export PATH=$(readlink -f ./squashfs-root/usr/bin):$PATH
./squashfs-root/usr/bin/appimagetool -g ./appdir/
rm ./appdir/AppRun ; cp ./resources/AppRun appdir/ ; chmod a+x ./appdir/AppRun
PATH=./squashfs-root/usr/bin:$PATH ./squashfs-root/usr/bin/appimagetool -g ./appdir/
fi
after_success:

View File

@ -1,20 +0,0 @@
#!/bin/bash
HERE="$(dirname "$(readlink -f "${0}")")"
cat > /tmp/roothelper <<\EOoF
#!/bin/bash
cat > /etc/udev/rules.d/69-labrador.rules <<\EOF
ENV{ID_VENDOR_ID}=="03eb", ENV{ID_MODEL_ID}=="ba94", SYMLINK="EspoTek_Labrador", MODE="0666"
ENV{ID_VENDOR_ID}=="03eb", ENV{ID_MODEL_ID}=="2fe4", SYMLINK="ATXMEGA32A4U DFU Bootloader", MODE="0666"
EOF
udevadm trigger
EOoF
chmod a+x /tmp/roothelper
sudo true && sudo /tmp/roothelper
sudo true || pkexec --disable-internal-agent /tmp/roothelper || true
rm /tmp/roothelper
exec "$HERE/usr/bin/Labrador" "$@"

View File

@ -1,8 +0,0 @@
[Desktop Entry]
Name=EspoTek Labrador
Comment=Software Interface for Labrador Board
Exec=Labrador
Terminal=false
Type=Application
Categories=Development;Electronics;
Icon=espotek-labrador

View File

@ -0,0 +1,67 @@
#!/bin/sh -e
# A shell script that does the same as the binaries in the release section.
# It's only here as an example on how to achieve it with a Shell script.
cd "$(dirname "$0")"
cxxpre=""
gccpre=""
execpre=""
libc6arch="libc6,x86-64"
exec="./bin/$(sed -n 's|^Exec=||p' $(ls -1 *.desktop))"
if [ -n "$APPIMAGE" ] && [ "$(file -b "$APPIMAGE" | cut -d, -f2)" != " x86-64" ]; then
libc6arch="libc6"
fi
cd "usr"
if [ -e "./optional/libstdc++/libstdc++.so.6" ]; then
lib="$(PATH="/sbin:$PATH" ldconfig -p | grep "libstdc++\.so\.6 ($libc6arch)" | awk 'NR==1{print $NF}')"
sym_sys=$(tr '\0' '\n' < "$lib" | grep -e '^GLIBCXX_3\.4' | tail -n1)
sym_app=$(tr '\0' '\n' < "./optional/libstdc++/libstdc++.so.6" | grep -e '^GLIBCXX_3\.4' | tail -n1)
if [ "$(printf "${sym_sys}\n${sym_app}"| sort -V | tail -1)" != "$sym_sys" ]; then
cxxpath="./optional/libstdc++:"
fi
fi
if [ -e "./optional/libgcc/libgcc_s.so.1" ]; then
lib="$(PATH="/sbin:$PATH" ldconfig -p | grep "libgcc_s\.so\.1 ($libc6arch)" | awk 'NR==1{print $NF}')"
sym_sys=$(tr '\0' '\n' < "$lib" | grep -e '^GCC_[0-9]\\.[0-9]' | tail -n1)
sym_app=$(tr '\0' '\n' < "./optional/libgcc/libgcc_s.so.1" | grep -e '^GCC_[0-9]\\.[0-9]' | tail -n1)
if [ "$(printf "${sym_sys}\n${sym_app}"| sort -V | tail -1)" != "$sym_sys" ]; then
gccpath="./optional/libgcc:"
fi
fi
if [ -n "$cxxpath" ] || [ -n "$gccpath" ]; then
if [ -e "./optional/exec.so" ]; then
execpre=""
export LD_PRELOAD="./optional/exec.so:${LD_PRELOAD}"
fi
export LD_LIBRARY_PATH="${cxxpath}${gccpath}${LD_LIBRARY_PATH}"
fi
#echo ">>>>> $LD_LIBRARY_PATH"
#echo ">>>>> $LD_PRELOAD"
HERE="$(dirname "$(readlink -f "${0}")")"
cat > /tmp/roothelper <<\EOoF
#!/bin/bash
cat > /etc/udev/rules.d/69-labrador.rules <<\EOF
ENV{ID_VENDOR_ID}=="03eb", ENV{ID_MODEL_ID}=="ba94", SYMLINK="EspoTek_Labrador", MODE="0666"
ENV{ID_VENDOR_ID}=="03eb", ENV{ID_MODEL_ID}=="2fe4", SYMLINK="ATXMEGA32A4U DFU Bootloader", MODE="0666"
EOF
udevadm trigger
EOoF
chmod a+x /tmp/roothelper
sudo true && sudo /tmp/roothelper
sudo true || pkexec --disable-internal-agent /tmp/roothelper || true
rm /tmp/roothelper
exec "$HERE/Labrador" "$@"
exit $?

3
Desktop_Interface/resources/espotek-labrador.desktop Normal file → Executable file
View File

@ -1,3 +1,4 @@
#!/usr/bin/env xdg-open
[Desktop Entry]
Name=EspoTek Labrador
Comment=Software Interface for Labrador Board
@ -5,6 +6,6 @@ Exec=/usr/local/bin/EspoTek-Labrador/Labrador
Terminal=false
Type=Application
Categories=Education;Electronics
Icon=/usr/share/icons/hicolor/256x256/apps/espotek-labrador.png
Icon=espotek-labrador