Add support for package lists
This commit is contained in:
parent
7102e813d4
commit
e380b80559
2 changed files with 29 additions and 1 deletions
25
akshara
25
akshara
|
@ -183,6 +183,16 @@ def update_system():
|
||||||
'bash', '-c', 'echo "Current=breeze" >> /etc/sddm.conf.d/default.conf')
|
'bash', '-c', 'echo "Current=breeze" >> /etc/sddm.conf.d/default.conf')
|
||||||
exec_chroot('rm', '-f', '/etc/gdm/custom.conf')
|
exec_chroot('rm', '-f', '/etc/gdm/custom.conf')
|
||||||
|
|
||||||
|
# Install custom system packages
|
||||||
|
exec('touch', '/.custom_pkg_list')
|
||||||
|
exec('cp', '/.custom_pkg_list', '/mnt/iso-update/squashfs-root')
|
||||||
|
with open('/.custom_pkg_list') as custompkglist_file:
|
||||||
|
custompkglist = []
|
||||||
|
while line := custompkglist_file.readline():
|
||||||
|
if line.strip() != '':
|
||||||
|
custompkglist.append(line.strip())
|
||||||
|
exec_chroot('pacman', '-Sy', '--needed', '--noconfirm', *custompkglist)
|
||||||
|
|
||||||
# Note to self: since the hook only copies new files in /etc, configuring
|
# Note to self: since the hook only copies new files in /etc, configuring
|
||||||
# Note to self: locales and users isn't required
|
# Note to self: locales and users isn't required
|
||||||
|
|
||||||
|
@ -199,13 +209,18 @@ def handle_system_packages(operation):
|
||||||
error('no packages specified')
|
error('no packages specified')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
for pkg in args.pkg:
|
||||||
|
if pkg.startswith('linux'):
|
||||||
|
error('you may not install linux* packages')
|
||||||
|
exit(1)
|
||||||
|
|
||||||
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)')
|
||||||
print()
|
print()
|
||||||
info('this command 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')
|
||||||
elif operation == 'drop-packages':
|
elif operation == 'drop-overlay':
|
||||||
info('any installed packages will be removed')
|
info('any installed packages will be removed')
|
||||||
else:
|
else:
|
||||||
error('unsupported operation')
|
error('unsupported operation')
|
||||||
|
@ -262,6 +277,8 @@ def handle_system_packages(operation):
|
||||||
elif operation == 'drop-overlay':
|
elif operation == 'drop-overlay':
|
||||||
exec('rm', '-f', '/.blend-overlays/future-usr/.okay')
|
exec('rm', '-f', '/.blend-overlays/future-usr/.okay')
|
||||||
exec('rm', '-f', '/.blend-overlays/future-varlibpacman/.okay')
|
exec('rm', '-f', '/.blend-overlays/future-varlibpacman/.okay')
|
||||||
|
exec('rm', '-f', '/.custom_pkg_list')
|
||||||
|
exec('touch', '/.custom_pkg_list')
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
if exec('systemd-nspawn', '-D', '/.blendrw', '--', 'pacman', *operation, '--', *args.pkg, stdout=sys.stdout, stderr=sys.stderr) != 0:
|
if exec('systemd-nspawn', '-D', '/.blendrw', '--', 'pacman', *operation, '--', *args.pkg, stdout=sys.stdout, stderr=sys.stderr) != 0:
|
||||||
|
@ -285,6 +302,9 @@ def handle_system_packages(operation):
|
||||||
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('bash', '-c', "printf > /.custom_pkg_list")
|
||||||
|
for pkg in args.pkg:
|
||||||
|
exec('bash', '-c', f"echo '{pkg}' >> /.custom_pkg_list")
|
||||||
exec('touch', '/.blend-overlays/future-usr/.okay')
|
exec('touch', '/.blend-overlays/future-usr/.okay')
|
||||||
exec('touch', '/.blend-overlays/future-varlibpacman/.okay')
|
exec('touch', '/.blend-overlays/future-varlibpacman/.okay')
|
||||||
info('reboot to apply changes')
|
info('reboot to apply changes')
|
||||||
|
@ -306,6 +326,9 @@ def handle_system_packages(operation):
|
||||||
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('bash', '-c', "printf > /.custom_pkg_list")
|
||||||
|
for pkg in args.pkg:
|
||||||
|
exec('bash', '-c', f"echo '{pkg}' >> /.custom_pkg_list")
|
||||||
exec('touch', '/.blend-overlays/future-usr/.okay')
|
exec('touch', '/.blend-overlays/future-usr/.okay')
|
||||||
exec('touch', '/.blend-overlays/future-varlibpacman/.okay')
|
exec('touch', '/.blend-overlays/future-varlibpacman/.okay')
|
||||||
info('reboot to apply changes')
|
info('reboot to apply changes')
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
run_latehook() {
|
run_latehook() {
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
touch /new_root/.custom_pkg_list
|
||||||
|
|
||||||
# Remove /new_root/mnt/iso-update/.successful-update if exists
|
# Remove /new_root/mnt/iso-update/.successful-update if exists
|
||||||
rm -f /new_root/mnt/iso-update/.successful-update
|
rm -f /new_root/mnt/iso-update/.successful-update
|
||||||
|
|
||||||
|
@ -12,6 +14,9 @@ run_latehook() {
|
||||||
mv /new_root/usr /new_root/.old.usr
|
mv /new_root/usr /new_root/.old.usr
|
||||||
mv /new_root/mnt/iso-update/squashfs-root/usr /new_root/usr
|
mv /new_root/mnt/iso-update/squashfs-root/usr /new_root/usr
|
||||||
|
|
||||||
|
# Copy package list
|
||||||
|
mv /new_root/mnt/iso-update/squashfs-root/.custom_pkg_list /new_root
|
||||||
|
|
||||||
# Update /usr/lib/modules for current kernel version.
|
# Update /usr/lib/modules for current kernel version.
|
||||||
for kversion in /new_root/.old.usr/lib/modules/*; do
|
for kversion in /new_root/.old.usr/lib/modules/*; do
|
||||||
if [[ ! -d /new_root/usr/lib/modules/"$(basename "$kversion")" ]]; then
|
if [[ ! -d /new_root/usr/lib/modules/"$(basename "$kversion")" ]]; then
|
||||||
|
|
Loading…
Reference in a new issue