'Add this file to the init.d directory'

def add_init_script(self, file, name):

    f_path = os.path.join('/etc/init.d', name)
    f = open(f_path, 'w')
    f.write(file)
    f.close()
    os.chmod(f_path, ((stat.S_IREAD | stat.S_IWRITE) | stat.S_IEXEC))
    self.run(('/usr/sbin/update-rc.d    %s    defaults' % name))
