2020-10-07 13:49:40 +05:00
#!/bin/bash -e
2020-09-21 11:18:28 +03:00
################################################################################
2023-11-22 21:49:23 +01:00
## File: configure-system.sh
## Desc: Post deployment system configuration actions
2020-09-21 11:18:28 +03:00
################################################################################
2023-11-28 15:19:44 +01:00
source $HELPER_SCRIPT_FOLDER /etc-environment.sh
2024-06-04 11:35:21 +02:00
source $HELPER_SCRIPT_FOLDER /os.sh
2023-11-28 15:19:44 +01:00
2020-10-12 17:44:31 +03:00
mv -f /imagegeneration/post-generation /opt
2021-11-15 18:35:50 +01:00
echo "chmod -R 777 /usr/share"
chmod -R 777 /usr/share
2026-02-13 10:55:28 +01:00
echo "chmod -R 777 /opt"
chmod -R 777 /opt
echo "Setting sticky bit on hostedtoolcache Ruby directories due to the changes in Ruby 4.0; see issue: https://github.com/actions/runner-images/issues/13647"
find /opt/hostedtoolcache/Ruby -type d -exec chmod +t {} +
2020-09-22 13:55:21 +03:00
chmod 755 $IMAGE_FOLDER
2020-10-12 17:44:31 +03:00
2020-11-03 15:56:49 +03:00
# Remove quotes around PATH
2020-11-05 22:08:19 +03:00
ENVPATH = $( grep 'PATH=' /etc/environment | head -n 1 | sed -z 's/^PATH=*//' )
2020-11-05 10:36:01 +03:00
ENVPATH = ${ ENVPATH # "\"" }
ENVPATH = ${ ENVPATH % "\"" }
2024-02-14 12:09:49 +01:00
replace_etc_environment_variable "PATH" " ${ ENVPATH } "
2020-11-05 10:36:01 +03:00
echo "Updated /etc/environment: $( cat /etc/environment) "
2020-10-27 17:24:59 +03:00
2024-03-14 10:53:11 +01:00
# Clean yarn and npm cache
2023-12-29 12:36:27 +01:00
if yarn --version > /dev/null; then
yarn cache clean
2023-05-11 19:58:03 +02:00
fi
2023-12-29 12:36:27 +01:00
if npm --version; then
npm cache clean --force
2023-05-11 19:58:03 +02:00
fi
2024-06-04 11:35:21 +02:00
if is_ubuntu24; then
# Prevent needrestart from restarting the provisioner service.
# Currently only happens on Ubuntu 24.04, so make it conditional for the time being
# as configuration is too different between Ubuntu versions.
sed -i '/^\s*};/i \ qr(^runner-provisioner) => 0,' /etc/needrestart/needrestart.conf
fi