Mount /persistent if possible
This commit is contained in:
@@ -97,6 +97,14 @@ class ImageBuilder(object):
|
|||||||
'/etc/init.d/systemd-logind': '/bin/true',
|
'/etc/init.d/systemd-logind': '/bin/true',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_CHROOT_COPIES = {
|
||||||
|
'persistent.conf': 'etc/init/persistent.conf',
|
||||||
|
}
|
||||||
|
|
||||||
|
_ISO_COPIES = {
|
||||||
|
'loopback.cfg': 'boot/grub/loopback.cfg',
|
||||||
|
}
|
||||||
|
|
||||||
def __init__(self, source_iso, dest_iso, archive, arch, release, ca_cert, base_url, image_type):
|
def __init__(self, source_iso, dest_iso, archive, arch, release, ca_cert, base_url, image_type):
|
||||||
self._source_iso = source_iso
|
self._source_iso = source_iso
|
||||||
self._dest_iso = dest_iso
|
self._dest_iso = dest_iso
|
||||||
@@ -222,6 +230,12 @@ class ImageBuilder(object):
|
|||||||
source)
|
source)
|
||||||
os.unlink(os.path.join(chroot_path, 'usr', 'sbin', 'policy-rc.d'))
|
os.unlink(os.path.join(chroot_path, 'usr', 'sbin', 'policy-rc.d'))
|
||||||
|
|
||||||
|
def _CopyChrootFiles(self, chroot_path):
|
||||||
|
for source, dest in self._CHROOT_COPIES.items():
|
||||||
|
shutil.copyfile(
|
||||||
|
os.path.join(self._ico_server_path, 'chroot_files', source),
|
||||||
|
os.path.join(chroot_path, dest))
|
||||||
|
|
||||||
def _InstallIconograph(self, chroot_path):
|
def _InstallIconograph(self, chroot_path):
|
||||||
self._ExecChroot(
|
self._ExecChroot(
|
||||||
chroot_path,
|
chroot_path,
|
||||||
@@ -255,10 +269,11 @@ class ImageBuilder(object):
|
|||||||
os.path.join(union_path, 'casper', 'filesystem.squashfs'),
|
os.path.join(union_path, 'casper', 'filesystem.squashfs'),
|
||||||
'-noappend')
|
'-noappend')
|
||||||
|
|
||||||
def _FixGrub(self, union_path):
|
def _CopyISOFiles(self, union_path):
|
||||||
shutil.copyfile(
|
for source, dest in self._ISO_COPIES.items():
|
||||||
os.path.join(self._ico_server_path, 'iso_files', 'loopback.cfg'),
|
shutil.copyfile(
|
||||||
os.path.join(union_path, 'boot', 'grub', 'loopback.cfg'))
|
os.path.join(self._ico_server_path, 'iso_files', source),
|
||||||
|
os.path.join(union_path, dest))
|
||||||
|
|
||||||
def _CreateISO(self, union_path):
|
def _CreateISO(self, union_path):
|
||||||
self._Exec(
|
self._Exec(
|
||||||
@@ -285,11 +300,12 @@ class ImageBuilder(object):
|
|||||||
self._AddDiversions(chroot_path)
|
self._AddDiversions(chroot_path)
|
||||||
self._InstallPackages(chroot_path)
|
self._InstallPackages(chroot_path)
|
||||||
self._RemoveDiversions(chroot_path)
|
self._RemoveDiversions(chroot_path)
|
||||||
|
self._CopyChrootFiles(chroot_path)
|
||||||
self._InstallIconograph(chroot_path)
|
self._InstallIconograph(chroot_path)
|
||||||
if FLAGS.shell:
|
if FLAGS.shell:
|
||||||
self._Exec('bash', cwd=root)
|
self._Exec('bash', cwd=root)
|
||||||
self._Squash(chroot_path, union_path)
|
self._Squash(chroot_path, union_path)
|
||||||
self._FixGrub(union_path)
|
self._CopyISOFiles(union_path)
|
||||||
self._CreateISO(union_path)
|
self._CreateISO(union_path)
|
||||||
|
|
||||||
def BuildImage(self):
|
def BuildImage(self):
|
||||||
|
|||||||
11
server/chroot_files/persistent.conf
Normal file
11
server/chroot_files/persistent.conf
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
description "Mount /persistent"
|
||||||
|
|
||||||
|
start on filesystem
|
||||||
|
|
||||||
|
script
|
||||||
|
DEV=$(findfs LABEL=persistent)
|
||||||
|
if test "$?" = "0"; then
|
||||||
|
mkdir /persistent
|
||||||
|
mount "${DEV}" /persistent
|
||||||
|
fi
|
||||||
|
end script
|
||||||
Reference in New Issue
Block a user