summaryrefslogtreecommitdiff
path: root/data/ncurses/_metadata/prerm.c
diff options
context:
space:
mode:
Diffstat (limited to 'data/ncurses/_metadata/prerm.c')
-rw-r--r--data/ncurses/_metadata/prerm.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/data/ncurses/_metadata/prerm.c b/data/ncurses/_metadata/prerm.c
new file mode 100644
index 000000000..1bcb72a4c
--- /dev/null
+++ b/data/ncurses/_metadata/prerm.c
@@ -0,0 +1,26 @@
+#include <string.h>
+#include <unistd.h>
+
+int main(int argc, char *argv[]) {
+ if (argc < 2 || (
+ strcmp(argv[1], "remove") != 0
+ )) return 0;
+
+ if (unlink("/usr/lib/_ncurses") == -1)
+ return 1;
+
+ if (mkdir("/usr/lib/_ncurses", 0755) == -1) {
+ symlink("/usr/lib/", "/usr/lib/_ncurses");
+ return 2;
+ }
+
+ rename("/usr/lib/libcurses.dylib", "/usr/lib/_ncurses/libcurses.dylib");
+ rename("/usr/lib/libncurses.dylib", "/usr/lib/_ncurses/libncurses.dylib");
+
+ if (access("/usr/lib/libcurses.dylib", F_OK) != 0)
+ symlink("libncurses.5.4.dylib", "/usr/lib/libcurses.dylib");
+ if (access("/usr/lib/libncurses.dylib", F_OK) != 0)
+ symlink("libncurses.5.4.dylib", "/usr/lib/libncurses.dylib");
+
+ return 0;
+}