Now, if distro not have command, return false and user decide if launch error or not
This commit is contained in:
parent
5f6d176601
commit
dfb3b74665
3 changed files with 29 additions and 7 deletions
|
|
@ -53,7 +53,14 @@ def patch_file(original_file, patch_file):
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return shell_command("sudo patch {} < {}".format(original_file[distro_id], patch_file[distro_id]))
|
if distro_id in original_file:
|
||||||
|
|
||||||
|
return shell_command("sudo patch {} < {}".format(original_file[distro_id], patch_file[distro_id]))
|
||||||
|
else:
|
||||||
|
|
||||||
|
print('Ignored file for patching for distro '+distro_id)
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def systemd_service(action, service):
|
def systemd_service(action, service):
|
||||||
|
|
@ -64,8 +71,15 @@ def systemd_service(action, service):
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return shell_command('sudo systemctl {} {}'.format(action, service[distro_id]))
|
if distro_id in service:
|
||||||
|
|
||||||
|
return shell_command('sudo systemctl {} {}'.format(action, service[distro_id]))
|
||||||
|
|
||||||
|
else:
|
||||||
|
|
||||||
|
print('Cannot restart service')
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
def exec(command):
|
def exec(command):
|
||||||
|
|
||||||
|
|
@ -75,7 +89,15 @@ def exec(command):
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return shell_command(command[distro_id])
|
if not distro_id in command:
|
||||||
|
|
||||||
|
return shell_command(command[distro_id])
|
||||||
|
|
||||||
|
else:
|
||||||
|
|
||||||
|
print('Cannot execute the command in this distro')
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def sed(arr_sed):
|
def sed(arr_sed):
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ build-backend = "flit_core.buildapi"
|
||||||
name = "pastafariutils"
|
name = "pastafariutils"
|
||||||
authors = [{name = "Antonio de la Rosa", email = "antonio.delarosa@salirdelhoyo.com"}]
|
authors = [{name = "Antonio de la Rosa", email = "antonio.delarosa@salirdelhoyo.com"}]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
version = "0.76.3"
|
version = "0.76.4"
|
||||||
description = "Utils for make *nix scripts."
|
description = "Utils for make *nix scripts."
|
||||||
# dynamic = ["version", "description"]
|
# dynamic = ["version", "description"]
|
||||||
|
|
||||||
|
|
|
||||||
2
setup.py
2
setup.py
|
|
@ -9,7 +9,7 @@ if sys.version_info < (3, 9):
|
||||||
raise NotImplementedError("Sorry, you need at least Python 3.9 for use pastafariutils.")
|
raise NotImplementedError("Sorry, you need at least Python 3.9 for use pastafariutils.")
|
||||||
|
|
||||||
setup(name='pastafariutils',
|
setup(name='pastafariutils',
|
||||||
version='0.76',
|
version='0.76.4',
|
||||||
description='Utils for make *nix scripts.',
|
description='Utils for make *nix scripts.',
|
||||||
long_description='Utils for make *nix scripts.',
|
long_description='Utils for make *nix scripts.',
|
||||||
author='Antonio de la Rosa Caballero',
|
author='Antonio de la Rosa Caballero',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue