A nice little utility for downloading ISO images
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

204 lines
6.3 KiB

  1. #!/bin/bash
  2. #
  3. # _____ ____ _
  4. # |_ _|_ _ _ _ | \|_|___ ___
  5. # | | | | |_'_| | | | |_ -| _|
  6. # |_| |___|_,_| |____/|_|___|___|
  7. #
  8. # Version 2.1-1
  9. #
  10. # ==================================
  11. #
  12. # Copyright (C) 2017 John Laufert <johnglaufert@pm.me>
  13. #
  14. # This program is free software: you can redistribute it and/or modify
  15. # it under the terms of the GNU General Public License as published by
  16. # the Free Software Foundation, either version 3 of the License, or
  17. # (at your option) any later version.
  18. #
  19. # This program is distributed in the hope that it will be useful,
  20. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. # GNU General Public License for more details.
  23. #
  24. # You should have received a copy of the GNU General Public License
  25. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  26. #
  27. # ==================================
  28. #
  29. # This shell script allows for easy downloading of
  30. # ISO images for Ubuntu, it's various flavors, and KDE neon.
  31. # All ISO images provided are x86_64. i386 downloads will not be made available.
  32. # ISO images will be saved to $HOME/ISO.
  33. # Sets date as YYYYmmdd.
  34. DATE=$(date +%Y%m%d)
  35. # Sets LTS versions
  36. UBUNTU_1804="18.04.5"
  37. UBUNTU_2004="20.04.1"
  38. # Makes the ISO directory if not present.
  39. if [ ! -d ${HOME}/ISO ]; then
  40. mkdir -p ${HOME}/ISO
  41. fi
  42. echo "
  43. ##########################################
  44. ## _____ ____ _ ##
  45. ## |_ _|_ _ _ _ | \|_|___ ___ ##
  46. ## | | | | |_'_| | | | |_ -| _| ##
  47. ## |_| |___|_,_| |____/|_|___|___| ##
  48. ## ##
  49. ## Version 2.1-1 ##
  50. ## ##
  51. ##########################################
  52. Copyright (C) 2020 John Laufert
  53. This program comes with ABSOLUTELY NO WARRANTY.
  54. This is free software, and you are welcome to redistribute it
  55. under the terms of the GNU General Public License version 3.
  56. "
  57. # Asks user which flavor of Ubuntu they want to download.
  58. echo 'Please choose your flavor of Ubuntu (or KDE neon)'
  59. select FLAVOR in "KDE neon" "Kubuntu" "Lubuntu" "Ubuntu" "Ubuntu Budgie" "Ubuntu MATE" "Ubuntu Studio" "Xubuntu"
  60. do
  61. case ${FLAVOR} in
  62. "KDE neon"|"Kubuntu"|"Lubuntu"|"Ubuntu"|"Ubuntu Budgie"|"Ubuntu MATE"|"Ubuntu Studio"|"Xubuntu")
  63. break
  64. ;;
  65. *)
  66. echo 'Please select one of the available flavors of Ubuntu (or KDE neon)'
  67. ;;
  68. esac
  69. done
  70. # If the user chose KDE neon, asks them what release channel they want to
  71. # download.
  72. if [[ ${FLAVOR} = "KDE neon" ]]; then
  73. echo 'Please pick a release channel for KDE neon'
  74. select RELEASE in "User Edition" "Testing Edition" "Unstable Edition" "Developer Edition"
  75. do
  76. case $RELEASE in
  77. "User Edition"|"Testing Edition"|"Unstable Edition"|"Developer Edition")
  78. break
  79. ;;
  80. *)
  81. echo 'Please pick a release channel for KDE neon'
  82. ;;
  83. esac
  84. done
  85. if [[ $RELEASE = "User Edition" ]]; then
  86. NEON="user"
  87. elif [[ ${RELEASE} = "Testing Edition" ]]; then
  88. NEON="testing"
  89. elif [[ $RELEASE = "Unstable Edition" ]]; then
  90. NEON="unstable"
  91. elif [[ $RELEASE = "Developer Edition" ]]; then
  92. NEON="developer"
  93. fi
  94. else
  95. # Otherwise, if they chose an Ubuntu flavor, they are now asked to
  96. # choose which release they would like to download.
  97. # Ubuntu Budgie does not have an official 16.04 release, so the user
  98. # will not be given that option when choosing Ubuntu Budgie.
  99. if [[ ${FLAVOR} = "Ubuntu Budgie" ]]; then
  100. echo 'Please select an Ubuntu release to download'
  101. select RELEASE in "${UBUNTU_1804}" "${UBUNTU_2004}" "20.10"
  102. do
  103. case ${RELEASE} in
  104. "${UBUNTU_1804}"|"${UBUNTU_2004}"|"20.10")
  105. break
  106. ;;
  107. *)
  108. echo 'Please select an Ubuntu release to download'
  109. ;;
  110. esac
  111. done
  112. else
  113. # If the flavor they want to download isn't Ubuntu Budgie, then
  114. # they get to pick from all of the currently suportded releases.
  115. echo 'Please select an Ubuntu release to download'
  116. select RELEASE in "16.04.7" "${UBUNTU_1804}" "${UBUNTU_2004}" "20.10"
  117. do
  118. case ${RELEASE} in
  119. "16.04.7"|"${UBUNTU_1804}"|"${UBUNTU_2004}"|"20.10")
  120. break
  121. ;;
  122. *)
  123. echo 'Please select an Ubuntu release to download'
  124. ;;
  125. esac
  126. done
  127. fi
  128. fi
  129. echo "Are you sure you want to download ${FLAVOR} ${RELEASE}?"
  130. select YN in 'Yes' 'No'
  131. do
  132. case ${YN} in
  133. 'Yes'|'No')
  134. break
  135. ;;
  136. *)
  137. echo 'Please select either Yes or No'
  138. ;;
  139. esac
  140. done
  141. if [[ ${YN} = "Yes" ]]; then
  142. if [[ ${FLAVOR} = "KDE neon" ]]; then
  143. wget -O ${HOME}/ISO/neon-${NEON}-current-${DATE}.iso https://files.kde.org/neon/images/${NEON}/current/neon-${NEON}-current.iso
  144. else
  145. # Ubuntu Studio uses 'dvd' instead of 'desktop' in their file name for
  146. # whatever reason. This fixes that issue if downloading Ubuntu Studio.
  147. if [[ ${FLAVOR} = "Ubuntu Studio" ]]; then
  148. RELEASE="${RELEASE//${UBUNTU_1804}/18.04}"
  149. FLAVOR="${FLAVOR// /}"
  150. PLATFORM="dvd"
  151. if [[ ${RELEASE} = 18.04 ]]; then
  152. echo ''
  153. echo '################################################################################'
  154. echo 'NOTICE: Ubuntu Studio 18.04 is not an LTS release. To recieve updates through'
  155. echo '2021, please enable the Backports PPA'
  156. echo '################################################################################'
  157. echo ''
  158. fi
  159. else
  160. # This bit changes out spaces with dashes, and sets 'desktop' in
  161. # the file name (thanks Ubuntu Studio...)
  162. FLAVOR="${FLAVOR// /-}"
  163. PLATFORM="desktop"
  164. fi
  165. # This will make all letters lowercase. This is the final thing that
  166. # needs to be done before the ISO can be downloaded.
  167. FLAVOR=$(echo $FLAVOR | tr '[A-Z]' '[a-z]')
  168. # Ubuntu proper has a special download link that's different from the
  169. # others. This uses that for Ubuntu, and the 'cdimage' one for the
  170. # rest.
  171. if [[ $FLAVOR = "ubuntu" ]]; then
  172. wget -P ${HOME}/ISO http://releases.ubuntu.com/${RELEASE}/${FLAVOR}-${RELEASE}-${PLATFORM}-amd64.iso
  173. else
  174. wget -P ${HOME}/ISO http://cdimage.ubuntu.com/${FLAVOR}/releases/${RELEASE}/release/${FLAVOR}-${RELEASE}-${PLATFORM}-amd64.iso
  175. fi
  176. fi
  177. fi
  178. # Flush all variables set during operation of Tux Disc.
  179. DATE=""
  180. FLAVOR=""
  181. RELEASE=""
  182. NEON=""
  183. PLATFORM=""
  184. YN=""