From 07d3fd1ed4b5fac22f84df96d0a15b385dc79bf0 Mon Sep 17 00:00:00 2001 From: Maximilian Federle Date: Thu, 16 Apr 2020 19:51:06 +0200 Subject: [PATCH] snap: Use SNAP_USER_COMMON as HOME This prevents the config and the user collection from being backed up by snapd on update. If the user reverts qelectrotech, the current collection will thus not be overwritten by the possibly outdated backup. Add a migration script that automatically transfers the user's .qet directory to the new location. --- build-aux/snap/local/launchers/qelectrotech-launch | 12 +++++++++++- build-aux/snap/snapcraft.yaml | 7 ++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/build-aux/snap/local/launchers/qelectrotech-launch b/build-aux/snap/local/launchers/qelectrotech-launch index e3cd9ba9a..d56bcfdcd 100755 --- a/build-aux/snap/local/launchers/qelectrotech-launch +++ b/build-aux/snap/local/launchers/qelectrotech-launch @@ -1,5 +1,15 @@ -#!/bin/bash +#!/bin/sh +# migrate .qet directory from SNAP_USER_DATA to SNAP_USER_COMMON +from="$SNAP_USER_DATA/.qet" +to="$SNAP_USER_COMMON/.qet" +if [ ! -d "$to" ] && [ -d "$from" ]; then + echo "Migrating user data from $from to $to" + mkdir "$to" + cp -av "$from/." "$to" +fi + +# link DXFtoQET so that QET finds it mkdir -p "$HOME/.qet" ln -snf "$SNAP/bin/DXFtoQET" "$HOME/.qet/DXFtoQET" diff --git a/build-aux/snap/snapcraft.yaml b/build-aux/snap/snapcraft.yaml index ac2b519b1..c8ad19fac 100644 --- a/build-aux/snap/snapcraft.yaml +++ b/build-aux/snap/snapcraft.yaml @@ -28,15 +28,16 @@ apps: environment: &env __EGL_VENDOR_LIBRARY_DIRS: $SNAP/kf5/usr/share/glvnd/egl_vendor.d:$SNAP/usr/share/glvnd/egl_vendor.d TCL_LIBRARY: $SNAP/usr/share/tcltk/tcl8.6 - QT_QPA_PLATFORMTHEME: gtk3 - QT_AUTO_SCREEN_SCALE_FACTOR: 1 + QT_QPA_PLATFORMTHEME: gtk3 + QT_AUTO_SCREEN_SCALE_FACTOR: 1 + HOME: $SNAP_USER_COMMON qet-tb-generator: command: bin/qelectrotech-launch $SNAP/bin/qet_tb_generator extensions: [kde-neon] plugs: *plugs environment: *env - + dxf-to-qet: command: bin/DXFtoQET extensions: [kde-neon]