fwupd/contrib/snap/fwupdtool.wrapper
Mario Limonciello bb1cb5af35 trivial: snap: Update the mime information
Fixes installation from CAB files in devmode
(although they need to be placed in the ratherintuitive directory
/root/snap/fwupdtool/common/ for now)
2018-06-06 17:37:37 -05:00

45 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
export XDG_CACHE_HOME=$SNAP_USER_COMMON/.cache
mkdir -p $XDG_CACHE_HOME
export GIO_MODULE_DIR=$XDG_CACHE_HOME/gio-modules
export XDG_DATA_DIRS="$SNAP/usr/share"
# don't update between versions, we want to preserve previous data
[ ! -d "$SNAP_USER_DATA/etc" ] && cp -R "$SNAP/etc" "$SNAP_USER_DATA"
[ ! -d "$SNAP_USER_DATA/var" ] && cp -R "$SNAP/var" "$SNAP_USER_DATA"
#determine architecture
if [ "$SNAP_ARCH" = "amd64" ]; then
ARCH="x86_64-linux-gnu"
elif [ "$SNAP_ARCH" = "armhf" ]; then
ARCH="arm-linux-gnueabihf"
elif [ "$SNAP_ARCH" = "arm64" ]; then
ARCH="aarch64-linux-gnu"
else
ARCH="$SNAP_ARCH-linux-gnu"
fi
# re-generate gio modules in local cache
needs_update=true
if [ -f $SNAP_USER_DATA/.last_revision ]; then
. $SNAP_USER_DATA/.last_revision 2>/dev/null
fi
if [ "$SNAP_DESKTOP_LAST_REVISION" = "$SNAP_REVISION" ]; then
needs_update=false
fi
if [ $needs_update = true ]; then
if [ -f $SNAP/usr/lib/$ARCH/glib-2.0/gio-querymodules ]; then
rm -rf $GIO_MODULE_DIR
mkdir -p $GIO_MODULE_DIR
ln -s $SNAP/usr/lib/$ARCH/gio/modules/*.so $GIO_MODULE_DIR
$SNAP/usr/lib/$ARCH/glib-2.0/gio-querymodules $GIO_MODULE_DIR
fi
echo "SNAP_DESKTOP_LAST_REVISION=$SNAP_REVISION" > $SNAP_USER_DATA/.last_revision
fi
export PATH="$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH"
export LD_LIBRARY_PATH="$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/$ARCH:$SNAP/usr/lib/$ARCH"
export LD_LIBRARY_PATH=$SNAP_LIBRARY_PATH:$LD_LIBRARY_PATH
exec "$SNAP/usr/lib/fwupd/fwupdtool" "$@"