summaryrefslogtreecommitdiff
path: root/extras/mirror/generate-mirror-html.sh
blob: db5e265dcef22d239ed88fb0af13128cc6366842 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env bash
set -e

providedBy="$1"
repositoryUrl="$2"
outputPath="$3"

if [ "$providedBy" == "" ] || [ "$repositoryUrl" == "" ] || [ "$outputPath" == "" ]; then
    echo "Usage: ./generate-mirror-html.sh [PROVIDED_BY] [REPOSITORY_URL] [OUTPUT_PATH]"
    echo -e "\t[PROVIDED_BY] shall be your or mirror name"
    echo -e "\t[REPOSITORY_URL] shall be URL prefix, like http://1.2.3.4 if your repository is in / or http://1.2.3.4/apt if your repository is in /apt"
    echo -e "\t[OUTPUT_PATH] shall be output path, like /tmp/index.html"
    exit 0
fi

cp ./resources/template.html "$outputPath"
sed -i "s/\[PROVIDED_BY\]/${providedBy//\//\\/}/" "$outputPath"
sed -i "s/\[REPOSITORY_URL\]/${repositoryUrl//\//\\/}/" "$outputPath"