feat: some major changes
This commit is contained in:
parent
19812e9ef3
commit
d1bd93a980
2 changed files with 13 additions and 20 deletions
25
akshara
25
akshara
|
@ -109,9 +109,9 @@ def get_server_timestamp():
|
||||||
|
|
||||||
def update_system():
|
def update_system():
|
||||||
os.chdir('/mnt')
|
os.chdir('/mnt')
|
||||||
exec('rm', '-rf', '/mnt/iso-update/iso')
|
for f in os.listdir('/mnt/iso-update'):
|
||||||
exec('rm', '-rf', '/mnt/iso-update/squashfs-root')
|
if f != 'update.iso':
|
||||||
exec('mkdir', '-p', '/mnt/iso-update')
|
exec('rm', '-f', f)
|
||||||
|
|
||||||
# Check if update is available
|
# Check if update is available
|
||||||
if os.path.isfile('/etc/blend_release'):
|
if os.path.isfile('/etc/blend_release'):
|
||||||
|
@ -124,22 +124,11 @@ def update_system():
|
||||||
# Update is available, let's download the latest ISO
|
# Update is available, let's download the latest ISO
|
||||||
exec('mkdir', '-p', '/mnt/iso-update')
|
exec('mkdir', '-p', '/mnt/iso-update')
|
||||||
if not os.path.isfile('/mnt/iso-update/update.iso'):
|
if not os.path.isfile('/mnt/iso-update/update.iso'):
|
||||||
exec('wget', '-O', '/mnt/iso-update/update.iso',
|
if exec('zsync2', f'https://updates.blendos.co/{track}/{get_server_timestamp()}/update.iso.zsync', '-o', '/mnt/iso-update/update.iso') != 0:
|
||||||
f'{server_url}/track/{track}/download')
|
return
|
||||||
exec('rm', '-f', '/mnt/iso-update/update.iso.sha512sum')
|
else:
|
||||||
exec('wget', '-O', '/mnt/iso-update/update.iso.sha512sum',
|
if exec('zsync2', f'https://updates.blendos.co/{track}/{get_server_timestamp()}/update.iso.zsync', '-i', '/mnt/iso-update/update.iso', '-o', '/mnt/iso-update/update.iso') != 0:
|
||||||
f'{server_url}/track/{track}/update-sha512sum')
|
|
||||||
if exec('bash', '-c', 'cd /mnt/iso-update; sha512sum --check --status /mnt/iso-update/update.iso.sha512sum') != 0:
|
|
||||||
exec('rm', '-f', '/mnt/iso-update/update.iso.sha512sum',
|
|
||||||
'/mnt/iso-update/update.iso.sha512sum')
|
|
||||||
exec('wget', '-O', '/mnt/iso-update/update.iso',
|
|
||||||
f'{server_url}/track/{track}/download')
|
|
||||||
exec('wget', '-O', '/mnt/iso-update/update.iso.sha512sum',
|
|
||||||
f'{server_url}/track/{track}/update-sha512sum')
|
|
||||||
if exec('sha512sum', '--check', '--status', 'update.iso.sha512sum', cwd='/mnt/iso-update') != 0:
|
|
||||||
exec('rm', '-f', '/mnt/iso-update/.download_lock')
|
|
||||||
return
|
return
|
||||||
exec('rm', '-f', '/mnt/iso-update/.download_lock')
|
|
||||||
|
|
||||||
# Since the ISO has been downloaded, proceed to extracing it
|
# Since the ISO has been downloaded, proceed to extracing it
|
||||||
# as well the rootfs it contains (single-core unsquashfs)
|
# as well the rootfs it contains (single-core unsquashfs)
|
||||||
|
|
|
@ -40,9 +40,13 @@ run_latehook() {
|
||||||
|
|
||||||
# Replace editable /etc files.
|
# Replace editable /etc files.
|
||||||
for i in sudoers crypttab fstab group gshadow hostname hosts passwd resolv.conf shadow shells subgid subuid; do
|
for i in sudoers crypttab fstab group gshadow hostname hosts passwd resolv.conf shadow shells subgid subuid; do
|
||||||
cp "/new_root/etc/${i}" /new_root/.new.etc
|
mv "/new_root/etc/${i}" "/new_root/.new.etc/${i}"
|
||||||
done
|
done
|
||||||
cp "/new_root/etc/default/grub" /new_root/.new.etc
|
mv "/new_root/etc/default/grub" "/new_root/.new.etc/default/grub"
|
||||||
|
[[ -d /new_root/etc/NetworkManager/system-connections ]] && (
|
||||||
|
rm -rf /new_root/.new.etc/NetworkManager/system-connections;
|
||||||
|
mv /new_root/etc/NetworkManager/system-connections /new_root/.new.etc/NetworkManager/system-connections
|
||||||
|
)
|
||||||
|
|
||||||
# Rename existing /etc.
|
# Rename existing /etc.
|
||||||
mv /new_root/etc /new_root/.old.etc &>/dev/null || :
|
mv /new_root/etc /new_root/.old.etc &>/dev/null || :
|
||||||
|
|
Loading…
Reference in a new issue