Compare commits
No commits in common. "main" and "0.2" have entirely different histories.
|
@ -1,4 +1,5 @@
|
||||||
old/
|
old/
|
||||||
|
VoidServiceControl/main.py
|
||||||
__pycache__
|
__pycache__
|
||||||
.idea
|
.idea
|
||||||
.venv
|
.venv
|
||||||
|
|
19
README.md
19
README.md
|
@ -1,12 +1,6 @@
|
||||||
# Void Service Control (VSC)
|
# Void Service Control (VSC)
|
||||||
## A simple script that will allow you to manage runit services in Void Linux
|
## 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)
|
- [Installation](#install)
|
||||||
- [Usage](#usage)
|
- [Usage](#usage)
|
||||||
- [Build from sources](#build-from_sources)
|
- [Build from sources](#build-from_sources)
|
||||||
|
@ -20,7 +14,7 @@
|
||||||
From [git.orudo.ru](https://git.orudo.ru/trueold89/void-service-control/releases):
|
From [git.orudo.ru](https://git.orudo.ru/trueold89/void-service-control/releases):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ pip install https://git.orudo.ru/trueold89/void-service-control/releases/download/0.2.1/VoidServiceControl-0.2.1.tar.gz
|
$ pip install https://git.orudo.ru/trueold89/void-service-control/releases/download/0.2/VoidServiceControl-0.2.tar.gz
|
||||||
```
|
```
|
||||||
or pypi
|
or pypi
|
||||||
|
|
||||||
|
@ -32,12 +26,6 @@ $ 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**
|
**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:
|
### Usage:
|
||||||
|
@ -54,11 +42,6 @@ $ vsc e <service_name>
|
||||||
$ vsc d <service_name>
|
$ vsc d <service_name>
|
||||||
```
|
```
|
||||||
|
|
||||||
**Action with multiple services:**
|
|
||||||
```bash
|
|
||||||
$ vsc e <first_service_name> <second_service_name>
|
|
||||||
```
|
|
||||||
|
|
||||||
**Print help:**
|
**Print help:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
|
@ -70,10 +70,12 @@ class Args(object):
|
||||||
"""
|
"""
|
||||||
Checks the arguments
|
Checks the arguments
|
||||||
"""
|
"""
|
||||||
if len(self.__arguments) == 1 and self.__arguments[0] in Arg.HELP.value:
|
if len(self.__arguments) == 0:
|
||||||
raise Help()
|
|
||||||
if len(self.__arguments) < 2:
|
|
||||||
raise TypeError(lang.errors["usage"])
|
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:
|
||||||
|
raise Help()
|
||||||
if self.__arguments[0] not in Arg.all():
|
if self.__arguments[0] not in Arg.all():
|
||||||
raise TypeError(lang.errors["args"])
|
raise TypeError(lang.errors["args"])
|
||||||
|
|
||||||
|
@ -89,7 +91,7 @@ class Args(object):
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
yield self.__action()
|
yield self.__action()
|
||||||
yield self.__arguments[1:]
|
yield self.__arguments[1]
|
||||||
|
|
||||||
|
|
||||||
class Service(object):
|
class Service(object):
|
||||||
|
|
|
@ -1,14 +1 @@
|
||||||
{
|
{"errors": {"su": "Error: Access denied", "usage": "Bad usage", "args": "Error: Invalid args", "ne": "Error: Service '{}' doesn't exists", "enabled": "Error: Service '{}' already enabled", "disabled": "Error: Service '{}' already disabled"}, "messages": {"enabled": "Service '{}' successfully enabled", "disabled": "Service '{}' successfully disabled", "help": "Usage:\n---\nvsc {e/enable/on/up} <service_name> - Run service and add it to autostart\nvsc {d/disable/off/down <service_name> - Stop service and remove it from autostart"}}
|
||||||
"errors": {
|
|
||||||
"su": "Error: Access denied",
|
|
||||||
"usage": "Bad usage",
|
|
||||||
"args": "Error: Invalid args",
|
|
||||||
"ne": "Error: Service '{}' doesn't exists",
|
|
||||||
"enabled": "Error: Service '{}' already enabled",
|
|
||||||
"disabled": "Error: Service '{}' already disabled"},
|
|
||||||
"messages": {
|
|
||||||
"enabled": "Service '{}' successfully enabled",
|
|
||||||
"disabled": "Service '{}' successfully disabled",
|
|
||||||
"help": "Usage:\n---\nvsc {e/enable/on/up} <service_name> - Run service and add it to autostart\nvsc {d/disable/off/down} <service_name> - Stop service and remove it from autostart"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
#!/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()
|
|
|
@ -1,14 +1 @@
|
||||||
{
|
{"errors": {"su": "\u041e\u0448\u0438\u0431\u043a\u0430: \u0414\u043e\u0441\u0442\u0443\u043f \u0437\u0430\u043f\u0440\u0435\u0449\u0435\u043d", "usage": "\u041e\u0448\u0438\u0431\u043a\u0430: \u041d\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435", "args": "\u041e\u0448\u0438\u0431\u043a\u0430: \u041d\u0435\u0432\u0435\u0440\u043d\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b", "ne": "\u041e\u0448\u0438\u0431\u043a\u0430: \u0421\u0435\u0440\u0432\u0438\u0441 '{}' \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442", "enabled": "\u041e\u0448\u0438\u0431\u043a\u0430: \u0421\u0435\u0440\u0432\u0438\u0441 '{}' \u0443\u0436\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d", "disabled": "\u041e\u0448\u0438\u0431\u043a\u0430: \u0421\u0435\u0440\u0432\u0438\u0441 '{}' \u0443\u0436\u0435 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d"}, "messages": {"enabled": "\u0421\u0435\u0440\u0432\u0438\u0441 '{}' \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0435\u043d", "disabled": "\u0421\u0435\u0440\u0432\u0438\u0441 '{}' \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d", "help": "\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435:\n---\nvsc {e/enable/on/up} <\u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435_\u0441\u0435\u0440\u0432\u0438\u0441\u0430> - \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0430\u0432\u0442\u043e\u0437\u0430\u043f\u0443\u0441\u043a\nvsc {d/disable/off/down <\u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435_\u0441\u0435\u0440\u0432\u0438\u0441\u0430> - \u0412\u044b\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0438\u0437 \u0430\u0432\u0442\u043e\u0437\u0430\u043f\u0443\u0441\u043a\u0430"}}
|
||||||
"errors": {
|
|
||||||
"su": "Ошибка: Доступ запрещен",
|
|
||||||
"usage": "Ошибка: Неверное использование",
|
|
||||||
"args": "Ошибка: Неверные аргументы",
|
|
||||||
"ne": "Ошибка: Сервис '{}' не существует",
|
|
||||||
"enabled": "Ошибка: Сервис '{}' уже включен",
|
|
||||||
"disabled": "Ошибка: Сервис '{}' уже выключен"},
|
|
||||||
"messages": {
|
|
||||||
"enabled": "Сервис '{}' успешно включен",
|
|
||||||
"disabled": "Сервис '{}' успешно выключен",
|
|
||||||
"help": "Использование:\n---\nvsc {e/enable/on/up} <название_сервиса> - Запустить и добавить в автозапуск\nvsc {d/disable/off/down} <название_сервиса> - Выключить и удалить из автозапуска"
|
|
||||||
}
|
|
||||||
}
|
|
12
VoidTemplate
12
VoidTemplate
|
@ -1,12 +0,0 @@
|
||||||
# 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 <trueold89@orudo.ru>"
|
|
||||||
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=
|
|
2
setup.py
2
setup.py
|
@ -2,7 +2,7 @@ from setuptools import setup
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='VoidServiceControl',
|
name='VoidServiceControl',
|
||||||
version='0.2.1',
|
version='0.2',
|
||||||
url='https://git.orudo.ru/trueold89/void-service-control',
|
url='https://git.orudo.ru/trueold89/void-service-control',
|
||||||
author='trueold89',
|
author='trueold89',
|
||||||
author_email='trueold89@orudo.ru',
|
author_email='trueold89@orudo.ru',
|
||||||
|
|
Loading…
Reference in New Issue