Customized RFS manifest.

This commit is contained in:
Jeffrey Townsend
2016-05-27 19:27:59 +00:00
parent 3727a226e7
commit 7a10269fb8
2 changed files with 19 additions and 8 deletions

View File

@@ -28,10 +28,14 @@ ifdef RFS_SQUASH
RFS_COMMAND += --squash $(RFS_SQUASH)
endif
ifndef RFS_MANIFEST
RFS_MANIFEST := etc/onl/rootfs/manifest.json
endif
RFS:
$(ONL_V_at) rm -rf manifest.json
$(ONL_V_at) $(RFS_COMMAND)
$(ONL_V_at) [ -f $(RFS_DIR)/etc/onl/rootfs/manifest.json ] && cp $(RFS_DIR)/etc/onl/rootfs/manifest.json .
$(ONL_V_at) [ -f $(RFS_DIR)/$(RFS_MANIFEST) ] && cp $(RFS_DIR)/$(RFS_MANIFEST) .
clean:
$(ONL_V_at) sudo rm -rf $(RFS_DIR)

View File

@@ -354,6 +354,11 @@ rm -f /usr/sbin/policy-rc.d
options = Configure.get('options', {})
if options.get('clean', False):
logger.info("Cleaning Filesystem...")
onlu.execute('sudo chroot %s /usr/bin/apt-get clean' % dir_)
onlu.execute('sudo chroot %s /usr/sbin/localepurge' % dir_ )
onlu.execute('sudo chroot %s find /usr/share/doc -type f | xargs rm -rf' % dir_)
onlu.execute('sudo chroot %s find /usr/share/man -type f | xargs rm -rf' % dir_)
if not options.get('securetty', True):
f = os.path.join(dir_, 'etc/securetty')
@@ -387,19 +392,21 @@ rm -f /usr/sbin/policy-rc.d
ua.chmod('go-w', os.path.dirname(f))
manifest = Configure.get('manifest', {})
if manifest:
mname = "%s/etc/onl/rootfs/manifest.json" % dir_
for (mf, fields) in Configure.get('manifests', {}).iteritems():
logger.info("Configuring manifest %s..." % mf)
if mf.startswith('/'):
mf = mf[1:]
mname = os.path.join(dir_, mf)
onlu.execute("sudo mkdir -p %s" % os.path.dirname(mname))
onlu.execute("sudo touch %s" % mname)
onlu.execute("sudo chmod a+w %s" % mname)
md = {}
md['version'] = json.load(open(manifest['version']))
md['version'] = json.load(open(fields['version']))
md['arch'] = self.arch
if os.path.exists(manifest['platforms']):
md['platforms'] = yaml.load(open(manifest['platforms']))
if os.path.exists(fields['platforms']):
md['platforms'] = yaml.load(open(fields['platforms']))
else:
md['platforms'] = manifest['platforms'].split(',')
md['platforms'] = fields['platforms'].split(',')
with open(mname, "w") as f:
json.dump(md, f, indent=2)
onlu.execute("sudo chmod a-w %s" % mname)