|
|
@ -195,20 +195,26 @@ function ifthenelse() { |
|
|
|
arg="$1" |
|
|
|
arg="$1" |
|
|
|
shift |
|
|
|
shift |
|
|
|
cmd="$*" |
|
|
|
cmd="$*" |
|
|
|
|
|
|
|
DISTRIBUTOR=$(docker exec ${DOCKER_ID} lsb_release -si | sed 's, .*,,' | tr [:upper:] [:lower:]) |
|
|
|
|
|
|
|
CODENAME=$(docker exec ${DOCKER_ID} lsb_release -cs) |
|
|
|
|
|
|
|
ARCH=$((docker exec ${DOCKER_ID} which dpkg > /dev/null 2> /dev/null && docker exec ${DOCKER_ID} dpkg --print-architecture) || echo amd64) |
|
|
|
if test "${arg/:::/}" = "${arg}"; then |
|
|
|
if test "${arg/:::/}" = "${arg}"; then |
|
|
|
docker exec ${DOCKER_ID} bash -c "${cmd//ARG/${arg}}" |
|
|
|
docker exec ${DOCKER_ID} bash -c "${cmd//ARG/${arg//@DISTRIBUTOR@/${DISTRIBUTOR}}}" |
|
|
|
else |
|
|
|
else |
|
|
|
os="${arg%%:::*}" |
|
|
|
os="${arg%%:::*}" |
|
|
|
thenpart="${arg#*:::}" |
|
|
|
thenpart="${arg#*:::}" |
|
|
|
if test "${thenpart/:::/}" = "${thenpart}"; then |
|
|
|
elsepart= |
|
|
|
docker exec ${DOCKER_ID} bash -c 'os="'$os'"; if [[ "$(lsb_release -is)-$(lsb_release -cs)-$((which dpkg > /dev/null 2> /dev/null && dpkg --print-architecture) || echo amd64)" =~ ${os} ]]; then '"${cmd//ARG/${thenpart}}"'; fi' |
|
|
|
if test "${thenpart/:::/}" != "${thenpart}"; then |
|
|
|
else |
|
|
|
|
|
|
|
elsepart="${thenpart##*:::}" |
|
|
|
elsepart="${thenpart##*:::}" |
|
|
|
thenpart="${thenpart%:::*}" |
|
|
|
thenpart="${thenpart%%:::*}" |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
if [[ "${DISTRIBUTOR}-${CODENAME}-${ARCH}" =~ ${os} ]]; then |
|
|
|
if test -n "${thenpart}"; then |
|
|
|
if test -n "${thenpart}"; then |
|
|
|
docker exec ${DOCKER_ID} bash -c 'os="'$os'"; if [[ "$(lsb_release -is)-$(lsb_release -cs)-$((which dpkg > /dev/null 2> /dev/null && dpkg --print-architecture) || echo amd64)" =~ ${os} ]]; then '"${cmd//ARG/${thenpart}}"'; else '"${cmd//ARG/${elsepart}}"'; fi' |
|
|
|
docker exec ${DOCKER_ID} bash -c "${cmd//ARG/${thenpart//@DISTRIBUTOR@/${DISTRIBUTOR}}}" |
|
|
|
else |
|
|
|
fi |
|
|
|
docker exec ${DOCKER_ID} bash -c 'os="'$os'"; if [[ "$(lsb_release -is)-$(lsb_release -cs)-$((which dpkg > /dev/null 2> /dev/null && dpkg --print-architecture) || echo amd64)" =~ ${os} ]]; then true; else '"${cmd//ARG/${elsepart}}"'; fi' |
|
|
|
else |
|
|
|
|
|
|
|
if test -n "${elsepart}"; then |
|
|
|
|
|
|
|
docker exec ${DOCKER_ID} bash -c "${cmd//ARG/${elsepart//@DISTRIBUTOR@/${DISTRIBUTOR}}}" |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
@ -290,7 +296,7 @@ EOF |
|
|
|
rm rpm-key |
|
|
|
rm rpm-key |
|
|
|
done |
|
|
|
done |
|
|
|
for repo in "${repos[@]}"; do |
|
|
|
for repo in "${repos[@]}"; do |
|
|
|
INSTALL_REPO=$((docker exec ${DOCKER_ID} test -x /usr/bin/zypper && echo zypper ar) || (docker exec ${DOCKER_ID} test -x /usr/bin/dnf && echo dnf config-manager --add-repo) || (docker exec ${DOCKER_ID} test -x /usr/bin/yum && echo wget -O/etc/yum.repos.d/additional$i.repo) || (docker exec ${DOCKER_ID} test -x /usr/sbin/urpmi && echo true)) |
|
|
|
INSTALL_REPO=$((docker exec ${DOCKER_ID} test -x /usr/bin/zypper && echo zypper ar) || (docker exec ${DOCKER_ID} test -x /usr/bin/dnf && echo dnf config-manager --add-repo) || (docker exec ${DOCKER_ID} test -x /usr/bin/yum && echo wget -O/etc/yum.repos.d/additional$i.repo) || (docker exec ${DOCKER_ID} test -x /usr/sbin/urpmi && echo false)) |
|
|
|
ifthenelse "${repo}" "${INSTALL_REPO} 'ARG'" |
|
|
|
ifthenelse "${repo}" "${INSTALL_REPO} 'ARG'" |
|
|
|
((++i)) |
|
|
|
((++i)) |
|
|
|
done |
|
|
|
done |
|
|
|