#!/usr/bin/env bash
#
# Copyright (C) 2011-2019 Intel Corporation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Intel Corporation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#
set -e
PKG_NAME="Intel SGX Driver"
if test $(id -u) -ne 0; then
echo "Root privilege is required to install $PKG_NAME."
exit 4
fi
# Check if dkms is installed.
dkms --version &> /dev/null ||
{
echo "Package dkms is required. Try sudo apt-get install dkms."
exit 4
}
# Check if the kernel module is in use.
/sbin/modinfo intel_sgx &> /dev/null &&
{
/sbin/modprobe -r intel_sgx ||
{
echo "$PKG_NAME can't be reinstalled because the kernel module is in use."
exit 4
}
}
DRIVER_INSTALL_PATH=/opt/intel/sgxdriver
[[ -x $DRIVER_INSTALL_PATH/uninstall.sh ]] && $DRIVER_INSTALL_PATH/uninstall.sh &> /dev/null
PATH=/usr/bin:/bin
umask 022
DRIVERPKG=`mktemp -t sgx-driver-pkg.XXXXXX`
DRIVER_TEMP_FOLDER=`mktemp -d sgx-driver-XXXXXX -p /tmp`
trap "rm -fr $DRIVERPKG $DRIVER_TEMP_FOLDER 2>/dev/null; /bin/sed -i '/^intel_sgx$/d' /etc/modules; exit 3" HUP INT QUIT TERM EXIT
# The number of lines in this script (plus 1). Using this number to
# calculate the start address of the payload.
NR_SCRIPT_LINES=118
# Run /usr/bin/md5sum on the binary payload to get the MD5 check sum.
CHKSUM=0053febc7bc394b5873193905a4f82e4
# Get the install payload from this shell script.
echo -n "Unpacking $PKG_NAME ..."
tail -n +$NR_SCRIPT_LINES "$0" > $DRIVERPKG
echo " done."
echo -n "Verifying the integrity of the install package ..."
if test $(md5sum $DRIVERPKG | awk '{print $1}') != $CHKSUM; then
echo " The install package appears to be corrupted."
exit 1
fi
echo " done."
echo "Installing $PKG_NAME ..."
tar zxf $DRIVERPKG -C $DRIVER_TEMP_FOLDER >/dev/null 2>&1
retcode=$? # Save the return code
# Clean-up the temporary tarball.
rm -f $DRIVERPKG 2>/dev/null
if test $retcode -ne 0; then
echo " failed."
exit 2
fi
pushd $DRIVER_TEMP_FOLDER
if [ ! -f package/dkms.conf ]; then
echo "File dkms.conf does not exist."
exit 1
fi
source scripts/installConfig
make install
popd
${SGX_PACKAGES_PATH}/${DRIVER_PKG_NAME}/scripts/install.sh
rm -fr ${DRIVER_TEMP_FOLDER}
trap - EXIT
exit 0
g`^ A8fvgRacg:߽hCNtwZV{597jpZ/^Go;8zAH[%u>!W{՝\CJvpP!+7CsX64 >
CjaL8M%Ko[LA|t9|[ ḏ21}JV_:aHmdžpnCb}t+by %
2ːo&i<Ƃ 3 "Xs` B녎E0 !/c/M ~u!0!I0joC PpY%u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