Define URLs according to each release of Debian

This commit is contained in:
Jeremy Gardais 2019-01-03 15:06:04 +01:00
parent 725936597f
commit 545b528844
1 changed files with 48 additions and 9 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh
# Notes {{{
# Mount or extract
# Extract Debian ISO, add a preseed file and rebuild an ISO.
# At the end, mounting or extracting the iso use the same disk space, but
# mount require root permissions, so i choose to extract the iso.
# }}}
@ -44,13 +44,56 @@ fi
# }}}
# Vars {{{
## Debian release to use
### Can be stretch, stable, buster, testing, sid or unstable
DEBIAN_VERSION_NAME="stretch"
## ISO to download and use
### Can be dvd, net, netinst or mini
DEBIAN_ISO_TYPE="netinst"
# Define URL according to specified release name {{{
case "${DEBIAN_VERSION_NAME}" in
"stable" | "stretch" )
DEBIAN_VERSION_NB="9.6.0"
DEBIAN_ISO_DVD_URL="https://cdimage.debian.org/debian-cd/current/amd64/iso-dvd/debian-${DEBIAN_VERSION_NB}-amd64-DVD-1.iso"
DEBIAN_ISO_NETINST_URL="https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-${DEBIAN_VERSION_NB}-amd64-netinst.iso"
DEBIAN_ISO_MINI_URL="http://ftp.nl.debian.org/debian/dists/${DEBIAN_VERSION_NAME}/main/installer-amd64/current/images/netboot/mini.iso"
DEBIAN_ISO_MINI_URL="http://ftp.fr.debian.org/debian/dists/${DEBIAN_VERSION_NAME}/main/installer-amd64/current/images/netboot/mini.iso"
;;
"testing" | "buster" | "unstable" | "sid")
DEBIAN_ISO_DVD_URL="https://cdimage.debian.org/cdimage/weekly-builds/amd64/iso-dvd/debian-testing-amd64-DVD-1.iso"
DEBIAN_ISO_NETINST_URL="https://cdimage.debian.org/cdimage/daily-builds/daily/current/amd64/iso-cd/debian-testing-amd64-netinst.iso"
DEBIAN_ISO_MINI_URL="http://ftp.fr.debian.org/debian/dists/${DEBIAN_VERSION_NAME}/main/installer-amd64/current/images/netboot/mini.iso"
;;
* )
printf '%b\n' "Please define a correct Debian release name according to:"
printf '%b\n' "stable, buster, testing, sid or unstable"
printf '%b\n' "${DEBIAN_VERSION_NAME} does not seems to be correct."
exit 1
;;
esac
# }}}
# Define ISO type to use {{{
case "${DEBIAN_ISO_TYPE}" in
dvd )
USE_DEBIAN_ISO="${DEBIAN_ISO_DVD_URL}"
;;
net | netinst )
USE_DEBIAN_ISO="${DEBIAN_ISO_NETINST_URL}"
;;
mini )
USE_DEBIAN_ISO="${DEBIAN_ISO_MINI_URL}"
;;
* )
printf '%b\n' "Please define a correct ISO type according to:"
printf '%b\n' "dvd, net, netinst or mini"
exit 1
;;
esac
# }}}
## Temp directories according to $TEMP_DIR
TEMP_ISO_DIR="${TEMP_DIR}/extracted-iso"
TEMP_INITRD_DIR="${TEMP_DIR}/initrd"
@ -58,10 +101,6 @@ DEBIAN_DL_ISO_PATH="${TEMP_DIR}/debian.iso"
DEBIAN_PRESEED_ISO_PATH="$(dirname ${TEMP_DIR})/preseed-debian-${DEBIAN_VERSION_NB}-amd64.iso"
# }}}
#USE_DEBIAN_ISO="${DEBIAN_ISO_DVD_URL}"
USE_DEBIAN_ISO="${DEBIAN_ISO_NETINST_URL}"
#USE_DEBIAN_ISO="${DEBIAN_ISO_MINI_URL}"
# Pre-requisites {{{
if [ ! $(command -v 7z) ]; then
printf '%b\n' "ERROR: Please install '7z' bin:\\nsudo apt install p7zip-full"