This commit is contained in:
Daniel Langbein 2021-04-22 11:24:04 +02:00
parent 89db13eb8f
commit a6b68fe752
3 changed files with 12 additions and 2 deletions

View File

@ -2,7 +2,7 @@
_pkgname=repo _pkgname=repo
_reponame=arch-pkg _reponame=arch-pkg
pkgname="de-p1st-$_pkgname" pkgname="de-p1st-$_pkgname"
pkgver=0.0.3 pkgver=0.0.4
pkgrel=1 pkgrel=1
pkgdesc="Bash script to manage remote Arch Linux repository" pkgdesc="Bash script to manage remote Arch Linux repository"
arch=('any') arch=('any')

View File

@ -3,6 +3,7 @@
source /etc/de-p1st-repo/arch-repo.cfg || exit source /etc/de-p1st-repo/arch-repo.cfg || exit
cd "${LOCAL_PKG_DIR}" || exit cd "${LOCAL_PKG_DIR}" || exit
# get list of new packages, one package per line # get list of new packages, one package per line
@ -13,9 +14,11 @@ rsync --ignore-existing --out-format="%n" --dry-run \
rsync --ignore-existing --progress --human-readable \ rsync --ignore-existing --progress --human-readable \
./*.pkg.tar.{xz,zst} "${REMOTE_SSH_HOST}":"${REMOTE_PKG_DIR}" || exit ./*.pkg.tar.{xz,zst} "${REMOTE_SSH_HOST}":"${REMOTE_PKG_DIR}" || exit
# transfer new-pkg.txt # transfer new-pkg.txt
rsync --ignore-times --checksum --progress --human-readable \ rsync --ignore-times --checksum --progress --human-readable \
new-pkg.txt "${REMOTE_SSH_HOST}":"${REMOTE_PKG_DIR}" || exit new-pkg.txt "${REMOTE_SSH_HOST}":"${REMOTE_PKG_DIR}" || exit
# add each new package to database # add each new package to database
ssh "${REMOTE_SSH_HOST}" "/home/yoda/arch-repo-receive-new.sh" ssh "${REMOTE_SSH_HOST}" "/usr/bin/arch-repo-receive-new"

View File

@ -3,10 +3,13 @@
source /etc/de-p1st-repo/arch-repo.cfg || exit source /etc/de-p1st-repo/arch-repo.cfg || exit
# #
# add new packages to database # add new packages to database
# #
function add_to_db(){ function add_to_db(){
echo "Adding new packages to db ..."
mapfile -t PKGS < <(cat new-pkg.txt) mapfile -t PKGS < <(cat new-pkg.txt)
for PKG in "${PKGS[@]}"; do for PKG in "${PKGS[@]}"; do
repo-add -n "${REMOTE_DB_NAME}.db.tar.gz" "${PKG}" || exit repo-add -n "${REMOTE_DB_NAME}.db.tar.gz" "${PKG}" || exit
@ -14,10 +17,13 @@ function add_to_db(){
} }
# #
# generate index.html # generate index.html
# #
function generate_index(){ function generate_index(){
echo "Generating index.html with links to all packages ..."
echo '<!DOCTYPE html> echo '<!DOCTYPE html>
<html> <html>
<head> <head>
@ -37,6 +43,7 @@ function generate_index(){
} }
cd "${REMOTE_PKG_DIR}" || exit cd "${REMOTE_PKG_DIR}" || exit
add_to_db add_to_db
generate_index generate_index