This commit is contained in:
Daniel Langbein 2021-04-25 17:45:53 +02:00
parent f5653bf40c
commit ad0b122f47
2 changed files with 16 additions and 7 deletions

View File

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

View File

@ -13,7 +13,13 @@ function add_to_db(){
sort_pkgname_pkgver || return $?
echo "For each package: Add latest version to database ..."
for PKGNAME in ./db/*; do
for PKGNAME in db/*; do
PKGNAME=$(basename "${PKGNAME}") # strip directory and suffix from filename
# TODO
# db/* -> results in filenames db/FILE1
# => remove prefix "db/" to get FILE1
# e.g. use filename / basename (!)
#
# get latest version for $PKGNAME
@ -21,13 +27,16 @@ function add_to_db(){
local LATEST
# pick one random version as starting point for the latest version
for PKGVER in ./db/"${PKGNAME}"/*; do
for PKGVER in db/"${PKGNAME}"/*; do
PKGVER=$(basename "${PKGVER}") # strip directory and suffix from filename
LATEST="$PKGVER"
break
done
local cmp
for PKGVER in ./db/"$PKGNAME"/*; do
for PKGVER in db/"$PKGNAME"/*; do
PKGVER=$(basename "${PKGVER}") # strip directory and suffix from filename
# compare the currently known latest version
# with the next version
cmp=$(vercmp "$LATEST" "$PKGVER") || return $?
@ -40,7 +49,7 @@ function add_to_db(){
#
# add latest version of PKGNAME to database
#
PKG=$(cat "./db/${PKGNAME}/${LATEST}") || return $?
PKG=$(cat "db/${PKGNAME}/${LATEST}") || return $?
repo-add --new "${REMOTE_DB_NAME}.db.tar.gz" "${PKG}" || return $?
true
@ -54,7 +63,7 @@ function add_to_db(){
function sort_pkgname_pkgver(){
echo "Sorting packages by package name and package version ..."
for PKG in ./*.pkg.tar.{xz,zst}; do
for PKG in *.pkg.tar.{xz,zst}; do
get_pkginfo "$PKG" || { echo "get_pkginfo failed"; return 1; }
get_pkgname "$PKGINFO" || { echo "get_pkgname failed"; echo "Content of PKGINFO: ${PKGINFO}"; return 1; }
get_pkgver "$PKGINFO" || { echo "get_pkgver failed"; echo "Content of PKGINFO: ${PKGINFO}"; return 1; }
@ -136,7 +145,7 @@ function generate_index(){
<ul>
' > index.html
for PKG in ./*.pkg.tar.{xz,zst}; do
for PKG in *.pkg.tar.{xz,zst}; do
echo "<li><a href=\"$PKG\">$PKG</a></li>" >> index.html;
done