summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2019-02-17 04:20:43 +0300
committerDevaev Maxim <[email protected]>2019-02-17 04:20:43 +0300
commit45fa3da3d7f85536ce62f9b73a278ef8cf9b4086 (patch)
treec84f616320fe8ea418516b66690cb01fd7c222e9
parent10498811a646f833037d01ad7c816df9dea5a772 (diff)
platform packages
-rw-r--r--.dockerignore11
-rw-r--r--.gitignore7
-rw-r--r--Makefile2
-rw-r--r--PKGBUILD52
-rw-r--r--configs/os/systemd/kvmd-nginx.service17
5 files changed, 77 insertions, 12 deletions
diff --git a/.dockerignore b/.dockerignore
index 3aeb85cc..4e0990a5 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,3 +1,14 @@
+/pkg/
+/src/
+/site/
+/build/
+/dist/
+/kvmd.egg-info/
/testenv/.tox/
/testenv/.mypy_cache/
/.git/
+/v*.tar.gz
+/*.pkg.tar.xz
+/*.egg-info
+/*kvmd-*.tar.gz
+
diff --git a/.gitignore b/.gitignore
index ca39aeff..87da5a35 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,14 @@
+/pkg/
+/src/
+/site/
/build/
/dist/
/kvmd.egg-info/
/testenv/.tox/
/testenv/.mypy_cache/
+/v*.tar.gz
+/*.pkg.tar.xz
+/*.egg-info
+/*kvmd-*.tar.gz
*.pyc
*.swp
diff --git a/Makefile b/Makefile
index f7baf2f5..5de3c377 100644
--- a/Makefile
+++ b/Makefile
@@ -51,7 +51,7 @@ push:
clean:
- rm -rf build site dist pkg src *.egg-info kvmd-*.tar.gz
+ rm -rf build site dist pkg src v*.tar.gz *.pkg.tar.xz *.egg-info kvmd-*.tar.gz
find kvmd -name __pycache__ | xargs rm -rf
rm -rf __pycache__
make -C hid clean
diff --git a/PKGBUILD b/PKGBUILD
index 71535397..df6c26a9 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,7 +2,17 @@
# Author: Maxim Devaev <[email protected]>
-pkgname=kvmd
+_PLATFORMS="v1-vga v1-hdmi"
+_BOARDS="rpi2 rpi3"
+
+
+pkgname=(kvmd)
+for _platform in $_PLATFORMS; do
+ for _board in $_BOARDS; do
+ pkgname+=(kvmd-platform-$_platform-$_board)
+ done
+done
+pkgbase=kvmd
pkgver=0.128
pkgrel=1
pkgdesc="The main Pi-KVM daemon"
@@ -23,37 +33,57 @@ depends=(
python-dbus
python-pygments
v4l-utils
+ nginx
)
makedepends=(python-setuptools)
source=("$url/archive/v$pkgver.tar.gz")
md5sums=(SKIP)
-install=$pkgname.install
build() {
- cd $srcdir
+ cd "$srcdir"
rm -rf $pkgname-build
cp -r kvmd-$pkgver $pkgname-build
cd $pkgname-build
python setup.py build
}
-package() {
- cd $srcdir/$pkgname-build
+package_kvmd() {
+ install=$pkgname.install
+
+ cd "$srcdir/$pkgname-build"
python setup.py install --root="$pkgdir"
mkdir -p "$pkgdir/usr/lib/systemd/system"
cp configs/os/systemd/*.service "$pkgdir/usr/lib/systemd/system"
+ _cfgdir="$pkgdir/usr/share/kvmd/configs.default"
mkdir -p "$pkgdir/usr/share/kvmd"
cp -r web "$pkgdir/usr/share/kvmd"
cp -r extras "$pkgdir/usr/share/kvmd"
- cp -r configs "$pkgdir/usr/share/kvmd/configs.default"
- rm -rf "$pkgdir/usr/share/kvmd/configs.default/os/systemd"
- sed -i -e "s/^#PROD//g" "$pkgdir/usr/share/kvmd/configs.default/nginx/nginx.conf"
+ cp -r configs "$_cfgdir"
+
+ rm -rf "$_cfgdir/os/systemd"
find "$pkgdir" -name ".gitignore" -delete
- find "$pkgdir/usr/share/kvmd/configs.default" -type f -exec chmod 444 '{}' \;
- chmod 440 "$pkgdir/usr/share/kvmd/configs.default/kvmd/htpasswd"
+ sed -i -e "s/^#PROD//g" "$_cfgdir/nginx/nginx.conf"
+ find "$_cfgdir" -type f -exec chmod 444 '{}' \;
+ chmod 440 "$_cfgdir/kvmd/htpasswd"
- mkdir -p "$pkgdir/etc/kvmd"
+ mkdir -p "$pkgdir/etc/kvmd/nginx"
+ for path in "$_cfgdir/nginx/*.conf"; do
+ ln -sf "/usr/share/kvmd/configs.default/nginx/`basename $path`" "$pkgdir/etc/kvmd/nginx"
+ done
}
+
+export pkgdir
+for _platform in $_PLATFORMS; do
+ for _board in $_BOARDS; do
+ eval "package_kvmd-platform-$_platform-$_board() {
+ mkdir -p \"$pkgdir/etc/\"{sysctl.d,udev/rules.d,modules-load.d}
+ _osdir=\"/usr/share/kvmd/configs.default/os\"
+ ln -sf \"$_osdir/sysctl.conf\" \"$pkgdir/etc/sysctl.d/99-pikvm.conf\"
+ ln -sf \"$_osdir/udev/$_platform-$_board.rules\" \"$pkgdir/etc/udev/rules.d/99-pikvm.rules\"
+ ln -sf \"$_osdir/modules-load/$_platform.conf\" \"$pkgdir/etc/modules-load.d/pikvm.conf\"
+ }"
+ done
+done
diff --git a/configs/os/systemd/kvmd-nginx.service b/configs/os/systemd/kvmd-nginx.service
new file mode 100644
index 00000000..ab223488
--- /dev/null
+++ b/configs/os/systemd/kvmd-nginx.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=Nginx instance for KVMD
+After=network.target network-online.target nss-lookup.target kvmd.service
+
+[Service]
+Type=forking
+PIDFile=/run/kvmd-nginx.pid
+PrivateDevices=yes
+SyslogLevel=err
+
+ExecStart=/usr/bin/nginx -g 'pid /run/kvmd-nginx.pid; error_log stderr;'
+ExecReload=/usr/bin/nginx -s reload -p /etc/kvmd/nginx
+KillSignal=SIGQUIT
+KillMode=mixed
+
+[Install]
+WantedBy=multi-user.target