From 69d83efa3801b6e7f27b5b816a2aa4445be1d2cb Mon Sep 17 00:00:00 2001 From: Samuel <36420837+Samueru-sama@users.noreply.github.com> Date: Wed, 2 Apr 2025 04:12:53 -0400 Subject: [PATCH] =?UTF-8?q?bundle=20smartctl=20with=20wrappe=20?= =?UTF-8?q?=F0=9F=91=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qdiskinfo-appimage.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/qdiskinfo-appimage.sh b/qdiskinfo-appimage.sh index 6ae7404..dce0675 100644 --- a/qdiskinfo-appimage.sh +++ b/qdiskinfo-appimage.sh @@ -32,11 +32,24 @@ chmod +x ./lib4bin /usr/lib/"$ARCH"-linux-gnu/qt6/plugins/xcbglintegrations/* \ /usr/lib/"$ARCH"-linux-gnu/qt6/plugins/wayland-*/* +# also use lib4bin to make a portable smartctl with wrappe +./lib4bin --with-wrappe "$(command -v smartctl)" + # prepare sharun echo '#!/bin/sh CURRENTDIR="$(dirname "$(readlink -f "$0")")" +CACHEDIR="${XDG_CACHE_HOME:-$HOME/.cache}" [ -f "$APPIMAGE".stylesheet ] && APPIMAGE_QT_THEME="$APPIMAGE.stylesheet" [ -f "$APPIMAGE_QT_THEME" ] && set -- "$@" "-stylesheet" "$APPIMAGE_QT_THEME" + +if ! command -v smartctl >/dev/null 2>&1; then + echo "smartctl is not on the system, using bundled binary..." + export PATH="$PATH:"$CACHEDIR"/qdiskinfo-appimage" + mkdir -p "$CACHEDIR"/qdiskinfo-appimage + cp -v "$CURRENTDIR"/smartctl "$CACHEDIR"/qdiskinfo-appimage + chmod +x "$CACHEDIR"/qdiskinfo-appimage/smartctl +fi + exec "$CURRENTDIR"/bin/QDiskInfo "$@"' > ./AppRun chmod +x ./AppRun ./sharun -g