mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 09:50:37 +00:00
Implemented APT cleanup
This commit is contained in:
parent
ba1fd93308
commit
6671a67d9b
2 changed files with 34 additions and 1 deletions
|
@ -59,7 +59,10 @@ def tasks(tasklist, manifest):
|
|||
initd.InstallInitScripts(),
|
||||
cleanup.ClearMOTD(),
|
||||
cleanup.ShredHostkeys(),
|
||||
cleanup.CleanTMP())
|
||||
cleanup.CleanTMP(),
|
||||
apt.PurgeUnusedPackages(),
|
||||
apt.AptClean(),
|
||||
apt.EnableDaemonAutostart())
|
||||
|
||||
from common.tasks import TriggerRollback
|
||||
tasklist.add(TriggerRollback())
|
||||
|
|
|
@ -47,3 +47,33 @@ class AptUpgrade(Task):
|
|||
log_check_call(['chroot', info.root, 'apt-get', 'update'])
|
||||
log_check_call(['chroot', info.root, 'apt-get', '-f', '-y', 'install'])
|
||||
log_check_call(['chroot', info.root, 'apt-get', '-y', 'upgrade'])
|
||||
|
||||
|
||||
class PurgeUnusedPackages(Task):
|
||||
description = 'Removing unused packages'
|
||||
phase = phases.system_cleaning
|
||||
|
||||
def run(self, info):
|
||||
log_check_call(['chroot', info.root, 'apt-get', 'autoremove', '--purge'])
|
||||
|
||||
|
||||
class AptClean(Task):
|
||||
description = 'Clearing the aptitude cache'
|
||||
phase = phases.system_cleaning
|
||||
|
||||
def run(self, info):
|
||||
log_check_call(['chroot', info.root, 'apt-get', 'clean'])
|
||||
|
||||
import glob
|
||||
lists = glob.glob(os.path.join(info.root, 'var/lib/apt/lists/*'))
|
||||
for list_file in lists:
|
||||
if os.path.isfile(list_file):
|
||||
os.remove(list_file)
|
||||
|
||||
|
||||
class EnableDaemonAutostart(Task):
|
||||
description = 'Re-enabling daemon autostart after installation'
|
||||
phase = phases.system_cleaning
|
||||
|
||||
def run(self, info):
|
||||
os.remove(os.path.join(info.root, 'usr/sbin/policy-rc.d'))
|
||||
|
|
Loading…
Add table
Reference in a new issue