mirror of
https://codeberg.org/privacy1st/arch
synced 2024-12-23 01:16:04 +01:00
add remote repository manager
This commit is contained in:
parent
805c0f6e14
commit
a97803454f
32
pkg/de-p1st-repo/PKGBUILD
Normal file
32
pkg/de-p1st-repo/PKGBUILD
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# Maintainer: Daniel Langbein <daniel@systemli.org>
|
||||||
|
_pkgname=repo
|
||||||
|
_reponame=arch-pkg
|
||||||
|
pkgname="de-p1st-$_pkgname"
|
||||||
|
pkgver=0.0.1
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc="Bash script to manage remote Arch Linux repository"
|
||||||
|
arch=('any')
|
||||||
|
url="https://git.privacy1st.de/langfingaz/${_reponame}"
|
||||||
|
license=('MIT')
|
||||||
|
groups=()
|
||||||
|
depends=('openssh' 'bash')
|
||||||
|
makedepends=()
|
||||||
|
optdepends=()
|
||||||
|
provides=()
|
||||||
|
conflicts=()
|
||||||
|
replaces=()
|
||||||
|
backup=()
|
||||||
|
options=()
|
||||||
|
install=
|
||||||
|
changelog=
|
||||||
|
source=("git+${url}.git")
|
||||||
|
noextract=()
|
||||||
|
sha256sums=('SKIP')
|
||||||
|
|
||||||
|
package() {
|
||||||
|
cd "${_reponame}/pkg/${pkgname}"
|
||||||
|
|
||||||
|
install -Dm0544 arch-repo-push-new.sh "$pkgdir"/usr/bin/arch-repo-push-new
|
||||||
|
install -Dm0544 arch-repo-receive-new.sh "$pkgdir"/usr/bin/arch-repo-receive-new
|
||||||
|
install -Dm0644 arch-repo.cfg "$pkgdir"/etc/de-p1st-repo/arch-repo.cfg
|
||||||
|
}
|
21
pkg/de-p1st-repo/arch-repo-push-new.sh
Normal file
21
pkg/de-p1st-repo/arch-repo-push-new.sh
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
souce /etc/de-p1st-repo/arch-repo.cfg || exit
|
||||||
|
|
||||||
|
|
||||||
|
cd "${LOCAL_PKG_DIR}" || exit
|
||||||
|
|
||||||
|
# get list of new packages, one package per line
|
||||||
|
rsync --ignore-existing --out-format="%n" --dry-run \
|
||||||
|
./*.pkg.tar.{xz,zst} "${REMOTE_SSH_HOST}":"${REMOTE_PKG_DIR}" > new-pkg.txt || exit
|
||||||
|
|
||||||
|
# transfer new packages using rsync
|
||||||
|
rsync --ignore-existing --progress --human-readable \
|
||||||
|
./*.pkg.tar.{xz,zst} "${REMOTE_SSH_HOST}":"${REMOTE_PKG_DIR}" || exit
|
||||||
|
|
||||||
|
# transfer new-pkg.txt
|
||||||
|
rsync --ignore-times --checksum --progress --human-readable \
|
||||||
|
new-pkg.txt "${REMOTE_SSH_HOST}":"${REMOTE_PKG_DIR}" || exit
|
||||||
|
|
||||||
|
# add each new package to database
|
||||||
|
ssh "${REMOTE_SSH_HOST}" "/home/yoda/arch-repo-receive-new.sh"
|
42
pkg/de-p1st-repo/arch-repo-receive-new.sh
Normal file
42
pkg/de-p1st-repo/arch-repo-receive-new.sh
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
souce /etc/de-p1st-repo/arch-repo.cfg || exit
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# add new packages to database
|
||||||
|
#
|
||||||
|
function add_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 '<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>privacy1st.de Arch Packages</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>privacy1st.de Arch Packages</h1>
|
||||||
|
' > index.html
|
||||||
|
|
||||||
|
for PKG in ./*.pkg.tar.{xz,zst}; do
|
||||||
|
echo "<p><a href=\"$PKG\">$PKG</a></p>" >> index.html;
|
||||||
|
done
|
||||||
|
|
||||||
|
echo '
|
||||||
|
</body>
|
||||||
|
</html>' >> index.html
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
cd "${REMOTE_PKG_DIR}" || exit
|
||||||
|
add_to_db
|
||||||
|
generate_index
|
4
pkg/de-p1st-repo/arch-repo.cfg
Normal file
4
pkg/de-p1st-repo/arch-repo.cfg
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
REMOTE_SSH_HOST=rootnas
|
||||||
|
LOCAL_PKG_DIR=/home/custompkgs
|
||||||
|
REMOTE_PKG_DIR=/mnt/data/live/arch-repo
|
||||||
|
REMOTE_DB_NAME=de-p1st
|
Loading…
Reference in New Issue
Block a user