[ubuntu] Unify approach to /etc/environment (#8904)

* [ubuntu] Unify approach to /etc/environment

* [ubuntu] fix typo in XDG_CONFIG_HOME name
This commit is contained in:
Shamil Mubarakshin
2023-11-28 15:19:44 +01:00
committed by GitHub
parent da1c04b81a
commit 435ba67550
17 changed files with 78 additions and 46 deletions

View File

@@ -6,17 +6,18 @@
# Source the helpers for use with the script
source $HELPER_SCRIPTS/os.sh
source $HELPER_SCRIPTS/etc-environment.sh
# Set ImageVersion and ImageOS env variables
echo ImageVersion=$IMAGE_VERSION | tee -a /etc/environment
echo ImageOS=$IMAGE_OS | tee -a /etc/environment
setEtcEnvironmentVariable "ImageVersion" "${IMAGE_VERSION}"
setEtcEnvironmentVariable "ImageOS" "${IMAGE_OS}"
# Set the ACCEPT_EULA variable to Y value to confirm your acceptance of the End-User Licensing Agreement
echo ACCEPT_EULA=Y | tee -a /etc/environment
setEtcEnvironmentVariable "ACCEPT_EULA" "Y"
# This directory is supposed to be created in $HOME and owned by user(https://github.com/actions/runner-images/issues/491)
mkdir -p /etc/skel/.config/configstore
echo 'XDG_CONFIG_HOME=$HOME/.config' | tee -a /etc/environment
setEtcEnvironmentVariable "XDG_CONFIG_HOME" '$HOME/.config'
# Change waagent entries to use /mnt for swapfile
sed -i 's/ResourceDisk.Format=n/ResourceDisk.Format=y/g' /etc/waagent.conf
@@ -29,7 +30,7 @@ sed -i 's/::1 ip6-localhost ip6-loopback/::1 localhost ip6-localhost ip6-loo
# Prepare directory and env variable for toolcache
AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache
mkdir $AGENT_TOOLSDIRECTORY
echo "AGENT_TOOLSDIRECTORY=$AGENT_TOOLSDIRECTORY" | tee -a /etc/environment
setEtcEnvironmentVariable "AGENT_TOOLSDIRECTORY" "${AGENT_TOOLSDIRECTORY}"
chmod -R 777 $AGENT_TOOLSDIRECTORY
# https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html