2016-12-20 16:44:01 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
source $ROOT_DIR/utils.sh
|
|
|
|
|
|
|
|
TARGET=$1
|
|
|
|
|
|
|
|
GUI_EXEC=$2
|
|
|
|
|
|
|
|
platform=$(get_platform)
|
|
|
|
|
2017-01-16 20:58:17 +01:00
|
|
|
if [[ "$platform" == "linux64" ]]; then
|
|
|
|
PLAT_DIR="/usr/lib/x86_64-linux-gnu"
|
|
|
|
elif [[ "$platform" == "linux32" ]]; then
|
|
|
|
PLAT_DIR="/usr/lib/i386-linux-gnu"
|
|
|
|
elif [[ "$platform" == "linuxarmv7" ]]; then
|
|
|
|
PLAT_DIR="/usr/lib/arm-linux-gnueabihf"
|
|
|
|
elif [[ "$platform" == "linuxarmv8" ]]; then
|
|
|
|
PLAT_DIR="/usr/lib/aarch64-linux-gnu"
|
|
|
|
else
|
|
|
|
PLAT_DIR="/usr/lib"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$QT_DIR" ]; then
|
|
|
|
QT_DIR=$PLAT_DIR/qt5
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$QTXML_DIR" ]; then
|
|
|
|
QTXML_DIR=$PLAT_DIR
|
|
|
|
fi
|
|
|
|
|
2016-12-20 16:44:01 +01:00
|
|
|
# Copy dependencies
|
|
|
|
EXCLUDE='libstdc++|libgcc_s.so|libc.so|libpthread'
|
2017-02-07 20:10:17 +01:00
|
|
|
INCLUDE='libunbound'
|
2017-01-16 20:58:17 +01:00
|
|
|
cp -rv $QT_DIR/qml $TARGET || exit
|
|
|
|
cp -rv $QT_DIR/plugins $TARGET || exit
|
2017-01-16 18:37:12 +01:00
|
|
|
mkdir -p $TARGET/libs || exit
|
2017-02-07 20:10:17 +01:00
|
|
|
#ldd $TARGET/$GUI_EXEC | grep "=> /" | awk '{print $3}' | grep $INCLUDE | xargs -I '{}' cp -v '{}' $TARGET/libs || exit
|
|
|
|
#ldd $TARGET/$GUI_EXEC | grep "=> /" | awk '{print $3}' | grep -Ev $EXCLUDE | xargs -I '{}' cp -v '{}' $TARGET/libs || exit
|
|
|
|
#ldd $TARGET/plugins/platforms/libqxcb.so| grep "=> /" | awk '{print $3}' | grep -Ev $EXCLUDE | xargs -I '{}' cp -v '{}' $TARGET/libs || exit
|
|
|
|
#cp -v $QTXML_DIR/libQt5XmlPatterns.so.5 $TARGET/libs || exit
|
2016-12-20 16:44:01 +01:00
|
|
|
|
|
|
|
# Create start script
|
|
|
|
cat > $TARGET/start-gui.sh <<EOL
|
|
|
|
#!/bin/bash
|
2017-02-07 20:10:17 +01:00
|
|
|
export LD_LIBRARY_PATH=\`pwd\`/libs
|
2016-12-20 16:44:01 +01:00
|
|
|
export QT_PLUGIN_PATH=\`pwd\`/plugins
|
|
|
|
export QML2_IMPORT_PATH=\`pwd\`/qml
|
2017-05-10 08:29:14 +02:00
|
|
|
# make it so that it can be called from anywhere and also through soft links
|
|
|
|
SCRIPT_DIR="\$(dirname "\$(test -L "\${BASH_SOURCE[0]}" && readlink "\${BASH_SOURCE[0]}" || echo "\${BASH_SOURCE[0]}")")"
|
2018-09-19 18:29:34 +02:00
|
|
|
"\$SCRIPT_DIR"/$GUI_EXEC "\$@"
|
2016-12-20 16:44:01 +01:00
|
|
|
EOL
|
2017-02-07 20:10:17 +01:00
|
|
|
|
2019-07-04 00:15:53 +02:00
|
|
|
# Create start script
|
|
|
|
cat > $TARGET/start-tails.AppImage <<EOL
|
|
|
|
#!/bin/bash
|
|
|
|
# Silly hack to provide a launcher that is double clickable
|
|
|
|
bash ./start-gui.sh
|
|
|
|
EOL
|
|
|
|
|
2017-05-10 08:29:14 +02:00
|
|
|
chmod +x $TARGET/start-gui.sh
|
2019-07-04 00:15:53 +02:00
|
|
|
chmod +x $TARGET/start-tails.AppImage
|