From ae747ca569b943eeb31ad460bb6e687bbdc1a3a5 Mon Sep 17 00:00:00 2001 From: trueold89 Date: Wed, 27 Mar 2024 23:45:34 +0300 Subject: [PATCH 1/3] You can now manage multiple services && main.py is now indexed in the repository --- .gitignore | 1 - VoidServiceControl/classes.py | 10 ++++------ VoidServiceControl/main.py | 21 +++++++++++++++++++++ 3 files changed, 25 insertions(+), 7 deletions(-) create mode 100755 VoidServiceControl/main.py diff --git a/.gitignore b/.gitignore index 58d60cd..b7298bb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ old/ -VoidServiceControl/main.py __pycache__ .idea .venv diff --git a/VoidServiceControl/classes.py b/VoidServiceControl/classes.py index 0186c76..79ddd71 100644 --- a/VoidServiceControl/classes.py +++ b/VoidServiceControl/classes.py @@ -70,12 +70,10 @@ class Args(object): """ Checks the arguments """ - if len(self.__arguments) == 0: - raise TypeError(lang.errors["usage"]) - if len(self.__arguments) != 2 and self.__arguments[0] not in Arg.HELP.value: - raise TypeError(lang.errors["usage"]) - if self.__arguments[0] in Arg.HELP.value: + if len(self.__arguments) == 1 and self.__arguments[0] in Arg.HELP.value: raise Help() + if len(self.__arguments) < 2: + raise TypeError(lang.errors["usage"]) if self.__arguments[0] not in Arg.all(): raise TypeError(lang.errors["args"]) @@ -91,7 +89,7 @@ class Args(object): def __iter__(self): yield self.__action() - yield self.__arguments[1] + yield self.__arguments[1:] class Service(object): diff --git a/VoidServiceControl/main.py b/VoidServiceControl/main.py new file mode 100755 index 0000000..36e0c9f --- /dev/null +++ b/VoidServiceControl/main.py @@ -0,0 +1,21 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- +from VoidServiceControl.classes import Su, Interface, Args, Help + + +def main() -> None: + try: + Su() + action, services = tuple(Args()) + for service_name in services: + service = Interface(service_name) + service.action(action) + del service + except TypeError as e: + print(f"{e}\n\n{Help()}") + except (ValueError, PermissionError, Help) as e: + print(e) + + +if __name__ == '__main__': + main() From 3f15909e695120e5e6d05be7888e251d6fcac7b2 Mon Sep 17 00:00:00 2001 From: trueold89 Date: Wed, 27 Mar 2024 23:57:04 +0300 Subject: [PATCH 2/3] Update README.md && setup.py --- README.md | 19 ++++++++++++++++++- setup.py | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0377e96..80fd99d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,12 @@ # Void Service Control (VSC) ## A simple script that will allow you to manage runit services in Void Linux +## Available on: +[![](https://cloud.orudo.ru/apps/files_sharing/publicpreview/RpcoJB8FwgNmqHC?file=/&fileId=48757&x=1920&y=1200&a=true&etag=10effec96382ba8b9fc181a5c1c85012)](https://git.orudo.ru/trueold89/void-service-control) +[![](https://cloud.orudo.ru/s/D8xtkTS8ZBCq8fC/download/GH.png)](https://github.com/Trueold89/void-service-control) + +*** + - [Installation](#install) - [Usage](#usage) - [Build from sources](#build-from_sources) @@ -14,7 +20,7 @@ From [git.orudo.ru](https://git.orudo.ru/trueold89/void-service-control/releases): ```bash -$ pip install https://git.orudo.ru/trueold89/void-service-control/releases/download/0.2/VoidServiceControl-0.2.tar.gz +$ pip install https://git.orudo.ru/trueold89/void-service-control/releases/download/0.2.1/VoidServiceControl-0.2.1.tar.gz ``` or pypi @@ -26,6 +32,12 @@ $ pip install void-service-control **Or by downloading the pre-built binary / xbps-package from the **[releases](https://git.orudo.ru/trueold89/void-service-control/releases)** page** +#### Install [.xbps package](https://git.orudo.ru/trueold89/void-service-control/releases): + +```bash +& xbps-rindex -a *.xbps && xbps-install --repository=$PWD void-service-control +``` + *** ### Usage: @@ -42,6 +54,11 @@ $ vsc e $ vsc d ``` +**Action with multiple services:** +```bash +$ vsc e +``` + **Print help:** ```bash diff --git a/setup.py b/setup.py index f716069..c4d8735 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup setup( name='VoidServiceControl', - version='0.2', + version='0.2.1', url='https://git.orudo.ru/trueold89/void-service-control', author='trueold89', author_email='trueold89@orudo.ru', From f245de20448bcf075050a3d94105cfc6704895a2 Mon Sep 17 00:00:00 2001 From: trueold89 Date: Thu, 28 Mar 2024 00:01:44 +0300 Subject: [PATCH 3/3] Add xbps-src template --- VoidTemplate | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 VoidTemplate diff --git a/VoidTemplate b/VoidTemplate new file mode 100644 index 0000000..ea2edbc --- /dev/null +++ b/VoidTemplate @@ -0,0 +1,12 @@ +# Template file for 'void-service-control' +pkgname=void-service-control +version= +revision=1 +build_style=python3-module +hostmakedepends="python3-setuptools" +short_desc="A simple script that will allow you to manage runit services in Void Linux" +maintainer="Trueold89 " +license="GPL-3" +homepage="https://git.orudo.ru/trueold89/void-service-control" +distfiles="https://git.orudo.ru/trueold89/void-service-control/releases/download/${version}/VoidServiceControl-${version}.tar.gz" +checksum=