[lxc-devel] [lxd-pkg-ubuntu/dpm-disco] Fix printing error and also exit when lxd snap is not installed

rbalint on Github lxc-bot at linuxcontainers.org
Thu Apr 11 08:48:52 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 368 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190411/5d6c1f27/attachment.bin>
-------------- next part --------------
From 044e033ab4eee9b33d4e95d425fd7a72e12495f6 Mon Sep 17 00:00:00 2001
From: Balint Reczey <balint.reczey at canonical.com>
Date: Thu, 11 Apr 2019 10:39:03 +0200
Subject: [PATCH] Fix printing error and also exit when lxd snap is not
 installed

Signed-off-by: Balint Reczey <balint.reczey at canonical.com>
---
 lxc | 11 +++++++----
 lxd | 11 +++++++----
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/lxc b/lxc
index 35138fdd..0fdedfe9 100755
--- a/lxc
+++ b/lxc
@@ -1,8 +1,11 @@
 #!/bin/sh
 if ! [ -x /snap/bin/lxc ]; then
-    echo "Command '$0' requires the lxd snap to be installed." >2
-    echo "Please install it with:" >2
-    echo "" >2
-    echo "snap install lxd" >2
+    echo "" >&2
+    echo "Command '$0' requires the lxd snap to be installed." >&2
+    echo "Please install it with:" >&2
+    echo "" >&2
+    echo "snap install lxd" >&2
+    echo "" >&2
+    exit 1
 fi
 exec /snap/bin/lxc "$@"
diff --git a/lxd b/lxd
index 745f1bc4..810c5bd5 100755
--- a/lxd
+++ b/lxd
@@ -1,8 +1,11 @@
 #!/bin/sh
 if ! [ -x /snap/bin/lxd ]; then
-    echo "Command '$0' requires the lxd snap to be installed." >2
-    echo "Please install it with:" >2
-    echo "" >2
-    echo "snap install lxd" >2
+    echo "" >&2
+    echo "Command '$0' requires the lxd snap to be installed." >&2
+    echo "Please install it with:" >&2
+    echo "" >&2
+    echo "snap install lxd" >&2
+    echo "" >&2
+    exit 1
 fi
 exec /snap/bin/lxd "$@"


More information about the lxc-devel mailing list