Fix sonic-slave-* build errors about sudo command not found (#13412)
issue #13395 Fix a bug about sudo failure. /usr/local/share/buildinfo/scripts/buildinfo_base.sh: line 24: sudo: command not found Fix an issue about warning message. ./scripts/run_with_retry: line 4: [: : integer expression expected
This commit is contained in:
parent
a096363b48
commit
6ba1a2e411
@ -1,7 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
run_with_retry(){
|
run_with_retry(){
|
||||||
[ "$SONIC_BUILD_RETRY_COUNT" -gt 0 ] || SONIC_BUILD_RETRY_COUNT=0
|
# set default value and change invalid param input to 0
|
||||||
|
(( SONIC_BUILD_RETRY_COUNT > 0 )) || SONIC_BUILD_RETRY_COUNT=0
|
||||||
|
(( SONIC_BUILD_RETRY_INTERVAL > 0 )) || SONIC_BUILD_RETRY_INTERVAL=600
|
||||||
[[ "$*" == "" ]] && { echo "run_with_retry: input command can't be empty." 1>&2;exit 1; }
|
[[ "$*" == "" ]] && { echo "run_with_retry: input command can't be empty." 1>&2;exit 1; }
|
||||||
for ((i=0; i<=$SONIC_BUILD_RETRY_COUNT; i++))
|
for ((i=0; i<=$SONIC_BUILD_RETRY_COUNT; i++))
|
||||||
do
|
do
|
||||||
|
@ -15,19 +15,6 @@ REPR_MIRROR_URL_PATTERN='http:\/\/packages.trafficmanager.net\/'
|
|||||||
DPKG_INSTALLTION_LOCK_FILE=/tmp/.dpkg_installation.lock
|
DPKG_INSTALLTION_LOCK_FILE=/tmp/.dpkg_installation.lock
|
||||||
|
|
||||||
. $BUILDINFO_PATH/config/buildinfo.config
|
. $BUILDINFO_PATH/config/buildinfo.config
|
||||||
if [ -e /vcache ]; then
|
|
||||||
PKG_CACHE_PATH=/vcache/${IMAGENAME}
|
|
||||||
else
|
|
||||||
PKG_CACHE_PATH=/sonic/target/vcache/${IMAGENAME}
|
|
||||||
fi
|
|
||||||
PKG_CACHE_FILE_NAME=${PKG_CACHE_PATH}/cache.tgz
|
|
||||||
sudo chown $USER $(dirname $PKG_CACHE_PATH)
|
|
||||||
mkdir -p ${PKG_CACHE_PATH}
|
|
||||||
|
|
||||||
. ${BUILDINFO_PATH}/scripts/utils.sh
|
|
||||||
|
|
||||||
|
|
||||||
URL_PREFIX=$(echo "${PACKAGE_URL_PREFIX}" | sed -E "s#(//[^/]*/).*#\1#")
|
|
||||||
|
|
||||||
if [ "$(whoami)" != "root" ] && [ -n "$(which sudo)" ];then
|
if [ "$(whoami)" != "root" ] && [ -n "$(which sudo)" ];then
|
||||||
SUDO=sudo
|
SUDO=sudo
|
||||||
@ -35,6 +22,20 @@ else
|
|||||||
SUDO=''
|
SUDO=''
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -e /vcache ]; then
|
||||||
|
PKG_CACHE_PATH=/vcache/${IMAGENAME}
|
||||||
|
else
|
||||||
|
PKG_CACHE_PATH=/sonic/target/vcache/${IMAGENAME}
|
||||||
|
fi
|
||||||
|
PKG_CACHE_FILE_NAME=${PKG_CACHE_PATH}/cache.tgz
|
||||||
|
$SUDO mkdir -p ${PKG_CACHE_PATH}
|
||||||
|
$SUDO chown $USER $PKG_CACHE_PATH
|
||||||
|
|
||||||
|
. ${BUILDINFO_PATH}/scripts/utils.sh
|
||||||
|
|
||||||
|
|
||||||
|
URL_PREFIX=$(echo "${PACKAGE_URL_PREFIX}" | sed -E "s#(//[^/]*/).*#\1#")
|
||||||
|
|
||||||
log_err()
|
log_err()
|
||||||
{
|
{
|
||||||
echo "$(date "+%F-%H-%M-%S") ERR $1" >> $LOG_PATH/error.log
|
echo "$(date "+%F-%H-%M-%S") ERR $1" >> $LOG_PATH/error.log
|
||||||
|
Loading…
Reference in New Issue
Block a user