summaryrefslogtreecommitdiff
path: root/pkg/launcher
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/launcher')
-rw-r--r--pkg/launcher/.gitignore2
-rw-r--r--pkg/launcher/Makefile15
-rw-r--r--pkg/launcher/README.rst14
-rw-r--r--pkg/launcher/bitmask-launcher.c23
4 files changed, 54 insertions, 0 deletions
diff --git a/pkg/launcher/.gitignore b/pkg/launcher/.gitignore
new file mode 100644
index 00000000..60de46d7
--- /dev/null
+++ b/pkg/launcher/.gitignore
@@ -0,0 +1,2 @@
+*.o
+bitmask
diff --git a/pkg/launcher/Makefile b/pkg/launcher/Makefile
new file mode 100644
index 00000000..8dd1013d
--- /dev/null
+++ b/pkg/launcher/Makefile
@@ -0,0 +1,15 @@
+CC = gcc
+CFLAGS = -g -Wall
+STRIP = strip
+
+default: bitmask
+
+bitmask.o: bitmask-launcher.c
+ $(CC) $(CFLAGS) -c bitmask-launcher.c -o bitmask.o
+
+bitmask: bitmask.o
+ $(CC) bitmask.o -o bitmask
+ $(STRIP) bitmask
+clean:
+ -rm -f bitmask.o
+ -rm -f bitmask
diff --git a/pkg/launcher/README.rst b/pkg/launcher/README.rst
new file mode 100644
index 00000000..9a840dec
--- /dev/null
+++ b/pkg/launcher/README.rst
@@ -0,0 +1,14 @@
+bitmask-launcher.c
+------------------
+
+A small, portable launcher for bitmask bundles.
+
+Problem that solves
+-------------------
+PyInstaller bundles leave everything (libs, data and the main binary) in a
+single folder. In a case like ours, there are too many files cluttering this
+top-most folder.
+
+We wanted to have a cleaner folder, with an obviously clickable entrypoint, that
+calls the binary that hides in an inferior folder.
+
diff --git a/pkg/launcher/bitmask-launcher.c b/pkg/launcher/bitmask-launcher.c
new file mode 100644
index 00000000..aac5da3f
--- /dev/null
+++ b/pkg/launcher/bitmask-launcher.c
@@ -0,0 +1,23 @@
+/*
+ * bitmask-launcher.c
+ *
+ * part of the bitmask bundle.
+ * execute main entrypoint in a child folder inside the bundle.
+ *
+ * (c) LEAP Encryption Access Project, 2016.
+ * License: GPL.
+ *
+*/
+
+#include <unistd.h>
+#include <stdlib.h>
+
+char* const bitmask_path = "libs";
+char* const entrypoint = "bitmask";
+
+int main(int argc, char *argv[])
+{
+ argv[0] = entrypoint;
+ chdir(bitmask_path);
+ execv(entrypoint, argv);
+}