summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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"