summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Doppler <dopsi@dopsi.ch>2017-08-06 15:50:39 +0200
committerSimon Doppler <dopsi@dopsi.ch>2017-08-06 15:51:29 +0200
commit6a7214ed114a3c68b8c0f75aab3c2ab41e35f8ed (patch)
tree2dd58479bcfb000919d8ff2e3877ae6f0421f3eb
parentcc28ea695f9afe6e7524e9b5ba6877f5e5c477d2 (diff)
downloadreleng-6a7214ed114a3c68b8c0f75aab3c2ab41e35f8ed.tar.xz
Use the options for the date
-rw-r--r--al32-mktorrent.sh41
1 files changed, 27 insertions, 14 deletions
diff --git a/al32-mktorrent.sh b/al32-mktorrent.sh
index 005ac13..34607b7 100644
--- a/al32-mktorrent.sh
+++ b/al32-mktorrent.sh
@@ -4,21 +4,9 @@ set -euo pipefail
function join_by { local IFS="$1"; shift; echo "$*"; }
usage () {
- echo "Usage: $0 [i686|dual]"
+ echo "Usage: $0 [-d date] [i686|dual]"
}
-if [ "$#" -eq 0 ] ; then
- echo "No architecture specified, selecting 'i686'"
- arch="i686"
-elif [ "$#" -eq 1 ] ; then
- echo "Selecting architecture '$1'"
- arch="$1"
-else
- usage
- echo "Too many arguments, exiting" >&2
- exit 1
-fi
-
fg_green="\033[32m"
fg_red="\033[31m"
fg_blue="\033[34m"
@@ -30,8 +18,33 @@ MIRRORLIST_FILE="https://raw.githubusercontent.com/archlinux32/packages/master/c
mirrorlist="$(curl "$MIRRORLIST_FILE" 2>/dev/null | grep Server | cut -d '=' -f 2 | sed -e 's/\s//g;s_$arch/$repo_archisos/_')"
declare -a available_mirrors
+iso_date=''
+
+while getopts "u:p:t:f:d:" o; do
+ case "${o}" in
+ d)
+ iso_date=${OPTARG}
+ ;;
+ *)
+ usage
+ ;;
+ esac
+done
+shift $((OPTIND-1))
-read -r -p "Date of the ISO: " iso_date
+[ -z "$iso_date" ] && read -r -p "Date of the ISO: " iso_date
+
+if [ "$#" -eq 0 ] ; then
+ echo "No architecture specified, selecting 'i686'"
+ arch="i686"
+elif [ "$#" -eq 1 ] ; then
+ echo "Selecting architecture '$1'"
+ arch="$1"
+else
+ usage
+ echo "Too many arguments, exiting" >&2
+ exit 1
+fi
iso_string="archlinux-$iso_date-$arch.iso"