Codebase list poshc2 / 1fcae30 debian / patches / Indicate-that-sudo-is-required.patch
1fcae30

Tree @1fcae30 (Download .tar.gz)

Indicate-that-sudo-is-required.patch @1fcae30raw · history · blame

From: Sophie Brun <[email protected]>
Date: Fri, 19 Nov 2021 11:36:54 +0100
Subject: Indicate that sudo is required


Last-Update: 2021-11-23
The Db is located in /var/lib/poshc2. We need to be root to write / use
the db.
---
 resources/scripts/posh        | 6 ++++++
 resources/scripts/posh-log    | 6 ++++++
 resources/scripts/posh-server | 6 ++++++
 3 files changed, 18 insertions(+)

diff --git a/resources/scripts/posh b/resources/scripts/posh
index 7e55f13..a1d7b25 100755
--- a/resources/scripts/posh
+++ b/resources/scripts/posh
@@ -8,6 +8,12 @@ function ctrl_c() {
     exit
 }
 
+# Check if running as root
+if [[ $EUID -ne 0 ]]; then
+   echo -e "Error: $0 must be run as root" 1>&2
+   exit 1
+fi
+
 source /usr/bin/_posh-common
 get_posh_dir
 
diff --git a/resources/scripts/posh-log b/resources/scripts/posh-log
index 508092e..3c3fdd9 100755
--- a/resources/scripts/posh-log
+++ b/resources/scripts/posh-log
@@ -1,5 +1,11 @@
 #!/bin/bash
 
+# Check if running as root
+if [[ $EUID -ne 0 ]]; then
+   echo -e "Error: $0 must be run as root" 1>&2
+   exit 1
+fi
+
 source /usr/bin/_posh-common
 get_posh_project_dir
 
diff --git a/resources/scripts/posh-server b/resources/scripts/posh-server
index ff220d6..a7c1858 100755
--- a/resources/scripts/posh-server
+++ b/resources/scripts/posh-server
@@ -8,6 +8,12 @@ function ctrl_c() {
     exit
 }
 
+# Check if running as root
+if [[ $EUID -ne 0 ]]; then
+   echo -e "Error: $0 must be run as root" 1>&2
+   exit 1
+fi
+
 source /usr/bin/_posh-common
 get_posh_dir
 get_posh_project_dir