From f6f3ad344a4b47d42f3adea01e67608a80159cc3 Mon Sep 17 00:00:00 2001 From: Douglas RAILLARD Date: Tue, 12 Feb 2019 17:05:36 +0000 Subject: [PATCH 1/2] install_base_ubuntu: use 0 exit status Since we don't make rational use of the exit status, let's make it 0 for now. This way, the infrastructure can be written to catch non-zero, and everything will fall into place if we actually give it a meaningful value. --- install_base_ubuntu.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/install_base_ubuntu.sh b/install_base_ubuntu.sh index 560a15e99..6784680d0 100755 --- a/install_base_ubuntu.sh +++ b/install_base_ubuntu.sh @@ -80,4 +80,10 @@ if [ "$install_android_sdk" == y ]; then install_sdk fi +# Make sure we exit with no errors, so we can start making use of that +# if we introduce some meaningful error handling. Since some packages are not +# needed for some tasks and since we don't have mechanisms in place to group +# related use cases, let's swallow errors and move on to lisa-install. +exit 0 + # vim: set tabstop=4 shiftwidth=4 textwidth=80 expandtab: -- GitLab From 8859ebe80a3297a42bdaec78b15f61730c03de48 Mon Sep 17 00:00:00 2001 From: Douglas RAILLARD Date: Tue, 12 Feb 2019 17:34:57 +0000 Subject: [PATCH 2/2] install_base_ubuntu: Check snapd is alive Use `snap list` as a check that snapd is alive, to avoid triggering lots of errors down the road when running snap install. Snapd may not be up and running in some container environment, where dbus is not setup and where the service is not running. --- install_base_ubuntu.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/install_base_ubuntu.sh b/install_base_ubuntu.sh index 6784680d0..637789bd3 100755 --- a/install_base_ubuntu.sh +++ b/install_base_ubuntu.sh @@ -46,7 +46,14 @@ install_nodejs() { # NodeJS v8+ is required, Ubuntu 16.04 LTS supports only an older version. # As a special case we can install it as a snap package if grep 16.04 /etc/lsb-release >/dev/null; then - snap install node --classic --channel=8 + # sanity check to make sure snap is up and running + if ! which snap >/dev/null 2>&1; then + echo 'Snap not installed on that system, not installing nodejs' + elif snap list >/dev/null 2>&1; then + echo 'Snap not usable on that system, not installing nodejs' + else + snap install node --classic --channel=8 + fi return fi apt-get install -y nodejs npm -- GitLab