Compare commits

..

1 commit

Author SHA1 Message Date
askiiart
825e6c8516
Fix /.new_rootfs/ not being deleted on error (was not empty) 2025-05-04 12:28:00 -05:00

14
akshara
View file

@ -19,11 +19,15 @@
import os import os
import sys import sys
import time
import yaml import yaml
import shutil
import filecmp import filecmp
import argparse import argparse
import requests import requests
import platform
import fasteners import fasteners
from threading import Event
import subprocess import subprocess
__version = '1.0.0' __version = '1.0.0'
@ -162,6 +166,7 @@ def update_system():
repo = "https://pkg-repo.blendos.co" repo = "https://pkg-repo.blendos.co"
elif not (repo.startswith("https://") or repo.startswith("http://")): elif not (repo.startswith("https://") or repo.startswith("http://")):
repo = "https://" + repo repo = "https://" + repo
if not os.path.isfile('/.update.tar.zst'): if not os.path.isfile('/.update.tar.zst'):
if exec('wget', '-q', '--show-progress', f'{bootstrap_repo}/iso/latest/archlinux-bootstrap-x86_64.tar.zst', '-O', '/.update.tar.zst') != 0: if exec('wget', '-q', '--show-progress', f'{bootstrap_repo}/iso/latest/archlinux-bootstrap-x86_64.tar.zst', '-O', '/.update.tar.zst') != 0:
warn('failed download') warn('failed download')
@ -219,6 +224,10 @@ def update_system():
'blend-files' 'blend-files'
] ]
keep = [
'/usr/share'
]
if (type(blend_release.get('impl')) == str and if (type(blend_release.get('impl')) == str and
type(blend_release.get('track')) != 'custom'): type(blend_release.get('track')) != 'custom'):
res = interpret_track(blend_release) res = interpret_track(blend_release)
@ -250,7 +259,7 @@ def update_system():
with open('/.new_rootfs/etc/pacman.d/mirrorlist', 'w') as pacman_mirrorlist_conf: with open('/.new_rootfs/etc/pacman.d/mirrorlist', 'w') as pacman_mirrorlist_conf:
pacman_mirrorlist_conf.write( pacman_mirrorlist_conf.write(
f'Server = {arch_repo}/$repo/os/$arch\n') f'Server = {arch_repo}/$repo/os/$arch\n')
exec_chroot('mkdir', '-p', '/var/cache/pacman/pkg') exec_chroot('mkdir', '-p', '/var/cache/pacman/pkg')
exec_chroot('rm', '-rf', '/var/cache/pacman/pkg') exec_chroot('rm', '-rf', '/var/cache/pacman/pkg')
@ -430,6 +439,7 @@ Server = {package_repo["repo-url"]}
exec('cp', '-ax', '/.new_rootfs/var/lib/pacman', '/.new.var.lib/pacman') exec('cp', '-ax', '/.new_rootfs/var/lib/pacman', '/.new.var.lib/pacman')
exec('mv', '.new_rootfs', '.update_rootfs') exec('mv', '.new_rootfs', '.update_rootfs')
exec('cp', '-ax', '/.update_rootfs/etc', '/.update_rootfs/usr/etc')
new_boot_files = [] new_boot_files = []
@ -520,7 +530,7 @@ except:
# remove update and akshara stuff if the program errors (either exited by the user or an error) and is updating # remove update and akshara stuff if the program errors (either exited by the user or an error) and is updating
if command == update_system and not args.keep_files_on_error: if command == update_system and not args.keep_files_on_error:
exec('umount', '-rf', '/.new_rootfs/') exec('umount', '-rf', '/.new_rootfs/')
exec('rmdir', '/.new_rootfs/') exec('rm', '-rf', '/.new_rootfs/')
exec('rm', '-rf', '/.update_rootfs') exec('rm', '-rf', '/.update_rootfs')
exec('rm', '-f', '/.update') exec('rm', '-f', '/.update')
else: else: