Autoimage working nicely.
This commit is contained in:
@@ -3,7 +3,6 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import stat
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
@@ -171,7 +170,7 @@ class ImageBuilder(object):
|
|||||||
with open(os.path.join(chroot_path, 'usr', 'sbin', 'policy-rc.d'), 'w') as fh:
|
with open(os.path.join(chroot_path, 'usr', 'sbin', 'policy-rc.d'), 'w') as fh:
|
||||||
fh.write('#!/bin/sh\n')
|
fh.write('#!/bin/sh\n')
|
||||||
fh.write('exit 101\n')
|
fh.write('exit 101\n')
|
||||||
os.fchmod(fh.fileno(), stat.S_IRWXU)
|
os.fchmod(fh.fileno(), 0o744)
|
||||||
|
|
||||||
def _InstallPackages(self, chroot_path):
|
def _InstallPackages(self, chroot_path):
|
||||||
os.environ['DEBIAN_FRONTEND'] = 'noninteractive'
|
os.environ['DEBIAN_FRONTEND'] = 'noninteractive'
|
||||||
|
|||||||
@@ -71,15 +71,24 @@ def main():
|
|||||||
fh.write("""
|
fh.write("""
|
||||||
description "AutoImage"
|
description "AutoImage"
|
||||||
|
|
||||||
start on net-device-up
|
start on stopped rc RUNLEVEL=[2345]
|
||||||
|
|
||||||
|
stop on runlevel [!2345]
|
||||||
|
|
||||||
script
|
script
|
||||||
chvt 7
|
chvt 7
|
||||||
/autoimage/imager/wait_for_service.py --host=%(host)s --service=%(service)s </dev/tty7 >/dev/tty7
|
/autoimage/imager/wait_for_service.py --host=%(host)s --service=%(service)s </dev/tty7 >/dev/tty7 2>&1
|
||||||
/autoimage/imager/image.py --device=%(device)s --persistent-percent=%(persistent_percent)d --ca-cert=/autoimage/config/ca.cert.pem --base-url=%(base_url)s </dev/tty7 >/dev/tty7
|
chvt 7
|
||||||
|
/autoimage/imager/image.py --device=%(device)s --persistent-percent=%(persistent_percent)d --ca-cert=/autoimage/config/ca.cert.pem --base-url=%(base_url)s </dev/tty7 >/dev/tty7 2>&1
|
||||||
|
chvt 7
|
||||||
|
|
||||||
|
echo >/dev/tty7
|
||||||
|
echo "==================" >/dev/tty7
|
||||||
|
echo "autoimage complete" >/dev/tty7
|
||||||
|
echo "==================" >/dev/tty7
|
||||||
end script
|
end script
|
||||||
""" % {
|
""" % {
|
||||||
'host': parsed.host,
|
'host': parsed.hostname,
|
||||||
'service': parsed.port or parsed.scheme,
|
'service': parsed.port or parsed.scheme,
|
||||||
'device': FLAGS.device,
|
'device': FLAGS.device,
|
||||||
'persistent_percent': FLAGS.persistent_percent,
|
'persistent_percent': FLAGS.persistent_percent,
|
||||||
|
|||||||
@@ -75,9 +75,11 @@ def main():
|
|||||||
*args,
|
*args,
|
||||||
stdin=fh_in,
|
stdin=fh_in,
|
||||||
stdout=fh)
|
stdout=fh)
|
||||||
|
os.fchmod(fh.fileno(), 0o644)
|
||||||
os.rename(fh.name, signed_manifest)
|
os.rename(fh.name, signed_manifest)
|
||||||
except:
|
except:
|
||||||
os.unlink(fh.name)
|
os.unlink(fh.name)
|
||||||
|
raise
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
Reference in New Issue
Block a user