init and add mirror scripts
This commit is contained in:
commit
82601cda2f
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
/usr/local/bin/mirror-ubuntu && echo ubuntu synced
|
||||
/usr/local/bin/mirror-debian && echo debian synced
|
||||
/usr/local/bin/mirror-alpine && echo alpine synced
|
||||
sudo -u apt-mirror apt-mirror >/dev/null 2>&1 && echo misc repos synced
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
lockfile="/tmp/alpine-mirror.lock"
|
||||
if [ -z "$flock" ]; then
|
||||
exec env flock=1 flock -n $lockfile "$0" "$@"
|
||||
fi
|
||||
|
||||
src=rsync://rsync.alpinelinux.org/alpine/
|
||||
dest=/var/www/html/alpine/
|
||||
|
||||
mkdir -p "$dest"
|
||||
/usr/bin/rsync \
|
||||
--archive \
|
||||
--update \
|
||||
--hard-links \
|
||||
--delete \
|
||||
--delete-after \
|
||||
--delay-updates \
|
||||
--timeout=600 \
|
||||
--include latest-stable \
|
||||
--include v3.11 \
|
||||
--include v3.10 \
|
||||
--include edge \
|
||||
--include x86_64 \
|
||||
--exclude v2.* \
|
||||
--exclude v3.* \
|
||||
--exclude x86 \
|
||||
--exclude aarch64 \
|
||||
--exclude armhf \
|
||||
--exclude armv7 \
|
||||
--exclude ppc64le \
|
||||
--exclude s390x \
|
||||
"$src" "$dest"
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
debmirror \
|
||||
--keyring /usr/share/keyrings/debian-archive-keyring.gpg \
|
||||
-a amd64 \
|
||||
-s main,contrib,non-free \
|
||||
-h ftp.us.debian.org \
|
||||
-d buster,buster-updates,buster-backports,sid \
|
||||
-r /debian \
|
||||
--i18n \
|
||||
--getcontents \
|
||||
--method=rsync \
|
||||
--diff=mirror \
|
||||
"$@" \
|
||||
/var/www/html/debian
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
#!/bin/sh
|
||||
|
||||
output="/var/www/html/.stats"
|
||||
nic="ens18"
|
||||
|
||||
generate_index() {
|
||||
cat <<-EOF
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="cache-control" content=no-cache">
|
||||
<meta http-equiv="refresh" content="3000">
|
||||
<title>mirror.bhh.sh statistics</title>
|
||||
</head>
|
||||
<body>
|
||||
<table border="0">
|
||||
<tr><td><img src="summary.png" alt="summary"></td><td><img src="hours.png" alt="hours"></td></tr>
|
||||
<tr><td rowspan="2"><img src="days.png" alt="days"></td><td><img src="top10.png" alt="top10"></td></tr>
|
||||
<tr><td><img src="months.png" alt="months"></td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
EOF
|
||||
}
|
||||
|
||||
if [ ! -f "$output"/index.html ]; then
|
||||
mkdir -p $output
|
||||
generate_index > "$output"/index.html
|
||||
fi
|
||||
|
||||
for type in hours days months top10 summary hsummary vsummary; do
|
||||
vnstati --${type} -i $nic -o $output/${type}.png
|
||||
done
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh
|
||||
|
||||
debmirror \
|
||||
--keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg \
|
||||
-a amd64 \
|
||||
-s main,universe,multiverse,restricted \
|
||||
-h us.archive.ubuntu.com \
|
||||
-d bionic,bionic-updates,bionic-security,bionic-backports \
|
||||
-r /ubuntu \
|
||||
--i18n \
|
||||
--getcontents \
|
||||
--method=rsync \
|
||||
--diff=mirror \
|
||||
"$@" \
|
||||
/var/www/html/ubuntu
|
||||
|
||||
|
Loading…
Reference in New Issue