diff options
| author | Franoosh <uinarf@autistici.org> | 2025-11-20 12:49:39 +0100 |
|---|---|---|
| committer | Franoosh <uinarf@autistici.org> | 2025-11-20 12:49:39 +0100 |
| commit | f6e0682c11e79d2316bb3b826da3e0f8fe3cdc4e (patch) | |
| tree | 109c9c4cfd800309fac3a261ce1cbb17c2a52bbe | |
| parent | 1d6bcb600fbd529a27327e8f71e8d39ee496775d (diff) | |
| download | Bash-f6e0682c11e79d2316bb3b826da3e0f8fe3cdc4e.tar.gz Bash-f6e0682c11e79d2316bb3b826da3e0f8fe3cdc4e.tar.bz2 Bash-f6e0682c11e79d2316bb3b826da3e0f8fe3cdc4e.zip | |
Fix emerge script for client, fix comments
| -rwxr-xr-x | emerge | 21 | ||||
| -rwxr-xr-x | emerge-client | 53 |
2 files changed, 46 insertions, 28 deletions
@@ -1,13 +1,16 @@ #!/usr/bin/env bash - -# This script is for a binhost server. -# 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 -# For a binhost client you need this defined: -# PORTAGE_BINHOST="ssh://user@binhost_server/path/to/binary/host/$PKGDIR" -# There is an accompanying script emerge-client in the repo. -# One needs to put it on $PATH before /usr/bin/emerge, for instance /usr/bin/local on the binhost user host. +############################################################################# +# This script is for a binhost server. # +# # +# 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 # +# # +# For a binhost client you need this defined: # +# PORTAGE_BINHOST="ssh://user@binhost_server/path/to/binary/host/$PKGDIR" # +# # +# There is an accompanying script emerge-client in the repo. # +############################################################################# PROFILE=$(eselect profile show|sed -n 2p|cut -d '/' -f4) GCC_VERSION=$(eselect gcc show|cut -d '-' -f5) diff --git a/emerge-client b/emerge-client index c02c588..9c0febc 100755 --- a/emerge-client +++ b/emerge-client @@ -1,31 +1,46 @@ #!/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 +############################################################################# +# This script is for a binhost client. # +# # +# Script deciding on a correct PORTAGE_BINHOST variable # +# after change of profile/gcc version. # +# This script will only use new PORTAGE_BINHOST for current emerge, # +# leaving it untouched in make.conf. # +# You will have to update make.conf manually # +# # +# In order to use, rename to `emerge` and place in # +# $PATH before /usr/bin/emerge, for instance /usr/bin/local # +# call `source /etc/profile` and `env-update`. Check script permissions. # +# # +# Note: do not use blindly, back up your make.conf first. # +# # +############################################################################# 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_USER='orp' +BINHOST_SERVER='onge' BINHOST_PATH='/var/www/binhost/rpi3/binpkgs/' -MAKE_CONF='/etc/portage/make.conf' - -export BINHOST_DIR=${BINHOST_DIR} +MAKE_CONF='make.conf' 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 ..." +OLD_BINHOST=$(grep -e "^PORTAGE_BINHOST=" $MAKE_CONF) +if [ -n "$OLD_BINHOST" ]; then + # Old PORTAGE_BINHOST exists + if [ "$OLD_BINHOST" != "$NEW_PORTAGE_BINHOST" ];then + echo "PORTAGE_BINHOST:" + echo "Old value: $OLD_BINHOST" + echo "New value: $NEW_PORTAGE_BINHOST" + echo "You may want to write the new PORTAGE_BINHOST in make.conf." + echo "Proceeding with emerge using new PORTAGE_BINHOST value..." + else + echo "Binhost value has not changed, proceeding with emerge ..." + fi else - echo "Binhost value has not changed, proceeding with emerge ..." + echo "No PORTAGE_BINHOST variable found" fi + +PORTAGE_BINHOST=$NEW_PORTAGE_BINHOST /usr/bin/emerge "$@" |
