mirror of
https://github.com/arcan1s/dotfiles.git
synced 2025-04-25 00:17:17 +00:00
added repo-check script
This commit is contained in:
parent
5b08a959a8
commit
fc8a8f7267
48
repo-check
Executable file
48
repo-check
Executable file
@ -0,0 +1,48 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# variables
|
||||||
|
REPODIR="${HOME}/arch/repo"
|
||||||
|
STAGINGDIR="${HOME}/arch/staging/"
|
||||||
|
|
||||||
|
# functions
|
||||||
|
func_update() {
|
||||||
|
PKGNAME="$1"
|
||||||
|
REPODIR="$2"
|
||||||
|
|
||||||
|
echo "=> Checking ${PKGNAME}"
|
||||||
|
echo ${PKGNAME} | /usr/bin/grep -q "\-svn\|\-git\|\-bzr" && return 1;
|
||||||
|
/usr/bin/yaourt -G aur/${PKGNAME}
|
||||||
|
[ -d ${PKGNAME} ] || return 1;
|
||||||
|
|
||||||
|
cd ${PKGNAME}
|
||||||
|
PKGVER=$(/usr/bin/basename $(/usr/bin/find ${REPODIR} -name "${PKGNAME}*.pkg.tar.xz") | /usr/bin/awk -F '-' '{printf("%s-%s", $(NF-2), $(NF-1));}')
|
||||||
|
_NEWVER=$(/usr/bin/grep ^pkgver= PKGBUILD | /usr/bin/sed 's/^pkgver=//' | /usr/bin/tr -d \"\|\')
|
||||||
|
_NEWREL=$(/usr/bin/grep ^pkgrel= PKGBUILD | /usr/bin/sed 's/^pkgrel=//' | /usr/bin/tr -d \"\|\')
|
||||||
|
NEWVER="${_NEWVER}-${_NEWREL}"
|
||||||
|
cd ../
|
||||||
|
if [ "${PKGVER}" = "${NEWVER}" ]; then
|
||||||
|
/usr/bin/rm -rf ${PKGNAME}
|
||||||
|
echo "${PKGNAME} is up-to-date"
|
||||||
|
else
|
||||||
|
echo "${PKGNAME} is out-of-date"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# get list
|
||||||
|
/usr/bin/rm -f "${STAGINGDIR}/pkglist"
|
||||||
|
cd "${REPODIR}/i686"
|
||||||
|
/usr/bin/find * -name "*.pkg.tar.xz" >> ${STAGINGDIR}/pkglist
|
||||||
|
|
||||||
|
# work block
|
||||||
|
cd "${STAGINGDIR}"
|
||||||
|
for PACKAGE in $(cat pkglist); do
|
||||||
|
PKGNAME=$(echo ${PACKAGE} | /usr/bin/awk -F '-' '{for(i=1; i<=NF-3;i++) {printf("%s-", $i);}}' | /usr/bin/sed 's/.$//')
|
||||||
|
func_update ${PKGNAME} ${REPODIR}
|
||||||
|
done
|
||||||
|
/usr/bin/rm -f "${STAGINGDIR}/pkglist"
|
||||||
|
|
||||||
|
# check for updates
|
||||||
|
cd "${STAGINGDIR}"
|
||||||
|
if [[ $(find * -type d | wc -l) > 0 ]]; then
|
||||||
|
repo-update
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user