Now, if distro not have command, return false and user decide if launch error or not

This commit is contained in:
Antonio de la Rosa 2025-11-12 18:52:07 +01:00
parent 5f6d176601
commit dfb3b74665
3 changed files with 29 additions and 7 deletions

View file

@ -52,8 +52,15 @@ def patch_file(original_file, patch_file):
if not distro_id:
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):
@ -64,8 +71,15 @@ def systemd_service(action, service):
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):
@ -75,7 +89,15 @@ def exec(command):
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):

View file

@ -6,7 +6,7 @@ build-backend = "flit_core.buildapi"
name = "pastafariutils"
authors = [{name = "Antonio de la Rosa", email = "antonio.delarosa@salirdelhoyo.com"}]
readme = "README.md"
version = "0.76.3"
version = "0.76.4"
description = "Utils for make *nix scripts."
# dynamic = ["version", "description"]

View file

@ -9,7 +9,7 @@ if sys.version_info < (3, 9):
raise NotImplementedError("Sorry, you need at least Python 3.9 for use pastafariutils.")
setup(name='pastafariutils',
version='0.76',
version='0.76.4',
description='Utils for make *nix scripts.',
long_description='Utils for make *nix scripts.',
author='Antonio de la Rosa Caballero',