summaryrefslogtreecommitdiff
path: root/emerge-client
diff options
context:
space:
mode:
Diffstat (limited to 'emerge-client')
-rwxr-xr-xemerge-client30
1 files changed, 30 insertions, 0 deletions
diff --git a/emerge-client b/emerge-client
new file mode 100755
index 0000000..eddfac1
--- /dev/null
+++ b/emerge-client
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+
+# This script is for a binhost client.
+# Script creating new binhost directories if they don't exist
+# after changing profile/gcc versions.
+# To be placed in $PATH before /usr/bin/emerge, for instance /usr/bin/local
+
+PROFILE=$(eselect profile show|sed -n 2p|cut -d '/' -f4)
+GCC_VERSION=$(eselect gcc show|cut -d '-' -f5)
+PKGDIR="${PROFILE}/gcc-${GCC_VERSION}.x/armv8a"
+BINHOST_USER='example_user'
+BINHOST_SERVER='example_binhost_server'
+BINHOST_PATH='/var/www/binhost/rpi3/binpkgs/'
+
+export BINHOST_DIR=${BINHOST_DIR}
+
+NEW_PORTAGE_BINHOST="PORTAGE_BINHOST='ssh://$BINHOST_USER@$BINHOST_SERVER$BINHOST_PATH$PKGDIR'"
+OLD_BINHOST=$(grep PORTAGE_BINHOST=\' make.conf)
+if [ "$OLD_BINHOST" != "$NEW_PORTAGE_BINHOST" ];then
+ echo "Replacing old binhost value in make.conf with new"
+ echo "Old value: $OLD_BINHOST"
+ echo "New value: $NEW_PORTAGE_BINHOST"
+ sed -i '/^PORTAGE_BINHOST/i # Old PORTAGE_BINHOST:' make.conf
+ sed -i 's/^PORTAGE_BINHOST/# PORTAGE_BINHOST/' make.conf
+ sed -i "/^# PORTAGE_BINHOST/a $NEW_PORTAGE_BINHOST" make.conf
+ echo "Proceeding with emerge ..."
+else
+ echo "Binhost value has not changed, proceeding with emerge ..."
+fi
+