Skip to content

Commit

Permalink
Code & Features Update
Browse files Browse the repository at this point in the history
  • Loading branch information
nathaneltitane committed Oct 23, 2023
1 parent e37600b commit 81755df
Showing 1 changed file with 109 additions and 29 deletions.
138 changes: 109 additions & 29 deletions container-image
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ frobulator.script "Setting up ${script#*-}"

# variables ////////////////////////////////////////////////////////////////////

distribution_name="ubuntu"
distribution_name="debian"

distribution_version="23.04"
distribution_version="12"

# defaults /////////////////////////////////////////////////////////////////////

Expand All @@ -134,20 +134,27 @@ image_version () {

# list supported distribution versions

debian_versions=(
debian 10 "buster"
debian 11 "bullseye"
debian 12 "bookworm"
)

fedora_versions=(
fedora 33
fedora 34
fedora 35
)

ubuntu_versions=(
ubuntu 18.04
ubuntu 20.04
ubuntu 22.04
ubuntu 23.04
ubuntu 18.04 "bionic beaver"
ubuntu 20.04 "focal fossa"
ubuntu 22.04 "jammy jellyfish"
ubuntu 23.04 "lunar lobster"
)

versions=(
${debian_versions[@]}
# ${fedora_versions[@]}
${ubuntu_versions[@]}
)
Expand All @@ -162,8 +169,9 @@ image_version () {
do
name="${versions[$i]}"
version="${versions[$i+1]}"
codename="${versions[$i+2]}"

number=$((($i/2) + 1))
number=$(( ( $i / 2 ) + 1 ))

if (( $i/2 >= 0 && $i/2 <= 8 ))
then
Expand Down Expand Up @@ -211,6 +219,7 @@ image_version () {

distribution_name="${name}"
distribution_version="${version}"
distribution_codename="${codename}"
fi

# handle distribution code markup
Expand Down Expand Up @@ -238,6 +247,7 @@ image_version () {
export distribution_name="${distribution_name}"
export distribution_release="${distribution_release}"
export distribution_version="${distribution_version}"
export distribution_codename="${distribution_codename}"
fi
}

Expand All @@ -255,6 +265,17 @@ image_architecture () {

# list supported image architechtures

if [ "${distribution_name}" = debian ]
then
image_architectures=(
arm64v8
arm32v7
amd64
i386
amd64
)
fi

if [ "${distribution_name}" = fedora ]
then
image_architectures=(
Expand Down Expand Up @@ -321,6 +342,14 @@ image_download () {

case "${distribution_name}"
in
debian)

image_url="https://github.com/debuerreotype/docker-debian-artifacts/blob/dist-${image_architecture}/${distribution_codename}"
image_archive="rootfs.tar.xz"
image_name="${distribution_name}-${distribution_version}"
image_file="${image_name}.tar.xz"
;;

fedora)
image_url="https://download.fedoraproject.org/pub/fedora/linux/releases/${distribution_version}/Container/${image_architecture}/images"
image_archive="Fedora-Container-Base-${distribution_version}-1.2.${image_architecture}.tar.xz"
Expand Down Expand Up @@ -389,6 +418,11 @@ image_extract () {

frobulator.directory "${PREFIX}"/cnt "${distribution_name}"/"${distribution_version}"

if [ "${distribution_name}" = debian ]
then
core_extract "${PREFIX}"/img/"${image_file}" "${PREFIX}"/cnt/"${distribution_name}"/"${distribution_version}"
fi

if [ "${distribution_name}" = fedora ]
then
container_extract "${PREFIX}"/img/"${image_file}" "${PREFIX}"/img
Expand All @@ -410,6 +444,13 @@ image_handle () {

case "${distribution_name}"
in
[dD][eE][bB][iI][aA][nN])
distribution_name="${distribution_name,,}"

frobulator.scs "Supported distribution name."
echo
;;

[uU][bB][uU][nN][tT][uU])
distribution_name="${distribution_name,,}"

Expand All @@ -425,15 +466,15 @@ image_handle () {
;;

"")
distribution_name="ubuntu"
distribution_name="debian"

frobulator.err "Empty distribution name."
echo
;;


*)
distribution_name="ubuntu"
distribution_name="debian"

frobulator.err "Unsupported distribution name."
echo
Expand All @@ -443,33 +484,24 @@ image_handle () {
;;
esac

if [ "${distribution_name}" = "ubuntu" ]
if [ "${distribution_name}" = "debian" ]
then
case "${distribution_version}"
in
18*04|18*04*)
distribution_version="18.04.5"

frobulator.scs "Supported distribution version" "[ ${distribution_version} ]"
echo
10)
distribution_version=10
;;

20*04|20*04*)
distribution_version="20.04.5"

frobulator.scs "Supported distribution version" "[ ${distribution_version} ]"
echo
11)
distribution_version=11
;;

22*04|22*04*)
distribution_version="22.04.2"

frobulator.scs "Supported distribution version" "[ ${distribution_version} ]"
echo
;;
12)
distribution_version=12
;;

"")
distribution_version="${distribution_version}"
"")
distribution_version=12

frobulator.err "Distribution version not specified."
echo
Expand All @@ -478,8 +510,9 @@ image_handle () {
echo
;;


*)
distribution_version="${distribution_version}"
distribution_version=12

frobulator.err "Unsupported distribution version."
echo
Expand Down Expand Up @@ -528,6 +561,53 @@ image_handle () {
;;
esac
fi

if [ "${distribution_name}" = "ubuntu" ]
then
case "${distribution_version}"
in
18*04|18*04*)
distribution_version="18.04.5"

frobulator.scs "Supported distribution version" "[ ${distribution_version} ]"
echo
;;

20*04|20*04*)
distribution_version="20.04.5"

frobulator.scs "Supported distribution version" "[ ${distribution_version} ]"
echo
;;

22*04|22*04*)
distribution_version="22.04.2"

frobulator.scs "Supported distribution version" "[ ${distribution_version} ]"
echo
;;

"")
distribution_version="${distribution_version}"

frobulator.err "Distribution version not specified."
echo

frobulator.wrn "Defaulting" "[ ${distribution_version} ]"
echo
;;

*)
distribution_version="${distribution_version}"

frobulator.err "Unsupported distribution version."
echo

frobulator.wrn "Defaulting" "[ ${distribution_version} ]"
echo
;;
esac
fi
}

image_environment () {
Expand Down

0 comments on commit 81755df

Please sign in to comment.