-
Notifications
You must be signed in to change notification settings - Fork 3
/
app-image-create.sh
executable file
·108 lines (89 loc) · 3.98 KB
/
app-image-create.sh
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/usr/bin/env bash
set -e
cd `dirname $0`
VERSION='latest'
# Will create a https://appimage.org/
# [Get the tools]
if [ ! -f linuxdeploy-plugin-conda.sh ]; then
wget -nc "https://raw.githubusercontent.com/TheAssassin/linuxdeploy-plugin-conda/master/linuxdeploy-plugin-conda.sh"
chmod +x linuxdeploy-plugin-conda.sh
fi
if [ ! -f linuxdeploy-x86_64.AppImage ]; then
wget -nc "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
chmod +x linuxdeploy-x86_64.AppImage
fi
if [ ! -f appimagetool-x86_64.AppImage ]; then
wget -nc "https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage"
chmod +x appimagetool-x86_64.AppImage
fi
rm -rf AppDir
# ------------------------------------------------------------------------------
# [Prepair the ingredients]
APP_RUN='#! /bin/bash
APPDIR=`dirname $0`
export PATH="$PATH":"${APPDIR}"/usr/bin
if [ "$($APPDIR/can-run-host.py)" == "ALL_OK" ]; then
${APPDIR}/opt/database-dossier/database-dossier.py $@
else
${APPDIR}/usr/bin/python3 ${APPDIR}/opt/database-dossier/database-dossier.py $@
fi'
export CONDA_PYTHON_VERSION="3.9"
export CONDA_CHANNELS='conda-forge'
# I think PyWebkit looks nicer than the new QtWebEngine
#export CONDA_PACKAGES='PyQtWebKit; pyqt5 5.15.7'
export CONDA_PACKAGES='PyQtWebKit';# pyqt5 5.15.7'
# Install PyQt5 at this point - will install the correct version
export PIP_REQUIREMENTS='appdirs mysql_connector_python Pygments pyqt5'
# [Pour everything into a large bowl]
mkdir -p ./AppDir/opt/database-dossier/artwork
cp ../artwork/*.png ./AppDir/opt/database-dossier/artwork/
cp ../database-dossier.py ./AppDir/opt/database-dossier
cp -R ../database_dossier ./AppDir/opt/database-dossier
cp -R ../doc ./AppDir/opt/database-dossier
cp -R ../diagram ./AppDir/opt/database-dossier
cp -p can-run-host.py ./AppDir/
echo "$APP_RUN" > ./AppDir/AppRun.sh
# ------------------------------------------------------------------------------
# [Stir until well mixed]
./linuxdeploy-x86_64.AppImage \
--appdir AppDir \
-i ../artwork/database-dossier.png \
-d ../artwork/database-dossier.desktop \
--plugin conda \
--custom-apprun ./AppDir/AppRun.sh \
--output appimage
# The version of PyQt that is compatibile with PyQtWebKit has a nasty bug
# this change makes things work
#sed -i 's/QtCore.QMetaObject.connectSlotsByName(self.toplevelWidget)/#QtCore.QMetaObject.connectSlotsByName(self.toplevelWidget)/g' AppDir/usr/conda/lib/*/site-packages/PyQt5/uic/uiparser.py
sed -i 's/QtCore.QMetaObject.connectSlotsByName(self.toplevelWidget)/#QtCore.QMetaObject.connectSlotsByName(self.toplevelWidget)/g' AppDir/usr/conda/lib/python3.9/site-packages/PyQt5/uic/uiparser.py
mkdir -p AppDir/usr/share/metainfo/
echo '<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>com.nshiell.database-dossier</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0</project_license>
<name>Database Dossier</name>
<summary>Query your databases</summary>
<description>
<p>Query your databases.</p>
</description>
<launchable type="desktop-id">database-dossier.desktop</launchable>
<url type="homepage">https://nshiell.com/database-dossier</url>
<screenshots>
<screenshot type="default">
<image>https://nshiell.com/database-dossier/screenshot-kde.png</image>
</screenshot>
</screenshots>
<provides>
<id>database-dossier.desktop</id>
</provides>
</component>' > AppDir/usr/share/metainfo/com.nshiell.database-dossier.xml
rm Database_Dossier*.AppImage
# ------------------------------------------------------------------------------
# [Preheat the oven upto gas mark 6 and wait for it to bake]
./appimagetool-x86_64.AppImage AppDir --sign
# ------------------------------------------------------------------------------
# [serve with garnish]
mkdir -p ../release
mv Database_Dossier*.AppImage "../release/Database-Dossier-$VERSION.AppImage"
ls -l ../release