diff options
-rw-r--r-- | kvmd/.bumpversion.cfg | 15 | ||||
-rw-r--r-- | kvmd/MANIFEST.in | 1 | ||||
-rw-r--r-- | kvmd/PKGBUILD | 43 | ||||
-rw-r--r-- | kvmd/kvmd.service | 6 | ||||
-rwxr-xr-x | kvmd/setup.py | 51 | ||||
-rwxr-xr-x | os/kvm/run.sh | 6 |
6 files changed, 115 insertions, 7 deletions
diff --git a/kvmd/.bumpversion.cfg b/kvmd/.bumpversion.cfg new file mode 100644 index 00000000..0574a99e --- /dev/null +++ b/kvmd/.bumpversion.cfg @@ -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}" diff --git a/kvmd/MANIFEST.in b/kvmd/MANIFEST.in new file mode 100644 index 00000000..f9bd1455 --- /dev/null +++ b/kvmd/MANIFEST.in @@ -0,0 +1 @@ +include requirements.txt diff --git a/kvmd/PKGBUILD b/kvmd/PKGBUILD new file mode 100644 index 00000000..c603814a --- /dev/null +++ b/kvmd/PKGBUILD @@ -0,0 +1,43 @@ +# Contributor: Maxim Devaev <[email protected]> +# Author: Maxim Devaev <[email protected]> + + +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 +} diff --git a/kvmd/kvmd.service b/kvmd/kvmd.service index 40fd6cd9..7b04fc59 100644 --- a/kvmd/kvmd.service +++ b/kvmd/kvmd.service @@ -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 diff --git a/kvmd/setup.py b/kvmd/setup.py new file mode 100755 index 00000000..30316b37 --- /dev/null +++ b/kvmd/setup.py @@ -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="[email protected]", + 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() diff --git a/os/kvm/run.sh b/os/kvm/run.sh index c2bb8b7d..904fd3ef 100755 --- a/os/kvm/run.sh +++ b/os/kvm/run.sh @@ -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 |