1 |
commit: 9ff664072a17b88a33e78addefc10d04c12e6197 |
2 |
Author: Göktürk Yüksek <gokturk <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Jan 31 02:56:08 2020 +0000 |
4 |
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Jan 31 07:36:49 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/crossdev.git/commit/?id=9ff66407 |
7 |
|
8 |
crossdev: remove the repos.conf entry for the output overlay during uninstall |
9 |
|
10 |
If the output overlay is completely removed during uninstall, it is |
11 |
incorrect to leave behind the repos.conf file since the location |
12 |
specified in the conf file points to a non-existing directory. |
13 |
|
14 |
We scan all the conf files under ${CONFIGROOT}/repos.conf, looking for |
15 |
the file that defines the output overlay and remove it if it is |
16 |
managed by crossdev. |
17 |
|
18 |
Signed-off-by: Göktürk Yüksek <gokturk <AT> gentoo.org> |
19 |
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org> |
20 |
|
21 |
crossdev | 14 ++++++++++++++ |
22 |
1 file changed, 14 insertions(+) |
23 |
|
24 |
diff --git a/crossdev b/crossdev |
25 |
index 4576e0f..12e14e3 100755 |
26 |
--- a/crossdev |
27 |
+++ b/crossdev |
28 |
@@ -580,6 +580,20 @@ uninstall() { |
29 |
[[ ${i} -eq 2 ]] && rm -r "${CROSSDEV_OVERLAY}" |
30 |
fi |
31 |
fi |
32 |
+ # Remove the repos.conf entry if the output overlay is completely removed |
33 |
+ if [[ ! -e "${CROSSDEV_OVERLAY}" ]]; then |
34 |
+ # There is no easy way to reverse map an overlay entry |
35 |
+ # to a particular file under repos.conf |
36 |
+ # We'll scan every conf file for a match on repo name and |
37 |
+ # remove if the file is managed by crossdev |
38 |
+ while IFS="" read -d $'\0' -r f ; do |
39 |
+ grep -qs "^${AUTOGEN_TAG}" "${f}" || continue |
40 |
+ if grep -qs "^\[${CROSSDEV_OVERLAY_NAME}\]$" "${f}"; then |
41 |
+ rm -f "${f}" |
42 |
+ break |
43 |
+ fi |
44 |
+ done < <(find "${CONFIGROOT}"/repos.conf -type f -print0) |
45 |
+ fi |
46 |
# crossdev stopped creating 'package.keywords' in Jan 2020 |
47 |
for f in categories package.{accept_keywords,env,mask,keywords,use} profile/package.use.{force,mask} ; do |
48 |
f="${CONFIGROOT}/${f}" |