first commit

This commit is contained in:
Rodrigo de Avila 2023-08-09 09:59:38 -03:00
commit 86f367a89c
No known key found for this signature in database
3 changed files with 1262 additions and 0 deletions

1102
public/style.css Normal file

File diff suppressed because it is too large Load Diff

82
public/template.html Normal file
View File

@ -0,0 +1,82 @@
<!DOCTYPE html>
<html $if(lang)$ lang="$lang$" $endif$ dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>$if(title)$$title$$endif$</title>
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon-precomposed" href="images/apple-touch-icon.png">
$if(template_css)$
<link rel="stylesheet" href="$template_css$">
$else$
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.26.4/css/uikit.gradient.css">
$endif$
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/diversen/pandoc-uikit@master/style.css">
<script src="https://code.jquery.com/jquery-2.2.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/diversen/pandoc-uikit@master/scripts.js"></script>
<meta name="generator" content="pandoc-uikit" />
$for(author-meta)$
<meta name="author" content="$author-meta$" />
$endfor$
$if(date-meta)$
<meta name="date" content="$date-meta$" />
$endif$
<title>$if(title-prefix)$$title-prefix$ - $endif$$pagetitle$</title>
<style type="text/css">code{white-space: pre;}</style>
$if(quotes)$
<style type="text/css">q { quotes: "“" "”" "" ""; }</style>
$endif$
$if(highlighting-css)$
<style type="text/css">
$highlighting-css$
</style>
$endif$
$for(css)$
<link rel="stylesheet" href="$css$" $if(html5)$$else$type="text/css" $endif$/>
$endfor$
$if(math)$
$math$
$endif$
$for(header-includes)$
$header-includes$
$endfor$
</head>
<body>
<div class="uk-container uk-container-center uk-margin-top uk-margin-large-bottom">
$if(title)$
<div class="uk-grid" data-uk-grid-margin>
<div class="uk-width-1-1">
<h1 class="uk-heading-large">$title$</h1>
$if(date)$
<h3 class="uk-heading-large">$date$</p></h3>
$endif$
$for(author)$
<p class="uk-text-large">$author$</p>
$endfor$
</div>
</div>
$endif$
<div class="uk-grid" data-uk-grid-margin >
<div class="uk-width-1-1">
$if(abstract)$
<H1>$abstract-title$</H1>
$abstract$
$endif$
$body$
</div>
</div>
</div>
</body>
</html>

78
run.sh Executable file
View File

@ -0,0 +1,78 @@
#!/bin/bash
if ! command -v jq >/dev/null 2>&1; then
echo "The jq command is not available."
exit 1
fi
if ! command -v yq >/dev/null 2>&1; then
echo "The yq command is not available"
exit 1
fi
if ! command -v pandoc >/dev/null 2>&1; then
echo "The pandoc command is not available"
exit 1
fi
ORIGINAL_TIME=$(curl -fsSL "https://rsync.repo.almalinux.org/almalinux/TIME")
# Example: https://admin.fedoraproject.org/mirrormanager/propagation
# This diagram shows how many mirrors for the development branch have a repomd.xml file which is the
# same (respectively one day older, two days older or much older) version as on the
# master mirror.
# File names
FILES=$(curl -fsSL https://api.github.com/repos/AlmaLinux/mirrors/contents/mirrors.d | jq -r '.[].name')
echo "This service provides information about the status of the AlmaLinux mirrors. The report shows the time it takes for updates to propagate to the mirrors, as well as the number of mirrors that have been updated. This information can be used to identify mirrors that are not up to date, and to troubleshoot any problems with the mirror propagation process."
echo ""
echo "## Primary mirror info"
echo ""
echo "- Address: \`rsync.repo.almalinux.org\`"
echo "- Last update: \`$(date -ud "@$ORIGINAL_TIME" +"%Y-%m-%d %H:%M:%S") UTC\`"
echo ""
echo "## Mirror drift"
echo ""
echo "- Last report update: \`$(date -u +"%Y-%m-%d %H:%M:%S") UTC\`"
echo ""
echo "| Name | Sponsor | Status | URL |"
echo "|:--|:--|:--|:--|"
for FILE in $FILES; do
DETAILS=$(curl -fsSL "https://raw.githubusercontent.com/AlmaLinux/mirrors/master/mirrors.d/$FILE")
NAME=$(yq -r '.name' <<< "$DETAILS")
SPONSOR=$(yq -r '.sponsor' <<< "$DETAILS")
ADDRESS=$(yq -r '.address.https' <<< "$DETAILS")
if [ "$ADDRESS" == "null" ]; then
ADDRESS=$(yq -r '.address.http' <<< "$DETAILS")
fi
if [[ "${ADDRESS: -1}" != '/' ]]; then
ADDRESS="$ADDRESS/"
fi
TIME=$(curl -fsSL -m 3 "${ADDRESS}TIME" 2>/dev/null)
if [ $? -eq 0 ]; then
if [[ $TIME =~ ^[0-9]+$ ]]; then
DIFF=$(($ORIGINAL_TIME - $TIME))
if [ "$DIFF" -eq 0 ]; then
TIME="IN SYNC"
else
TIME="$(date -d "@$(($DIFF))" +"%Hh %Mmin") behind"
fi
else
TIME="Unavailable"
fi
else
TIME="Unavailable"
fi
echo "| $NAME | $SPONSOR | $TIME | [${ADDRESS}TIME](${ADDRESS}TIME) |"
done
# pandoc -f markdown -t html public/result.md > public/index.html
# pandoc --css=public/style.css --pagetitle="AlmaLinux mirror propagation report" --to=html5 -s -f markdown+smart public/result.md -o index.html