This commit is contained in:
Devaev Maxim 2018-06-29 00:29:24 +03:00
parent 9237bb020d
commit b06bf44e33
6 changed files with 115 additions and 7 deletions

15
kvmd/.bumpversion.cfg Normal file
View File

@ -0,0 +1,15 @@
[bumpversion]
commit = True
tag = True
current_version = 0.1
parse = (?P<major>\d+)\.(?P<minor>\d+)(\-(?P<release>[a-z]+))?)?
serialize =
{major}.{minor}.{patch}
[bumpversion:file:setup.py]
search = version="{current_version}"
replace = version="{new_version}"
[bumpversion:file:PKGBUILD]
search = pkgver="{current_version}"
replace = pkgver="{new_version}"

1
kvmd/MANIFEST.in Normal file
View File

@ -0,0 +1 @@
include requirements.txt

43
kvmd/PKGBUILD Normal file
View File

@ -0,0 +1,43 @@
# Contributor: Maxim Devaev <mdevaev@gmail.com>
# Author: Maxim Devaev <mdevaev@gmail.com>
pkgname="kvmd"
pkgver="0.1"
pkgrel="1"
pkgdesc="The main Pi-KVM daemon"
arch=("any")
url="https://github.com/mdevaev/pi-kvm"
license=("GPL")
depends=(
"python"
"python-yaml"
"python-aiohttp"
"python-raspberry-gpio"
)
backup=("etc/kvmd.yaml")
makedepends=("python-setuptools" "wget")
build() {
cd $startdir/src
if [ ! -d $pkgname-$pkgver ]; then
msg "Downloading tag v$pkgver..."
wget $url/archive/v$pkgver.tar.gz
tar -xzf v$pkgver.tar.gz
fi
rm -rf $pkgname-build
cp -r $pkgname-$pkgver $pkgname-build
cd $pkgname-build/kvmd
python setup.py build
}
package() {
cd $srcdir/$pkgname-build/kvmd
python setup.py install --root=$pkgdir
install -Dm644 kvmd.yaml $pkgdir/etc/kvmd.yaml
install -Dm644 kvmd.service "$pkgdir"/usr/lib/systemd/system/nginx.service
}

View File

@ -1,5 +1,5 @@
[Unit]
Description=The main process of Pi-KVM
Description=The main Pi-KVM daemon
After=network.target network-online.target nss-lookup.target
[Service]
@ -7,8 +7,8 @@ Type=simple
Restart=always
RestartSec=3
ExecStart=python -m kvmd --config /etc/kvmd.yaml
ExecStopPost=python -m kvmd.extras.cleanup --config /etc/kvmd.yaml
ExecStart=kvmd --config /etc/kvmd.yaml
ExecStopPost=kvmd-cleanup --config /etc/kvmd.yaml
[Install]
WantedBy=multi-user.target

51
kvmd/setup.py Executable file
View File

@ -0,0 +1,51 @@
#!/usr/bin/env python3
from setuptools import setup
# =====
def main() -> None:
with open("requirements.txt") as requirements_file:
install_requires = list(filter(None, requirements_file.read().splitlines()))
setup(
name="kvmd",
version="0.1",
url="https://github.com/mdevaev/pi-kvm",
license="GPLv3",
author="Maxim Devaev",
author_email="mdevaev@gmail.com",
description="The main Pi-KVM daemon",
platforms="any",
packages=[
"kvmd",
"kvmd.extras",
],
entry_points={
"console_scripts": [
"kvmd = kvmd:main",
"kvmd-cleanup = kvmd.extras.cleanup:main",
"kvmd-wscli = kvmd.extras.wscli:main",
],
},
install_requires=install_requires,
classifiers=[
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Development Status :: 3 - Alpha",
"Programming Language :: Python :: 3.6",
"Topic :: System :: Systems Administration",
"Operating System :: POSIX :: Linux",
"Intended Audience :: System Administrators",
"Intended Audience :: End Users/Desktop",
"Intended Audience :: Telecommunications Industry",
],
)
if __name__ == "__main__":
main()

View File

@ -7,13 +7,11 @@ set -x
cat config.txt > "$FS/boot/config.txt"
pkg_install \
python \
python-pyaml \
python-aiohttp \
python-raspberry-gpio \
kvmd \
mjpg-streamer-pikvm \
nginx
cp index.html "$FS/srv/http/"
cp nginx.conf "$FS/etc/nginx/"
rpi systemctl enable kvmd
rpi systemctl enable nginx