diff options
author | Göktürk Yüksek <gokturk@gentoo.org> | 2020-01-30 21:56:08 -0500 |
---|---|---|
committer | Sergei Trofimovich <slyfox@gentoo.org> | 2020-01-31 07:36:49 +0000 |
commit | 9ff664072a17b88a33e78addefc10d04c12e6197 (patch) | |
tree | 3f2e6466352045a4579b44f720b3b99691e84ee5 /crossdev | |
parent | crossdev: remove the output overlay during uninstallation when possible (diff) | |
download | crossdev-9ff664072a17b88a33e78addefc10d04c12e6197.tar.gz crossdev-9ff664072a17b88a33e78addefc10d04c12e6197.tar.bz2 crossdev-9ff664072a17b88a33e78addefc10d04c12e6197.zip |
crossdev: remove the repos.conf entry for the output overlay during uninstall
If the output overlay is completely removed during uninstall, it is
incorrect to leave behind the repos.conf file since the location
specified in the conf file points to a non-existing directory.
We scan all the conf files under ${CONFIGROOT}/repos.conf, looking for
the file that defines the output overlay and remove it if it is
managed by crossdev.
Signed-off-by: Göktürk Yüksek <gokturk@gentoo.org>
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Diffstat (limited to 'crossdev')
-rwxr-xr-x | crossdev | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -580,6 +580,20 @@ uninstall() { [[ ${i} -eq 2 ]] && rm -r "${CROSSDEV_OVERLAY}" fi fi + # Remove the repos.conf entry if the output overlay is completely removed + if [[ ! -e "${CROSSDEV_OVERLAY}" ]]; then + # There is no easy way to reverse map an overlay entry + # to a particular file under repos.conf + # We'll scan every conf file for a match on repo name and + # remove if the file is managed by crossdev + while IFS="" read -d $'\0' -r f ; do + grep -qs "^${AUTOGEN_TAG}" "${f}" || continue + if grep -qs "^\[${CROSSDEV_OVERLAY_NAME}\]$" "${f}"; then + rm -f "${f}" + break + fi + done < <(find "${CONFIGROOT}"/repos.conf -type f -print0) + fi # crossdev stopped creating 'package.keywords' in Jan 2020 for f in categories package.{accept_keywords,env,mask,keywords,use} profile/package.use.{force,mask} ; do f="${CONFIGROOT}/${f}" |