@@ -10,22 +10,23 @@ script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
1010
1111echo " Checking for elevated privileges..."
1212privileged_command_prefix=" "
13- if [ ${EUID:- $(id -u)} -ne 0 ] ; then
13+ USER_ID=${EUID:- $(id -u)}
14+ if [[ 0 -ne ${USER_ID} ]] ; then
1415 sudo echo " Script can elevate privileges."
1516 privileged_command_prefix=" ${privileged_command_prefix} sudo"
1617fi
1718
1819# Check if the system is running Ubuntu and determine the version
1920if [[ -f /etc/os-release ]]; then
2021 source /etc/os-release
21- if [[ " $ID " == " ubuntu" &&
22- ( " $VERSION_CODENAME " == " focal" ||
23- " $VERSION_CODENAME " == " jammy" ||
24- " $VERSION_CODENAME " == " noble" ) ]]; then
25- dist_dir=" $script_dir /ubuntu-$VERSION_CODENAME "
22+ if [[ " ${ID} " == " ubuntu" &&
23+ ( " ${ VERSION_CODENAME} " == " focal" ||
24+ " ${ VERSION_CODENAME} " == " jammy" ||
25+ " ${ VERSION_CODENAME} " == " noble" ) ]]; then
26+ dist_dir=" ${ script_dir} /ubuntu-${ VERSION_CODENAME} "
2627 for exe_file in \
27- " $dist_dir /install-prebuilt-packages.sh" " $dist_dir /install-packages-from-source.sh" ; do
28- [[ -f " $exe_file " ]] && ${privileged_command_prefix} $exe_file
28+ " ${ dist_dir} /install-prebuilt-packages.sh" " ${ dist_dir} /install-packages-from-source.sh" ; do
29+ [[ -f " ${ exe_file} " ]] && " ${privileged_command_prefix} ${ exe_file} "
2930 done
3031 exit 0
3132 fi
0 commit comments