Skip to content

Commit

Permalink
AppImage support added
Browse files Browse the repository at this point in the history
  • Loading branch information
GleammerRay committed Jul 12, 2022
1 parent 4c04efd commit 81b092a
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 2 deletions.
94 changes: 94 additions & 0 deletions appimage_builder
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions linux/my_application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 81b092a

Please sign in to comment.