/etc/profile: Remove bogus Emacs command line editing option.
[dragonfly.git] / tools / tools / unpriv_base / unpriv_base.sh
1 #!/bin/sh
2
3 if [ $# -ne 2 ]
4 then
5         echo "$0 [unpriv] [restore] <DESTDIR>" >&2
6         echo "   create/remove conveniece symlinks for base private" >&2
7         echo "   libraries and headers:" >&2
8         echo "      libedit ncurses openssl" >&2
9         echo "   if new software package needs runtime for tests or does" >&2
10         echo "   not respect -rpath /lib/priv -rpath /usr/lib/priv flags" >&2
11         echo "   use export LD_LIBRARY_PATH=/lib/priv:/usr/lib/priv"
12         exit 1
13 fi
14
15 DESTDIR=$2
16
17 set -e
18
19 if [ "$1" == "unpriv" ]
20 then
21         echo "Creating symlinks:"
22         ln -sv priv/ncurses  "$DESTDIR"/usr/include/ncurses
23         ln -sv priv/openssl  "$DESTDIR"/usr/include/openssl
24         ln -sv priv/readline "$DESTDIR"/usr/include/readline
25         ln -sv priv/histedit.h "$DESTDIR"/usr/include/histedit.h
26         # ncurses
27         ln -sv priv/libprivate_ncurses.a   "$DESTDIR"/usr/lib/libncurses.a
28         ln -sv priv/libprivate_ncurses.so  "$DESTDIR"/usr/lib/libncurses.so
29         ln -sv priv/libprivate_ncursesw.a  "$DESTDIR"/usr/lib/libncursesw.a
30         ln -sv priv/libprivate_ncursesw.so "$DESTDIR"/usr/lib/libncursesw.so
31         # LibreSSL
32         ln -sv priv/libprivate_crypto.a  "$DESTDIR"/usr/lib/libcrypto.a
33         ln -sv priv/libprivate_crypto.so "$DESTDIR"/usr/lib/libcrypto.so
34         ln -sv priv/libprivate_ssl.a     "$DESTDIR"/usr/lib/libssl.a
35         ln -sv priv/libprivate_ssl.so    "$DESTDIR"/usr/lib/libssl.so
36         # libedit
37         ln -sv priv/libprivate_edit.a  "$DESTDIR"/usr/lib/libedit.a
38         ln -sv priv/libprivate_edit.so "$DESTDIR"/usr/lib/libedit.so
39         # warn
40         echo "Done. Later DO NOT forget to run '$0 restore'"
41 fi
42
43 if [ "$1" == "restore" ]
44 then
45         echo "Cleaning symlinks:"
46         rm -fv "$DESTDIR"/usr/include/ncurses
47         rm -fv "$DESTDIR"/usr/include/openssl
48         rm -fv "$DESTDIR"/usr/include/readline
49         rm -fv "$DESTDIR"/usr/include/histedit.h
50         # ncurses
51         rm -fv "$DESTDIR"/usr/lib/libncurses.a
52         rm -fv "$DESTDIR"/usr/lib/libncurses.so
53         rm -fv "$DESTDIR"/usr/lib/libncursesw.a
54         rm -fv "$DESTDIR"/usr/lib/libncursesw.so
55         # LibreSSL
56         rm -fv "$DESTDIR"/usr/lib/libcrypto.a
57         rm -fv "$DESTDIR"/usr/lib/libcrypto.so
58         rm -fv "$DESTDIR"/usr/lib/libssl.a
59         rm -fv "$DESTDIR"/usr/lib/libssl.so
60         # libedit
61         rm -fv "$DESTDIR"/usr/lib/libedit.a
62         rm -fv "$DESTDIR"/usr/lib/libedit.so
63         # warn
64         echo "Done."
65 fi