mirror of
https://github.com/YunoHost/package_linter.git
synced 2024-09-03 20:06:12 +02:00
[mod] #5: remove 'sudo' cmd prefix check for YnH 2.6.
This commit is contained in:
parent
b9bbb7d93c
commit
70fe13bd4e
1 changed files with 0 additions and 26 deletions
|
@ -181,7 +181,6 @@ def check_script(path, script_name, script_nbr):
|
||||||
|
|
||||||
script = read_file(script_path)
|
script = read_file(script_path)
|
||||||
|
|
||||||
return_code = check_sudo_prefix_commands(script) or return_code
|
|
||||||
return_code = check_non_helpers_usage(script) or return_code
|
return_code = check_non_helpers_usage(script) or return_code
|
||||||
if script_nbr < 5:
|
if script_nbr < 5:
|
||||||
return_code = check_verifications_done_before_modifying_system(script) or return_code
|
return_code = check_verifications_done_before_modifying_system(script) or return_code
|
||||||
|
@ -191,31 +190,6 @@ def check_script(path, script_name, script_nbr):
|
||||||
return return_code
|
return return_code
|
||||||
|
|
||||||
|
|
||||||
def check_sudo_prefix_commands(script):
|
|
||||||
"""
|
|
||||||
Check if commands are prefix with "sudo"
|
|
||||||
"""
|
|
||||||
cmds = ("rm", "chown", "chmod", "apt-get", "apt",
|
|
||||||
"service", "yunohost", "find" "swapon", "mkswap", "useradd") # , "dd") cp, mkdir
|
|
||||||
ok = True
|
|
||||||
|
|
||||||
for line_nbr, line in enumerate(script):
|
|
||||||
for cmd in cmds:
|
|
||||||
if cmd + " " in line and "sudo " + cmd + " " not in line \
|
|
||||||
and "yunohost service" not in line and "-exec " + cmd not in line \
|
|
||||||
and ".service" not in line and line[0] != '#':
|
|
||||||
print(c.FAIL + "✘ Line ", line_nbr + 1,
|
|
||||||
"you should add \"sudo\" before this command line:", c.END)
|
|
||||||
print(" " + line.replace(cmd,
|
|
||||||
c.BOLD + c.FAIL + cmd + c.END))
|
|
||||||
ok = False
|
|
||||||
if ok:
|
|
||||||
print_right("All commands are prefix with \"sudo\".")
|
|
||||||
return 0
|
|
||||||
|
|
||||||
return 1
|
|
||||||
|
|
||||||
|
|
||||||
def check_verifications_done_before_modifying_system(script):
|
def check_verifications_done_before_modifying_system(script):
|
||||||
"""
|
"""
|
||||||
Check if verifications are done before modifying the system
|
Check if verifications are done before modifying the system
|
||||||
|
|
Loading…
Reference in a new issue