summaryrefslogtreecommitdiff
path: root/modereset
diff options
context:
space:
mode:
authorV3n3RiX <venerix@rogentos.ro>2016-04-20 18:03:21 +0100
committerV3n3RiX <venerix@rogentos.ro>2016-04-20 18:03:21 +0100
commit8fb6dc9a8dc3c44c69f579d649ddd0afb36c4cce (patch)
tree3cc488360fbfe929c1f3832d2a1e972ecbe840f6 /modereset
parent90eb32f31f8a14858a537b00a3bedff77321a3ff (diff)
make use of variables, avoid removal of distfiles and package directories when switching modes
Diffstat (limited to 'modereset')
-rwxr-xr-xmodereset14
1 files changed, 8 insertions, 6 deletions
diff --git a/modereset b/modereset
index 6fad670..84b0d35 100755
--- a/modereset
+++ b/modereset
@@ -1,12 +1,14 @@
#!/usr/bin/env bash
+export local portagedir="/usr/portage"
+export local confdir="/etc/portage"
+
reset_current_mode() {
- if [ -d /usr/portage/.git ] ; then
- rm -rf /usr/portage/*
- rm -rf /usr/portage/.git*
- rm /etc/portage/make.conf
- rm /etc/portage/make.profile
- rm /etc/portage
+ if [ -d ""$portagedir"/.git" ] ; then
+ rm -rf $(find "$portagedir" -mindepth 1 | grep -v "distfiles" | grep -v "packages")
+ rm ""$confdir"/make.conf"
+ rm ""$confdir"/make.profile"
+ rm "$confdir"
fi
}