diff --git a/images/linux/scripts/installers/configure-environment.sh b/images/linux/scripts/installers/configure-environment.sh new file mode 100644 index 00000000..35e3dba6 --- /dev/null +++ b/images/linux/scripts/installers/configure-environment.sh @@ -0,0 +1,7 @@ +#Set ImageVersion and ImageOS env variables +echo ImageVersion=$IMAGE_VERSION | tee -a /etc/environment +echo ImageOS=$IMAGE_OS | 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) +mkdir -p /etc/skel/.config/configstore +echo 'export XDG_CONFIG_HOME=$HOME/.config' | tee -a /etc/skel/.bashrc diff --git a/images/linux/ubuntu1604.json b/images/linux/ubuntu1604.json index 51e1bb51..45b7386c 100644 --- a/images/linux/ubuntu1604.json +++ b/images/linux/ubuntu1604.json @@ -123,9 +123,12 @@ }, { "type": "shell", - "inline": [ - "echo ImageVersion={{user `image_version`}} | tee -a /etc/environment", - "echo ImageOS={{user `image_os`}} | tee -a /etc/environment" + "scripts": [ + "{{template_dir}}/scripts/installers/configure-environment.sh" + ], + "environment_vars": [ + "IMAGE_VERSION={{user `image_version`}}", + "IMAGE_OS={{user `image_os`}}" ], "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" }, diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index 33800251..4cf6f15b 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -126,9 +126,12 @@ }, { "type": "shell", - "inline": [ - "echo ImageVersion={{user `image_version`}} | tee -a /etc/environment", - "echo ImageOS={{user `image_os`}} | tee -a /etc/environment" + "scripts": [ + "{{template_dir}}/scripts/installers/configure-environment.sh" + ], + "environment_vars": [ + "IMAGE_VERSION={{user `image_version`}}", + "IMAGE_OS={{user `image_os`}}" ], "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" },