launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #28736
[Merge] ~cjwatson/launchpad:fix-lsb-release-parsing into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:fix-lsb-release-parsing into launchpad:master.
Commit message:
rocketfuel-setup: Parse /etc/lsb-release by hand
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/426368
We used to source `/etc/lsb-release` into the shell, but that fell afoul of `shellcheck`, somewhat reasonably. However, running `lsb_release -sc` also doesn't always work, since `lsb_release` isn't always present (e.g. in a basic Ubuntu Docker image), and we can't rely on dependencies here since this script is the one responsible for installing them. Parse the file directly using basic tools instead.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:fix-lsb-release-parsing into launchpad:master.
diff --git a/utilities/rocketfuel-setup b/utilities/rocketfuel-setup
index 53c236e..e03e8be 100755
--- a/utilities/rocketfuel-setup
+++ b/utilities/rocketfuel-setup
@@ -8,7 +8,11 @@
# as utilities/rocketfuel-setup
# load up Ubuntu release details so we know which repos to enable
-DISTRIB_CODENAME="$(lsb_release -sc)"
+DISTRIB_CODENAME="$(sed -n 's/^DISTRIB_CODENAME=//p' /etc/lsb-release | tr -d '"')"
+if [ -z "$DISTRIB_CODENAME" ]; then
+ echo "Cannot find DISTRIB_CODENAME in /etc/lsb-release" >&2
+ exit 1
+fi
DO_WORKSPACE=1
INSTALL_OPTS=""
getopt_output="$(getopt -o '' -l no-workspace,lpusername:,assume-yes -- "$@")" || exit 1