All cli calls now use absolute paths

This commit is contained in:
Anders Ingemann 2013-07-07 19:38:34 +02:00
parent 7c2f248649
commit 58e560a893
6 changed files with 22 additions and 24 deletions

View file

@ -44,9 +44,9 @@ class AptUpgrade(Task):
after = [GenerateLocale, AptSources, DisableDaemonAutostart]
def run(self, info):
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'])
log_check_call(['/usr/sbin/chroot', info.root, '/usr/bin/apt-get', 'update'])
log_check_call(['/usr/sbin/chroot', info.root, '/usr/bin/apt-get', '-f', '-y', 'install'])
log_check_call(['/usr/sbin/chroot', info.root, '/usr/bin/apt-get', '-y', 'upgrade'])
class PurgeUnusedPackages(Task):
@ -54,7 +54,7 @@ class PurgeUnusedPackages(Task):
phase = phases.system_cleaning
def run(self, info):
log_check_call(['chroot', info.root, 'apt-get', 'autoremove', '--purge'])
log_check_call(['/usr/sbin/chroot', info.root, '/usr/bin/apt-get', 'autoremove', '--purge'])
class AptClean(Task):
@ -62,7 +62,7 @@ class AptClean(Task):
phase = phases.system_cleaning
def run(self, info):
log_check_call(['chroot', info.root, 'apt-get', 'clean'])
log_check_call(['/usr/sbin/chroot', info.root, '/usr/bin/apt-get', 'clean'])
lists = os.path.join(info.root, 'var/lib/apt/lists')
for list_file in [os.path.join(lists, f) for f in os.listdir(lists)]:

View file

@ -30,8 +30,8 @@ class ConfigureGrub(Task):
'GRUB_HIDDEN_TIMEOUT=true')
from common.tools import log_check_call
log_check_call(['chroot', info.root, 'update-grub'])
log_check_call(['chroot', info.root, 'ln', '-s', '/boot/grub/grub.cfg', '/boot/grub/menu.lst'])
log_check_call(['/usr/sbin/chroot', info.root, '/usr/sbin/update-grub'])
log_check_call(['/usr/sbin/chroot', info.root, 'ln', '-s', '/boot/grub/grub.cfg', '/boot/grub/menu.lst'])
class BlackListModules(Task):

View file

@ -23,8 +23,7 @@ class TuneVolumeFS(Task):
def run(self, info):
dev_path = info.bootstrap_device['path']
# Disable the time based filesystem check
command = ['/sbin/tune2fs', '-i', '0', dev_path]
log_check_call(command)
log_check_call(['/sbin/tune2fs', '-i', '0', dev_path])
class AddXFSProgs(Task):
@ -60,8 +59,7 @@ class MountVolume(Task):
msg = 'Something is already mounted at {root}'.format(root=info.root)
raise TaskError(msg)
command = ['mount', info.bootstrap_device['path'], info.root]
log_check_call(command)
log_check_call(['/bin/mount', info.bootstrap_device['path'], info.root])
class MountSpecials(Task):
@ -70,10 +68,10 @@ class MountSpecials(Task):
after = [Bootstrap]
def run(self, info):
log_check_call(['mount', '--bind', '/dev', '{root}/dev'.format(root=info.root)])
log_check_call(['chroot', info.root, 'mount', '-t', 'proc', 'none', '/proc'])
log_check_call(['chroot', info.root, 'mount', '-t', 'sysfs', 'none', '/sys'])
log_check_call(['chroot', info.root, 'mount', '-t', 'devpts', 'none', '/dev/pts'])
log_check_call(['/bin/mount', '--bind', '/dev', '{root}/dev'.format(root=info.root)])
log_check_call(['/usr/sbin/chroot', info.root, '/bin/mount', '-t', 'proc', 'none', '/proc'])
log_check_call(['/usr/sbin/chroot', info.root, '/bin/mount', '-t', 'sysfs', 'none', '/sys'])
log_check_call(['/usr/sbin/chroot', info.root, '/bin/mount', '-t', 'devpts', 'none', '/dev/pts'])
class UnmountSpecials(Task):
@ -81,10 +79,10 @@ class UnmountSpecials(Task):
phase = phases.volume_unmounting
def run(self, info):
log_check_call(['chroot', info.root, 'umount', '/dev/pts'])
log_check_call(['chroot', info.root, 'umount', '/sys'])
log_check_call(['chroot', info.root, 'umount', '/proc'])
log_check_call(['umount', '{root}/dev'.format(root=info.root)])
log_check_call(['/usr/sbin/chroot', info.root, '/bin/umount', '/dev/pts'])
log_check_call(['/usr/sbin/chroot', info.root, '/bin/umount', '/sys'])
log_check_call(['/usr/sbin/chroot', info.root, '/bin/umount', '/proc'])
log_check_call(['/bin/umount', '{root}/dev'.format(root=info.root)])
class UnmountVolume(Task):
@ -93,7 +91,7 @@ class UnmountVolume(Task):
after = [UnmountSpecials]
def run(self, info):
log_check_call(['umount', info.root])
log_check_call(['/bin/umount', info.root])
class DeleteMountDir(Task):

View file

@ -43,7 +43,7 @@ class InstallInitScripts(Task):
dst = os.path.join(info.root, 'etc/init.d', name)
copy(src, dst)
os.chmod(dst, rwxr_xr_x)
log_check_call(['chroot', info.root, '/sbin/insserv', '-d', name])
log_check_call(['/usr/sbin/chroot', info.root, '/sbin/insserv', '-d', name])
for name in info.initd['disable']:
log_check_call(['chroot', info.root, '/sbin/insserv', '-r', name])
log_check_call(['/usr/sbin/chroot', info.root, '/sbin/insserv', '-r', name])

View file

@ -16,7 +16,7 @@ class GenerateLocale(Task):
search = '# ' + locale_str
sed_i(locale_gen, search, locale_str)
command = ['chroot', info.root, 'dpkg-reconfigure', '--priority=critical', 'locales']
command = ['/usr/sbin/chroot', info.root, '/usr/sbin/dpkg-reconfigure', '--priority=critical', 'locales']
log_check_call(command)

View file

@ -9,7 +9,7 @@ class EnableShadowConfig(Task):
def run(self, info):
from common.tools import log_check_call
log_check_call(['chroot', info.root, '/sbin/shadowconfig', 'on'])
log_check_call(['/usr/sbin/chroot', info.root, '/sbin/shadowconfig', 'on'])
class DisableSSHPasswordAuthentication(Task):