arch/pkg/de-p1st-repo/arch-repo-receive-new.sh
2021-04-22 11:46:18 +02:00

55 lines
934 B
Bash

#!/bin/bash
source /etc/de-p1st-repo/arch-repo.cfg || exit
#
# add new packages to database
#
function add_to_db(){
echo "Adding new packages to db ..."
mapfile -t PKGS < <(cat new-pkg.txt)
for PKG in "${PKGS[@]}"; do
repo-add -n "${REMOTE_DB_NAME}.db.tar.gz" "${PKG}" || exit
done
}
#
# generate index.html
#
function generate_index(){
echo "Generating index.html with links to all packages ..."
echo '<!DOCTYPE html>
<html>
<head>
<title>privacy1st.de Arch Packages</title>
</head>
<body>
<h1>privacy1st.de Arch Packages</h1>
<p>The sources can be found here: <a href="https://git.privacy1st.de/langfingaz/arch-pkg">https://git.privacy1st.de/langfingaz/arch-pkg</a></p>
<ul>
' > index.html
for PKG in ./*.pkg.tar.{xz,zst}; do
echo "<li><a href=\"$PKG\">$PKG</a></li>" >> index.html;
done
echo '
</ul>
</body>
</html>' >> index.html
}
cd "${REMOTE_PKG_DIR}" || exit
add_to_db
generate_index