Skip to content

Commit a40ea8e

Browse files
committed
\#11: Initial AppImage packaging system
1 parent aba7c94 commit a40ea8e

File tree

6 files changed

+90
-19
lines changed

6 files changed

+90
-19
lines changed

.travis.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ script:
1212
- echo No test scripts implemented yet. Travis is used only for deploy yet.
1313

1414
before_deploy:
15-
- package/update_version.sh $TRAVIS_TAG
15+
- package/build_all.sh $TRAVIS_TAG
1616

1717
deploy:
1818
- provider: releases
1919
api_key:
2020
secure: zFbsCIKcsvWU/Yc+9k294Qj8QY48VlkV8DSScP5gz6dQegeUSaSHI/YafherkFQ0B03bIY8yc7roMtDo7HAkEnPptjFhdUiOFI11+xDVb3s7Y8Ek2nV3znQzdtR4CR/94l3in6R3DH+eNA6+6Je/NIWLdVcvRX07RBSfBVdPmnsAyAD9KNTsl8Q4c20HgtLNxfWv2s5eCyD+heCTLYrErEZKZ5vYeeANmWomHvT2ED/4QerpBP8wkh59QXD1S79CF7oyq6X173ZJUQVxdBP+OSXt/mDBAoqf+TV6okawRZn48JluvCWAJ7BceX7t9emd1rVI/s8t3wCP+eMcmNn5g/6UJaCPnTJ5YplTuUWRc63UFSkE0AY8WYcRlrz+/OiXYgQ8LMXfN23aWgarHCbS2vHR3Afu9gpLCoKucr36hKhs3zfjJzVLFFW16mnbaTFcBzfDDRpkvOANB1aZwGVRFpTIWIMjkn0+lxWTC/moIJvQlfRPsC4dN5cDAilRQlguHzayebtGE8X0PuIe9A8bkET3V/y+KPnQiSJ7J+5PNoDSdqRAE4IKvVOLEyHtlqBVkvIHKnugUnWPIZ21gm5RemMEj9/YGa8Efwz7PIKtJJ3kFMGDYKVlIKyB+rg/TFWNdo6jjevnWM6y4SfVI3kFyjA+mp31o6nshrQy0zVQpd8=
2121
file:
22-
- "package/debian/build/virtscreen_$TRAVIS_TAG-1_all.deb"
22+
- package/debian/build/virtscreen_$TRAVIS_TAG-1_all.deb
23+
- package/appimage/VirtScreen-x86_64.AppImage
2324
skip_cleanup: true
2425
on:
2526
tags: true

Dockerfile

+13-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22
FROM ubuntu:bionic
33
LABEL author="Bumsik Kim <[email protected]>"
44

5-
WORKDIR /app
6-
CMD ["/bin/bash"]
7-
85
RUN apt-get update && \
9-
apt-get install -y python3-all python3-pip python3-wheel fakeroot debmake debhelper fakeroot wget tar && \
6+
apt-get install -y python3-all python3-pip python3-wheel fakeroot debmake debhelper fakeroot wget tar curl && \
107
apt-get autoremove -y && \
118
ln /usr/bin/python3 /usr/bin/python && \
129
ln /usr/bin/pip3 /usr/bin/pip && \
@@ -18,3 +15,15 @@ RUN apt-get update && \
1815
RUN wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \
1916
bash ~/miniconda.sh -b -p ~/miniconda && \
2017
rm ~/miniconda.sh
18+
19+
# AppImageKit
20+
WORKDIR /opt
21+
RUN wget https://github.com/AppImage/AppImageKit/releases/download/10/appimagetool-x86_64.AppImage && \
22+
chmod a+x appimagetool-x86_64.AppImage && \
23+
./appimagetool-x86_64.AppImage --appimage-extract && \
24+
mv squashfs-root appimagetool && \
25+
rm appimagetool-x86_64.AppImage
26+
ENV PATH=/opt/appimagetool/usr/bin:$PATH
27+
28+
WORKDIR /app
29+
CMD ["/bin/bash"]

Makefile

+21-12
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
# for python packaging reference.
33

44
DOCKER_NAME=kbumsik/virtscreen
5-
DOCKER_RUN=docker run -v $(shell pwd)/package/debian:/app $(DOCKER_NAME)
6-
DOCKER_RUN_TTY=docker run --interactive --tty -v $(shell pwd)/package/debian:/app $(DOCKER_NAME)
5+
DOCKER_RUN=docker run --interactive --tty -v $(shell pwd):/app $(DOCKER_NAME)
6+
DOCKER_RUN_TTY=docker run --interactive --tty -v $(shell pwd):/app $(DOCKER_NAME)
7+
DOCKER_RUN_DEB=docker run -v $(shell pwd)/package/debian:/app $(DOCKER_NAME)
78

89
.PHONY:
910

@@ -41,29 +42,37 @@ docker-push:
4142
docker login
4243
docker push $(DOCKER_NAME)
4344

45+
# For AppImage packaging, https://github.com/AppImage/AppImageKit/wiki/Creating-AppImages
46+
appimage-build:
47+
$(DOCKER_RUN) package/appimage/build.sh
48+
$(DOCKER_RUN) chown -R $(shell id -u):$(shell id -u) package/appimage
49+
50+
appimage-clean:
51+
$(DOCKER_RUN) rm -rf package/appimage/virtscreen.AppDir package/appimage/VirtScreen-x86_64.AppImage
52+
4453
# For Debian packaging, https://www.debian.org/doc/manuals/debmake-doc/ch08.en.html#setup-py
4554
deb-make:
46-
$(DOCKER_RUN) /app/debmake.sh
55+
$(DOCKER_RUN_DEB) /app/debmake.sh
4756

4857
deb-build: deb-make
49-
$(DOCKER_RUN) /app/copy_debian.sh
50-
$(DOCKER_RUN) /app/debuild.sh
58+
$(DOCKER_RUN_DEB) /app/copy_debian.sh
59+
$(DOCKER_RUN_DEB) /app/debuild.sh
5160

5261
deb-contents:
53-
$(DOCKER_RUN) /app/contents.sh
62+
$(DOCKER_RUN_DEB) /app/contents.sh
5463

5564
deb-env-make:
56-
$(DOCKER_RUN) /app/debmake.sh virtualenv
65+
$(DOCKER_RUN_DEB) /app/debmake.sh virtualenv
5766

5867
deb-env-build: deb-env-make
59-
$(DOCKER_RUN) /app/copy_debian.sh virtualenv
60-
$(DOCKER_RUN) /app/debuild.sh virtualenv
68+
$(DOCKER_RUN_DEB) /app/copy_debian.sh virtualenv
69+
$(DOCKER_RUN_DEB) /app/debuild.sh virtualenv
6170

6271
deb-chown:
63-
$(DOCKER_RUN) chown -R $(shell id -u):$(shell id -u) /app/build
72+
$(DOCKER_RUN_DEB) chown -R $(shell id -u):$(shell id -u) /app/build
6473

6574
deb-clean:
66-
$(DOCKER_RUN) rm -rf /app/build
75+
$(DOCKER_RUN_DEB) rm -rf /app/build
6776

6877
# For AUR: https://wiki.archlinux.org/index.php/Python_package_guidelines
6978
# and: https://wiki.archlinux.org/index.php/Creating_packages
@@ -95,4 +104,4 @@ arch-clean:
95104
cd package/archlinux
96105
rm -rf pkg src *.tar*
97106

98-
clean: arch-clean deb-clean python-clean
107+
clean: appimage-clean arch-clean deb-clean python-clean

package/appimage/AppRun

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
# This script is only for isolated miniconda environment
3+
# Used in AppImage package
4+
SCRIPTDIR=$(dirname $0)
5+
ENV=$SCRIPTDIR/usr/share/virtscreen/env
6+
7+
echo $SCRIPTDIR
8+
export PYTHONPATH=$ENV/lib/python3.6
9+
export LD_LIBRARY_PATH=$ENV/lib
10+
export QT_PLUGIN_PATH=$ENV/lib/python3.6/site-packages/PyQt5/Qt/plugins
11+
export QML2_IMPORT_PATH=$ENV/lib/python3.6/site-packages/PyQt5/Qt/qml
12+
# export QT_QPA_FONTDIR=/usr/share/fonts
13+
# export QT_XKB_CONFIG_ROOT=/usr/share/X11/xkb
14+
15+
$ENV/bin/python3 $ENV/bin/virtscreen

package/appimage/build.sh

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
# Directory
4+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
5+
ROOT=$DIR/../..
6+
7+
cd $ROOT/package/appimage
8+
mkdir virtscreen.AppDir
9+
cd virtscreen.AppDir
10+
# Create virtualenv
11+
install -d usr/share/virtscreen
12+
source $HOME/miniconda/bin/activate && \
13+
conda create -y --copy --prefix usr/share/virtscreen/env python=3.6
14+
# Install VirtScreen using pip
15+
source $HOME/miniconda/bin/activate && \
16+
source activate usr/share/virtscreen/env && \
17+
pip install $ROOT
18+
# Delete unnecessary installed files done by setup.py
19+
rm -rf usr/share/virtscreen/env/lib/python3.6/site-packages/usr
20+
# Copy desktop entry, icon, and AppRun
21+
install -m 644 -D $ROOT/virtscreen.desktop \
22+
usr/share/applications/virtscreen.desktop
23+
install -m 644 -D $ROOT/virtscreen.desktop \
24+
.
25+
install -m 644 -D $ROOT/data/virtscreen.png \
26+
usr/share/pixmaps/virtscreen.png
27+
install -m 644 -D $ROOT/data/virtscreen.png \
28+
.
29+
install -m 755 -D $ROOT/package/appimage/AppRun \
30+
.
31+
cd ..
32+
appimagetool virtscreen.AppDir

package/update_version.sh package/build_all.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ build_pypi () {
3232
make -C $ROOT python-wheel
3333
}
3434

35+
build_appimage () {
36+
make -C $ROOT appimage-build
37+
}
38+
3539
build_arch () {
3640
wget -q https://github.com/kbumsik/VirtScreen/archive/$VERSION.tar.gz
3741
SHA256=$(sha256sum $VERSION.tar.gz | cut -d' ' -f1)
@@ -49,5 +53,6 @@ build_debian () {
4953

5054
override_version
5155
# build_pypi
52-
build_arch
56+
build_appimage
57+
# build_arch
5358
build_debian

0 commit comments

Comments
 (0)