Reuse old future overlay

This commit is contained in:
Rudra Saraswat 2023-05-08 23:21:33 +05:30
parent a276c0020e
commit 3735588e93

16
akshara
View file

@ -216,10 +216,10 @@ def handle_system_packages(install):
error('already running') error('already running')
exit(1) exit(1)
info('this command will discard any system packages installed') info("if this operation fails, any system packages installed previously")
info("previously if you didn't reboot after instlling them") info('without rebooting shall be removed')
print() print()
info('this should __only__ be used for the installation of drivers') info('this command should __only__ be used for the installation of drivers')
info('blendOS is __not__ responsible for any system breakage') info('blendOS is __not__ responsible for any system breakage')
exec('mkdir', '-p', '/.blendrw') exec('mkdir', '-p', '/.blendrw')
@ -235,12 +235,20 @@ def handle_system_packages(install):
usr_overlay = subprocess.run( usr_overlay = subprocess.run(
['mktemp', '-d', '/mnt/.blend-tmp-overlay-XXXXXXXXXXXXX'], stdout=subprocess.PIPE).stdout.decode().strip() ['mktemp', '-d', '/mnt/.blend-tmp-overlay-XXXXXXXXXXXXX'], stdout=subprocess.PIPE).stdout.decode().strip()
exec('chmod', '=rw', usr_overlay) exec('chmod', '=rw', usr_overlay)
if os.path.isdir('/.blend-overlays/future-usr'):
exec('rm', '-f', '/.blend-overlays/future-usr/.okay')
exec('rm', '-rf', usr_overlay)
exec('mv', '/.blend-overlays/future-usr', usr_overlay)
usr_overlay_workdir = subprocess.run( usr_overlay_workdir = subprocess.run(
['mktemp', '-d', '/mnt/.blend-tmp-overlay-XXXXXXXXXXXXX'], stdout=subprocess.PIPE).stdout.decode().strip() ['mktemp', '-d', '/mnt/.blend-tmp-overlay-XXXXXXXXXXXXX'], stdout=subprocess.PIPE).stdout.decode().strip()
exec('chmod', '=rw', usr_overlay_workdir) exec('chmod', '=rw', usr_overlay_workdir)
varlibpacman_overlay = subprocess.run( varlibpacman_overlay = subprocess.run(
['mktemp', '-d', '/mnt/.blend-tmp-overlay-XXXXXXXXXXXXX'], stdout=subprocess.PIPE).stdout.decode().strip() ['mktemp', '-d', '/mnt/.blend-tmp-overlay-XXXXXXXXXXXXX'], stdout=subprocess.PIPE).stdout.decode().strip()
exec('chmod', '=rw', varlibpacman_overlay) exec('chmod', '=rw', varlibpacman_overlay)
if os.path.isdir('/.blend-overlays/future-varlibpacman'):
exec('rm', '-f', '/.blend-overlays/future-varlibpacman/.okay')
exec('rm', '-rf', varlibpacman_overlay)
exec('mv', '/.blend-overlays/future-varlibpacman', usr_overlay)
varlibpacman_overlay_workdir = subprocess.run( varlibpacman_overlay_workdir = subprocess.run(
['mktemp', '-d', '/mnt/.blend-tmp-overlay-XXXXXXXXXXXXX'], stdout=subprocess.PIPE).stdout.decode().strip() ['mktemp', '-d', '/mnt/.blend-tmp-overlay-XXXXXXXXXXXXX'], stdout=subprocess.PIPE).stdout.decode().strip()
exec('chmod', '=rw', varlibpacman_overlay_workdir) exec('chmod', '=rw', varlibpacman_overlay_workdir)
@ -306,6 +314,8 @@ def handle_system_packages(install):
exec('mv', usr_overlay, '/.blend-overlays/future-usr') exec('mv', usr_overlay, '/.blend-overlays/future-usr')
exec('mv', varlibpacman_overlay, '/.blend-overlays/future-varlibpacman') exec('mv', varlibpacman_overlay, '/.blend-overlays/future-varlibpacman')
exec('rm', '-rf', usr_overlay_workdir, varlibpacman_overlay_workdir) exec('rm', '-rf', usr_overlay_workdir, varlibpacman_overlay_workdir)
exec('touch', '/.blend-overlays/future-usr/.okay')
exec('touch', '/.blend-overlays/future-varlibpacman/.okay')
info('reboot to apply changes') info('reboot to apply changes')