-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathcreate-deb.sh
executable file
·45 lines (41 loc) · 1.83 KB
/
create-deb.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
#!/bin/sh
# Script to create a PyQT deb package using fpm
#
# This script will create a folder structure that will be used as input
# for the fpm command and copy into it all the distributable files generated by
# pyinstaller.
# We will create a folder with the same structure Linux systems expects:
# - /opt for our executable and associated files (a.k.a our dist/ folder)
# - /usr/share/applications (for the .desktop file)
# - /usr/share/icons/hicolor/scalable/apps for our svg icons (only svg in scalable folder)
#
# More info:
# - https://www.pythonguis.com/tutorials/packaging-pyqt5-applications-linux-pyinstaller/
# - https://fpm.readthedocs.io/en/latest/packages/dir.html#dir-local-files
#
# Create folders
[ -e tmp ] && rm -r tmp
mkdir -p tmp/opt
mkdir -p tmp/usr/share/applications
mkdir -p tmp/usr/share/icons/hicolor/scalable/apps
# Build the project
[ -e build ] && rm -r build
[ -e dist ] && rm -r dist
python build.py
# Copy files
cp -r dist/opendataeditor tmp/opt/opendataeditor
cp ./packaging/linux/icon.svg tmp/usr/share/icons/hicolor/scalable/apps/org.okfn.opendataeditor.svg
cp ./packaging/linux/opendataeditor.desktop tmp/usr/share/applications
# Change permissions
# Packages retain the permissions of installed files from when they were packaged,
# but will be installed by root. In order for ordinary users to be able to run the
# application, we need to change the permissions.
find tmp/opt/opendataeditor -type f -exec chmod 644 -- {} +
find tmp/opt/opendataeditor -type d -exec chmod 755 -- {} +
find tmp/usr/share -type f -exec chmod 644 -- {} +
chmod +x tmp/opt/opendataeditor/opendataeditor
# Create the deb package
VERSION=$(python -c "import ode; print(ode.__version__)")
FILENAME=opendataeditor-linux-$VERSION.deb
[ -e dist/$FILENAME ] && rm dist/$FILENAME
fpm -C tmp -s dir -t deb -n "opendataeditor" -v $VERSION -p dist/$FILENAME