2 PATH
=/usr
/local
/sbin
:/usr
/sbin
:/sbin
:/usr
/local
/bin
:/usr
/bin
:/bin
5 d
=${TMPDIR:-/tmp}/nacl64.$$
6 if ! mkdir
"$d" > /dev
/null
2>&1
9 Could not create safe temporary directory "$d".
17 trap 'rm -fr "$d"; exit' 0 1 2 3 15
19 function isRunningAsRoot
() {
20 whoami |
grep -q 'root'
25 #include <openssl/aes.h>
28 char key[AES_BLOCK_SIZE];
30 AES_set_encrypt_key(key, AES_BLOCK_SIZE * 8, &k);
34 if ! gcc
-o "$fout" "$f" -lssl -lcrypto > /dev
/null
2>&1
41 if ! [ -f /usr
/include
/openssl
/aes.h
]
44 libssl-dev not installed. Installing...
46 if apt-get
install libssl-dev
51 ... could not
install libssl-dev.
60 int main
(void
) { return sizeof
(long
) == 8; }
62 gcc
-o "$fout" "$f" > /dev
/null
2>&1
67 You
do not appear to be using an x86_64 system. This rest of this
script
76 Not running as root
, so cannot
install libraries
/links.
77 Note
: you probably will need to copy this
script to the
local file system
78 (and off of NFS
) in order to run this
script as root.
85 if ! [ -d /usr
/lib32
]
88 ... you
do not have
/usr
/lib32
at all
!
90 First
, must
install ia32-libs...
92 if apt-get
install ia32-libs
> /dev
/null
2>&1
97 ... failed to
install ia32-libs.
107 if ! [ -f /usr
/lib32
/libX11.so
]
109 x11_libs
=($
(echo /usr
/lib32
/libX11.so.
*))
110 if (( ${#x11_libs[@]} != 1 ))
113 More than one version of
/usr
/lib32
/libX11.so.
* exists. This
script will
114 picks the lexicographically greatest one.
116 x11_libs
=(${x11_libs[${#x11_libs[@]}-1]})
117 echo "Using $x11_libs" >&2
120 Linking /usr/lib32/libX11.so to $x11_libs
122 ln -s $x11_libs /usr
/lib32
/libX11.so
125 if [ -f /usr
/lib32
/libcrypto.so
-a -f /usr
/lib32
/libssl.so
] && try
127 echo "You already have /usr/lib32/libcrypto.so and libssl.so"
132 ssl_libs
=($
(echo /usr
/lib32
/libssl.so.
*))
133 if (( ${#ssl_libs[@]} != 1 ))
136 WARNING
: More than one versions of
/usr
/lib32
/libssl.so.
* This
script will
137 pick the lexicographically greatest one.
139 ssl_libs
=(${ssl_libs[${#ssl_libs[@]}-1]})
140 echo "Using $ssl_libs" >&2
142 ssl_lib
=${ssl_libs[0]}
144 ssl_vers
=$
(expr \
( $ssl_lib : '/usr/lib32/libssl\.so\.\(.*\)' \
))
148 /usr
/lib32
/libssl.so.SSLVERSION missing. This should have been installed
149 as part of the ia32-libs package.
156 if ! [ -f /usr
/lib32
/libcrypto.so.
$ssl_vers ]
159 Version mismatch: /usr/lib32/libssl.so.$ssl_vers exists, but
160 /usr/lib32/libcrypto.so.$ssl_vers does not!
166 echo "SSL version $ssl_vers shared libraries are available"
168 echo "Attempting to install ia32-libs-dev to get crypto libraries..." >&2
169 apt-get
install ia32-libs-dev
> /dev
/null
2>&1
170 if [ -f /usr
/lib32
/libcrypto.so
-a -f /usr
/lib32
/libssl.so
] && try
178 Attempting to
install lib32bz2-dev to get crypto libraries...
180 apt-get
install lib32bz2-dev
> /dev
/null
2>&1
181 if [ -f /usr
/lib32
/libcrypto.so
-a -f /usr
/lib32
/libssl.so
] && try
189 Falling back to installing symlinks manually....
191 if ! ln -s libcrypto.so.
$ssl_vers /usr
/lib32
/libcrypto.so
194 ... failed. Could not
make symbolic links
in /usr
/lib32.
200 ln -s libssl.so.
$ssl_vers /usr
/lib32
/libssl.so