diff options
Diffstat (limited to 'data/ncurses/_metadata')
-rw-r--r-- | data/ncurses/_metadata/preinst.c | 16 | ||||
-rw-r--r-- | data/ncurses/_metadata/prerm.c | 26 | ||||
-rw-r--r-- | data/ncurses/_metadata/version | 2 |
3 files changed, 43 insertions, 1 deletions
diff --git a/data/ncurses/_metadata/preinst.c b/data/ncurses/_metadata/preinst.c new file mode 100644 index 000000000..2c33ad71d --- /dev/null +++ b/data/ncurses/_metadata/preinst.c @@ -0,0 +1,16 @@ +#include <string.h> +#include <unistd.h> + +int main(int argc, char *argv[]) { + if (argc < 2 || ( + strcmp(argv[1], "install") != 0 && ( + strcmp(argv[1], "upgrade") != 0 || + strncmp(argv[2], "5.6-", 4) != 0 + ))) return 0; + + unlink("/usr/lib/_ncurses"); + if (symlink("/usr/lib/", "/usr/lib/_ncurses") != 0) + return 1; + + return 0; +} 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; +} diff --git a/data/ncurses/_metadata/version b/data/ncurses/_metadata/version index 2df33d769..760606e1f 100644 --- a/data/ncurses/_metadata/version +++ b/data/ncurses/_metadata/version @@ -1 +1 @@ -5.6 +5.7 |