Skip to content

Commit

Permalink
add locale
Browse files Browse the repository at this point in the history
  • Loading branch information
smerleCB committed Sep 16, 2022
1 parent c8e8756 commit 9cea9f3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion locals.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ locals {
"AGENT_OS_TYPE=${var.agent_os_type}",
"AGENT_OS_VERSION=${var.agent_os_version}",
"LANG=${var.locale}",
"LANGUAGE=${element(split(".", var.locale),0)}:${element(split("_", var.locale),0)}",
"LANGUAGE=${element(split(".", var.locale),0)}:C",
"LC_ALL=${var.locale}",
],
)
Expand Down
25 changes: 22 additions & 3 deletions provisioning/ubuntu-provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,24 @@ set -eux -o pipefail

## Check for environment variables or fail miserably (due to set -u enabled)
echo "== Provisiong jenkins-infra agent for ubuntu 20"
case "$(uname -m)" in
x86_64)
if test "${ARCHITECTURE}" != "amd64"; then
echo "Architecture mismatch: $(uname -m) != ${ARCHITECTURE}"
exit 1
fi
;;
arm64 | aarch64) # macOS M1 arm64 while ubuntu 20 is aarch64
if test "${ARCHITECTURE}" != "arm64"; then
echo "Architecture mismatch: $(uname -m) != ${ARCHITECTURE}"
exit 1
fi
;;
*)
echo "Unsupported architecture: $(uname -m)"
exit 1
;;
esac
echo "ARCHITECTURE=${ARCHITECTURE}"
export DEBIAN_FRONTEND=noninteractive

Expand Down Expand Up @@ -52,11 +70,11 @@ function copy_custom_scripts() {
}

## Set the locale
function set_local(){
function set_locale(){
echo "LC_ALL=${LC_ALL}" >> /etc/environment
echo "${LANG} ${element(split('.', var.locale),1)}" >> /etc/locale.gen
echo "${LANG} ${LANG##*.}" >> /etc/locale.gen
echo "LANG=${LANG}" > /etc/locale.conf
locale-gen ${LANG}
locale-gen "${LANG}"
}

## All the clean for apt
Expand Down Expand Up @@ -452,6 +470,7 @@ function sanity_check() {
function main() {
check_commands
copy_custom_scripts
set_locale # Define the locale
clean_apt
install_ssh_requirements # Ensure that OpenSSH CLI and SSH agent are installed
setuser # Define user Jenkins before all (to allow installing stuff in its home dir)
Expand Down

0 comments on commit 9cea9f3

Please sign in to comment.