def _begin_installation(self): if 0: # calamares Spawned.do("/usr/bin/calamares_polkit", timeout=Spawned.TIMEOUT_INFINITE) else: # manjaro-architect # ensure the setup script is installed if not SpawnedSU.do("which setup || pacman -S manjaro-architect --noconfirm --needed --noprogressbar", with_status=True).success: _tlog("manjaro-architect isn't available. Abort...") app_exit() # run manjaro-architect t = SpawnedSU("setup", timeout=Spawned.TIMEOUT_INFINITE) t.interact_user() t.waitfor(SpawnedSU.TASK_END)
def read_upass_from_preseeding_file(pass_key): prefile = preseeding_file() if not prefile: return "" template = f"grep 'passwd/%s' {prefile} | grep -vP '#' | cut -d' ' -f4" return Spawned.do(template % pass_key)
def run(self): # check partman availability if not Spawned.do("which partman", with_status=True).success: _tlog("[II] partman not found => skip PartmanHelper actions") return script = re_script() self.visuals_updater = create_py_script(script) SpawnedSU.do_script(f""" echo "Waiting for PARTMAN files in '{PARTMAN_BASE}' ..." while [ ! -d {PARTMAN_BASE} ]; do sleep 1 done echo ""PARTMAN files found. Ready for processing."" """) for p in self.scheme: if p.mountpoint and not p.isspecial: self.mark_to_use(p.url, p.mountpoint, p.do_format, p.fs)
def _prepare_installation(self): # clear partman cache SpawnedSU.do("rm -rf /var/lib/partman") # clear debconf cache # note: removing the DB leads the ubiquity installer to crash SpawnedSU.do_script(""" if [ ! -d /var/cache/debconf.back ]; then cp -r /var/cache/debconf/ /var/cache/debconf.back else rm -rf /var/cache/debconf cp -r /var/cache/debconf.back /var/cache/debconf fi """) # ensure crypt/lvm volumes are available dm_list = Spawned.do(f"ls /dev/mapper", list_=True) for pt in [pt for pt in self.scheme if pt.mapperID]: if isinstance(pt.parent, Disk) and pt.mapperID not in dm_list: pt.execute(Involve()) # wait for Partman and modify values in background PartmanHelper(self.scheme).run()
def target_user(root_fs: str): return Spawned.do(f'ls {root_fs}/home/ | grep -v "lost+found"')
def distro_name(): return Spawned.do("less /etc/lsb-release | grep -oP '(?<=DISTRIB_ID=).*'")
def uefi_loaded(): return Spawned.do("mount | grep efivars", with_status=True).success
def solid(volume_url): return Spawned.do( f"lsblk -n -d -o ROTA {volume_url}").strip() == "0" # 0 - SSD, 1 - HDD
def is_daemon_active(): return Spawned.do( "systemctl status udisks2.service | grep '(running)'", with_status=True).success
def _begin_installation(self): # parse the .desktop file to get the installation command; grep for 'ubiquity' to filter other .desktop files if any data = Spawned.do("grep '^Exec' ~/Desktop/*.desktop | grep 'ubiquity' | tail -1 | sed 's/^Exec=//'") cmd = data.replace("ubiquity", "ubiquity -b --automatic") Spawned(cmd).waitfor(Spawned.TASK_END, timeout=Spawned.TIMEOUT_INFINITE)