summaryrefslogtreecommitdiff
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
parent90eb32f31f8a14858a537b00a3bedff77321a3ff (diff)
make use of variables, avoid removal of distfiles and package directories when switching modes
-rwxr-xr-xdevmodeset14
-rwxr-xr-xmodereset14
-rwxr-xr-xusermodeset14
3 files changed, 26 insertions, 16 deletions
diff --git a/devmodeset b/devmodeset
index 3ebffa0..cd28d1b 100755
--- a/devmodeset
+++ b/devmodeset
@@ -1,18 +1,22 @@
#!/usr/bin/env bash
+export local portagedir="/usr/portage"
+export local confdir="/etc/portage"
+export local gitdir="/opt/kogaion-build/conf/intel/portage"
+
fetch_devmode_portage_tree() {
- if [[ ! -d /usr/portage/.git ]] ; then
- cd /usr/portage && git init > /dev/null 2>&1
+ if [[ ! -d "$portagedir"/.git ]] ; then
+ cd "$portagedir" && git init > /dev/null 2>&1
git remote add origin git://anongit.gentoo.org/repo/gentoo.git
git pull --depth=1 origin master
git branch -u origin/master master
- rm -rf /usr/portage/profiles/updates
+ rm -rf ""$portagedir"/profiles/updates"
fi
}
set_devmode_portage_tree() {
- ln -sf /opt/kogaion-build/conf/intel/portage /etc/portage
- ln -sf /etc/portage/make.conf.amd64-devel /etc/portage/make.conf
+ ln -sf "$gitdir" "$confdir"
+ ln -sf "$confdir"/make.conf.amd64-devel "$confdir"/make.conf
eselect profile set 1
env-update
. /etc/profile
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
}
diff --git a/usermodeset b/usermodeset
index 6a8e925..ae4a9ec 100755
--- a/usermodeset
+++ b/usermodeset
@@ -1,8 +1,12 @@
#!/usr/bin/env bash
+export local portagedir="/usr/portage"
+export local confdir="/etc/portage"
+export local gitdir="/opt/kogaion-build/conf/intel/portage"
+
fetch_usermode_portage_tree() {
- if [[ ! -d /usr/portage/.git ]] ; then
- cd /usr/portage && git init > /dev/null 2>&1
+ if [[ ! -d "$portagedir"/.git ]] ; then
+ cd "$portagedir" && git init > /dev/null 2>&1
git remote add origin git://anongit.gentoo.org/repo/gentoo.git
git config core.sparsecheckout true
echo "profiles/*" >> .git/info/sparse-checkout
@@ -11,13 +15,13 @@ fetch_usermode_portage_tree() {
echo ".gitignore" >> .git/info/sparse-checkout
git pull --depth=1 origin master
git branch -u origin/master master
- rm -rf /usr/portage/profiles/updates
+ rm -rf ""$portagedir"/profiles/updates"
fi
}
set_usermode_portage_tree() {
- ln -sf /opt/kogaion-build/conf/intel/portage /etc/portage
- ln -sf /etc/portage/make.conf.amd64-user /etc/portage/make.conf
+ ln -sf "$gitdir" "$confdir"
+ ln -sf "$confdir"/make.conf.amd64-user "$confdir"/make.conf
eselect profile set 1
env-update
. /etc/profile