aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@protonmail.com>2022-04-21 22:02:12 -0400
committerLibravatar netblue30 <netblue30@protonmail.com>2022-04-21 22:02:12 -0400
commitd4106f7aaa0e013d59ef8b3690fb54a0069b1090 (patch)
tree854fb962c1924ba4169ea927ca87d16b3355a092
parentfirejail-welcome.sh fixes (diff)
downloadfirejail-d4106f7aaa0e013d59ef8b3690fb54a0069b1090.tar.gz
firejail-d4106f7aaa0e013d59ef8b3690fb54a0069b1090.tar.zst
firejail-d4106f7aaa0e013d59ef8b3690fb54a0069b1090.zip
fix firecfg --guide
-rwxr-xr-xsrc/firecfg/firejail-welcome.sh13
-rw-r--r--src/firecfg/main.c6
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
15PROGRAM=$1 15if ! command -v "$1" >/dev/null; then
16SYSCONFDIR=$2 16 echo "Please install $1."
17
18if ! command -v "$PROGRAM" >/dev/null; then
19 echo "Please install $PROGRAM."
20 exit 1 17 exit 1
21fi 18fi
22 19
20PROGRAM="sudo -u $3 $1"
21SYSCONFDIR=$2
23export LANG=en_US.UTF8 22export LANG=en_US.UTF8
24 23
25TITLE="Firejail Configuration Guide" 24TITLE="Firejail Configuration Guide"
@@ -165,7 +164,7 @@ Now, I will apply the changes. This is what I will do:
165 164
166 165
167EOM 166EOM
168 167MSG_RUN+="\n\n"
169if [[ "$run_firecfg" == "true" ]]; then 168if [[ "$run_firecfg" == "true" ]]; then
170 MSG_RUN+=" * enable Firejail for all recognized programs\n" 169 MSG_RUN+=" * enable Firejail for all recognized programs\n"
171fi 170fi
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