mirror of
https://github.com/iDescriptor/iDescriptor.git
synced 2026-06-21 19:35:49 +08:00
use bundled ifuse on AppImage builds
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
build
|
||||
CMakeLists.txt.user
|
||||
.DS_Store
|
||||
AppDir
|
||||
*.AppImage
|
||||
build-dir
|
||||
+29
-11
@@ -11,10 +11,15 @@ export VERSION=$VERSION
|
||||
export APPDIR=$PWD/AppDir
|
||||
export GSTREAMER_VERSION=1.0
|
||||
|
||||
# Download linuxdeployqt if not already present
|
||||
if [ ! -f linuxdeployqt-continuous-x86_64.AppImage ]; then
|
||||
wget -c -nv "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
|
||||
chmod a+x linuxdeployqt-continuous-x86_64.AppImage
|
||||
# Download linuxdeploy and linuxdeploy-plugin-qt if not already present
|
||||
if [ ! -f linuxdeploy-x86_64.AppImage ]; then
|
||||
wget -c -nv "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
|
||||
chmod a+x linuxdeploy-x86_64.AppImage
|
||||
fi
|
||||
|
||||
if [ ! -f linuxdeploy-plugin-qt-x86_64.AppImage ]; then
|
||||
wget -c -nv "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage"
|
||||
chmod a+x linuxdeploy-plugin-qt-x86_64.AppImage
|
||||
fi
|
||||
|
||||
# Ensure patchelf is installed
|
||||
@@ -32,6 +37,13 @@ mkdir -p "$APPDIR/usr/share/icons/hicolor/256x256/apps"
|
||||
cp build/iDescriptor "$APPDIR/usr/bin/"
|
||||
cp resources/icons/app-icon/icon.png "$APPDIR/usr/share/icons/hicolor/256x256/apps/iDescriptor.png"
|
||||
|
||||
|
||||
# Copy ifuse
|
||||
cp /usr/local/bin/ifuse "$APPDIR/usr/bin"
|
||||
|
||||
# Copy iproxy
|
||||
cp /usr/local/bin/iproxy "$APPDIR/usr/bin"
|
||||
|
||||
# Bundle GStreamer plugins and helpers
|
||||
plugins_target_dir="$APPDIR/usr/lib/gstreamer-$GSTREAMER_VERSION"
|
||||
helpers_target_dir="$APPDIR/usr/lib/gstreamer1.0/gstreamer-$GSTREAMER_VERSION"
|
||||
@@ -88,7 +100,8 @@ done
|
||||
|
||||
mkdir -p "$APPDIR/apprun-hooks"
|
||||
|
||||
cat <<'EOF' > "$APPDIR/apprun-hooks/linuxdeploy-plugin-gstreamer.sh"
|
||||
export QML_MODULES_PATHS="./qml"
|
||||
cat <<'EOF' > "$APPDIR/apprun-hooks/linuxdeploy-plugin-env.sh"
|
||||
#!/bin/bash
|
||||
|
||||
export GST_REGISTRY_REUSE_PLUGIN_SCANNER="no"
|
||||
@@ -97,15 +110,20 @@ export GST_PLUGIN_PATH_1_0="${APPDIR}/usr/lib/gstreamer-1.0"
|
||||
|
||||
export GST_PLUGIN_SCANNER_1_0="${APPDIR}/usr/lib/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner"
|
||||
export GST_PTP_HELPER_1_0="${APPDIR}/usr/lib/gstreamer1.0/gstreamer-1.0/gst-ptp-helper"
|
||||
|
||||
export IPROXY_APPIMAGE="${APPDIR}/usr/bin/iproxy"
|
||||
export IFUSE_APPIMAGE="${APPDIR}/usr/bin/ifuse"
|
||||
EOF
|
||||
|
||||
chmod +x "$APPDIR/apprun-hooks/linuxdeploy-plugin-gstreamer.sh"
|
||||
chmod +x "$APPDIR/apprun-hooks/linuxdeploy-plugin-env.sh"
|
||||
|
||||
# .desktop file
|
||||
cp iDescriptor.desktop "$APPDIR/usr/share/applications/"
|
||||
|
||||
./linuxdeployqt-continuous-x86_64.AppImage AppDir/usr/share/applications/iDescriptor.desktop \
|
||||
-appimage \
|
||||
-qmldir=./qml \
|
||||
-exclude-libs=libGL,libGLX,libEGL,libOpenGL,libdrm,libva,libvdpau,libxcb,libxcb-glx,libxcb-dri2,libxcb-dri3,libX11,libXext,libXrandr,libXrender,libXfixes,libXau,libXdmcp,libqsqlmimer,libmysqlclient,libmysqlclient
|
||||
|
||||
./linuxdeploy-x86_64.AppImage \
|
||||
--appdir ./AppDir \
|
||||
--desktop-file AppDir/usr/share/applications/iDescriptor.desktop \
|
||||
--plugin qt \
|
||||
--exclude-library libGL,libGLX,libEGL,libOpenGL,libdrm,libva,libvdpau,libxcb,libxcb-glx,libxcb-dri2,libxcb-dri3,libX11,libXext,libXrandr,libXrender,libXfixes,libXau,libXdmcp,libqsqlmimer,libmysqlclient,libmysqlclient \
|
||||
--output appimage \
|
||||
--deploy-deps-only AppDir/usr/bin/ifuse
|
||||
|
||||
+28
-11
@@ -194,7 +194,6 @@ void iFuseWidget::onMountClicked()
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if ifuse binary exists
|
||||
m_ifuseProcess = new QProcess(this);
|
||||
connect(m_ifuseProcess,
|
||||
QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this,
|
||||
@@ -202,16 +201,34 @@ void iFuseWidget::onMountClicked()
|
||||
connect(m_ifuseProcess, &QProcess::errorOccurred, this,
|
||||
&iFuseWidget::onProcessError);
|
||||
|
||||
// First check if ifuse exists
|
||||
QProcess checkProcess;
|
||||
checkProcess.start("which", QStringList() << "ifuse");
|
||||
checkProcess.waitForFinished(3000);
|
||||
QString ifuseExecutablePath;
|
||||
|
||||
// todo: ship with ifuse binary
|
||||
if (checkProcess.exitCode() != 0) {
|
||||
setStatusMessage(
|
||||
"Error: ifuse binary not found. Please install ifuse first.", true);
|
||||
return;
|
||||
/*
|
||||
Check if running in AppImage
|
||||
this is set by the plugin script
|
||||
*/
|
||||
if (qEnvironmentVariableIsSet("IFUSE_APPIMAGE")) {
|
||||
ifuseExecutablePath = qgetenv("IFUSE_APPIMAGE");
|
||||
if (ifuseExecutablePath.isEmpty()) {
|
||||
setStatusMessage("Error: Running in AppImage mode, but "
|
||||
"IFUSE_APPIMAGE is not set.",
|
||||
true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!QFileInfo(ifuseExecutablePath).isExecutable()) {
|
||||
setStatusMessage(
|
||||
"Error: Bundled ifuse not found or is not executable.", true);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
ifuseExecutablePath = QStandardPaths::findExecutable("ifuse");
|
||||
if (ifuseExecutablePath.isEmpty()) {
|
||||
setStatusMessage(
|
||||
"Error: ifuse binary not found. Please install ifuse first.",
|
||||
true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Create the mount directory
|
||||
@@ -245,7 +262,7 @@ void iFuseWidget::onMountClicked()
|
||||
QStringList arguments;
|
||||
arguments << "-u" << deviceUdid << fullMountPath;
|
||||
|
||||
m_ifuseProcess->start("ifuse", arguments);
|
||||
m_ifuseProcess->start(ifuseExecutablePath, arguments);
|
||||
}
|
||||
|
||||
void iFuseWidget::onProcessFinished(int exitCode,
|
||||
|
||||
Reference in New Issue
Block a user