From 8410ae2c65543676b229a6d1e071482817b658a4 Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Thu, 23 Apr 2020 20:19:11 +0500 Subject: [PATCH] Add snap/bin to /etc/environment (#755) * Add snap/bin to /etc/environment Co-authored-by: Sergey Dolin --- .../linux/scripts/installers/complete-snap-setup.sh | 12 ++++++++++++ images/linux/ubuntu1604.json | 10 ++++++++++ images/linux/ubuntu1804.json | 10 ++++++++++ 3 files changed, 32 insertions(+) create mode 100644 images/linux/scripts/installers/complete-snap-setup.sh diff --git a/images/linux/scripts/installers/complete-snap-setup.sh b/images/linux/scripts/installers/complete-snap-setup.sh new file mode 100644 index 000000000..51e631546 --- /dev/null +++ b/images/linux/scripts/installers/complete-snap-setup.sh @@ -0,0 +1,12 @@ +#!/bin/bash +################################################################################ +## File: snap-environment.sh +## Desc: Update /etc/environment to include /snap/bin in PATH +## because /etc/profile.d is ignored by `--norc` shell launch option +################################################################################ + +# Source the helpers +source $HELPER_SCRIPTS/etc-environment.sh + +# Update /etc/environemnt +prependEtcEnvironmentPath "/snap/bin" diff --git a/images/linux/ubuntu1604.json b/images/linux/ubuntu1604.json index 7ef1a820c..62081af54 100644 --- a/images/linux/ubuntu1604.json +++ b/images/linux/ubuntu1604.json @@ -132,6 +132,16 @@ ], "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" }, + { + "type": "shell", + "scripts": [ + "{{template_dir}}/scripts/installers/complete-snap-setup.sh" + ], + "environment_vars": [ + "HELPER_SCRIPTS={{user `helper_script_folder`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, { "type": "shell", "scripts": [ diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index 8217608bf..41b758976 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -135,6 +135,16 @@ ], "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" }, + { + "type": "shell", + "scripts": [ + "{{template_dir}}/scripts/installers/complete-snap-setup.sh" + ], + "environment_vars": [ + "HELPER_SCRIPTS={{user `helper_script_folder`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, { "type": "shell", "scripts": [