diff --git a/index.html b/index.html new file mode 100644 index 0000000..1e370c4 --- /dev/null +++ b/index.html @@ -0,0 +1,158 @@ + + + + + + PAWE.ME + + + + + + + + +
+

PAWE.ME

+

Simple mirroring & archiving server.

+ +
+
+
+

Mirroring List

+
+
+

ArchLinux (x86_64)

+

Last Updated: Not Synced

+

Upstream: rsync://mirrors.xtom.de/archlinux/

+
+
+

Ubuntu

+

Last Updated: Not Synced

+

Upstream: rsync://rsync.archive.ubuntu.com/ubuntu/

+
+
+

Ubuntu Releases

+

Last Updated: Not Synced

+

Upstream: rsync://releases.ubuntu.com/releases/

+
+
+

Debian

+

Last Updated: Not Synced

+

Upstream: rsync://mirrors.xtom.jp/debian/

+
+
+

Debian CD

+

Last Updated: Not Synced

+

Upstream: rsync://ftp.lanet.kr/debian-cd/

+
+
+

Fedora

+

Last Updated: Not Synced

+

Upstream: rsync://dl.fedoraproject.org/fedora-enchilada/linux/

+
+
+

Manjaro

+

Last Updated: Not Synced

+

Upstream: rsync://ftp.riken.jp/manjaro/

+
+
+

Raspbian

+

Last Updated: Not Synced

+

Upstream: rsync://archive.raspbian.org/archive/

+
+
+
+
+

Additional Mirror

+ +
+
+

ArchLinux (ARM)

+

Last Updated: Not Synced

+

Upstream: http://jp.mirror.archlinuxarm.org/

+
+
+

AsahiLinux

+

Last Updated: Not Synced

+

Upstream: https://cdn.asahilinux.org/

+
+
+

Ubuntu Releases (Old)

+

Last Updated: Not Synced

+

Upstream: rsync://old-releases.ubuntu.com/releases/

+
+ + + +
+
+
+

Server Info

+ +

Fill out this form to request additional mirroring.

+
+ +
+ + + + + \ No newline at end of file diff --git a/pub/index.html b/pub/index.html deleted file mode 100644 index 2cbc0b3..0000000 --- a/pub/index.html +++ /dev/null @@ -1,179 +0,0 @@ - - - - - - - PAWE.ME - - - - - - - - -
-

PAWE.ME

-

Simple mirroring & archiving server.

-

Hide my Email, Invidious, Proxy.

-
- -
-
-

Mirroring List

-
- -
-

ArchLinux (x86_64)

-

Last Updated: 2023-10-05 08:00

-

Source: rsync://mirror.rackspace.com/archlinux/

-
-
-

Ubuntu

-

Last Updated: 2023-10-05 06:00

-

Source: rsync://rsync.archive.ubuntu.com/ubuntu/

-
-
-

Ubuntu Releases

-

Last Updated: 2023-10-05 00:00

-

Source: rsync://releases.ubuntu.com/releases/

-
-
-

Debian

-

Last Updated: 2023-10-05 06:00

-

Source: rsync://ftp.halifax.rwth-aachen.de/debian/

-
-
-

Debian Releases

-

Last Updated: 2023-10-05 00:00

-

Source: rsync://ftp.lanet.kr/debian-cd/ -

-
-
-

Manjaro

-

Last Updated: 2023-10-05 08:00

-

Source: rsync://ftp.riken.jp/manjaro/

-
-
-

Raspbian

-

Last Updated: 2023-10-05 08:00

-

Source: rsync://archive.raspbian.org/archive/

-
-
-

Fedora

-

Last Updated: Not Synced

-

Source: rsync://dl.fedoraproject.org/fedora-enchilada/linux/

-
-
-

Epel

-

Last Updated: Not Synced

-

Source: rsync://dl.fedoraproject.org/fedora-epel/

-
- -
- - -
-
-

Additional Mirror

- -
-
-

ArchLinux (ARM)

-

Last Updated: 2023-07-07 00:50

-

Source: http://jp.mirror.archlinuxarm.org/

-
-
-

AsahiLinux

-

Last Updated: 2023-10-05 00:00

-

Source: https://cdn.asahilinux.org/

-
-
-

Ubuntu Releases (Old)

-

Last Updated: 2023-03-06 14:39

-

Source: rsync://old-releases.ubuntu.com/releases/

-
- -
-
-
-

Server Info

- -

Fill out this form to request additional mirroring.

- -
- -
- - - - - - - diff --git a/pub/index.html b/pub/index.html new file mode 120000 index 0000000..79c5d6f --- /dev/null +++ b/pub/index.html @@ -0,0 +1 @@ +../index.html \ No newline at end of file diff --git a/scripts/base.html b/scripts/base.html deleted file mode 100644 index 8a4236f..0000000 --- a/scripts/base.html +++ /dev/null @@ -1,179 +0,0 @@ - - - - - - - PAWE.ME - - - - - - - - -
-

PAWE.ME

-

Simple mirroring & archiving server.

-

Hide my Email, Invidious, Proxy.

-
- -
-
-

Mirroring List

-
- -
-

ArchLinux (x86_64)

-

Last Updated: @@archlinux@@

-

Source: rsync://mirror.rackspace.com/archlinux/

-
-
-

Ubuntu

-

Last Updated: @@ubuntu@@

-

Source: rsync://rsync.archive.ubuntu.com/ubuntu/

-
-
-

Ubuntu Releases

-

Last Updated: @@ubuntu_cd@@

-

Source: rsync://releases.ubuntu.com/releases/

-
-
-

Debian

-

Last Updated: @@debian@@

-

Source: rsync://ftp.halifax.rwth-aachen.de/debian/

-
-
-

Debian Releases

-

Last Updated: @@debian_cd@@

-

Source: rsync://ftp.lanet.kr/debian-cd/ -

-
-
-

Manjaro

-

Last Updated: @@manjaro@@

-

Source: rsync://ftp.riken.jp/manjaro/

-
-
-

Raspbian

-

Last Updated: @@raspbian@@

-

Source: rsync://archive.raspbian.org/archive/

-
-
-

Fedora

-

Last Updated: @@fedora@@

-

Source: rsync://dl.fedoraproject.org/fedora-enchilada/linux/

-
-
-

Epel

-

Last Updated: @@epel@@

-

Source: rsync://dl.fedoraproject.org/fedora-epel/

-
- -
- - -
-
-

Additional Mirror

- -
-
-

ArchLinux (ARM)

-

Last Updated: @@archlinuxarm@@

-

Source: http://jp.mirror.archlinuxarm.org/

-
-
-

AsahiLinux

-

Last Updated: @@asahilinux@@

-

Source: https://cdn.asahilinux.org/

-
-
-

Ubuntu Releases (Old)

-

Last Updated: @@ubuntu_cd_old@@

-

Source: rsync://old-releases.ubuntu.com/releases/

-
- -
-
-
-

Server Info

- -

Fill out this form to request additional mirroring.

- -
- -
- - - - - - - diff --git a/scripts/config.yml b/scripts/config.yml new file mode 100644 index 0000000..82fa3e3 --- /dev/null +++ b/scripts/config.yml @@ -0,0 +1,118 @@ +BASE_DIR: /srv/mirror +ENV: ./scripts/.env +global: + type: rsync + scripts: + pre: + # - ./scripts/cleanup.sh + fail: + - ./scripts/alert.sh + post: + - ./script/index.py + # - ./script/rotate_log.py + log: ./logs/sync.log + log_dir: ./logs/ + sync: + - ALL + rsync: + options: "-rtlHpv --chmod=D0755,F0644 --partial --hard-links --safe-links --stats --delete --delete-after --delay-updates --max-delete=70000" + exclude: + - ".*.??????" + - ".~tmp~/" + - "Packages*" + - "Sources*" + - "Release*" + - "*.links.tar.gz*" + - "/other" + - "/sources" +repos: + ARCHLINUX: + url: rsync://mirrors.xtom.de/archlinux/ + duration: 4 + name: "ArchLinux (x86_64)" + path: archlinux + log: ./logs/archlinux + last_sync: "2023-10-09T23:48Z" + UBUNTU: + url: rsync://rsync.archive.ubuntu.com/ubuntu/ + duration: 4 + name: "Ubuntu" + path: ubuntu + log: ./logs/ubuntu + last_sync: "2023-10-09T23:48Z" + UBUNTU_CD: + url: rsync://releases.ubuntu.com/releases/ + duration: 24 + name: "Ubuntu Releases" + path: ubuntu_cd + log: ./logs/ubuntu_cd + last_sync: "2023-10-09T23:48Z" + UBUNTU_CD_OLD: + url: rsync://old-releases.ubuntu.com/releases/ + duration: 24 + name: "Ubuntu Releases (Old)" + path: ubuntu_cd_old + log: ./logs/ubuntu_cd_old + last_sync: "2023-10-09T23:48Z" + DEBIAN: + url: rsync://mirrors.xtom.jp/debian/ + type: ftpsync + duration: 4 + name: Debian + path: debian + scripts: + # pre: ./scripts/pre_debian.sh + last_sync: "2023-10-09T23:48Z" + DEBIAN_CD: + url: rsync://ftp.lanet.kr/debian-cd/ + duration: 24 + name: "Debian CD" + path: debian_cd + log: ./logs/debian_cd + last_sync: "2023-10-09T23:48Z" + FEDORA: + url: rsync://dl.fedoraproject.org/fedora-enchilada/linux/ + duration: 4 + name: "Fedora" + path: fedora + log: ./logs/fedora + last_sync: "2023-10-09T23:30Z" + RASPBIAN: + url: rsync://archive.raspbian.org/archive/ + duration: 6 + name: "Raspbian" + path: raspbian + log: ./logs/raspbian + last_sync: "2023-10-09T23:30Z" + MANJARO: + url: rsync://ftp.riken.jp/manjaro/ + duration: 4 + name: Manjaro + path: manjaro + log: ./logs/manjaro + last_sync: "2023-10-09T23:30Z" + ARCHLINUXARM: + name: "ArchLinux (ARM)" + path: archlinuxarm + url: http://jp.mirror.archlinuxarm.org/ + type: http + duration: 12 + last_sync: "2023-10-09T23:30Z" + ASAHILINUX: + name: "AsahiLinux" + path: asahilinux + url: https://cdn.asahilinux.org/ + type: http + duration: 12 + last_sync: "2023-10-09T23:30Z" +index: + - ARCHLINUX + - UBUNTU UBUNTU_CD + - DEBIAN DEBIAN_CD + - FEDORA + - MANJARO + - RASPBIAN + - DIVIDER + - ARCHLINUXARM + - ASAHILINUX + - UBUNTU_CD_OLD diff --git a/scripts/http/getFetch.py b/scripts/getFetch.py similarity index 91% rename from scripts/http/getFetch.py rename to scripts/getFetch.py index 62e78b7..1b881c0 100644 --- a/scripts/http/getFetch.py +++ b/scripts/getFetch.py @@ -49,8 +49,8 @@ def parseIndex(url, base = "", idx = 0, dirs = [], ret = []): if __name__ == "__main__": - if len(sys.argv) != 3: - print("Usage: createFetch.py [URL] [Path]") + if len(sys.argv) != 3 and len(sys.argv) != 4: + print("Usage: createFetch.py [URL] [Path] (fetch)") sys.exit() # urls = {"archlinuxarm": "http://jp.mirror.archlinuxarm.org/", "asahilinux": "https://cdn.asahilinux.org/", "linux-surface": "https://pkg.surfacelinux.com/arch/"} @@ -73,6 +73,9 @@ if __name__ == "__main__": files = parseIndex('', base = url, dirs = [bpath]) filename = url.split('/')[2]+'.fetch' + if len(sys.argv) == 4: + filename = sys.argv[3] + with open(filename, 'w') as f: f.write(json.dumps(files, indent=4)) diff --git a/scripts/http/getFile.py b/scripts/getFile.py similarity index 100% rename from scripts/http/getFile.py rename to scripts/getFile.py diff --git a/scripts/http/http.sh b/scripts/http/http.sh deleted file mode 100755 index ef081d6..0000000 --- a/scripts/http/http.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -TIMENOW=$(date '+%Y%m%d_%H%M') -BASE_DIR="/srv/mirror" - -DIST_ARR=('archlinuxarm' 'asahilinux') - -in=0 -for di in "${DIST_ARR[@]}" -do - if [ "$di" == "$1" ]; then in=1; fi -done - -if [ "$in" -ne 1 ]; then - echo Not declared;exit; -fi - -dist=$1 - -echo HTTP Mirroring ${dist} started at ${TIMENOW}. -echo "${TIMENOW} STARTED ${dist}" >> ${BASE_DIR}/logs/all.log -cd $BASE_DIR/scripts/http - -echo ${dist} Fetch >> $BASE_DIR/logs/http.log -python3 -u $BASE_DIR/scripts/http/fetchFile.py ${dist} $BASE_DIR/${dist}/ >> $BASE_DIR/logs/${dist}.log 2>&1 -echo ${dist} Download >> $BASE_DIR/logs/http.log -python3 -u $BASE_DIR/scripts/http/getFile.py $BASE_DIR/scripts/http/${dist}.fetch >> $BASE_DIR/logs/${dist}.log 2>&1 -if [ $? -eq 0 ]; -then - echo Sync ${dist} Success - echo "${TIMENOW} DONE ${dist}" >> ${BASE_DIR}/logs/all.log - cd $BASE_DIR - echo "Updating Index" - python3 -u ./scripts/index.py ${BASE_DIR} -fi \ No newline at end of file diff --git a/scripts/index.py b/scripts/index.py old mode 100644 new mode 100755 index 990c6d0..58de335 --- a/scripts/index.py +++ b/scripts/index.py @@ -1,48 +1,80 @@ -import os, sys, re +#!/usr/bin/python3 + +import os, sys +import yaml +import jinja2 import datetime -from pprint import pprint -base_path = sys.argv[1] -assert os.path.exists(base_path) +BASE_DIR = "." -log_path = os.path.join(base_path, "logs/all.log") -assert os.path.exists(log_path) +CONFIG_PATH = os.path.join(BASE_DIR, "scripts/config.yml") +TEMPLATES_DIR = os.path.join(BASE_DIR, "scripts/templates") +LOG_DIR = os.path.join(BASE_DIR, "logs") +OUTPUT_PATH = os.path.join(BASE_DIR, "index.html") -html_path = os.path.join(base_path, "scripts/base.html") -index = os.path.join(base_path, "index.html") -assert os.path.exists(html_path) +# def get_last_sync(repo_name): +# log_path = os.path.join(LOG_DIR, f"all.log") +# if os.path.exists(log_path): +# with open(log_path, 'r') as log_file: +# log_all = reversed(log_file.readlines()) +# for logline in log_all: +# time, stat, dist = logline.split() +# if repo_name == dist and stat =="DONE": +# return datetime.datetime.strptime(time, '%Y%m%d_%H%M').strftime("%Y-%m-%d %H:%M") +# return "Not Synced" -with open(log_path, 'r') as f: - log_file = f.read().splitlines() -log_file.reverse() +# main() -with open(html_path, 'r') as f: - html_file = f.read() -dists = re.findall("@@([^@@]+)@@", html_file) -pprint(dists) +if __name__=="__main__": + with open(CONFIG_PATH, 'r') as f: + config = yaml.safe_load(f) -logs = {} -for dist in dists: - logs[dist] = [] + env = jinja2.Environment(loader=jinja2.FileSystemLoader(TEMPLATES_DIR)) + base_template = env.get_template('base.html') + full_template = env.get_template('full.html') + half_template = env.get_template('half.html') -for logline in log_file: - print(logline) - time, stat, dist = logline.split(" ") - if stat == "DONE": - time = datetime.datetime.strptime(time, '%Y%m%d_%H%M') - if dist in logs.keys(): - logs[dist].append(time) + main_repos = [] + additional_repos = [] -last = {} -for dist in logs: - if logs[dist]: - last[dist] = sorted(logs[dist])[-1].strftime("%Y-%m-%d %H:%M") - else: - last[dist] = "Not Synced" -pprint(last) + DIV = 0 + for line in config['index']: + if line == "DIVIDER": + DIV = 1 + continue + repos_line = line.split() + for repo_name in repos_line: + repo_data = config['repos'].get(repo_name) + if not repo_data: + continue -for dist in last: - html_file = html_file.replace(f"@@{dist}@@", last[dist]) + context = { + 'path': repo_data['path'], + 'name': repo_data['name'], + 'lastsync': repo_data.get('lastsync', "Not Synced"), + 'upstream': repo_data['url'] + } + print(context) + if len(repos_line) > 1: + (main_repos if not DIV else additional_repos).append(half_template.render(**context)) + else: + (main_repos if not DIV else additional_repos).append(full_template.render(**context)) -with open(index, 'w') as f: - f.write(html_file) + html_output = base_template.render( + repos="\n".join(main_repos), + repos_more="\n".join(additional_repos) + ) + + try: + with open(OUTPUT_PATH, 'w') as f: + f.write(html_output) + + except: + if len(sys.argv) == 2: + if os.path.exists(sys.argv[1]): + if not os.path.isdir(sys.argv[1]): + print(f"Writing to {sys.argv[1]}") + with open(sys.argv[1], 'w') as f: + f.write(html_output) + else: + print(html_output) diff --git a/scripts/sync.sh b/scripts/sync.sh index 2dd14b0..9599a23 100755 --- a/scripts/sync.sh +++ b/scripts/sync.sh @@ -1,79 +1,141 @@ #!/bin/bash -TIMENOW=$(date '+%Y%m%d_%H%M') -BASE_DIR="/srv/mirror" -ALERT="" -option="-rtlHpv --chmod=D0755,F0644 --partial --hard-links --safe-links --stats --delete --delete-after --delay-updates --max-delete=70000" +CONFIG_PATH="./scripts/config.yml" +YAML="./scripts/yq" -exclude="--exclude=.*.?????? --exclude='.~tmp~/' --exclude='Packages*' --exclude='Sources*' --exclude='Release*' --exclude='*.links.tar.gz*' --exclude='/other' --exclude='/sources'" +BASE_DIR=$($YAML eval ".BASE_DIR" "${CONFIG_PATH}") +TIMESTAMP=$(date '+%Y-%m-%dT%H:%MZ') -ubuntu="rsync://rsync.archive.ubuntu.com/ubuntu/" -ubuntu_cd="rsync://releases.ubuntu.com/releases/" -ubuntu_cd_old="rsync://old-releases.ubuntu.com/releases/" -debian="rsync://mirrors.xtom.jp/debian/" -debian_cd="rsync://ftp.lanet.kr/debian-cd/" -fedora="rsync://dl.fedoraproject.org/fedora-enchilada/linux/" -epel="rsync://dl.fedoraproject.org/fedora-epel/" -fedora_cd="" -archlinux="rsync://mirror.rackspace.com/archlinux/" -raspbian="rsync://archive.raspbian.org/archive/" -manjaro="rsync://ftp.riken.jp/manjaro/" +parse_yaml() { + echo $($YAML eval ".$1" "${CONFIG_PATH}") +} -DIST_ARR=('archlinux' 'debian' 'debian_cd' 'ubuntu' 'ubuntu_cd' 'ubuntu_cd_old' 'raspbian' 'epel' 'fedora' 'fedora_cd' 'manjaro') +sync_repo() { -in=0 -for di in "${DIST_ARR[@]}" -do - if [ "$di" == "$1" ]; then in=1; fi + local repo=$1 + local type=$(parse_yaml "repos.${repo}.type") + local url=$(parse_yaml "repos.${repo}.url") + local path=$(parse_yaml "repos.${repo}.path") + local log=$(parse_yaml "repos.${repo}.log") + + if [[ "$type" == "null" ]]; then + type=$(parse_yaml "global.type") + fi + + if [[ "$log" == "null" ]]; then + log="$(parse_yaml "global.log_dir")$path" + fi + + log=$(realpath $log) + path="${BASE_DIR}/$path/" + echo -e "----\n| Repo: $repo\n| Type: $type\n| Upstream: $url\n| Path: $path\n| Log: $log\n----" + + rotate_log $log + + case $type in + "rsync") + local rsync_options=$(parse_yaml 'global.rsync.options') + local exclude_list=($(parse_yaml 'global.rsync.exclude[]')) + local exclude="" + for ex in "${exclude_list[@]}"; do + exclude="${exclude} --exclude='${ex}'" + done + echo rsync ${rsync_options} ${exclude} $url $path >> $log + rsync ${rsync_options} ${exclude} $url $path >> $log 2>> ${log}-error + ;; + "ftpsync") + cd ${BASE_DIR}/scripts + export BASE_DIR=${BASE_DIR} + ./ftpsync >> $log 2>> ${log}-error + cd ${BASE_DIR} + ;; + "http") + echo ${repo} Fetch >> $log 2>> ${log}-error + python3 -u $BASE_DIR/scripts/getFetch.py "${url}" $path $BASE_DIR/scripts/${path}.fetch >> $log 2>> ${log}-error + echo ${repo} Download >> $log 2>> ${log}-error + python3 -u $BASE_DIR/scripts/getFile.py $BASE_DIR/scripts/${path}.fetch >> $log 2>> ${log}-error + ;; + *) + echo "Unknown type $type for $repo." | tee ${log}-error + ;; + esac + + clean_log $log +} + +rotate_log() { + local log_file=$1 + if [[ -f $log_file ]]; then + PREV_LOG=$(cat "$log_file" | head -n 1) + old_log_file="$(dirname $log_file)/old/$(basename $log_file)-$PREV_LOG" + mkdir -p "$(dirname $old_log_file)" + mv "$log_file" "$old_log_file" + fi + + local error_file=$1-error + if [[ -f $error_file ]]; then + PREV_LOG=$(cat "$error_file" | head -n 1) + old_error_file="$(dirname $error_file)/old/$(basename $error_file)-$PREV_LOG" + mkdir -p "$(dirname $old_error_file)" + mv "$error_file" "$old_error_file" + fi + + echo $TIMESTAMP >> $log_file + echo $TIMESTAMP >> $error_file +} + +clean_log() { + local error_file=$1-error + nl=$(cat "$error_file" | wc -l) + if [ $nl -eq 1 ]; then + rm "$error_file" + fi +} + +########## +# Main # +########## + +echo Started job $TIMESTAMP.. + +global_pre_scripts=($(parse_yaml 'global.scripts.pre[]')) +for script in "${global_pre_scripts[@]}"; do + $script done -if [ "$in" -ne 1 ]; then - echo Not declared;exit; +repos=($(parse_yaml 'global.sync[]')) + +if [[ "${repos[0]}" == "ALL" ]]; then + repos=($($YAML eval '.repos | keys| .[]' "${CONFIG_PATH}")) fi +for repo in "${repos[@]}"; do + echo Checking $repo... + duration=$(parse_yaml "repos.${repo}.duration") + last_sync_timestamp=$(date -d "$(parse_yaml "repos.${repo}.last_sync")" +%s) + next_sync_timestamp=$(( last_sync_timestamp + duration * 3600 )) + next_sync_timestamp=1 + if [ $next_sync_timestamp -le $(date +%s) ]; then + echo "Lastsync $last_sync_timestamp" + echo "Syncing $repo..." -dist=$1 -echo Syncing $1... + sync_repo $repo -LASTLOG=`head -1 ${BASE_DIR}/logs/${dist}.log` + if [ $? -ne 0 ]; then + global_fail_scripts=($(parse_yaml 'global.scripts.fail[]')) + for script in "${global_fail_scripts[@]}"; do + $script + done + echo "Error syncing $repo" + else + $YAML eval ".repos.${repo}.last_sync = \"$TIMESTAMP\"" -i "${CONFIG_PATH}" + echo "Successfully synced $repo." + fi + fi +done -mv ${BASE_DIR}/logs/${dist}.log ${BASE_DIR}/logs/previous/${dist}-${LASTLOG}.log -mv ${BASE_DIR}/logs/${dist}-error.log ${BASE_DIR}/logs/previous/${dist}-error-${LASTLOG}.log +global_post_scripts=($(parse_yaml 'global.scripts.post[]')) +for script in "${global_post_scripts[@]}"; do + $script +done -echo ${TIMENOW} >> ${BASE_DIR}/logs/${dist}.log -echo ${TIMENOW} >> ${BASE_DIR}/logs/${dist}-error.log -echo "${TIMENOW}: Mirroring ${dist} from ${!dist} to ${BASE_DIR}/${dist}" -echo "${TIMENOW} STARTED ${dist}" >> ${BASE_DIR}/logs/all.log - -if [ "$dist" == "debian" ]; -then - cd ${BASE_DIR}/scripts - export BASE_DIR=${BASE_DIR} - ./ftpsync -else - echo "rsync ${option} ${exclude} ${!dist} ${BASE_DIR}/${dist}" >> ${BASE_DIR}/logs/${dist}.log - rsync ${option} ${exclude} ${!dist} ${BASE_DIR}/${dist} >> ${BASE_DIR}/logs/${dist}.log 2>> ${BASE_DIR}/logs/${dist}-error.log -fi - -if [ $? -ne 0 ]; -then - cd ${ALERT} - MSG="${dist} failed at ${TIMENOW}" - if [ -n "$ALERT" ]; - then - ${ALERT}/alert alert "${MSG}" - fi - - echo Sync ${dist} Error - echo "${TIMENOW} ERROR ${dist}" >> ${BASE_DIR}/logs/all.log - echo curl -X POST -d 'email=DEVPG.NET' -d "title=${dist}" -d "content=${MSG}" https://one.devpg.net/send -else - echo Sync ${dist} Success - if [ `echo ${BASE_DIR}/logs/${dist}-error.log | wc -l` -eq 1 ]; - then - rm ${BASE_DIR}/logs/${dist}-error.log - fi - echo "${TIMENOW} DONE ${dist}" >> ${BASE_DIR}/logs/all.log - cd $BASE_DIR - echo "Updating Index" - python3 -u ./scripts/index.py ${BASE_DIR} -fi +echo Ended job $TIMESTAMP.. diff --git a/scripts/templates/base.html b/scripts/templates/base.html new file mode 100644 index 0000000..0451d87 --- /dev/null +++ b/scripts/templates/base.html @@ -0,0 +1,94 @@ + + + + + + PAWE.ME + + + + + + + + +
+

PAWE.ME

+

Simple mirroring & archiving server.

+ +
+
+
+

Mirroring List

+
+ {{ repos }} +
+
+
+

Additional Mirror

+ +
+ {{ repos_more }} + + + +
+
+
+

Server Info

+ +

Fill out this form to request additional mirroring.

+
+ +
+ + + + + diff --git a/scripts/templates/full.html b/scripts/templates/full.html new file mode 100644 index 0000000..3fd07e2 --- /dev/null +++ b/scripts/templates/full.html @@ -0,0 +1,6 @@ +
+

{{name}}

+

Last Updated: {{lastsync}}

+

Upstream: {{upstream}}

+
\ No newline at end of file diff --git a/scripts/templates/half.html b/scripts/templates/half.html new file mode 100644 index 0000000..0d807e6 --- /dev/null +++ b/scripts/templates/half.html @@ -0,0 +1,6 @@ +
+

{{name}}

+

Last Updated: {{lastsync}}

+

Upstream: {{upstream}}

+
\ No newline at end of file diff --git a/scripts/yq b/scripts/yq new file mode 100755 index 0000000..0e63a90 Binary files /dev/null and b/scripts/yq differ