Add a patch to indicate that sudo is required
Sophie Brun
2 years ago
0 | From: Sophie Brun <[email protected]> | |
1 | Date: Fri, 19 Nov 2021 11:36:54 +0100 | |
2 | Subject: Indicate that sudo is required | |
3 | ||
4 | ||
5 | Last-Update: 2021-11-23 | |
6 | The Db is located in /var/lib/poshc2. We need to be root to write / use | |
7 | the db. | |
8 | --- | |
9 | resources/scripts/posh | 6 ++++++ | |
10 | resources/scripts/posh-log | 6 ++++++ | |
11 | resources/scripts/posh-server | 6 ++++++ | |
12 | 3 files changed, 18 insertions(+) | |
13 | ||
14 | diff --git a/resources/scripts/posh b/resources/scripts/posh | |
15 | index 7e55f13..a1d7b25 100755 | |
16 | --- a/resources/scripts/posh | |
17 | +++ b/resources/scripts/posh | |
18 | @@ -8,6 +8,12 @@ function ctrl_c() { | |
19 | exit | |
20 | } | |
21 | ||
22 | +# Check if running as root | |
23 | +if [[ $EUID -ne 0 ]]; then | |
24 | + echo -e "Error: $0 must be run as root" 1>&2 | |
25 | + exit 1 | |
26 | +fi | |
27 | + | |
28 | source /usr/bin/_posh-common | |
29 | get_posh_dir | |
30 | ||
31 | diff --git a/resources/scripts/posh-log b/resources/scripts/posh-log | |
32 | index 508092e..3c3fdd9 100755 | |
33 | --- a/resources/scripts/posh-log | |
34 | +++ b/resources/scripts/posh-log | |
35 | @@ -1,5 +1,11 @@ | |
36 | #!/bin/bash | |
37 | ||
38 | +# Check if running as root | |
39 | +if [[ $EUID -ne 0 ]]; then | |
40 | + echo -e "Error: $0 must be run as root" 1>&2 | |
41 | + exit 1 | |
42 | +fi | |
43 | + | |
44 | source /usr/bin/_posh-common | |
45 | get_posh_project_dir | |
46 | ||
47 | diff --git a/resources/scripts/posh-server b/resources/scripts/posh-server | |
48 | index ff220d6..a7c1858 100755 | |
49 | --- a/resources/scripts/posh-server | |
50 | +++ b/resources/scripts/posh-server | |
51 | @@ -8,6 +8,12 @@ function ctrl_c() { | |
52 | exit | |
53 | } | |
54 | ||
55 | +# Check if running as root | |
56 | +if [[ $EUID -ne 0 ]]; then | |
57 | + echo -e "Error: $0 must be run as root" 1>&2 | |
58 | + exit 1 | |
59 | +fi | |
60 | + | |
61 | source /usr/bin/_posh-common | |
62 | get_posh_dir | |
63 | get_posh_project_dir |