mirror of
https://codeberg.org/privacy1st/arch
synced 2024-12-23 01:16:04 +01:00
fix
This commit is contained in:
parent
27875f6030
commit
fe8fffe8c9
@ -2,7 +2,7 @@
|
||||
_pkgname=repo
|
||||
_reponame=arch-pkg
|
||||
pkgname="de-p1st-$_pkgname"
|
||||
pkgver=0.0.10
|
||||
pkgver=0.0.11
|
||||
pkgrel=1
|
||||
pkgdesc="Bash script to manage remote Arch Linux repository"
|
||||
arch=('any')
|
||||
|
@ -56,8 +56,8 @@ function sort_pkgname_pkgver(){
|
||||
|
||||
for PKG in ./*.pkg.tar.{xz,zst}; do
|
||||
get_pkginfo "$PKG" || { echo "get_pkginfo failed"; return 1; }
|
||||
get_pkgname "$PKGINFO" || { echo "get_pkgname failed"; return 1; }
|
||||
get_pkgver "$PKGINFO" || { echo "get_pkgver 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; }
|
||||
|
||||
echo "Creating file ./db/${PKGNAME} with content ${PKG} ..."
|
||||
mkdir -p "db/${PKGNAME}" || return $?
|
||||
@ -73,15 +73,27 @@ function get_pkginfo(){
|
||||
# return: 0 on success
|
||||
|
||||
if endswith "$1" ".pkg.tar.xz"; then
|
||||
PKGINFO=$(tar -xvf "$1" -O .PKGINFO) || { echo "tar failed"; return 1; }
|
||||
PKGINFO=$(tar -xf "$1" -O .PKGINFO) || { echo "tar failed"; return 1; }
|
||||
elif endswith "$1" ".pkg.tar.zst"; then
|
||||
PKGINFO=$(tar -I zstd -xvf "$1" -O .PKGINFO) || { echo "tar failed"; return 1; }
|
||||
PKGINFO=$(tar -I zstd -xf "$1" -O .PKGINFO) || { echo "tar failed"; return 1; }
|
||||
else
|
||||
echo "$1 does not seem to be a package!"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# get pkgname from $PKGINFO
|
||||
#
|
||||
function get_pkgname(){
|
||||
# return: 0 on success
|
||||
|
||||
# remove "pkgname = " as well as tailing whitespace characters
|
||||
local tmp
|
||||
tmp=$(echo "$PKGINFO" | grep '^pkname') || return $?
|
||||
PKGVER=$(echo "$tmp" | sed 's|^pkgname\s*=\s*||; s|\s*$||') || return $?
|
||||
}
|
||||
#
|
||||
# get pkgver from $PKGINFO
|
||||
#
|
||||
@ -93,17 +105,6 @@ function get_pkgver(){
|
||||
tmp=$(echo "$PKGINFO" | grep '^pkgver') || return $?
|
||||
PKGVER=$(echo "$tmp" | sed 's|^pkgver\s*=\s*||; s|\s*$||') || return $?
|
||||
}
|
||||
#
|
||||
# get pkgname from &PKGINFO
|
||||
#
|
||||
function get_pkgname(){
|
||||
# return: 0 on success
|
||||
|
||||
# remove "pkgname = " as well as tailing whitespace characters
|
||||
local tmp
|
||||
tmp=$(echo "$PKGINFO" | grep '^pkname') || return $?
|
||||
PKGVER=$(echo "$tmp" | sed 's|^pkgname\s*=\s*||; s|\s*$||') || return $?
|
||||
}
|
||||
|
||||
|
||||
# Inspired by: https://stackoverflow.com/questions/2172352/in-bash-how-can-i-check-if-a-string-begins-with-some-value/18558871#18558871
|
||||
|
Loading…
Reference in New Issue
Block a user