unixbench.sh
#!/bin/sh
set -eux;
do_package_install () {
apt-get \
--no-install-recommends \
install \
ca-certificates \
perl \
make \
gcc \
libc6-dev \
;
return 0;
}
do_unixbench () {
# local _WGET_URI='https://github.com/kdlucas/byte-unixbench/archive/master.tar.gz';
# local _WGET_OUTPUT_DOCUMENT='master.tar.gz';
local _WGET_URI='https://github.com/kdlucas/byte-unixbench/archive/v5.1.3.tar.gz';
local _WGET_OUTPUT_DOCUMENT='v5.1.3.tar.gz';
wget \
--output-document "${_WGET_OUTPUT_DOCUMENT}" \
"${_WGET_URI}" \
;
tar \
zxf \
"${_WGET_OUTPUT_DOCUMENT}" \
;
cd \
*/UnixBench/ \
;
# for /sbin/runlevel
export PATH=${PATH}:/sbin;
./Run \
;
return 0;
}
main (){
local _SAVEDIR="${1}";
local _WORKDIR="$(mktemp --tmpdir --directory unixbench.XXXX)";
cd \
"${_WORKDIR}" \
;
do_package_install \
;
do_unixbench \
;
cd \
;
cp \
-a \
"${_WORKDIR}" \
"${_SAVEDIR}" \
;
return 0;
}
main \
"${1}" \
;