Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
options.output_data_path)
config['packages'] = packages
if os.path.isdir(options.working_directory):
process = subprocess.Popen(['rm', '-rf', options.working_directory])
retval = process.wait()
process = subprocess.Popen(['mkdir', '-p',
os.path.join(options.working_directory, "photon-chroot")])
retval = process.wait()
config['working_directory'] = options.working_directory
# Run the installer
package_installer = Installer(config, rpm_path=options.rpm_path,
log_path=options.log_path)
package_installer.install(None)
# Making the iso if needed
if options.iso_path:
rpm_list = " ".join(
create_rpm_list_to_be_copied_to_iso(
options.pkg_to_rpm_map_file,
options.pkg_to_be_copied_conf_file, 1, options.output_data_path))
files_to_copy = " ".join(
create_additional_file_list_to_copy_in_iso(
os.path.abspath(options.stage_path), options.package_list_file))
live_cd = get_live_cd_status_string(options.package_list_file)
process = subprocess.Popen(['./mk-install-iso.sh', '-w',
options.working_directory, options.iso_path,
# if user not root (UID != 0)
elif os.getuid() != 0:
# multiple components require root access
Avalon.error('SCUTUM must be run as root')
Avalon.error('Exiting')
exit(1)
# privileged section
# set an exit code
exit_code = 0
try:
# initialize installer
installer = Installer(args.config)
if not (args.install or args.uninstall):
# Some objects don't need to be initialized during
# installation or uninstallation
interfaces, network_controllers, ufw_handled, arp_driver = read_config()
# Initialize objects
ac = ArpController()
if ufw_handled:
ufwctrl = Ufw()
# If '--install'
if args.install:
# Install scutum into system
installer.install()
def runInstaller(options, install_config, working_directory):
try:
sys.path.insert(0, options.installer_path)
from installer import Installer
except:
raise ImportError('Installer path incorrect!')
# Run the installer
installer = Installer(working_directory=working_directory, rpm_path=options.rpm_path,
log_path=options.log_path)
installer.configure(install_config)
installer.execute()
import string
import shutil
import fnmatch
import signal
import sys
import glob
import urllib
import modules.commons
from jsonwrapper import JsonWrapper
from progressbar import ProgressBar
from windowstringreader import WindowStringReader
from window import Window
from actionresult import ActionResult
from installer import Installer
class OstreeServerInstaller(Installer):
def __init__(self, install_config, maxy = 0, maxx = 0, iso_installer = False, rpm_path = "../stage/RPMS", log_path = "../stage/LOGS"):
Installer.__init__(self, install_config, maxy, maxx, iso_installer, rpm_path, log_path)
def finalize_system(self):
Installer.finalize_system(self)
self.run("mkdir -p {}/srv/rpm-ostree/repo".format(self.photon_root))
self.run("cp ./photon-base.json {}/srv/rpm-ostree/".format(self.photon_root))
self.run("cp ./photon-minimal.json {}/srv/rpm-ostree/".format(self.photon_root))
self.run("cp ./photon-full.json {}/srv/rpm-ostree/".format(self.photon_root))
self.run("ln -s /etc/yum.repos.d/photon.repo {}/srv/rpm-ostree/photon-ostree.repo".format(self.photon_root))
self.run("ln -s /etc/yum.repos.d/photon-iso.repo {}/srv/rpm-ostree/photon-iso-ostree.repo".format(self.photon_root))
self.run("ln -s /etc/yum.repos.d/photon-updates.repo {}/srv/rpm-ostree/photon-updates-ostree.repo".format(self.photon_root))
self.run("ln -s /etc/yum.repos.d/photon-extras.repo {}/srv/rpm-ostree/photon-extras-ostree.repo".format(self.photon_root))
self.run("cp ./ostree-httpd.conf {}/srv/rpm-ostree/".format(self.photon_root))
def finalize_system(self):
Installer.finalize_system(self)
self.run("mkdir -p {}/srv/rpm-ostree/repo".format(self.photon_root))
self.run("cp ./photon-base.json {}/srv/rpm-ostree/".format(self.photon_root))
self.run("cp ./photon-minimal.json {}/srv/rpm-ostree/".format(self.photon_root))
self.run("cp ./photon-full.json {}/srv/rpm-ostree/".format(self.photon_root))
self.run("ln -s /etc/yum.repos.d/photon.repo {}/srv/rpm-ostree/photon-ostree.repo".format(self.photon_root))
self.run("ln -s /etc/yum.repos.d/photon-iso.repo {}/srv/rpm-ostree/photon-iso-ostree.repo".format(self.photon_root))
self.run("ln -s /etc/yum.repos.d/photon-updates.repo {}/srv/rpm-ostree/photon-updates-ostree.repo".format(self.photon_root))
self.run("ln -s /etc/yum.repos.d/photon-extras.repo {}/srv/rpm-ostree/photon-extras-ostree.repo".format(self.photon_root))
self.run("cp ./ostree-httpd.conf {}/srv/rpm-ostree/".format(self.photon_root))
# Use a custom httpd service file for ostree server
self.run("mkdir {}/etc/systemd/system/httpd.service.d".format(self.photon_root))
self.run("cp ./10-httpd-service.conf {}/etc/systemd/system/httpd.service.d/".format(self.photon_root))
self.run("cp ./get-ip-address.sh {}/usr/bin/".format(self.photon_root))
self.run("cp ./ostree-server-greeting.txt {}/etc/issue".format(self.photon_root))
self.run("ln -s /usr/lib/systemd/system/httpd.service {}/usr/lib/systemd/system/multi-user.target.wants/httpd.service".format(self.photon_root))
self.write_settings()
self.write_frontend_config()
self.write_env_file()
self.attempt_docker_start()
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--upgrade', help="Upgrade an existing installation",
action='store_true')
parser.add_argument('--with-settings', help="Use an existing settings.json file",
action='store_true')
args = parser.parse_args()
installer = Installer(args)
installer.run()
repo_path = self.media_mount_path + "/RPMS"
else:
print("Please specify RPM repo path.")
return
if ks_path:
install_config=self._load_ks_config(ks_path)
if options.ui_config_file:
ui_config = (JsonWrapper(options.ui_config_file)).read()
else:
ui_config={}
ui_config['options_file'] = options.options_file
# Run installer
installer = Installer(rpm_path=repo_path, log_path="/var/log")
installer.configure(install_config, ui_config)
installer.execute()
def install(self):
installer = None
if self.install_config.get('type', '') == "ostree_host":
installer = OstreeInstaller(self.install_config, self.maxy, self.maxx,
self.iso_installer, self.rpm_path, self.log_path, self.log_level)
else:
installer = Installer(self.install_config, self.maxy, self.maxx,
self.iso_installer, self.rpm_path, self.log_path, self.log_level)
return installer.install()