diff options
-rwxr-xr-x | src/firecfg/firejail-welcome.sh | 13 | ||||
-rw-r--r-- | src/firecfg/main.c | 6 |
2 files changed, 11 insertions, 8 deletions
diff --git a/src/firecfg/firejail-welcome.sh b/src/firecfg/firejail-welcome.sh index b70d7861d..7183b74e1 100755 --- a/src/firecfg/firejail-welcome.sh +++ b/src/firecfg/firejail-welcome.sh | |||
@@ -4,7 +4,7 @@ | |||
4 | # Copyright (C) 2020-2022 Firejail Authors | 4 | # Copyright (C) 2020-2022 Firejail Authors |
5 | # License GPL v2 | 5 | # License GPL v2 |
6 | # | 6 | # |
7 | # Usage: firejail-welcome PROGRAM SYSCONFDIR | 7 | # Usage: firejail-welcome PROGRAM SYSCONFDIR USER_NAME |
8 | # where PROGRAM is detected and driven by firecfg. | 8 | # where PROGRAM is detected and driven by firecfg. |
9 | # SYSCONFDIR is most of the time /etc/firejail. | 9 | # SYSCONFDIR is most of the time /etc/firejail. |
10 | # | 10 | # |
@@ -12,14 +12,13 @@ | |||
12 | # we will provide a console-only replacement in /usr/lib/firejail/fzenity | 12 | # we will provide a console-only replacement in /usr/lib/firejail/fzenity |
13 | # | 13 | # |
14 | 14 | ||
15 | PROGRAM=$1 | 15 | if ! command -v "$1" >/dev/null; then |
16 | SYSCONFDIR=$2 | 16 | echo "Please install $1." |
17 | |||
18 | if ! command -v "$PROGRAM" >/dev/null; then | ||
19 | echo "Please install $PROGRAM." | ||
20 | exit 1 | 17 | exit 1 |
21 | fi | 18 | fi |
22 | 19 | ||
20 | PROGRAM="sudo -u $3 $1" | ||
21 | SYSCONFDIR=$2 | ||
23 | export LANG=en_US.UTF8 | 22 | export LANG=en_US.UTF8 |
24 | 23 | ||
25 | TITLE="Firejail Configuration Guide" | 24 | TITLE="Firejail Configuration Guide" |
@@ -165,7 +164,7 @@ Now, I will apply the changes. This is what I will do: | |||
165 | 164 | ||
166 | 165 | ||
167 | EOM | 166 | EOM |
168 | 167 | MSG_RUN+="\n\n" | |
169 | if [[ "$run_firecfg" == "true" ]]; then | 168 | if [[ "$run_firecfg" == "true" ]]; then |
170 | MSG_RUN+=" * enable Firejail for all recognized programs\n" | 169 | MSG_RUN+=" * enable Firejail for all recognized programs\n" |
171 | fi | 170 | fi |
diff --git a/src/firecfg/main.c b/src/firecfg/main.c index 19f2573f3..0c81f69bd 100644 --- a/src/firecfg/main.c +++ b/src/firecfg/main.c | |||
@@ -443,11 +443,15 @@ int main(int argc, char **argv) { | |||
443 | } | 443 | } |
444 | 444 | ||
445 | if (arg_guide) { | 445 | if (arg_guide) { |
446 | int status = system("sudo "LIBDIR "/firejail/firejail-welcome.sh zenity " SYSCONFDIR); | 446 | char *cmd; |
447 | if (asprintf(&cmd, "sudo %s/firejail/firejail-welcome.sh /usr/bin/zenity %s %s", LIBDIR, SYSCONFDIR, user) == -1) | ||
448 | errExit("asprintf"); | ||
449 | int status = system(cmd); | ||
447 | if (status == -1) { | 450 | if (status == -1) { |
448 | fprintf(stderr, "Error: cannot run firejail-welcome.sh\n"); | 451 | fprintf(stderr, "Error: cannot run firejail-welcome.sh\n"); |
449 | exit(1); | 452 | exit(1); |
450 | } | 453 | } |
454 | free(cmd); | ||
451 | 455 | ||
452 | // the last 8 bits of the status is the return value of the command executed by system() | 456 | // the last 8 bits of the status is the return value of the command executed by system() |
453 | // firejail-welcome.sh returns 55 if setting sysmlinks is required | 457 | // firejail-welcome.sh returns 55 if setting sysmlinks is required |