installer/modules/m_postinstall.py
4967065a
 import os
 import subprocess
 import commons
 
 install_phase = commons.POST_INSTALL
 enabled = True
 
a5a8bd39
 def execute(config, root):
4967065a
     if 'postinstall' not in config:
4ddea019
         return
4967065a
     # run the script in the chroot environment
     script = config['postinstall']
 
52810a0f
     script_file = os.path.join(root, 'etc/tmpfiles.d/postinstall.sh')
4967065a
 
a5a8bd39
     with open(script_file, 'wb') as outfile:
a672bd24
         outfile.write("\n".join(script).encode())
4967065a
 
a5a8bd39
     os.chmod(script_file, 0o700)
     with open(commons.KS_POST_INSTALL_LOG_FILE_NAME, "w") as logfile:
         process = subprocess.Popen(["./mk-run-chroot.sh", '-w', root,
                                     "/etc/tmpfiles.d/postinstall.sh"],
                                    stdout=logfile, stderr=logfile)
1b11aa2d
         retval = process.wait()
a5a8bd39
         if retval == 0:
1b11aa2d
             return True
         return False