blob: c02c5883eb7aa1a55bd5e2086ef722b193b6f595 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#!/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/'
MAKE_CONF='/etc/portage/make.conf'
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
|