Now, if distro not have command, return false and user decide if launch error or not
This commit is contained in:
parent
dfb3b74665
commit
8379fc90f2
3 changed files with 18 additions and 9 deletions
|
|
@ -45,12 +45,21 @@ def install_package(package):
|
|||
return shell_command('sudo pacman -S --noconfirm {}'.format(package[distro_id]))
|
||||
|
||||
|
||||
def patch_file(original_file, patch_file):
|
||||
def patch_file(original_file, patch_file, no_patch_distro=True):
|
||||
|
||||
distro_id=check_distro(original_file)
|
||||
|
||||
if not distro_id:
|
||||
|
||||
if no_patch_distro:
|
||||
|
||||
print('This distro ignored for patch')
|
||||
|
||||
return True
|
||||
else:
|
||||
|
||||
print('This distro need a patch')
|
||||
|
||||
return False
|
||||
|
||||
if distro_id in original_file:
|
||||
|
|
@ -60,7 +69,7 @@ def patch_file(original_file, patch_file):
|
|||
|
||||
print('Ignored file for patching for distro '+distro_id)
|
||||
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def systemd_service(action, service):
|
||||
|
|
@ -79,7 +88,7 @@ def systemd_service(action, service):
|
|||
|
||||
print('Cannot restart service')
|
||||
|
||||
return False
|
||||
return True
|
||||
|
||||
def exec(command):
|
||||
|
||||
|
|
@ -89,7 +98,7 @@ def exec(command):
|
|||
|
||||
return False
|
||||
|
||||
if not distro_id in command:
|
||||
if distro_id in command:
|
||||
|
||||
return shell_command(command[distro_id])
|
||||
|
||||
|
|
@ -97,7 +106,7 @@ def exec(command):
|
|||
|
||||
print('Cannot execute the command in this distro')
|
||||
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def sed(arr_sed):
|
||||
|
|
@ -106,7 +115,7 @@ def sed(arr_sed):
|
|||
|
||||
if not distro_id:
|
||||
|
||||
return False
|
||||
return 0
|
||||
|
||||
return shell_command("sudo sed -i \"s/{}/{}/g\" {}".format(arr_sed[distro_id][0], arr_sed[distro_id][1], arr_sed[distro_id][2]))
|
||||
|
||||
|
|
|
|||
|
|
@ -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.4"
|
||||
version = "0.76.5"
|
||||
description = "Utils for make *nix scripts."
|
||||
# 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.")
|
||||
|
||||
setup(name='pastafariutils',
|
||||
version='0.76.4',
|
||||
version='0.76.5',
|
||||
description='Utils for make *nix scripts.',
|
||||
long_description='Utils for make *nix scripts.',
|
||||
author='Antonio de la Rosa Caballero',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue