fix: handle services during updates

This commit is contained in:
Rudra B.S. 2023-11-20 15:25:28 +05:30
parent 68e3cb67a4
commit 2fc74367c9

33
akshara
View file

@ -179,13 +179,18 @@ def update_system():
exec('rm', '-f', '/.new_rootfs/version') exec('rm', '-f', '/.new_rootfs/version')
packages = [ packages = [
'akshara' 'akshara',
'blend'
] ]
services = [ services = [
'akshara' 'akshara'
] ]
user_services = [
'blend-files'
]
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)
@ -261,6 +266,14 @@ Server = {package_repo["repo-url"]}
if return_val == 0: if return_val == 0:
break break
for service in services:
if type(service) is str:
exec_chroot('systemctl', 'enable', service)
for user_service in user_services:
if type(user_service) is str:
exec_chroot('systemctl', 'enable', '--global', user_service)
if type(blend_release.get('commands')) == list: if type(blend_release.get('commands')) == list:
for command in blend_release.get('commands'): for command in blend_release.get('commands'):
if type(command) == str: if type(command) == str:
@ -284,17 +297,17 @@ Server = {package_repo["repo-url"]}
new_boot_files = [] new_boot_files = []
# for f in os.listdir('/.update_rootfs/boot'): for f in os.listdir('/.update_rootfs/boot'):
# if not os.path.isdir(f'/.update_rootfs/boot/{f}'): if not os.path.isdir(f'/.update_rootfs/boot/{f}'):
# exec('mv', f'/.update_rootfs/boot/{f}', '/boot') exec('mv', f'/.update_rootfs/boot/{f}', '/boot')
# new_boot_files.append(f) new_boot_files.append(f)
# for f in os.listdir('/boot'): for f in os.listdir('/boot'):
# if not os.path.isdir(f'/boot/{f}'): if not os.path.isdir(f'/boot/{f}'):
# if f not in new_boot_files: if f not in new_boot_files:
# exec('rm', '-f', f'/boot/{f}') exec('rm', '-f', f'/boot/{f}')
# exec('grub-mkconfig', '-o', '/boot/grub/grub.cfg') exec('grub-mkconfig', '-o', '/boot/grub/grub.cfg')
info('downloaded update and generated new rootfs') info('downloaded update and generated new rootfs')
info('you may reboot now') info('you may reboot now')