From 09bc20f23875c19774c58472bbefdd36bbd546df Mon Sep 17 00:00:00 2001 From: Mikhail Timofeev Date: Thu, 12 Mar 2020 23:46:11 +0300 Subject: [PATCH] move inline to envvariables.sh --- images/linux/scripts/installers/envvariables.sh | 7 +++++++ images/linux/ubuntu1604.json | 16 +++++----------- images/linux/ubuntu1804.json | 16 +++++----------- 3 files changed, 17 insertions(+), 22 deletions(-) create mode 100644 images/linux/scripts/installers/envvariables.sh diff --git a/images/linux/scripts/installers/envvariables.sh b/images/linux/scripts/installers/envvariables.sh new file mode 100644 index 00000000..7ffdd35f --- /dev/null +++ b/images/linux/scripts/installers/envvariables.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 133751f3..dc08e206 100644 --- a/images/linux/ubuntu1604.json +++ b/images/linux/ubuntu1604.json @@ -123,18 +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/envvariables.sh" ], - "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" - }, - { - "type": "shell", - "inline": [ - "# 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" + "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 d96b8bea..f5443028 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -126,18 +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/envvariables.sh" ], - "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" - }, - { - "type": "shell", - "inline": [ - "# 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" + "environment_vars": [ + "IMAGE_VERSION={{user `image_version`}}", + "IMAGE_OS={{user `image_os`}}" ], "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" },