From 8d33febf17a9d4a21d88aa33d2cc3880967ded72 Mon Sep 17 00:00:00 2001
From: ale rimoldi <ale@graphicslab.org>
Date: Wed, 19 Mar 2025 20:09:12 +0100
Subject: symlink lib a bit earlier; use again apt-get (more low level; for
 scripting)


diff --git a/AppImage-package/bundle.sh b/AppImage-package/bundle.sh
index c0c116726..2b6c41086 100644
--- a/AppImage-package/bundle.sh
+++ b/AppImage-package/bundle.sh
@@ -34,6 +34,22 @@ cp ./appdir/usr/share/icons/hicolor/256x256/apps/scribus.png ./appdir/
 # TODO: is this needed?
 sed -i -e 's|^Icon=.*|Icon=scribus|g' ./appdir/usr/share/applications/scribus.desktop
 
+########################################################################
+# Work around side effect of bundling everything
+########################################################################
+
+# https://github.com/scribusproject/scribus/issues/111#issuecomment-457823282
+# applicationDirPath() is not usr/bin but lib/x86_64-linux-gnu/
+# when AppRun invokes the binary with
+# exec "${HERE}/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2" --inhibit-cache --library-path "${LIBRARY_PATH}" "${MAIN}" "$@"
+# hence we add symlinks here to mitigate this
+
+cd appdir/
+# On Ubuntu 24.04 /lib is a symlink to /usr/lib
+ln -s usr/lib lib
+ln -s usr/lib64 lib64
+cd -
+
 ########################################################################
 # Bundle everything
 # to allow the AppImage to run on older systems as well
@@ -42,8 +58,8 @@ sed -i -e 's|^Icon=.*|Icon=scribus|g' ./appdir/usr/share/applications/scribus.de
 cd appdir/
 
 # Bundle all of glibc; this should eventually be done by linuxdeployqt
-apt update -q
-apt download libc6
+apt-get update -q
+apt-get download libc6
 find *.deb -exec dpkg-deb -x {} . \;
 rm *deb
 
@@ -56,27 +72,11 @@ mkdir -p etc/fonts/
 cp /etc/fonts/fonts.conf etc/fonts/
 
 # Bundle Python
-apt download python3.12 python3.12-minimal libpython3.12-minimal libpython3.12-stdlib python3-tk
+apt-get download python3.12 python3.12-minimal libpython3.12-minimal libpython3.12-stdlib python3-tk
 find *.deb -exec dpkg-deb -x {} . \;
 rm *deb
 cd -
 
-########################################################################
-# Work around side effect of bundling everything
-########################################################################
-
-# https://github.com/scribusproject/scribus/issues/111#issuecomment-457823282
-# applicationDirPath() is not usr/bin but lib/x86_64-linux-gnu/
-# when AppRun invokes the binary with
-# exec "${HERE}/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2" --inhibit-cache --library-path "${LIBRARY_PATH}" "${MAIN}" "$@"
-# hence we add symlinks here to mitigate this
-
-cd appdir/
-# On Ubuntu 24.04 /lib is a symlink to /usr/lib
-ln -s usr/lib lib
-ln -s usr/lib64 lib64
-cd -
-
 ########################################################################
 # Also bundle Tcl/Tk, Tkinter (for Calendar script)
 ########################################################################
