chore: remove .okay after update

This commit is contained in:
Rudra Saraswat 2023-05-16 23:44:18 +05:30
parent 754a7ddfff
commit 5dc1713698
2 changed files with 13 additions and 2 deletions

12
akshara
View file

@ -154,6 +154,7 @@ def update_system():
######################## ########################
# Enable services # Enable services
exec_chroot('systemctl', 'enable', 'akshara')
exec_chroot('systemctl', 'enable', 'bluetooth') exec_chroot('systemctl', 'enable', 'bluetooth')
exec_chroot('systemctl', 'enable', 'cups') exec_chroot('systemctl', 'enable', 'cups')
exec_chroot('systemctl', '--global', 'enable', 'blend-files') exec_chroot('systemctl', '--global', 'enable', 'blend-files')
@ -214,6 +215,10 @@ def handle_system_packages(operation):
error('you may not install linux* packages') error('you may not install linux* packages')
exit(1) exit(1)
if os.path.isfile('/mnt/iso-update/.ready-for-update'):
error('an update was downloaded in the background, you')
error('must reboot before installing any system packages')
if operation == 'set-custom-packages': if operation == 'set-custom-packages':
info('this operation will replace the current overlay on the next boot') info('this operation will replace the current overlay on the next boot')
info('(any custom system packages/drivers installed earlier will be removed)') info('(any custom system packages/drivers installed earlier will be removed)')
@ -342,8 +347,11 @@ def daemon():
shutil.rmtree('/' + dir) shutil.rmtree('/' + dir)
while True: while True:
if not os.path.isfile('/mnt/iso-update/.ready-for-update'): if not os.path.isfile('/mnt/iso-update/.ready-for-update'):
exec('touch', '/var/lib/.akshara-system-lock')
system_lock = fasteners.InterProcessLock('/var/lib/.akshara-system-lock')
with system_lock:
update_system() update_system()
time.sleep(3600) time.sleep(300)
description = f''' description = f'''
@ -406,6 +414,8 @@ try:
elif command == handle_system_packages: elif command == handle_system_packages:
exec('touch', '/var/lib/.akshara-system-lock') exec('touch', '/var/lib/.akshara-system-lock')
system_lock = fasteners.InterProcessLock('/var/lib/.akshara-system-lock') system_lock = fasteners.InterProcessLock('/var/lib/.akshara-system-lock')
info('attempting to acquire system lock')
print()
with system_lock: with system_lock:
command(args.command) command(args.command)
else: else:

View file

@ -76,6 +76,7 @@ run_latehook() {
for i in usr varlibpacman; do for i in usr varlibpacman; do
rm -rf /new_root/.blend-overlays/$i rm -rf /new_root/.blend-overlays/$i
mv /new_root/.blend-overlays/future-$i /new_root/.blend-overlays/$i mv /new_root/.blend-overlays/future-$i /new_root/.blend-overlays/$i
rm -f /new_root/.blend-overlays/$i/.okay
done done
else else
rm -rf /new_root/.blend-overlays /new_root/.blendrw rm -rf /new_root/.blend-overlays /new_root/.blendrw