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 function ensure_installed
{
45 ... you do not have $2. Installing...
47 if apt-get
-y install "$2" > /dev
/null
2>&1
52 ... failed to install $2.
64 Not running as root
, so cannot
install libraries
/links.
65 Note
: you probably will need to copy this
script to the
local file system
66 (and off of NFS
) in order to run this
script as root.
73 # openssl is required for both 32 and 64-bit systems.
74 ensure_installed
'/usr/include/openssl/aes.h' 'libssl-dev'
75 # gtk-2.0 is required for both 32 and 64-bit systems
76 ensure_installed
'/usr/include/gtk-2.0/gtk/gtk.h' 'libgtk2.0-dev'
79 int main
(void
) { return sizeof
(long
) == 8; }
81 gcc
-o "$fout" "$f" > /dev
/null
2>&1
86 You
do not appear to be using an x86_64 system. This rest of this
script
92 ensure_installed
'/usr/lib32' 'ia32-libs'
93 ensure_installed
'/usr/lib32/libncurses.a' 'lib32ncurses5-dev'
95 # now check for symlinks
100 target
="/usr/lib32/$1"
102 if ! [ -f "$target" ]
104 vers
=($
(echo "$target".
*))
105 if (( ${#vers[@]} != 1 ))
108 More than one version of $target.* exists. This script will
109 picks the lexicographically greatest one.
111 vers
=("${vers[${#vers[@]}-1]}")
112 echo "Using $vers" >&2
115 Linking $target to $vers
117 ln -s "$vers" "$target"
122 dev_libs
=(libatk-1.0.so libgtk-x11-2.0.so libgdk-x11-2.0.so \
123 libgdk_pixbuf-2.0.so libpangocairo-1.0.so libpango-1.0.so \
124 libcairo.so libgobject-2.0.so libgmodule-2.0.so libglib-2.0.so \
127 for lib
in "${dev_libs[@]}"
132 if [ -f /usr
/lib32
/libcrypto.so
-a -f /usr
/lib32
/libssl.so
] && try
134 echo "You already have /usr/lib32/libcrypto.so and libssl.so"
137 # we omit libssl.so and libcrypto.so from dev_libs so we can ensure
138 # that ssl_vers is consistent between the two.
141 ssl_libs
=($
(echo /usr
/lib32
/libssl.so.
*))
142 if (( ${#ssl_libs[@]} != 1 ))
145 WARNING
: More than one versions of
/usr
/lib32
/libssl.so.
* This
script will
146 pick the lexicographically greatest one.
148 ssl_libs
=(${ssl_libs[${#ssl_libs[@]}-1]})
149 echo "Using $ssl_libs" >&2
151 ssl_lib
=${ssl_libs[0]}
153 ssl_vers
=$
(expr \
( $ssl_lib : '/usr/lib32/libssl\.so\.\(.*\)' \
))
157 /usr
/lib32
/libssl.so.SSLVERSION missing. This should have been installed
158 as part of the ia32-libs package.
165 if ! [ -f /usr
/lib32
/libcrypto.so.
$ssl_vers ]
168 Version mismatch: /usr/lib32/libssl.so.$ssl_vers exists, but
169 /usr/lib32/libcrypto.so.$ssl_vers does not!
175 echo "SSL version $ssl_vers shared libraries are available"
177 echo "Attempting to install ia32-libs-dev to get crypto libraries..." >&2
178 apt-get
-y install ia32-libs-dev
> /dev
/null
2>&1
179 if [ -f /usr
/lib32
/libcrypto.so
-a -f /usr
/lib32
/libssl.so
] && try
187 Fallback
: attempting to
install lib32bz2-dev to get crypto libraries...
189 apt-get
-y install lib32bz2-dev
> /dev
/null
2>&1
190 if [ -f /usr
/lib32
/libcrypto.so
-a -f /usr
/lib32
/libssl.so
] && try
198 Fallback
: installing symlinks manually....
200 if ! ln -s libcrypto.so.
$ssl_vers /usr
/lib32
/libcrypto.so
203 ... failed. Could not
make symbolic links
in /usr
/lib32.
209 ln -s libssl.so.
$ssl_vers /usr
/lib32
/libssl.so