aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Doppler <dopsi@dopsi.ch>2018-05-03 14:34:42 +0200
committerSimon Doppler <dopsi@dopsi.ch>2018-05-03 14:34:42 +0200
commitd9cc8689ef530d1450801847302965b626fa26e1 (patch)
treeb5a9ad4601ebd7be5e36392594dff9753b3fc154
parent27187cc9cab7808cbd01bcf308ccca50acca1454 (diff)
downloadal32-torrent-d9cc8689ef530d1450801847302965b626fa26e1.tar.gz
al32-torrent-d9cc8689ef530d1450801847302965b626fa26e1.tar.xz
al32-torrent-d9cc8689ef530d1450801847302965b626fa26e1.zip
Create the modified download/index.html fileHEADmaster
-rw-r--r--.gitignore1
-rw-r--r--README.md4
-rw-r--r--al32-mktorrent.sh28
3 files changed, 30 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index c82b53a..7b62504 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
*sums
*.rss
.idea
+*.html*
diff --git a/README.md b/README.md
index c1a7cbc..e7e2b5a 100644
--- a/README.md
+++ b/README.md
@@ -9,12 +9,14 @@ along with the RSS feeds (for [i686](https://static.dopsi.ch/al32/feed_i686.rss)
## Usage
- al32-mktorrent.sh [ -d date ] [ -w webdir ] [ -t hefurdir ] [ arch... ]
+ al32-mktorrent.sh [ -d date ] [ -w webdir ] [ -t hefurdir ] [ -d gitwebdir ] [ arch... ]
If no `arch` is specified both `i686` and `dual` will be generated.
If no `date` is specified, the script will prompt for a date during the process.
If `hefurdir` or `webdir` is not specified no file will be uploaded to
the corresponding server.
+If `gitwebdir` is specified, the modified download index file (present as `download.html`,
+will be copied to the `$gitwebdir/download/index.html` file (No staging/commit will be done).
## Features
diff --git a/al32-mktorrent.sh b/al32-mktorrent.sh
index b855ea2..36d7d5a 100644
--- a/al32-mktorrent.sh
+++ b/al32-mktorrent.sh
@@ -17,7 +17,7 @@ set -euo pipefail
function join_by { local IFS="$1"; shift; echo "$*"; }
usage () {
- echo "Usage: $0 [-d date] [-w webdir] [-t hefurdir] [arch...]"
+ echo "Usage: $0 [-d date] [-w webdir] [-t hefurdir] [ -g gitwebdir ] [arch...]"
}
fg_green="\\033[32m"
@@ -27,6 +27,11 @@ fg_reset="\\033[0m"
fg_bold="\\033[1m"
MIRRORLIST_FILE="https://raw.githubusercontent.com/archlinux32/packages/master/core/pacman-mirrorlist/mirrorlist"
+DOWNLOAD_PAGE="https://raw.githubusercontent.com/archlinux32/website/master/download/index.html"
+
+function prepare {
+ curl "$DOWNLOAD_PAGE" > download.html
+}
function cleanup () {
echo -n -e "$fg_reset${fg_bold}Cleaning up directory...$fg_reset "
@@ -91,6 +96,17 @@ function create_torrent_for_arch () {
magnet_link="$(transmission-show --magnet "$iso_string.torrent")"
echo "$magnet_link"
+ mv download.html download.html.old
+ sed -n '1,/"magnet:.*'"$arch"'.*/p' download.html.old | sed -e '/"magnet:.*'"$arch"'.*/d'> download.html
+ echo -e "\\t<li><a href=\"$magnet_link\"" >> download.html
+ sed -n '/"magnet:.*'"$arch"'.*/,$p' download.html.old | sed -e '/"magnet:.*'"$arch"'.*/d' >> download.html
+
+ mv download.html download.html.old
+ sed -n '1,/.*static.*'"$arch"'.*torrent/p' download.html.old | sed -e '/.*static.*'"$arch"'.*torrent/d' > download.html
+ echo -e "\\t<li><a href=\"https://static.dopsi.ch/al32/archlinux-$iso_date-$arch.iso.torrent\"" >> download.html
+ sed -n '/.*static.*'"$arch"'.*torrent/,$p' download.html.old | sed -e '/.*static.*'"$arch"'.*torrent/d' >> download.html
+ rm download.html.old
+
echo -e "$fg_reset${fg_bold}Create RSS feed files...$fg_reset"
python magnet2feed.py "$magnet_link" "$iso_date"
}
@@ -123,14 +139,18 @@ which transmission-show >/dev/null 2>&1 || (
declare -a architectures=("i686" "dual")
iso_date=''
+git_web_dir=''
web_dir=''
hefur_dir=''
-while getopts "d:w:t:h" o; do
+while getopts "d:g:w:t:h" o; do
case "${o}" in
d)
iso_date=${OPTARG}
;;
+ g)
+ git_web_dir=${OPTARG}
+ ;;
t)
hefur_dir=${OPTARG}
;;
@@ -156,6 +176,7 @@ fi
[ -z "$iso_date" ] && read -r -p "Date of the ISO: " iso_date
cleanup
+prepare
for a in "${architectures[@]}" ; do
create_torrent_for_arch "$a"
@@ -171,6 +192,9 @@ for a in "${architectures[@]}" ; do
if [ -n "$hefur_dir" ] ; then
upload_file_to_remote_dir "$torrent_filename" "$hefur_dir"
fi
+ if [ -n "$git_web_dir" ] ; then
+ upload_file_to_remote_dir download.html "$git_web_dir/download/index.html"
+ fi
done
# vim: set ts=4 sw=4: