Skip to content
Snippets Groups Projects
Commit ac0e95a5 authored by Stéphane Diemer's avatar Stéphane Diemer
Browse files

Ignore packages with -generic in kernels listing.

parent d5a336b6
No related branches found
No related tags found
No related merge requests found
...@@ -32,10 +32,10 @@ def clean_kernels(): ...@@ -32,10 +32,10 @@ def clean_kernels():
log(RED + 'Failed to get sudo right.' + DEFAULT, error=True) log(RED + 'Failed to get sudo right.' + DEFAULT, error=True)
return 1 return 1
# list installed kernels # list installed kernels
p = subprocess.Popen('sudo dpkg --get-selections | grep linux', stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) p = subprocess.Popen('sudo dpkg --get-selections| grep -v -- -generic | grep linux', stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
out, err = p.communicate() out, err = p.communicate()
out = str(out, 'utf-8') if out else '' out = out.decode('utf-8') if out else ''
err = str(err, 'utf-8') if err else '' err = err.decode('utf-8') if err else ''
if p.returncode != 0: if p.returncode != 0:
log(RED + 'Failed to list kernels.' + DEFAULT + '\nOut: ' + out + '\nErr: ' + err, error=True) log(RED + 'Failed to list kernels.' + DEFAULT + '\nOut: ' + out + '\nErr: ' + err, error=True)
return 1 return 1
...@@ -55,8 +55,8 @@ def clean_kernels(): ...@@ -55,8 +55,8 @@ def clean_kernels():
# get current kernel # get current kernel
p = subprocess.Popen('uname -a', stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) p = subprocess.Popen('uname -a', stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
out, err = p.communicate() out, err = p.communicate()
out = str(out, 'utf-8') if out else '' out = out.decode('utf-8') if out else ''
err = str(err, 'utf-8') if err else '' err = err.decode('utf-8') if err else ''
if p.returncode != 0: if p.returncode != 0:
log(RED + 'Failed to get current kernel.' + DEFAULT + '\nOut: ' + out + '\nErr: ' + err, error=True) log(RED + 'Failed to get current kernel.' + DEFAULT + '\nOut: ' + out + '\nErr: ' + err, error=True)
return 1 return 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment