From d4106f7aaa0e013d59ef8b3690fb54a0069b1090 Mon Sep 17 00:00:00 2001 From: netblue30 Date: Thu, 21 Apr 2022 22:02:12 -0400 Subject: fix firecfg --guide --- src/firecfg/firejail-welcome.sh | 13 ++++++------- src/firecfg/main.c | 6 +++++- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'src/firecfg') 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 @@ # Copyright (C) 2020-2022 Firejail Authors # License GPL v2 # -# Usage: firejail-welcome PROGRAM SYSCONFDIR +# Usage: firejail-welcome PROGRAM SYSCONFDIR USER_NAME # where PROGRAM is detected and driven by firecfg. # SYSCONFDIR is most of the time /etc/firejail. # @@ -12,14 +12,13 @@ # we will provide a console-only replacement in /usr/lib/firejail/fzenity # -PROGRAM=$1 -SYSCONFDIR=$2 - -if ! command -v "$PROGRAM" >/dev/null; then - echo "Please install $PROGRAM." +if ! command -v "$1" >/dev/null; then + echo "Please install $1." exit 1 fi +PROGRAM="sudo -u $3 $1" +SYSCONFDIR=$2 export LANG=en_US.UTF8 TITLE="Firejail Configuration Guide" @@ -165,7 +164,7 @@ Now, I will apply the changes. This is what I will do: EOM - +MSG_RUN+="\n\n" if [[ "$run_firecfg" == "true" ]]; then MSG_RUN+=" * enable Firejail for all recognized programs\n" 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) { } if (arg_guide) { - int status = system("sudo "LIBDIR "/firejail/firejail-welcome.sh zenity " SYSCONFDIR); + char *cmd; + if (asprintf(&cmd, "sudo %s/firejail/firejail-welcome.sh /usr/bin/zenity %s %s", LIBDIR, SYSCONFDIR, user) == -1) + errExit("asprintf"); + int status = system(cmd); if (status == -1) { fprintf(stderr, "Error: cannot run firejail-welcome.sh\n"); exit(1); } + free(cmd); // the last 8 bits of the status is the return value of the command executed by system() // firejail-welcome.sh returns 55 if setting sysmlinks is required -- cgit v1.2.3-54-g00ecf