Skip to content

fix faulty `lb chroot_apt remove`

Lyndon Brown requested to merge jnqnfe/live-build:aptmod_removal into master

i have no idea what the author was thinking with this, but it was certainly not accomplishing what it should.

the install mode:

  1. moves the exiting file aside to FILE.orig
  2. copies the config file in place

the remove mode:

  1. moves FILE (the user config file) to FILE.orig, replacing the backed up original (if there was one)
  2. copies the user config file to FILE (pointless)
  3. if FILE.orig exists, moves it to replace FILE (pointless)

thus the remove mode just effectively destroys the backup of the original file and leaves the user config file in place.

it would correctly remove the additions to chroot/etc/apt/preferences though presumably.

we fix this by:

  1. replacing removal steps 1 & 2 with a command to remove the existing file
  2. performing the removal of additions to chroot/etc/apt/preferences only if they had been made to an existing file rather than to a user config provided file (which will be deleted)
Edited by Lyndon Brown

Merge request reports

Loading