From 3d9133fc63bbcb652d9cb6fb3717d0510e04540f Mon Sep 17 00:00:00 2001 From: Alexander David Frick Date: Fri, 17 Jun 2022 17:24:43 -0500 Subject: [PATCH] Add files via upload --- infra/APPIMAGE/README.md | 0 infra/APPIMAGE/Thorium.yml | 65 ++++ infra/APPIMAGE/build_appimage.sh | 69 +++++ infra/APPIMAGE/outc | Bin 0 -> 15960 bytes infra/APPIMAGE/pkg2appimage | 490 +++++++++++++++++++++++++++++++ 5 files changed, 624 insertions(+) create mode 100644 infra/APPIMAGE/README.md create mode 100644 infra/APPIMAGE/Thorium.yml create mode 100644 infra/APPIMAGE/build_appimage.sh create mode 100644 infra/APPIMAGE/outc create mode 100644 infra/APPIMAGE/pkg2appimage diff --git a/infra/APPIMAGE/README.md b/infra/APPIMAGE/README.md new file mode 100644 index 00000000..e69de29b diff --git a/infra/APPIMAGE/Thorium.yml b/infra/APPIMAGE/Thorium.yml new file mode 100644 index 00000000..a4d322f2 --- /dev/null +++ b/infra/APPIMAGE/Thorium.yml @@ -0,0 +1,65 @@ +# Copyright (c) 2022 Alex313031 +# Official Thorium builds can be downloaded from https://github.com/Alex313031/Thorium/releases +app: Thorium + +ingredients: + script: + - echo $VERSION + +script: + - echo $VERSION + - # Copy Files + - cp -r /home/alex/bin/thorium/* usr/bin/ + - cp -r /home/alex/bin/thorium/libffmpeg.so usr/lib/ + - # Copy Logo / Icon + - cp usr/bin/product_logo_256.png thorium.png + - cp usr/bin/product_logo_24.png usr/share/icons/hicolor/24x24/apps/thorium.png + - cp usr/bin/product_logo_32.png usr/share/icons/hicolor/32x32/apps/thorium.png + - cp usr/bin/product_logo_48.png usr/share/icons/hicolor/48x48/apps/thorium.png + - cp usr/bin/product_logo_64.png usr/share/icons/hicolor/64x64/apps/thorium.png + - cp usr/bin/product_logo_128.png usr/share/icons/hicolor/128x128/apps/thorium.png + - cp usr/bin/product_logo_256.png usr/share/icons/hicolor/256x256/apps/thorium.png + - # Set Version + - ./usr/bin/thorium --version | cut -d ' ' -f2 > ../VERSION + - # Add Desktop file + - cat > thorium-browser.desktop < ./AppRun <<\EOF + - #!/bin/sh + - HERE=$(dirname $(readlink -f "${0}")) + - export LD_LIBRARY_PATH="${HERE}"/usr/lib:$PATH + - "${HERE}"/usr/bin/thorium --no-default-browser-check --use-gl=desktop --enable-experimental-web-platform-features --new-canvas-2d-api --autoplay-policy=user-gesture-required --enable-features=PageInfoAboutThisSiteMoreInfo $@ + - EOF + - chmod a+x ./AppRun diff --git a/infra/APPIMAGE/build_appimage.sh b/infra/APPIMAGE/build_appimage.sh new file mode 100644 index 00000000..7512d21b --- /dev/null +++ b/infra/APPIMAGE/build_appimage.sh @@ -0,0 +1,69 @@ +#!/bin/bash + +# Copyright (c) 2022 Alex313031. + +YEL='\033[1;33m' # Yellow +RED='\033[1;31m' # Red +GRE='\033[1;32m' # Green +c0=$'\033[0m' # Reset Text +bold=$'\033[1m' # Bold Text +underline=$'\033[4m' # Underline Text + +# Error handling +yell() { echo "$0: $*" >&2; } +die() { yell "$*"; exit 111; } +try() { "$@" || die "${RED}Failed $*"; } + +# --help +displayHelp () { + printf "\n" && + printf "${bold}${YEL}Script to build Thorium .appimage on Linux.${c0}\n" && + printf "${bold}${YEL}Please place the Thorium .deb file in this directory before running.${c0}\n" && + printf "\n" +} + +case $1 in + --help) displayHelp; exit 0;; +esac + +printf "\n" && +printf "${bold}${RED}NOTE: You must place the Thorium .deb file in this directory before running.${c0}\n" && +printf "${YEL}Extracting & Copying files from Thorium .deb package...\n" && +printf "${c0}\n" && + +# Extract data.tar.xz +ar x thorium-browser* && +tar xf data.tar.xz && +mkdir thorium && +cp -r opt/chromium.org/thorium-unstable/* thorium/ && +cp -r usr/bin/chromedriver thorium/ && +cp -r usr/bin/pak thorium/ && +rm -r thorium/cron && +rm -r thorium/thorium-browser && +rm -r thorium/thorium-browser-unstable && + +printf "\n" && +printf "${YEL}Building .Appimage using Thorium.yml...\n" && +printf "${c0}\n" && + +# Build Appimage +chmod +x pkg2appimage && +./pkg2appimage Thorium.yml && + +printf "\n" && +printf "${YEL}Cleaning up...\n" && +printf "${c0}\n" && + +# Cleanup +rm -r opt && +rm -r etc && +rm -r usr && +rm -r control.tar.xz && +rm -r data.tar.xz && +rm -r debian-binary && +rm -r Thorium/ && +rm -r thorium/ && + +printf "${GRE}Done! ${YEL}Appimage at //out/thorium*.Appimage\n" && +printf "\n" && +tput sgr0 diff --git a/infra/APPIMAGE/outc b/infra/APPIMAGE/outc new file mode 100644 index 0000000000000000000000000000000000000000..63ce711fa73ae49b5c9f873e4985f09c24a3b891 GIT binary patch literal 15960 zcmeHOTWlOx89uwt#UZY}aT97gkgVFIZ9tybiESl8ChKd)$VuG95g^e{#@?~L>R#O4 zS!zc>4F-YLrkEFq+CEST(MqVOpsGqMq;6D*+6Peb5Ge?dLPaD;D#a}Y1rS;Of6o7{ z$HO|6DtM?gN80_)fBDYkKWApo?40x1!0=!+5>ZGs>a&Wa#hBJ4#Bi=lG6V^AK;1## zJJk-gf#h|bPTLb2$g0!T=xVGLeGMV=nmAJhKcUqMh!!$3Z>?lIyjxY?j}D>eIvq)#l2!w5IeM50a4!r#FL>FkJ|%= z`GnNB);O3Ff1rd{?M zSv#FN<0#9T&Zn~Ogf%|(FbOmY<5t17^RAV#Q(46_4?>qZGCb7VXYDig8J(54Y6rJ15a*Y}g`K9lDpN1)_9w3<$?gO~~rnhK)Nv?C~+eBZR(01q{Up=h# zJO?_T)FPZbdtbN_x$u@b|EJ}V(Si0-`UWS7=-EGvB z4VYU{=IFOVF0khrV(Hy$M; zu`02zM4Oah3L_9kAdEm5fiMDL1i}b}5eOp?Mj(tp7=bVX|Az=f=-t#wdhr(Tj_*zv z>1lO)&1d-CE58ehEtkvutlvhsNSGjeo^XV)L^ww{Ldc2VZE}j7IiVsmvB>tijkSyP zxX*fihkrl$-pdaC8@*R&yC}=`{O~X3a-2}r#|G=0KG(4M(b_q6xaH8N_V4mu7c!sU zO`an^ymMoB*1PmstfGH{^xq-Rw_D{L zySyly39)x@Zk;A#&)`+De@x1IR&cXmli)T%0QM-Jm;Hv=%Lspd{^P{^5INnYLA6Q6 z&`(Rl(C(7>(I!nVp}ZX;!|z{Z-9L(}r=oYdUVq!9JbHuc$%s2W-g@%gV*iK8=!X>l zKLhLs4;I+we@G4*ZzE%0>5;y^L-G4hjTN(QG2Y%z+iTle+Yc5!xqXjlZc`4&W1V`J zUvIBU9B zgqAUm{9i*veOzJQYpYW8l;QGm-9i6d&wpEGUoZ4)wg0D{|5mjWhvy1b>+df-|GQLh zynp4Q*FQYX6kqxPCo4N^mLa<_>`2rkMuFsT!|a32I(84 zTNLgu(07P`u$&&Re0Z(k20>mGO$m5vJVg3Nvfvzx z_umtl9ua?xJ6K;8|I;#my#J2K_zh1FuN8cn^xV#1InR+kzT#HNT_C;phgLMwm+V}*iny`u*HlL#x#p%Vs{MJEZ+RX$=+_1wVfa}AXO__%@>Kc$SqY{s?6 z2;IEKDdgw`gp;3EMmFa<#$>i=Oy_gcPTrmMsm6*aI-QbAimIn~sFi1l=RRc@rj(JK z%~BN_-MqGZ*~u4Dx$G*zB3s@`+f0z$blO!053@2TYfR=OQ*g$W;W{%U@_ZrhoHqc5 zGbJ-*DoLe5(q-tWq8Z3jRdyytg=sp)UKun;Gc@%ASICDGc|Ajy7TvRT3Z65=dPdBi zFY=7{(1+I$;IDO_ihVg@-Jm6<__&;(A3RsZ|9|@v?q|>qQO3{5?0O$Hz9NMK1EQGc-iKM;Pe_+ecN zM4Xt<`5>R;!!bemmEQ;XoxpmXT)Y$<|7S?+=f{OtLE!=L^8k=TIhtU3D{CIuERbc#8Ts#FEL<9u+zb1p99}^z1 z14O|f|91htDSY6M0({ILsIOCouMt^pSJtOE2O0E-41AZk+(+=S9xk<#k`ny1v?4?Q zZ!+-Q1t05IoNLATRlfc>froMY3F$a~;A1^|elL5|YdsB>Z}5Q|i0tR9gt)e8L_H_~ zJjiuKW*zFsIxi;tpg-5;Pg|sZaj%%bzqg{%8SwpBnR`Cp15)5=X&BCPqCL2;Y$6WY e?xU-7`?d5IDiUKrq_uW+{+UiqXbBJkqWTZkA>iBq literal 0 HcmV?d00001 diff --git a/infra/APPIMAGE/pkg2appimage b/infra/APPIMAGE/pkg2appimage new file mode 100644 index 00000000..e0ace599 --- /dev/null +++ b/infra/APPIMAGE/pkg2appimage @@ -0,0 +1,490 @@ +#!/usr/bin/env bash + +HERE="$(dirname "$(readlink -f "${0}")")" + +export PATH="${HERE}"/usr/bin/:"${HERE}"/usr/sbin/:"${HERE}"/usr/games/:"${HERE}"/bin/:"${HERE}"/sbin/:"${PATH}" +export LD_LIBRARY_PATH="${HERE}"/usr/lib/:"${HERE}"/usr/lib/i386-linux-gnu/:"${HERE}"/usr/lib/x86_64-linux-gnu/:"${HERE}"/usr/lib32/:"${HERE}"/usr/lib64/:"${HERE}"/lib/:"${HERE}"/lib/i386-linux-gnu/:"${HERE}"/lib/x86_64-linux-gnu/:"${HERE}"/lib32/:"${HERE}"/lib64/:"${LD_LIBRARY_PATH}" +export XDG_DATA_DIRS="${HERE}"/usr/share/:"${XDG_DATA_DIRS}" + + +# Specify a certain commit if you do not want to use master +# by using: +# export PKG2AICOMMIT= +if [ -z "$PKG2AICOMMIT" ] ; then + PKG2AICOMMIT=master +fi + +usage() { + if [ -z "$APPIMAGE" ] ; then + MYSELF="$0" + else + MYSELF="$APPIMAGE" + fi + echo "usage:" + echo " $MYSELF [--di] META-NAME|YAMLFILE" + echo "" + echo "options:" + echo " --di enable legacy desktop integration (unsupported)" + exit 1 +} + +check_dependencies() { + for executable in $@; do + which "${executable}" >/dev/null 2>&1 || { + (echo "${executable} missing"; exit 1) + } + done +} + +if [ $# -eq 0 ] || [ "x${!#}" = "x--di" ] ; then + usage +fi +if [ $# -eq 2 ] && [ "x$1" != "x--di" ] ; then + usage +fi + +if [ "x$1" = "x--di" ] ; then + ENABLE_DI="yes" +else + ENABLE_DI="no" +fi + +# Halt on errors +set -e +set -x + +# Check dependencies +check_dependencies \ + dpkg \ + dpkg-deb \ + convert \ + wget \ + grep \ + sed \ + cut \ + file \ + desktop-file-validate \ + strings + +# If the yaml file doesn't exist locally, get it from GitHub +if [ ! -f "${!#}" ] ; then + YAMLFILE=/tmp/_recipe.yml + rm -f "$YAMLFILE" + wget -q "https://github.com/AppImage/AppImages/raw/${PKG2AICOMMIT}/recipes/${!#}.yml" -O "$YAMLFILE" +else + YAMLFILE=$(readlink -f "${!#}") +fi + +# Lightweight bash-only dpkg-scanpackages replacement +scanpackages() { + for deb in *.deb ; do + dpkg -I $deb | sed 's/^ *//g' | grep -i -E '(package|version|installed-size|architecture|depends|priority):' + echo "Filename: $(readlink -f $deb)" + echo "MD5sum: $(md5sum -b $deb | cut -d' ' -f1)" + echo "SHA1: $(sha1sum -b $deb | cut -d' ' -f1)" + echo "SHA256: $(sha256sum -b $deb | cut -d' ' -f1)" + echo + done +} + +# Function to parse yaml +# https://gist.github.com/epiloque/8cf512c6d64641bde388 +# based on https://gist.github.com/pkuczynski/8665367 +parse_yaml() { + local prefix=$2 + local s + local w + local fs + s='[[:blank:]]*' + w='[a-zA-Z0-9_]*' + fs="$(echo @|tr @ '\034')" + sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \ + -e "s|^\($s\)\($w\)$s[:-]$s\(.*\)$s\$|\1$fs\2$fs\3|p" "$1" | + awk -F"$fs" '{ + indent = length($1)/2; + vname[indent] = $2; + for (i in vname) {if (i > indent) {delete vname[i]}} + if (length($3) > 0) { + vn=""; for (i=0; i/dev/null || true + generate_status + + # Some packages depend on packages which we do not want to bundle, + # in addition to the global excludes defined in excludedeblist. + # Use + # ingredients: + # exclude: + # - packagename + if [ ! -z "${_ingredients_exclude[0]}" ] ; then + for PACKAGE in "${_ingredients_exclude[@]}" ; do + printf "Package: $PACKAGE\nStatus: install ok installed\nArchitecture: all\nVersion: 9:999.999.999\n\n" >> status + done + fi + + # Some packages depend on an exact version of a dependency to be installed. + # Use + # ingredients: + # pretend: + # - packagename version_to_be_pretended + if [ ! -z "${_ingredients_pretend[0]}" ] ; then + for PRETEND in "${_ingredients_pretend[@]}" ; do + P_PKG=$(echo "$PRETEND" | cut -d " " -f 1) + P_VER=$(echo "$PRETEND" | cut -d " " -f 2) + cat status | tr '\n' '@' | sed -e 's|@@|\n\n|g' | sed -e 's|Package: '"$P_PKG"'@Status: install ok installed@Architecture: all@Version: 9:999.999.999|Package: '"$P_PKG"'@Status: install ok installed@Architecture: all@Version: '"$P_VER"'|g' | sed -e 's|@|\n|g' > status.temp + mv status.temp status + done + fi + + if [ -e sources.list ] ; then + rm sources.list + fi + for PPA in "${_ingredients_ppas[@]}" ; do + echo "deb http://ppa.launchpad.net/${PPA}/ubuntu/ ${_ingredients_dist} main" >> sources.list + done + for SOURCE in "${_ingredients_sources[@]}" ; do + echo "${SOURCE}" >> sources.list + done + for DEBFILE in "${_ingredients_debs[@]}" ; do + cp ${DEBFILE} . + done + # Use libcurl-slim to reduce AppImage size, thanks darealshinji + # Not really compiled on xenial but CentOS 6, https://github.com/AppImage/AppImages/issues/187 + echo "deb http://ppa.launchpad.net/djcj/libcurl-slim/ubuntu xenial main" >> sources.list + # Use gnutls-patched to have libgnutls look in various distributions' places for certificates, + # https://github.com/darealshinji/vlc-AppImage/issues/1#issuecomment-321041496 + # echo "deb http://ppa.launchpad.net/djcj/gnutls-patched/ubuntu ${_ingredients_dist} main" >> sources.list + ### echo "deb http://ppa.launchpad.net/djcj/gnutls-patched/ubuntu trusty main" >> sources.list # https://github.com/AppImage/pkg2appimage/issues/345 +fi + +if [ ! -z "${_ingredients_script[0]}" ] ; then + # Execute extra steps defined in recipe + shell_execute $YAMLFILE _ingredients_script +fi + +if [ ! -z "${_ingredients_dist}" ] ; then + # Some projects provide raw .deb files without a repository + # hence we create our own local repository as part of + # the AppImage creation process in order to "install" + # the package using apt-get as normal + if [ ! -z "${_ingredients_debs[0]}" ] ; then + for DEB in "${_ingredients_debs[@]}" ; do + if [ ! -f $(basename "$DEB") ] ; then + wget -c $DEB + fi + done + fi + scanpackages | gzip -9c > Packages.gz + echo "deb file:$(readlink -e $PWD) ./" >> sources.list + + INSTALL=$LOWERAPP + if [ ! -z "${_ingredients_package}" ] ; then + INSTALL="${_ingredients_package}" + fi + if [ ! -z "${_ingredients_packages}" ] ; then + INSTALL="" + fi + + # If packages are specifically listed, only install these, not a package with the name of the app + if [ ! -z "${_ingredients_packages[0]}" ] ; then + INSTALL=${_ingredients_packages[@]} + fi + +# apt-get -o Acquire::AllowInsecureRepositories=true -o Acquire::Languages="none" -o Acquire::AllowDowngradeToInsecureRepositories=true $OPTIONS update || true +# URLS=$(apt-get --allow-unauthenticated -o Apt::Get::AllowUnauthenticated=true $OPTIONS -y install --print-uris $INSTALL | cut -d "'" -f 2 | grep -e "^http") || true +# if which aria2c &>/dev/null; then +# dltool=aria2c +# else +# dltool=wget +# fi + +# $dltool -c -i- <<<"$URLS" + set +x + apt-get.update + + INSTALL=$(echo "${INSTALL}" | sed "s| |\n|g") + + for pkg in ${INSTALL}; do + apt-get.do-download ${pkg} + done + set -x +fi + +if [ ! -z "${_ingredients_post_script[0]}" ] ; then + # Execute extra steps defined in recipe + shell_execute $YAMLFILE _ingredients_post_script +fi + +mkdir -p ./$APP.AppDir/ +cd ./$APP.AppDir/ + +mkdir -p usr/bin usr/lib +find ../*.deb -exec dpkg-deb -X {} . \; || true + +unset LD_PRELOAD + +# Try to copy icons to standard locations where appimaged can pick them up +mkdir -p usr/share/icons/hicolor/{22x22,24x24,32x32,48x48,64x64,128x128,256x256,512x512}/apps/ +find . -path *icons* -path *22* -name "*$LOWERAPP*" -exec cp {} usr/share/icons/hicolor/22x22/apps/ \; || true +find . -path *icons* -path *24* -name "*$LOWERAPP*" -exec cp {} usr/share/icons/hicolor/24x24/apps/ \; || true +find . -path *icons* -path *32* -name "*$LOWERAPP*" -exec cp {} usr/share/icons/hicolor/32x32/apps/ \; || true +find . -path *icons* -path *48* -name "*$LOWERAPP*" -exec cp {} usr/share/icons/hicolor/48x48/apps/ \; || true +find . -path *icons* -path *64* -name "*$LOWERAPP*" -exec cp {} usr/share/icons/hicolor/64x64/apps/ \; || true +find . -path *icons* -path *128* -name "*$LOWERAPP*" -exec cp {} usr/share/icons/hicolor/128x128/apps/ \; || true +find . -path *icons* -path *256* -name "*$LOWERAPP*" -exec cp {} usr/share/icons/hicolor/256x256/apps/ \; || true +find . -path *icons* -path *512* -name "*$LOWERAPP*" -exec cp {} usr/share/icons/hicolor/512x512/apps/ \; || true + +get_icon + +if [ -z "${_union}" ] ; then + get_apprun +else +cat > AppRun <<\EOF +#!/bin/sh +HERE="$(dirname "$(readlink -f "${0}")")" +export UNION_PRELOAD="${HERE}" +export LD_PRELOAD="${HERE}/libunionpreload.so" +export PATH="${HERE}"/usr/bin/:"${HERE}"/usr/sbin/:"${HERE}"/usr/games/:"${HERE}"/bin/:"${HERE}"/sbin/:"${PATH}" +export LD_LIBRARY_PATH="${HERE}"/usr/lib/:"${HERE}"/usr/lib/i386-linux-gnu/:"${HERE}"/usr/lib/x86_64-linux-gnu/:"${HERE}"/usr/lib32/:"${HERE}"/usr/lib64/:"${HERE}"/lib/:"${HERE}"/lib/i386-linux-gnu/:"${HERE}"/lib/x86_64-linux-gnu/:"${HERE}"/lib32/:"${HERE}"/lib64/:"${LD_LIBRARY_PATH}" +export PYTHONPATH="${HERE}"/usr/share/pyshared/:"${PYTHONPATH}" +export PYTHONHOME="${HERE}"/usr/ +export XDG_DATA_DIRS="${HERE}"/usr/share/:"${XDG_DATA_DIRS}" +export PERLLIB="${HERE}"/usr/share/perl5/:"${HERE}"/usr/lib/perl5/:"${PERLLIB}" +export GSETTINGS_SCHEMA_DIR="${HERE}"/usr/share/glib-2.0/schemas/:"${GSETTINGS_SCHEMA_DIR}" +export QT_PLUGIN_PATH="${HERE}"/usr/lib/qt4/plugins/:"${HERE}"/usr/lib/i386-linux-gnu/qt4/plugins/:"${HERE}"/usr/lib/x86_64-linux-gnu/qt4/plugins/:"${HERE}"/usr/lib32/qt4/plugins/:"${HERE}"/usr/lib64/qt4/plugins/:"${HERE}"/usr/lib/qt5/plugins/:"${HERE}"/usr/lib/i386-linux-gnu/qt5/plugins/:"${HERE}"/usr/lib/x86_64-linux-gnu/qt5/plugins/:"${HERE}"/usr/lib32/qt5/plugins/:"${HERE}"/usr/lib64/qt5/plugins/:"${QT_PLUGIN_PATH}" +EXEC=$(grep -e '^Exec=.*' "${HERE}"/*.desktop | head -n 1 | cut -d "=" -f 2- | sed -e 's|%.||g') +exec ${EXEC} "$@" +EOF +chmod a+x AppRun +fi + +get_desktop + +# Prevent Qt from loading plugins from the system +unset QTPATH +QTPATH=$(find usr/lib -type d -name qt4 -or -name qt5 | sed -e 's|usr/|../|g') +if [ ! -z $QTPATH ] ; then +cat > usr/bin/qt.conf < temp \; + # Remove all absolute paths + sed -i -E 's|target=\"\/(.*\/)([a-z0-9].*?)>|target=\"\2>|g' temp + SONAMES=$(cat temp | cut -d '"' -f 4 | grep ".so" || true) + if [ "" != "$SONAMES" ] ; then + for SONAME in $SONAMES; do + find . -name "$SONAME" -exec mv {} usr/lib \; + done + fi + rm temp + PATH_OF_THE_EXE="usr/lib/mono/exe" + mkdir -p "$PATH_OF_THE_EXE" + # Force all dll files into PATH_OF_THE_EXE (or MONO_PATH which we would have to set) + find . -name "*.dll" -and -not -name "mscorlib.dll" -exec mv {} "$PATH_OF_THE_EXE" \; + # Edit all config files in place to remove absolute paths + find . -name "*.dll.config" -exec sed -i -E 's|target=\"\/(.*\/)([a-z0-9].*?)>|target=\"\2>|g' {} \; + # Force all config files into the PATH_OF_THE_EXE (or MONO_PATH which we would have to set) + find . -name "*.dll.config" -exec mv {} "$PATH_OF_THE_EXE" \; + # Remove gac, we are not using it since it is convoluted + rm -rf usr/lib/mono/gac/ +fi + +if [ -d "./usr/lib/x86_64-linux-gnu/gstreamer-1.0/" ] ; then + mv ./usr/lib/x86_64-linux-gnu/gstreamer-1.0/* ./usr/lib/x86_64-linux-gnu/ + rm -r ./usr/lib/x86_64-linux-gnu/gstreamer-1.0 +fi + +if [ -d "./usr/lib/x86_64-linux-gnu/pulseaudio/" ] ; then + mv ./usr/lib/x86_64-linux-gnu/pulseaudio/* ./usr/lib/x86_64-linux-gnu/ + rm -r ./usr/lib/x86_64-linux-gnu/pulseaudio +fi + +# Execute extra steps defined in recipe +if [ ! -z "${_script}" ] ; then + shell_execute $YAMLFILE _script +fi + +DESKTOP=$(find . -name '*.desktop' | sort | head -n 1) + +# desktop-file-validate complains about missing trailing semicolons for some +# keys although the format definition says that they are optional +fix_desktop "$DESKTOP" + +# Some non-distribution provided applications have an absolute +# path in the Exec= line which we remove for relocateability +if [ -z "$DESKTOP" ] ; then + echo "desktop file not found, aborting" + exit 1 +else + desktop-file-validate "$DESKTOP" || exit 1 + ORIG=$(grep -o "^Exec=.*$" "${DESKTOP}" | head -n 1| cut -d " " -f 1) + REPL=$(basename $(grep -o "^Exec=.*$" "${DESKTOP}" | head -n 1 | cut -d " " -f 1 | sed -e 's|Exec=||g')) + sed -i -e 's|'"${ORIG}"'|Exec='"${REPL}"'|g' "${DESKTOP}" +fi + +# Compile GLib schemas if the subdirectory is present in the AppImage +# AppRun has to export GSETTINGS_SCHEMA_DIR for this to work +if [ -d usr/share/glib-2.0/schemas/ ] ; then + ( cd usr/share/glib-2.0/schemas/ ; glib-compile-schemas . ) +fi + +if [ -f ../VERSION ] ; then + VERSION=$(cat ../VERSION) +else + get_version || true +fi + +# patch_usr +# Patching only the executable files seems not to be enough for some apps +if [ ! -z "${_binpatch}" ] ; then + find usr/ -type f -exec sed -i -e 's|/usr|././|g' {} \; + find usr/ -type f -exec sed -i -e 's@././/bin/env@/usr/bin/env@g' {} \; +fi + +# Don't suffer from NIH; use LD_PRELOAD to override calls to /usr paths +if [ ! -z "${_union}" ] ; then + mkdir -p usr/src/ + wget -q "https://raw.githubusercontent.com/mikix/deb2snap/master/src/preload.c" -O - | \ + sed -e 's|SNAPPY|UNION|g' | sed -e 's|SNAPP|UNION|g' | sed -e 's|SNAP|UNION|g' | \ + sed -e 's|snappy|union|g' > usr/src/libunionpreload.c + gcc -shared -fPIC usr/src/libunionpreload.c -o libunionpreload.so -ldl -DUNION_LIBNAME=\"libunionpreload.so\" + strip libunionpreload.so +fi + +delete_blacklisted + +if [ "$ENABLE_DI" = "yes" ] ; then + get_desktopintegration $LOWERAPP +fi + +# Fix desktop files that have file endings for icons +sed -i -e 's|\.png||g' *.desktop || true +sed -i -e 's|\.svg||g' *.desktop || true +sed -i -e 's|\.svgz||g' *.desktop || true +sed -i -e 's|\.xpm||g' *.desktop || true + +# Setting PYTHONHOME instead +# Fix Python imports, +# https://github.com/AppImage/AppImages/issues/172 +# SITECUSTOMIZEFILES=$(find . -name "sitecustomize.py") +# for SITECUSTOMIZEFILE in $SITECUSTOMIZEFILES ; do +# rm $SITECUSTOMIZEFILE # Remove symlinks, replace by files +# cat > $SITECUSTOMIZEFILE <<\EOF +# import sys,os +# if sys.version_info[0] < 3: +# prefix = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(sys.path[0])))) +# sys.path = [ prefix+s for s in sys.path if not s.startswith(prefix) ] +# EOF +# done + +# Execute extra steps defined in recipe +if [ ! -z "${_post_script[0]}" ] ; then + shell_execute $YAMLFILE _post_script +fi + +# Go out of AppImage +cd .. + +if [ -z "${_updateinformation}" ] ; then + generate_type2_appimage +else + generate_type2_appimage -u "${_updateinformation}" +fi + +ls -lh ../out/*.AppImage