File tree Expand file tree Collapse file tree
src/sonic-build-hooks/scripts Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,6 +17,12 @@ REPR_MIRROR_URL_PATTERN='http:\/\/packages.trafficmanager.net\/debian'
1717
1818URL_PREFIX=$( echo " ${PACKAGE_URL_PREFIX} " | sed -E " s#(//[^/]*/).*#\1#" )
1919
20+ if [ $USER != ' root' ] && [ -n $( which sudo) ]; then
21+ SUDO=sudo
22+ else
23+ SUDO=' '
24+ fi
25+
2026log_err ()
2127{
2228 echo " $1 " >> $LOG_PATH /error.log
@@ -72,7 +78,7 @@ set_reproducible_mirrors()
7278
7379 local mirrors=" /etc/apt/sources.list $( find /etc/apt/sources.list.d/ -type f) "
7480 for mirror in $mirrors ; do
75- sed -i " $expression " " $mirror "
81+ $SUDO sed -i " $expression " " $mirror "
7682 done
7783}
7884
@@ -161,7 +167,7 @@ run_pip_command()
161167 install=y
162168 elif [[ " $para " == * .whl ]]; then
163169 package_name=$( echo $para | cut -d- -f1 | tr _ .)
164- sed " /^${package_name} ==/d" -i $tmp_version_file
170+ $SUDO sed " /^${package_name} ==/d" -i $tmp_version_file
165171 fi
166172 done
167173
You can’t perform that action at this time.
0 commit comments