-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add snap support #70
Comments
I've managed to do some initial snapping of otpclient, but to be honest i'm not willing to maintain it because snap itself bugs me a little. Anyway i will leave here what i did, maybe it will be helpful. snapcraft.yaml name: otpclient
version: "1.2.2"
summary: Simple GTK+ v3 OTP client (TOTP and HOTP)
description: |
Highly secure and easy to use GTK+ software for two-factor authentication that supports both Time-based One-time Passwords (TOTP) and HMAC-Based One-Time Passwords (HOTP).
grade: devel
confinement: devmode
apps:
otpclient:
command: desktop-launch $SNAP/bin/otpclient
desktop: share/applications/com.github.paolostivanin.OTPClient.desktop
plugs:
- desktop
- home
parts:
desktop-gtk3-part:
plugin: make
make-parameters:
- FLAVOR=gtk3
source: https://github.com/ubuntu/snapcraft-desktop-helpers.git
source-subdir: gtk
build-packages:
- libgtk-3-dev
stage-packages:
- libxkbcommon0
- ttf-ubuntu-font-family
- dmz-cursor-theme
- light-themes
- adwaita-icon-theme
- gnome-themes-standard
- shared-mime-info
- libgtk-3-0
- libgdk-pixbuf2.0-0
- libglib2.0-bin
- libgtk-3-bin
- unity-gtk3-module
- libappindicator3-1
- locales-all
- xdg-user-dirs
- ibus-gtk3
- libibus-1.0-5
prime:
- -usr/lib/*/libLLVM*
- -usr/include
- -usr/share/doc
libbaseencode:
plugin: cmake
source: https://github.com/paolostivanin/libbaseencode/archive/v1.0.6.tar.gz
libcotp:
plugin: cmake
source: https://github.com/paolostivanin/libcotp/archive/v1.0.14.tar.gz
after:
- libbaseencode
otpclient:
plugin: cmake
configflags:
- "-DUSE_SNAP_FOLDER=ON"
source: https://github.com/paolostivanin/OTPClient/archive/v$SNAPCRAFT_PROJECT_VERSION.tar.gz
override-pull: |
snapcraftctl pull
patch -p1 < $SNAPCRAFT_STAGE/../snap/patches/snap.patch
stage-packages:
- libgcrypt20
- libgtk-3-0
- libzbar0
- libpng12-0
- libzip4
- libjansson4
build-packages:
- libgcrypt20-dev
- libgtk-3-dev
- libzbar-dev
- libpng-dev
- libzip-dev
- libjansson-dev
- build-essential
- pkg-config
after:
- libcotp
- desktop-gtk3-part snap.patch diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8a87589..f5856aa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,6 +4,7 @@ project(OTPClient)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
option(USE_FLATPAK_APP_FOLDER "Use flatpak app's config folder to store the database" OFF)
+option(USE_SNAP_FOLDER "Use snap app's folder to search for ui files" OFF)
set(OTPCLIENT_VERSION_MAJOR "1")
set(OTPCLIENT_VERSION_MINOR "2")
@@ -22,6 +23,9 @@ endif()
if(USE_FLATPAK_APP_FOLDER)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_FLATPAK_APP_FOLDER")
endif()
+if(USE_SNAP_FOLDER)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_SNAP_FOLDER")
+endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-add-needed -Wl,--as-needed -Wl,--no-undefined")
diff --git a/src/get-builder.c b/src/get-builder.c
index 3607776..9cc7cdf 100644
--- a/src/get-builder.c
+++ b/src/get-builder.c
@@ -5,7 +5,11 @@ GtkBuilder *
get_builder_from_partial_path (const gchar *partial_path)
{
const gchar *prefix;
-#ifndef USE_FLATPAK_APP_FOLDER
+#if defined (USE_FLATPAK_APP_FOLDER)
+ prefix = "/app/";
+#elif defined (USE_SNAP_FOLDER)
+ prefix = "/snap/otpclient/current/";
+#else
if (g_file_test (g_strconcat ("/usr/", partial_path, NULL), G_FILE_TEST_EXISTS)) {
prefix = "/usr/";
} else if (g_file_test (g_strconcat ("/usr/local/", partial_path, NULL), G_FILE_TEST_EXISTS)) {
@@ -13,8 +17,6 @@ get_builder_from_partial_path (const gchar *partial_path)
} else {
return NULL;
}
-#else
- prefix = "/app/";
#endif
gchar *path = g_strconcat (prefix, partial_path, NULL);
@@ -23,4 +25,4 @@ get_builder_from_partial_path (const gchar *partial_path)
g_free (path);
return builder;
-}
\ No newline at end of file
+} |
Thanks a lot for your work :) |
No one seems to be interested in this. Given that flatpak works fine also on Ubuntu I see no reason to keep this open |
No description provided.
The text was updated successfully, but these errors were encountered: