From 81b092a7df3ddfa2dedc1cad76dc448a12cf1b38 Mon Sep 17 00:00:00 2001 From: GleammerRay <101527589+GleammerRay@users.noreply.github.com> Date: Tue, 12 Jul 2022 13:24:30 +0100 Subject: [PATCH] AppImage support added --- appimage_builder | 94 +++++++++++++++++++++++++++++++++++++++++ linux/my_application.cc | 4 +- 2 files changed, 96 insertions(+), 2 deletions(-) create mode 100755 appimage_builder diff --git a/appimage_builder b/appimage_builder new file mode 100755 index 00000000..056335cc --- /dev/null +++ b/appimage_builder @@ -0,0 +1,94 @@ +#! /bin/bash + +# downloaded from https://gist.github.com/naveenadi/8dbe75c04cae7739f5cce0a260eb3e08 + +export ARCH=$(uname -m) + +echo "INFO:Generator:Searching AppDir" +export appId='com.teampassy.passy' +#read -p "? ID [Eg: com.example.app]: " appId +export appName='Passy' +#read -p "? Application Name: " appName +export appIcon='logo' +#read -p "? Icon: " appIcon +export appExec='passy' +#read -p "? Executable path relative to AppDir [usr/bin/app]: " appExec +# read -p "? Arguments [Default: $@]: " appExec_args +read -p "? Version [Eg: 1.0.0]: " appVersion +# read -p "? Update Information [Default: guess]: " guess +# read -p "? Architecture: " x86_64 + +function download_appimagetool() { + if [ ! -d ./build ]; then mkdir ./build; fi + if [ ! -d ./build/appimage ]; then mkdir ./build/appimage; fi + if [ ! -d ./build/appimage/appimage-build ]; then mkdir ./build/appimage/appimage-build; fi + if [ ! -x ./build/appimage/appimage-build/appimagetool-$ARCH.AppImage ]; then + curl -L -o ./build/appimage/appimage-build/appimagetool-$ARCH.AppImage https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-$ARCH.AppImage + chmod a+x ./build/appimage/appimage-build/appimagetool-$ARCH.AppImage + fi +} + +function create_appdir() { + if [ -d "./build/appimage/$appName.AppDir" ]; then rm -rf ./build/appimage/$appName.AppDir; fi + mkdir ./build/appimage/$appName.AppDir +} + +function after_bundle() { + cp build/linux/x64/release/bundle/assistant build/appimage/$appName.AppDir + cp -r build/linux/x64/release/bundle/lib/. build/appimage/$appName.AppDir/lib + cp -r build/linux/x64/release/bundle/data build/appimage/$appName.AppDir + cp -r build/linux/x64/release/bundle/passy build/appimage/$appName.AppDir + # cp $appIcon AppDir/usr/share/icons/ + + # cp -r build/linux/*/release/bundle/ $appName.AppDir + + # if [[ $(file -b "$appIcon.[ps]*g") =~ ]]; + + if [ ! -b "$appIcon.[ps]*g" ]; then + cp $appIcon.[ps]*g build/appimage/$appName.AppDir + # mkdir -p $appName.AppDir/usr/share/icons/ + # cp $appIcon.[ps]*g $appName.AppDir/usr/share/icons/ + fi +} + +function create_apprun() { + touch build/appimage/$appName.AppDir/AppRun + echo -e '#!/bin/sh\n\ncd "$(dirname "$0")"\nexec ./'$appExec'' > ./build/appimage/$appName.AppDir/AppRun + chmod +x ./build/appimage/$appName.AppDir/AppRun +} + +function create_desktop() { + local de="[Desktop Entry]" + local xaa="X-AppImage-Arch=$ARCH" + local xav="X-AppImage-Version=$appVersion" + local xan="X-AppImage-Name=$appName" + local v="Version=1.0" + local ty="Type=Application" + local te="Terminal=false" + local n="Name=$appName" + local e="Exec=$appExec %u" + local i="Icon=$appIcon" + local ca="Categories=Utility;" + local co="Comment=Cross-Platform Password Manager" + + touch ./build/appimage/$appName.AppDir/$appId.desktop + echo -e "$de\n$xaa\n$xav\n$xan\n$v\n$ty\n$te\n$n\n$e\n$i\n$ca\n$co" > ./build/appimage/$appName.AppDir/$appId.desktop +} + +function build_appimage() { + # the build command itself: + ./build/appimage/appimage-build/appimagetool-$ARCH.AppImage ./build/appimage/$appName.AppDir + + # move result in build folder + + mv ./$appName-$ARCH.AppImage ./build/appimage/$appName-$appVersion-$ARCH.AppImage + +} + + +download_appimagetool +create_appdir +after_bundle +create_apprun +create_desktop +build_appimage diff --git a/linux/my_application.cc b/linux/my_application.cc index 5872047b..68d965c5 100644 --- a/linux/my_application.cc +++ b/linux/my_application.cc @@ -40,11 +40,11 @@ static void my_application_activate(GApplication* application) { if (use_header_bar) { GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); gtk_widget_show(GTK_WIDGET(header_bar)); - gtk_header_bar_set_title(header_bar, "passy"); + gtk_header_bar_set_title(header_bar, "Passy"); gtk_header_bar_set_show_close_button(header_bar, TRUE); gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); } else { - gtk_window_set_title(window, "passy"); + gtk_window_set_title(window, "Passy"); } gtk_window_set_default_size(window, 1280, 720);