services checking- install tests positive

This commit is contained in:
brent s 2017-05-04 13:17:40 -04:00
parent b47259f86e
commit dd3f094058
2 changed files with 18 additions and 0 deletions

View File

@ -28,6 +28,7 @@
<xgroup name="users" /> <xgroup name="users" />
</user> </user>
</users> </users>
<service name="sshd" status="0" />
</system> </system>
<pacman> <pacman>
<repos> <repos>
@ -52,6 +53,7 @@
<package name="sed" repo="core" /> <package name="sed" repo="core" />
<package name="python" /> <package name="python" />
<package name="perl" /> <package name="perl" />
<package name="openssh" />
</software> </software>
</pacman> </pacman>
<bootloader type="grub" target="/boot" efi="true" /> <bootloader type="grub" target="/boot" efi="true" />

View File

@ -831,6 +831,21 @@ class archInstall(object):
pkgcmds.append(cmd) pkgcmds.append(cmd)
return(pkgcmds) return(pkgcmds)


def serviceSetup(self)
# this runs inside the chroot
for s in self.system['services'].keys():
if not re.match('\.(service|socket)$', s):
s = '{0}.service'.format(s)
service = '/usr/lib/systemd/system/{0}'.format(s)
sysdunit = '/etc/systemd/system/multi-user.target.wants/{0}'.format(s)
if self.system['services'][s]:
if not os.path.lexists(sysdunit):
os.symlink(service, sysdunit)
else:
if os.path.lexists(sysdunit):
os.remove(sysdunit)
return()

def chroot(self, chrootcmds = False, bootcmds = False, scriptcmds = False, pkgcmds = False): def chroot(self, chrootcmds = False, bootcmds = False, scriptcmds = False, pkgcmds = False):
if not chrootcmds: if not chrootcmds:
chrootcmds = self.setup() chrootcmds = self.setup()
@ -861,6 +876,7 @@ class archInstall(object):
subprocess.call('/root/scripts/post/{0}'.format(i), subprocess.call('/root/scripts/post/{0}'.format(i),
stdout = log, stdout = log,
stderr = subprocess.STDOUT) stderr = subprocess.STDOUT)
self.serviceSetup()
#os.system('{0}/root/aif-pre.sh'.format(self.system['chrootpath'])) #os.system('{0}/root/aif-pre.sh'.format(self.system['chrootpath']))
#os.system('{0}/root/aif-post.sh'.format(self.system['chrootpath'])) #os.system('{0}/root/aif-post.sh'.format(self.system['chrootpath']))
os.fchdir(real_root) os.fchdir(real_root)