aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/config.h.in8
-rw-r--r--include/omc.h1
-rw-r--r--include/os_darwin.h26
-rw-r--r--include/os_linux.h10
-rw-r--r--include/relocation.h6
-rw-r--r--src/deliverable.c14
6 files changed, 61 insertions, 4 deletions
diff --git a/include/config.h.in b/include/config.h.in
index 460ac04..fe6beb2 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -8,12 +8,14 @@
#elif defined(__linux__)
#define OMC_OS_LINUX
+#include "os_linux.h"
#elif defined(unix) || defined(__unix__) || defined(__unix)
#define OMC_OS_UNIX
-#elif defined(__APPLE__) && defined(__MACH__)
+#elif defined(__APPLE__)
#define OMC_OS_DARWIN
+#include "os_darwin.h"
#else
#define OMC_OS_UNKNOWN
@@ -21,4 +23,6 @@
#endif // OS detection
-#endif // OMC_CONFIG_H \ No newline at end of file
+
+
+#endif // OMC_CONFIG_H
diff --git a/include/omc.h b/include/omc.h
index bb49dd1..7eb6c6e 100644
--- a/include/omc.h
+++ b/include/omc.h
@@ -18,6 +18,7 @@
#include "config.h"
#include "template.h"
+
#include "utils.h"
#include "copy.h"
#include "ini.h"
diff --git a/include/os_darwin.h b/include/os_darwin.h
new file mode 100644
index 0000000..390968c
--- /dev/null
+++ b/include/os_darwin.h
@@ -0,0 +1,26 @@
+#ifndef OMC_OS_DARWIN_H
+#define OMC_OS_DARWIN_H
+
+#include <sys/mount.h>
+
+#ifndef __DARWIN_64_BIT_INO_T
+#define statvfs statfs
+
+#ifndef ST_RDONLY
+#define ST_RDONLY MNT_RDONLY
+#endif
+
+#define ST_NOEXEC MNT_NOEXEC
+#define f_flag f_flags
+#endif // __DARWIN_64_BIT_INO_T
+
+#include <limits.h>
+
+#ifndef PATH_MAX
+#include <sys/syslimits.h>
+#endif
+
+extern char **environ;
+#define __environ environ
+
+#endif
diff --git a/include/os_linux.h b/include/os_linux.h
new file mode 100644
index 0000000..8c3aed7
--- /dev/null
+++ b/include/os_linux.h
@@ -0,0 +1,10 @@
+#ifndef OMC_OS_LINUX_H
+#define OMC_OS_LINUX_H
+
+#include <limits.h>
+
+#ifndef PATH_MAX
+#include <linux/limits.h>
+#endif
+
+#endif
diff --git a/include/relocation.h b/include/relocation.h
index 2ccf762..ea9da9f 100644
--- a/include/relocation.h
+++ b/include/relocation.h
@@ -4,10 +4,16 @@
#ifndef OMC_RELOCATION_H
#define OMC_RELOCATION_H
+#include "config.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#if defined(OMC_OS_DARWIN)
+#include <limits.h>
+# else
#include <linux/limits.h>
+#endif
#include <unistd.h>
void replace_text(char *original, const char *target, const char *replacement);
diff --git a/src/deliverable.c b/src/deliverable.c
index ca07286..3f0fd34 100644
--- a/src/deliverable.c
+++ b/src/deliverable.c
@@ -3,6 +3,10 @@
#include "omc.h"
extern struct OMC_GLOBAL globals;
+#if defined(OMC_OS_DARWIN)
+extern char **environ;
+#define __environ environ
+#endif
#define getter(XINI, SECTION_NAME, KEY, TYPE) \
{ \
@@ -94,11 +98,13 @@ int delivery_init_tmpdir(struct Delivery *ctx) {
goto l_delivery_init_tmpdir_fatal;
}
+#if defined(OMC_OS_LINUX)
// If we can't execute programs, or write data to the file system at all, then die
if ((st.f_flag & ST_NOEXEC) != 0) {
msg(OMC_MSG_ERROR | OMC_MSG_L1, "%s is mounted with noexec\n", tmpdir);
goto l_delivery_init_tmpdir_fatal;
}
+#endif
if ((st.f_flag & ST_RDONLY) != 0) {
msg(OMC_MSG_ERROR | OMC_MSG_L1, "%s is mounted read-only\n", tmpdir);
goto l_delivery_init_tmpdir_fatal;
@@ -353,6 +359,7 @@ int delivery_init(struct Delivery *ctx, struct INIFILE *ini, struct INIFILE *cfg
ctx->meta.codename = NULL;
}
+ /*
if (!strcasecmp(ctx->meta.mission, "jwst")) {
getter(ini, "meta", "version", INIVAL_TYPE_STR)
conv_str(ctx, meta.version)
@@ -360,6 +367,9 @@ int delivery_init(struct Delivery *ctx, struct INIFILE *ini, struct INIFILE *cfg
} else {
ctx->meta.version = NULL;
}
+ */
+ getter(ini, "meta", "version", INIVAL_TYPE_STR)
+ conv_str(ctx, meta.version)
getter_required(ini, "meta", "name", INIVAL_TYPE_STR)
conv_str(ctx, meta.name)
@@ -1321,6 +1331,7 @@ void delivery_gather_tool_versions(struct Delivery *ctx) {
}
int delivery_init_artifactory(struct Delivery *ctx) {
+ int status = 0;
char dest[PATH_MAX] = {0};
char filepath[PATH_MAX] = {0};
snprintf(dest, sizeof(dest) - 1, "%s/bin", ctx->storage.tools_dir);
@@ -1331,7 +1342,6 @@ int delivery_init_artifactory(struct Delivery *ctx) {
msg(OMC_MSG_L3, "Skipped download, %s already exists\n", filepath);
goto delivery_init_artifactory_envsetup;
}
- int status = 0;
msg(OMC_MSG_L3, "Downloading %s for %s %s\n", globals.jfrog.remote_filename, ctx->system.platform, ctx->system.arch);
if ((status = artifactory_download_cli(dest,
@@ -1539,4 +1549,4 @@ int delivery_mission_render_files(struct Delivery *ctx) {
}
return 0;
-} \ No newline at end of file
+}