mirror of
https://github.com/actions/runner-images.git
synced 2025-12-13 20:56:47 +00:00
[Ubuntu] Set user-related environmental variables and PATH via post deployment script (#3030)
* Move home directory vars to post-deploy scripts * Remove "export" word * Move home directory vars to post-deploy scripts * Remove "export" word * add variables via post-deployment file * remove quotes around PATH * remove quotes * Replace $HOME in /etc/environment in post-deployment script * rename variable * get rid of extra variable
This commit is contained in:
6
images/linux/post-generation/environment-variables.sh
Normal file
6
images/linux/post-generation/environment-variables.sh
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Replace $HOME with the default user's home directory for environmental variables related to the default user home directory
|
||||||
|
|
||||||
|
homeDir=$(cut -d: -f6 /etc/passwd | tail -1)
|
||||||
|
sed -i "s|\$HOME|$homeDir|g" /etc/environment
|
||||||
@@ -9,7 +9,7 @@ echo ACCEPT_EULA=Y | tee -a /etc/environment
|
|||||||
|
|
||||||
# This directory is supposed to be created in $HOME and owned by user(https://github.com/actions/virtual-environments/issues/491)
|
# This directory is supposed to be created in $HOME and owned by user(https://github.com/actions/virtual-environments/issues/491)
|
||||||
mkdir -p /etc/skel/.config/configstore
|
mkdir -p /etc/skel/.config/configstore
|
||||||
echo 'export XDG_CONFIG_HOME=$HOME/.config' | tee -a /etc/skel/.bashrc
|
echo 'XDG_CONFIG_HOME=$HOME/.config' | tee -a /etc/environment
|
||||||
|
|
||||||
# Change waagent entries to use /mnt for swapfile
|
# Change waagent entries to use /mnt for swapfile
|
||||||
sed -i 's/ResourceDisk.Format=n/ResourceDisk.Format=y/g' /etc/waagent.conf
|
sed -i 's/ResourceDisk.Format=n/ResourceDisk.Format=y/g' /etc/waagent.conf
|
||||||
|
|||||||
@@ -89,7 +89,6 @@ done
|
|||||||
setEtcEnvironmentVariable DOTNET_SKIP_FIRST_TIME_EXPERIENCE 1
|
setEtcEnvironmentVariable DOTNET_SKIP_FIRST_TIME_EXPERIENCE 1
|
||||||
setEtcEnvironmentVariable DOTNET_NOLOGO 1
|
setEtcEnvironmentVariable DOTNET_NOLOGO 1
|
||||||
setEtcEnvironmentVariable DOTNET_MULTILEVEL_LOOKUP 0
|
setEtcEnvironmentVariable DOTNET_MULTILEVEL_LOOKUP 0
|
||||||
prependEtcEnvironmentPath /home/runner/.dotnet/tools
|
prependEtcEnvironmentPath '$HOME/.dotnet/tools'
|
||||||
echo 'export PATH="$PATH:$HOME/.dotnet/tools"' | tee -a /etc/skel/.bashrc
|
|
||||||
|
|
||||||
invoke_tests "DotnetSDK"
|
invoke_tests "DotnetSDK"
|
||||||
@@ -8,7 +8,7 @@ export NVM_DIR="/etc/skel/.nvm"
|
|||||||
mkdir $NVM_DIR
|
mkdir $NVM_DIR
|
||||||
VERSION=$(curl -s https://api.github.com/repos/nvm-sh/nvm/releases/latest | jq -r '.tag_name')
|
VERSION=$(curl -s https://api.github.com/repos/nvm-sh/nvm/releases/latest | jq -r '.tag_name')
|
||||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/$VERSION/install.sh | bash
|
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/$VERSION/install.sh | bash
|
||||||
echo 'export NVM_DIR=$HOME/.nvm' | tee -a /etc/skel/.bash_profile
|
echo 'NVM_DIR=$HOME/.nvm' | tee -a /etc/environment
|
||||||
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' | tee -a /etc/skel/.bash_profile
|
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' | tee -a /etc/skel/.bash_profile
|
||||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||||
|
|
||||||
|
|||||||
@@ -87,12 +87,8 @@ php composer-setup.php
|
|||||||
sudo mv composer.phar /usr/bin/composer
|
sudo mv composer.phar /usr/bin/composer
|
||||||
php -r "unlink('composer-setup.php');"
|
php -r "unlink('composer-setup.php');"
|
||||||
|
|
||||||
# Update /etc/environment
|
|
||||||
prependEtcEnvironmentPath /home/runner/.config/composer/vendor/bin
|
|
||||||
|
|
||||||
|
|
||||||
# Add composer bin folder to path
|
# Add composer bin folder to path
|
||||||
echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> /etc/skel/.bashrc
|
prependEtcEnvironmentPath '$HOME/.config/composer/vendor/bin'
|
||||||
|
|
||||||
#Create composer folder for user to preserve folder permissions
|
#Create composer folder for user to preserve folder permissions
|
||||||
mkdir -p /etc/skel/.composer
|
mkdir -p /etc/skel/.composer
|
||||||
|
|||||||
@@ -41,6 +41,6 @@ if isUbuntu18 || isUbuntu20 ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Adding this dir to PATH will make installed pip commands are immediately available.
|
# Adding this dir to PATH will make installed pip commands are immediately available.
|
||||||
echo 'export PATH="$PATH:$HOME/.local/bin"' | tee -a /etc/skel/.bashrc
|
prependEtcEnvironmentPath '$HOME/.local/bin'
|
||||||
|
|
||||||
invoke_tests "Tools" "Python"
|
invoke_tests "Tools" "Python"
|
||||||
|
|||||||
Reference in New Issue
Block a user