From de3432ed1537d3eaba5ba59da1e33dca4eb69d49 Mon Sep 17 00:00:00 2001 From: "Andrea G. Monaco" Date: Wed, 26 Aug 2020 19:59:37 +0200 Subject: [PATCH] freetalk: Search for first-time-run.sh in the package tree too * src/util.c (check_first_run): Ditto. --- src/util.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/util.c b/src/util.c index 5ee5d22..d245f95 100644 --- a/src/util.c +++ b/src/util.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "util.h" #include "freetalk.h" @@ -141,7 +142,18 @@ sync_printf (const char *fmt, va_list ap) void check_first_run (void) { - int res = system ("sh " FT_GLOBAL_EXT_DIR "/first-time-run.sh"); - if (res >> 8) + /* try running first-time-run.sh in the installed location + or, if that fails, inside the package tree; otherwise exit */ + + int ret; + + if (!access (FT_GLOBAL_EXT_DIR "/first-time-run.sh", R_OK)) + ret = system ("sh " FT_GLOBAL_EXT_DIR "/first-time-run.sh"); + else if (!access ("extensions/first-time-run.sh", R_OK)) + ret = system ("sh extensions/first-time-run.sh"); + else + exit (1); + + if (ret >> 8) exit (1); } -- 2.20.1