[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] freetalk: Search for first-time-run.sh in the package tree too
From: |
Andrea Monaco |
Subject: |
[PATCH] freetalk: Search for first-time-run.sh in the package tree too |
Date: |
Wed, 26 Aug 2020 20:15:52 +0200 |
User-agent: |
Evolution 3.30.5-1.1 |
Here's the patch I talked about in my last mail:
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 <string.h>
#include <stdlib.h>
#include <stdarg.h>
+#include <unistd.h>
#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
0001-freetalk-Search-for-first-time-run.sh-in-the-package.patch
Description: Text Data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] freetalk: Search for first-time-run.sh in the package tree too,
Andrea Monaco <=