summaryrefslogtreecommitdiff
path: root/archived/projt-launcher/launcher/Launcher.in
diff options
context:
space:
mode:
authorMehmet Samet Duman <yongdohyun@projecttick.org>2026-04-02 18:51:45 +0300
committerMehmet Samet Duman <yongdohyun@projecttick.org>2026-04-02 18:51:45 +0300
commitd3261e64152397db2dca4d691a990c6bc2a6f4dd (patch)
treefac2f7be638651181a72453d714f0f96675c2b8b /archived/projt-launcher/launcher/Launcher.in
parent31b9a8949ed0a288143e23bf739f2eb64fdc63be (diff)
downloadProject-Tick-d3261e64152397db2dca4d691a990c6bc2a6f4dd.tar.gz
Project-Tick-d3261e64152397db2dca4d691a990c6bc2a6f4dd.zip
NOISSUE add archived projects
Signed-off-by: Mehmet Samet Duman <yongdohyun@projecttick.org>
Diffstat (limited to 'archived/projt-launcher/launcher/Launcher.in')
-rwxr-xr-xarchived/projt-launcher/launcher/Launcher.in106
1 files changed, 106 insertions, 0 deletions
diff --git a/archived/projt-launcher/launcher/Launcher.in b/archived/projt-launcher/launcher/Launcher.in
new file mode 100755
index 0000000000..6428bf42b0
--- /dev/null
+++ b/archived/projt-launcher/launcher/Launcher.in
@@ -0,0 +1,106 @@
+#!/usr/bin/env bash
+# Basic start script for running the launcher with the libs packaged with it.
+
+function printerror {
+ printf "$1"
+ if which zenity >/dev/null; then zenity --error --text="$1" &>/dev/null;
+ elif which kdialog >/dev/null; then kdialog --error "$1" &>/dev/null;
+ fi
+}
+
+if [[ $EUID -eq 0 ]]; then
+ printerror "This program should not be run using sudo or as the root user!\n"
+ exit 1
+fi
+
+
+LAUNCHER_NAME=@Launcher_AppBinaryName@
+LAUNCHER_DIR="$(dirname "$(readlink -f "$0")")"
+echo "Launcher Dir: ${LAUNCHER_DIR}"
+
+# Set up env.
+# Pass our custom variables separately so that the launcher can remove them for child processes
+export LAUNCHER_LD_LIBRARY_PATH="${LAUNCHER_DIR}/lib@LIB_SUFFIX@"
+export LAUNCHER_LD_PRELOAD=""
+export LAUNCHER_QT_PLUGIN_PATH="${LAUNCHER_DIR}/plugins"
+export LAUNCHER_QT_FONTPATH="${LAUNCHER_DIR}/fonts"
+
+export LD_LIBRARY_PATH="$LAUNCHER_LD_LIBRARY_PATH:$LD_LIBRARY_PATH"
+export LD_PRELOAD="$LAUNCHER_LD_PRELOAD:$LD_PRELOAD"
+export QT_PLUGIN_PATH="$LAUNCHER_QT_PLUGIN_PATH:$QT_PLUGIN_PATH"
+export QT_FONTPATH="$LAUNCHER_QT_FONTPATH:$QT_FONTPATH"
+
+# Detect missing dependencies...
+DEPS_LIST=`ldd "${LAUNCHER_DIR}"/plugins/*/*.so 2>/dev/null | grep "not found" | sort -u | awk -vORS=", " '{ print $1 }'`
+if [ "x$DEPS_LIST" = "x" ]; then
+ # We have all our dependencies. Run the launcher.
+ echo "No missing dependencies found."
+
+ # Just to be sure...
+ chmod +x "${LAUNCHER_DIR}/bin/${LAUNCHER_NAME}"
+
+ ARGS=("${LAUNCHER_DIR}/${LAUNCHER_NAME}" "${LAUNCHER_DIR}/bin/${LAUNCHER_NAME}")
+
+ if [ -f portable.txt ]; then
+ ARGS+=("-d" "${LAUNCHER_DIR}")
+ fi
+
+ ARGS+=("$@")
+
+ # Run the launcher
+ exec -a "${ARGS[@]}"
+
+ # Run the launcher in valgrind
+ # valgrind --log-file="valgrind.log" --leak-check=full --track-origins=yes "${LAUNCHER_DIR}/bin/${LAUNCHER_NAME}" -d "${LAUNCHER_DIR}" "$@"
+
+ # Run the launcher with callgrind, delay instrumentation
+ # valgrind --log-file="valgrind.log" --tool=callgrind --instr-atstart=no "${LAUNCHER_DIR}/bin/${LAUNCHER_NAME}" -d "${LAUNCHER_DIR}" "$@"
+ # use callgrind_control -i on/off to profile actions
+
+ # Exit with launcher's exit code.
+ # exit $?
+else
+ # apt
+ if which apt-file &>/dev/null; then
+ LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*" | sort -u`
+ COMMAND_LIBS=`for LIBRARY in $LIBRARIES; do apt-file -l search $LIBRARY; done`
+ COMMAND_LIBS=`echo "$COMMAND_LIBS" | sort -u | awk -vORS=" " '{ print $1 }'`
+ INSTALL_CMD="sudo apt-get install $COMMAND_LIBS"
+ # pacman
+ elif which pkgfile &>/dev/null; then
+ LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*" | sort -u`
+ COMMAND_LIBS=`for LIBRARY in $LIBRARIES; do pkgfile $LIBRARY; done`
+ COMMAND_LIBS=`echo "$COMMAND_LIBS" | sort -u | awk -vORS=" " '{ print $1 }'`
+ INSTALL_CMD="sudo pacman -S $COMMAND_LIBS"
+ # dnf
+ elif which dnf &>/dev/null; then
+ LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*" | sort -u`
+ COMMAND_LIBS=`for LIBRARY in $LIBRARIES; do dnf whatprovides -q $LIBRARY; done`
+ COMMAND_LIBS=`echo "$COMMAND_LIBS" | grep -v 'Repo' | sort -u | awk -vORS=" " '{ print $1 }'`
+ INSTALL_CMD="sudo dnf install $COMMAND_LIBS"
+ # yum
+ elif which yum &>/dev/null; then
+ LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*" | sort -u`
+ COMMAND_LIBS=`for LIBRARY in $LIBRARIES; do yum whatprovides $LIBRARY; done`
+ COMMAND_LIBS=`echo "$COMMAND_LIBS" | sort -u | awk -vORS=" " '{ print $1 }'`
+ INSTALL_CMD="sudo yum install $COMMAND_LIBS"
+ # zypper
+ elif which zypper &>/dev/null; then
+ LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*" | sort -u`
+ COMMAND_LIBS=`for LIBRARY in $LIBRARIES; do zypper wp $LIBRARY; done`
+ COMMAND_LIBS=`echo "$COMMAND_LIBS" | sort -u | awk -vORS=" " '{ print $1 }'`
+ INSTALL_CMD="sudo zypper install $COMMAND_LIBS"
+ # emerge
+ elif which pfl &>/dev/null; then
+ LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*" | sort -u`
+ COMMAND_LIBS=`for LIBRARY in $LIBRARIES; do pfl $LIBRARY; done`
+ COMMAND_LIBS=`echo "$COMMAND_LIBS" | sort -u | awk -vORS=" " '{ print $1 }'`
+ INSTALL_CMD="sudo emerge $COMMAND_LIBS"
+ fi
+
+ MESSAGE="Error: The launcher is missing the following libraries that it needs to work correctly:\n\t${DEPS_LIST}\nPlease install them from your distribution's package manager."
+ MESSAGE="$MESSAGE\n\nHint (please apply common sense): $INSTALL_CMD\n"
+
+ printerror "$MESSAGE"
+ exit 1
+fi