|
|
@ -1,9 +1,13 @@
|
|
|
|
#!/bin/bash -e
|
|
|
|
#!/bin/bash -e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$(whoami)" != "root" ]; then
|
|
|
|
|
|
|
|
sudo exec $0 $@
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
VERSION="$1" # E.g: '42.3'
|
|
|
|
VERSION="$1" # E.g: '42.3'
|
|
|
|
|
|
|
|
|
|
|
|
if [ "${VERSION}" = "tumbleweed" ]; then
|
|
|
|
if [ "${VERSION}" = "tumbleweed" ]; then
|
|
|
|
URL="http://download.opensuse.org/tumbleweed"
|
|
|
|
URL="https://download.opensuse.org/ports/i586/tumbleweed"
|
|
|
|
NAME="opensuse32/tumbleweed"
|
|
|
|
NAME="opensuse32/tumbleweed"
|
|
|
|
else
|
|
|
|
else
|
|
|
|
URL="http://download.opensuse.org/distribution/leap/${VERSION}"
|
|
|
|
URL="http://download.opensuse.org/distribution/leap/${VERSION}"
|
|
|
@ -13,25 +17,38 @@ fi
|
|
|
|
IMAGE="${NAME}:latest"
|
|
|
|
IMAGE="${NAME}:latest"
|
|
|
|
INSTALLROOT="/dev/shm/${IMAGE}"
|
|
|
|
INSTALLROOT="/dev/shm/${IMAGE}"
|
|
|
|
|
|
|
|
|
|
|
|
sudo rm -rf "${INSTALLROOT}"
|
|
|
|
for dir in dev proc sys; do
|
|
|
|
sudo mkdir -p "${INSTALLROOT}"
|
|
|
|
if [ -d "${INSTALLROOT}/${dir}" ]; then
|
|
|
|
|
|
|
|
umount "${INSTALLROOT}/${dir}"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rm -rf "${INSTALLROOT}"
|
|
|
|
|
|
|
|
mkdir -p "${INSTALLROOT}"
|
|
|
|
|
|
|
|
|
|
|
|
sudo zypper --root "${INSTALLROOT}" \
|
|
|
|
for dir in dev proc sys; do
|
|
|
|
|
|
|
|
mkdir -p "${INSTALLROOT}/${dir}"
|
|
|
|
|
|
|
|
mount --bind "/${dir}" "${INSTALLROOT}/${dir}"
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
zypper --root "${INSTALLROOT}" \
|
|
|
|
ar "${URL}/repo/oss/" "oss"
|
|
|
|
ar "${URL}/repo/oss/" "oss"
|
|
|
|
sudo zypper --root "${INSTALLROOT}" \
|
|
|
|
zypper --root "${INSTALLROOT}" \
|
|
|
|
ar "${URL}/repo/non-oss/" "non-oss"
|
|
|
|
ar "${URL}/repo/non-oss/" "non-oss"
|
|
|
|
|
|
|
|
|
|
|
|
if [ "${VERSION}" != "tumbleweed" ]; then
|
|
|
|
if [ "${VERSION}" != "tumbleweed" ]; then
|
|
|
|
sudo zypper --root "${INSTALLROOT}" \
|
|
|
|
zypper --root "${INSTALLROOT}" \
|
|
|
|
ar "http://download.opensuse.org/update/leap/${VERSION}/oss/" "update-oss"
|
|
|
|
ar "http://download.opensuse.org/update/leap/${VERSION}/oss/" "update-oss"
|
|
|
|
sudo zypper --root "${INSTALLROOT}" \
|
|
|
|
zypper --root "${INSTALLROOT}" \
|
|
|
|
ar "http://download.opensuse.org/update/leap/${VERSION}/non-oss/" "update-non-oss"
|
|
|
|
ar "http://download.opensuse.org/update/leap/${VERSION}/non-oss/" "update-non-oss"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
sudo zypper --root "${INSTALLROOT}" \
|
|
|
|
zypper --root "${INSTALLROOT}" \
|
|
|
|
--gpg-auto-import-keys ref
|
|
|
|
--gpg-auto-import-keys ref
|
|
|
|
sudo setarch i686 zypper --root "${INSTALLROOT}" \
|
|
|
|
setarch i686 zypper --root "${INSTALLROOT}" \
|
|
|
|
install --download-only -y \
|
|
|
|
install --download-only -y \
|
|
|
|
bash \
|
|
|
|
bash \
|
|
|
|
|
|
|
|
ca-certificates \
|
|
|
|
|
|
|
|
curl \
|
|
|
|
docbook-utils \
|
|
|
|
docbook-utils \
|
|
|
|
filesystem \
|
|
|
|
filesystem \
|
|
|
|
gawk \
|
|
|
|
gawk \
|
|
|
@ -47,16 +64,23 @@ sudo setarch i686 zypper --root "${INSTALLROOT}" \
|
|
|
|
xz \
|
|
|
|
xz \
|
|
|
|
zlib \
|
|
|
|
zlib \
|
|
|
|
zypper
|
|
|
|
zypper
|
|
|
|
sudo rpm -Uvh --root "${INSTALLROOT}" "${INSTALLROOT}/var/cache/zypp/packages/oss/"*"/"*".rpm"
|
|
|
|
rpm -Uvh --root "${INSTALLROOT}" "${INSTALLROOT}/var/cache/zypp/packages/oss/"*"/"*".rpm"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
chroot "${INSTALLROOT}" rpmdb --rebuilddb
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for dir in dev proc sys; do
|
|
|
|
|
|
|
|
umount "${INSTALLROOT}/${dir}"
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
sudo chroot "${INSTALLROOT}" rpmdb --rebuilddb
|
|
|
|
rm -rfv "${INSTALLROOT}//var/cache/zypp/packages/"*
|
|
|
|
|
|
|
|
|
|
|
|
FILE="${IMAGE//\//_}.tar"
|
|
|
|
FILE="${IMAGE//\//_}.tar"
|
|
|
|
sudo tar -C "${INSTALLROOT}" -c . >"${FILE}"
|
|
|
|
tar -C "${INSTALLROOT}" -c . >"${FILE}"
|
|
|
|
sudo rm -rf "${INSTALLROOT}"
|
|
|
|
rm -rf "${INSTALLROOT}"
|
|
|
|
|
|
|
|
|
|
|
|
docker rmi -f "${IMAGE}"
|
|
|
|
docker rmi -f "${IMAGE}"
|
|
|
|
docker import "${FILE}" "${IMAGE}"
|
|
|
|
docker import "${FILE}" "${IMAGE}"
|
|
|
|
|
|
|
|
|
|
|
|
pigz "${FILE}"
|
|
|
|
pigz "${FILE}"
|
|
|
|
mv -fv "${FILE}.gz" "${HOME}/tde/docker"
|
|
|
|
mkdir -p "/home/${SUDO_USER}/tde/docker"
|
|
|
|
|
|
|
|
mv -fv "${FILE}.gz" "/home/${SUDO_USER}/tde/docker"
|
|
|
|