Also disable autostart for daemons started through upstart

This commit is contained in:
Anders Ingemann 2016-06-07 19:12:39 +02:00
parent feea266210
commit d222b267ce

View file

@ -144,11 +144,12 @@ class DisableDaemonAutostart(Task):
with open(rc_policy_path, 'w') as rc_policy: with open(rc_policy_path, 'w') as rc_policy:
rc_policy.write(('#!/bin/sh\n' rc_policy.write(('#!/bin/sh\n'
'exit 101')) 'exit 101'))
import stat os.chmod(rc_policy_path, 0755)
os.chmod(rc_policy_path, initictl_path = os.path.join(info.root, 'sbin/initctl')
stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | with open(initictl_path, 'w') as initctl:
stat.S_IRGRP | stat.S_IXGRP | initctl.write(('#!/bin/sh\n'
stat.S_IROTH | stat.S_IXOTH) 'exit 0'))
os.chmod(initictl_path, 0755)
class AptUpdate(Task): class AptUpdate(Task):
@ -223,3 +224,4 @@ class EnableDaemonAutostart(Task):
@classmethod @classmethod
def run(cls, info): def run(cls, info):
os.remove(os.path.join(info.root, 'usr/sbin/policy-rc.d')) os.remove(os.path.join(info.root, 'usr/sbin/policy-rc.d'))
os.remove(os.path.join(info.root, 'sbin/initctl'))