mirror of
https://github.com/actions/runner-images.git
synced 2025-12-16 06:40:32 +00:00
[ubuntu] Remove quoted PATH from /etc/environment (#9347)
* [ubuntu] Remove quoted PATH from /etc/environment * Update quotes handling in replace_etc_environment_variable()
This commit is contained in:
committed by
GitHub
parent
8a4dc5b0f6
commit
b33a106fb9
@@ -20,7 +20,7 @@ chmod 755 $IMAGE_FOLDER
|
|||||||
ENVPATH=$(grep 'PATH=' /etc/environment | head -n 1 | sed -z 's/^PATH=*//')
|
ENVPATH=$(grep 'PATH=' /etc/environment | head -n 1 | sed -z 's/^PATH=*//')
|
||||||
ENVPATH=${ENVPATH#"\""}
|
ENVPATH=${ENVPATH#"\""}
|
||||||
ENVPATH=${ENVPATH%"\""}
|
ENVPATH=${ENVPATH%"\""}
|
||||||
add_etc_environment_variable "PATH" "${ENVPATH}"
|
replace_etc_environment_variable "PATH" "${ENVPATH}"
|
||||||
echo "Updated /etc/environment: $(cat /etc/environment)"
|
echo "Updated /etc/environment: $(cat /etc/environment)"
|
||||||
|
|
||||||
# Сlean yarn and npm cache
|
# Сlean yarn and npm cache
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ replace_etc_environment_variable() {
|
|||||||
local variable_value=$2
|
local variable_value=$2
|
||||||
|
|
||||||
# modify /etc/environemnt in place by replacing a string that begins with variable_name
|
# modify /etc/environemnt in place by replacing a string that begins with variable_name
|
||||||
sudo sed -i -e "s%^${variable_name}=.*$%${variable_name}=\"${variable_value}\"%" /etc/environment
|
sudo sed -i -e "s%^${variable_name}=.*$%${variable_name}=${variable_value}%" /etc/environment
|
||||||
}
|
}
|
||||||
|
|
||||||
set_etc_environment_variable() {
|
set_etc_environment_variable() {
|
||||||
|
|||||||
Reference in New Issue
Block a user