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.
105 if ! [ -f /usr
/include
/gtk-2.0
/gtk
/gtk.h
]
108 ... you
do not have libgtk2.0
-dev. Installing...
110 if apt-get
install libgtk2.0
-dev > /dev
/null
2>&1
115 ... failed to
install libgtk2.0
-dev.
123 # now check for symlinks
125 function do_symlink
{
128 target
="/usr/lib32/$1"
130 if ! [ -f "$target" ]
132 vers
=($
(echo "$target".
*))
133 if (( ${#vers[@]} != 1 ))
136 More than one version of $target.* exists. This script will
137 picks the lexicographically greatest one.
139 vers
=("${vers[${#vers[@]}-1]}")
140 echo "Using $vers" >&2
143 Linking $target to $vers
145 ln -s "$vers" "$target"
150 dev_libs
=(libatk-1.0.so libgtk-x11-2.0.so libgdk-x11-2.0.so \
151 libgdk_pixbuf-2.0.so libpangocairo-1.0.so libpango-1.0.so \
152 libcairo.so libgobject-2.0.so libgmodule-2.0.so libglib-2.0.so \
155 for lib
in "${dev_libs[@]}"
160 if [ -f /usr
/lib32
/libcrypto.so
-a -f /usr
/lib32
/libssl.so
] && try
162 echo "You already have /usr/lib32/libcrypto.so and libssl.so"
165 # we omit libssl.so and libcrypto.so from dev_libs so we can ensure
166 # that ssl_vers is consistent between the two.
169 ssl_libs
=($
(echo /usr
/lib32
/libssl.so.
*))
170 if (( ${#ssl_libs[@]} != 1 ))
173 WARNING
: More than one versions of
/usr
/lib32
/libssl.so.
* This
script will
174 pick the lexicographically greatest one.
176 ssl_libs
=(${ssl_libs[${#ssl_libs[@]}-1]})
177 echo "Using $ssl_libs" >&2
179 ssl_lib
=${ssl_libs[0]}
181 ssl_vers
=$
(expr \
( $ssl_lib : '/usr/lib32/libssl\.so\.\(.*\)' \
))
185 /usr
/lib32
/libssl.so.SSLVERSION missing. This should have been installed
186 as part of the ia32-libs package.
193 if ! [ -f /usr
/lib32
/libcrypto.so.
$ssl_vers ]
196 Version mismatch: /usr/lib32/libssl.so.$ssl_vers exists, but
197 /usr/lib32/libcrypto.so.$ssl_vers does not!
203 echo "SSL version $ssl_vers shared libraries are available"
205 echo "Attempting to install ia32-libs-dev to get crypto libraries..." >&2
206 apt-get
install ia32-libs-dev
> /dev
/null
2>&1
207 if [ -f /usr
/lib32
/libcrypto.so
-a -f /usr
/lib32
/libssl.so
] && try
215 Attempting to
install lib32bz2-dev to get crypto libraries...
217 apt-get
install lib32bz2-dev
> /dev
/null
2>&1
218 if [ -f /usr
/lib32
/libcrypto.so
-a -f /usr
/lib32
/libssl.so
] && try
226 Falling back to installing symlinks manually....
228 if ! ln -s libcrypto.so.
$ssl_vers /usr
/lib32
/libcrypto.so
231 ... failed. Could not
make symbolic links
in /usr
/lib32.
237 ln -s libssl.so.
$ssl_vers /usr
/lib32
/libssl.so