feat(cpn): allow simulator standalone on Linux (#6898)
This commit is contained in:
@@ -325,6 +325,17 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|||||||
install(TARGETS ${SIMULATOR_NAME}
|
install(TARGETS ${SIMULATOR_NAME}
|
||||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR})
|
DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR})
|
||||||
|
|
||||||
|
# configure custom AppRun script from template
|
||||||
|
configure_file(${COMPANION_TARGETS_DIR}/AppRun.in ${CMAKE_BINARY_DIR}/AppDir/AppRun @ONLY
|
||||||
|
)
|
||||||
|
|
||||||
|
# Make it executable
|
||||||
|
file(CHMOD ${CMAKE_BINARY_DIR}/AppDir/AppRun
|
||||||
|
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
|
||||||
|
GROUP_READ GROUP_EXECUTE
|
||||||
|
WORLD_READ WORLD_EXECUTE
|
||||||
|
)
|
||||||
|
|
||||||
# configure and set variables used by package script
|
# configure and set variables used by package script
|
||||||
set(COMPANION_DESKTOP_FILE ${CMAKE_CURRENT_BINARY_DIR}/${COMPANION_NAME}.desktop)
|
set(COMPANION_DESKTOP_FILE ${CMAKE_CURRENT_BINARY_DIR}/${COMPANION_NAME}.desktop)
|
||||||
configure_file(${COMPANION_TARGETS_DIR}/companion.desktop.in ${COMPANION_DESKTOP_FILE} @ONLY)
|
configure_file(${COMPANION_TARGETS_DIR}/companion.desktop.in ${COMPANION_DESKTOP_FILE} @ONLY)
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# ARGV0 is what the AppImage was called as (includes symlink name)
|
||||||
|
# APPDIR is set by AppImage runtime to the mount point
|
||||||
|
CALLED_AS="$(basename "${ARGV0}")"
|
||||||
|
CALLED_AS_LOWER="${CALLED_AS,,}" # converts to lowercase
|
||||||
|
|
||||||
|
# Check if called via symlink with "simulator" in name
|
||||||
|
if [[ "$CALLED_AS_LOWER" == *"simulator"* ]]; then
|
||||||
|
exec "${APPDIR}/usr/bin/@SIMULATOR_NAME@" "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check for command-line parameter
|
||||||
|
case "$1" in
|
||||||
|
--simulator)
|
||||||
|
shift
|
||||||
|
exec "${APPDIR}/usr/bin/@SIMULATOR_NAME@" "$@"
|
||||||
|
;;
|
||||||
|
--help)
|
||||||
|
echo "EdgeTX Companion @VERSION@ AppImage"
|
||||||
|
echo ""
|
||||||
|
echo "AppImage Options:"
|
||||||
|
echo " --simulator Launch Simulator instead"
|
||||||
|
echo " --apprun-help Show AppImage routing help"
|
||||||
|
echo ""
|
||||||
|
echo "Companion Help:"
|
||||||
|
exec "${APPDIR}/usr/bin/@COMPANION_NAME@" --help
|
||||||
|
;;
|
||||||
|
--apprun-help)
|
||||||
|
echo "EdgeTX Companion AppImage Usage: $0 [OPTIONS]"
|
||||||
|
echo ""
|
||||||
|
echo "Routing Options:"
|
||||||
|
echo " (no options) Launch Companion"
|
||||||
|
echo " --simulator Launch Simulator"
|
||||||
|
echo " --help Show Companion help (with AppImage options)"
|
||||||
|
echo " --apprun-help Show this AppImage routing help only"
|
||||||
|
echo ""
|
||||||
|
echo "Symlink Usage:"
|
||||||
|
echo " Create a symlink with 'simulator' in the name to launch Simulator:"
|
||||||
|
echo " ln -s @COMPANION_NAME@.AppImage @SIMULATOR_NAME@.AppImage"
|
||||||
|
echo " ./@SIMULATOR_NAME@.AppImage"
|
||||||
|
echo ""
|
||||||
|
echo "Examples:"
|
||||||
|
echo " $0 # Launch Companion"
|
||||||
|
echo " $0 --simulator # Launch Simulator"
|
||||||
|
echo " $0 --simulator --help # Show Simulator help"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
exec "${APPDIR}/usr/bin/@COMPANION_NAME@" "$@"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
@@ -4,5 +4,5 @@ execute_process(COMMAND @CMAKE_MAKE_PROGRAM@ DESTDIR=@APPIMAGE_DIR@ install
|
|||||||
# This is done by cmake install target
|
# This is done by cmake install target
|
||||||
# setup Companion application
|
# setup Companion application
|
||||||
# add -v0 to linuxdeploy for debug info
|
# add -v0 to linuxdeploy for debug info
|
||||||
execute_process(COMMAND env LDAI_NO_APPSTREAM=1 @LINUXDEPLOY_APP@ --appdir @APPIMAGE_DIR@ -e @COMPANION_NAME@ -d @COMPANION_DESKTOP_FILE@ --plugin qt --output appimage
|
execute_process(COMMAND env LDAI_NO_APPSTREAM=1 @LINUXDEPLOY_APP@ --appdir @APPIMAGE_DIR@ -e @COMPANION_NAME@ -e @SIMULATOR_NAME@ -d @COMPANION_DESKTOP_FILE@ --custom-apprun @CMAKE_BINARY_DIR@/AppDir/AppRun --plugin qt --output appimage
|
||||||
WORKING_DIRECTORY @CMAKE_BINARY_DIR@)
|
WORKING_DIRECTORY @CMAKE_BINARY_DIR@)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Name=EdgeTX Simulator @VERSION@
|
|||||||
GenericName=Transmitter Simulator App
|
GenericName=Transmitter Simulator App
|
||||||
Comment=The Ultimate Transmitter Simulator
|
Comment=The Ultimate Transmitter Simulator
|
||||||
Icon=@COMPANION_NAME@
|
Icon=@COMPANION_NAME@
|
||||||
Exec=@SIMULATOR_NAME@
|
Exec=@COMPANION_NAME@ --simulator
|
||||||
Terminal=false
|
Terminal=false
|
||||||
StartupNotify=false
|
StartupNotify=false
|
||||||
Categories=Utility;
|
Categories=Utility;
|
||||||
|
|||||||
Reference in New Issue
Block a user