File: make-app-image.sh

package info (click to toggle)
kshutdown 6.0-2
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 1,992 kB
  • sloc: cpp: 8,349; sh: 477; makefile: 5
file content (58 lines) | stat: -rwxr-xr-x 1,453 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash

# DOC: Requires:
# https://github.com/AppImage/AppImageKit
# https://github.com/linuxdeploy/linuxdeploy
# https://github.com/linuxdeploy/linuxdeploy-plugin-qt

set -eu

if [ ! -f "src/kshutdown.desktop" ]; then
	echo "USAGE: ./tools/make-app-image.sh"
	exit 1
fi

# HACK: may not work with ext4+ecryptfs
APPDIRTMP="$(mktemp -d --tmpdir kshutdown.XXXXX)"

function cleanup() {
	echo "INFO: Removing $APPDIRTMP..."

	rm -fr "$APPDIRTMP"
}

trap cleanup EXIT

echo "INFO: Using temporary directory: $APPDIRTMP"

APPDIR="$APPDIRTMP/KShutdown.AppDir"
APPIMAGE="dist/KShutdown.AppImage"
APPIMAGE_DESKTOP_FILE="$APPDIRTMP/kshutdown.desktop"

echo "INFO: Patching $APPIMAGE_DESKTOP_FILE file..."

cp -v src/kshutdown.desktop "$APPIMAGE_DESKTOP_FILE"
sed -i "s?Icon=system-reboot?Icon=kshutdown.png?g" "$APPIMAGE_DESKTOP_FILE"

echo "INFO: Creating $APPDIR..."

linuxdeploy-x86_64.AppImage \
	--appdir "$APPDIR" \
	--desktop-file "$APPIMAGE_DESKTOP_FILE" \
	--executable src/kshutdown \
	--icon-file src/images/hi16-app-kshutdown.png \
	--icon-file src/images/hi22-app-kshutdown.png \
	--icon-file src/images/hi32-app-kshutdown.png \
	--icon-file src/images/hi48-app-kshutdown.png \
	--icon-file src/images/hi64-app-kshutdown.png \
	--icon-file src/images/hi128-app-kshutdown.png \
	--icon-filename kshutdown \
	--plugin qt

echo "INFO: Creating $APPIMAGE..."

mkdir -p "dist"
appimagetool-x86_64.AppImage \
	--comp gzip \
	"$APPDIR" \
	"$APPIMAGE"