diff --git a/tools/onlrfs.py b/tools/onlrfs.py index 9875f1a4..be985bec 100755 --- a/tools/onlrfs.py +++ b/tools/onlrfs.py @@ -411,6 +411,33 @@ rm -f /usr/sbin/policy-rc.d json.dump(md, f, indent=2) onlu.execute("sudo chmod a-w %s" % mname) + for (fname, v) in Configure.get('files', {}).iteritems(): + if fname.startswith('/'): + fname = fname[1:] + dst = os.path.join(dir_, fname) + onlu.execute("sudo mkdir -p %s" % os.path.dirname(dst)) + onlu.execute("sudo touch %s" % dst) + onlu.execute("sudo chmod a+w %s" % dst) + if os.path.exists(v): + shutil.copy(v, dst) + else: + with open(dst, "w") as f: + f.write("%s\n" % v) + + if Configure.get('issue'): + issue = Configure.get('issue') + fn = os.path.join(dir_, "etc/issue") + onlu.execute("sudo chmod a+w %s" % fn) + with open(fn, "w") as f: + f.write("%s\n" % issue) + onlu.execute("sudo chmod a-w %s" % fn) + + fn = os.path.join(dir_, "etc/issue.net") + onlu.execute("sudo chmod a+w %s" % fn) + with open(fn, "w") as f: + f.write("%s" % issue) + onlu.execute("sudo chmod a-w %s" % fn) + finally: onlu.execute("sudo umount -l %s %s" % (os.path.join(dir_, "dev"), os.path.join(dir_, "proc")))