1
0

Update to latest xe-solutions

Signed-off-by: James Ketrenos <james.p.ketrenos@intel.com>
This commit is contained in:
James Ketrenos 2021-01-20 15:26:15 -08:00
parent 51ef550d8d
commit fcbded63a3
4 changed files with 117 additions and 33 deletions

View File

@ -1,27 +1,9 @@
#!/bin/bash
arguments=()
for arg in "$@"; do
arguments+=($arg)
done
# First argument is the command
request=${arguments[0]}
# Rest of the arguments
arguments=("${arguments[@]:1}")
commands=(info help version shell)
for file in assets/commands/*; do
[[ -x "${file}" ]] && commands+=("${file}")
done
. /assets/SOLUTION
. /etc/os-release
name() {
cat << EOF
Intel Accelerated Graphics and Media Access container
Copyright (C) 2019 Intel Corporation
Copyright (C) 2019-2021 Intel Corporation
-----
EOF
}
@ -89,18 +71,105 @@ EOF
echo ""
}
[[ "${request}" == "" ]] && {
request="help"
}
# *****************************************************************************
# Execution begins here
# *****************************************************************************
[[ " ${commands[@]} " =~ " ${request} " ]] && {
# Parse arguments, looking for -r REPO and -s STREAM at the start
arguments=()
REPO=
STREAM=
while (( ${#@} > 0 )); do
arg=$1
shift
# If any arguments have been provided, stop looking for
# -r and -s options
if (( ${#arguments[@]} )); then
arguments+=($arg)
continue
fi
if [[ "${arg}" == "-r" ]]; then
REPO=$1
shift
elif [[ "${arg}" == "-s" ]]; then
STREAM=$1
shift
else
arguments+=($arg)
fi
done
# First argument is the command
request=${arguments[0]}
# Rest of the arguments
arguments=("${arguments[@]:1}")
# Build up the set of supported commands, including
# on the built-in 'info', 'help', 'version', and 'shell'
commands=(info help version shell)
for file in assets/commands/*; do
[[ -x "${file}" ]] && commands+=("${file}")
done
# Include solution specific defines
. /assets/SOLUTION
# Include OS specific defines
. /etc/os-release
# If REPO is set, re-configure the system repo file to point to the requested repo
if [[ "${REPO}" != "" ]]; then
echo "Setting repository to: ${REPO}"
case $OS_DISTRO in
ubuntu)
sudo sed -i -e "s,${GPGPU_PACKAGE_REPOSITORY},${REPO},g" /etc/apt/sources.list
;;
sles)
;;
rhel)
;;
esac
export GPGPU_PACKAGE_REPOSITORY=${REPO}
fi
# If STREAM is set, re-configure the system repo file to point to the requested stream
if [[ "${STREAM}" != "" ]]; then
echo "Setting stream to: ${STREAM}"
case $OS_DISTRO in
ubuntu)
sudo sed -i -e "s,${GPGPU_PACKAGE_STREAM},${STREAM},g" /etc/apt/sources.list
;;
sles)
;;
rhel)
;;
esac
export GPGPU_PACKAGE_STREAM=${STREAM}
fi
if [[ "${REPO}" != "" ]] || [[ "${STREAM}" != "" ]]; then
echo -e "\nUpdated container information:"
info
fi
# If no entry point was provided, default to help
request=${request:=help}
# If the requested command is in the set of build-in
# commands then run it with the rest of the arguments
if [[ " ${commands[@]} " =~ " ${request} " ]]; then
$request "${arguments[@]}"
exit $?
}
fi
[ ! -f /assets/commands/$request ] && {
# Otherwise if there is not a file with this command, run
# it from within a shell
if [ ! -f /assets/commands/$request ]; then
shell "${request}" "${arguments[@]}"
} || {
else
/assets/commands/$request "${arguments[@]}"
exit $?
}
fi

View File

@ -90,7 +90,7 @@ if echo ${RESULTS} | grep -q "HTTP.*200"; then
else
echo "Error deleting tag:" >&2
echo "${RESULTS}" >&2
fi
done
iter=5
while (( iter )); do

View File

@ -30,16 +30,25 @@ usage: scripts/test-image.sh [OPTIONS]
Options:
-l Use the local image (vs. from ${REGISTRY})
-r REPO Switch image to use REPO
-s STREAM Switch image to use STREAM
EOF
}
LOCAL=0
while getopts l opt; do
REPO=
while getopts lr:s: opt; do
case "${opt}" in
l)
LOCAL=1
;;
r)
REPO=${OPTARG}
;;
s)
STREAM=${OPTARG}
;;
[?])
>&2 echo -e "\nInvalid parameter: ${opt}\n"
usage >&2
@ -60,6 +69,12 @@ shift $(( OPTIND-1 ))
# Take entry-point from command line arguments, or set to 'test'
# if nothing provided
ENTRY="${*}"
if [[ "${REPO}" != "" ]]; then
ENTRY="-r ${REPO} ${ENTRY}"
fi
if [[ "${STREAM}" != "" ]]; then
ENTRY="-s ${STREAM} ${ENTRY}"
fi
[[ "${ENTRY}" == "" ]] && {
DOCKER_ARGS=""
ENTRY="test"
@ -98,5 +113,5 @@ $( echo " ${CMD} ${ENTRY}" | sed -e "s, , \\\\\n ,g")
EOF
${CMD} info || fail "Unable to execute 'info' on ${IMAGE}."
${CMD} info || fail "Unable to execute 'test' on ${IMAGE}."
${CMD} ${ENTRY} || fail "Unable to execute 'test' on ${IMAGE}."

View File

@ -1,3 +1,3 @@
# Pull internal sles 15sp1 image.
# Pull internal sles 15sp2 image.
FROM dockerv2-gfx-build.gfx-assets.intel.com/upstream/sle15:15.2 AS xe-base-stage
FROM amr-registry.caas.intel.com/vtt-osgc/os/sles:15.2 AS xe-base-stage