diff options
Diffstat (limited to 'archPackagesUpdate')
-rwxr-xr-x | archPackagesUpdate | 166 |
1 files changed, 77 insertions, 89 deletions
diff --git a/archPackagesUpdate b/archPackagesUpdate index e98a264c6..c0493dcbc 100755 --- a/archPackagesUpdate +++ b/archPackagesUpdate @@ -141,7 +141,6 @@ done if ${aufRechenknecht} then - sudo pacman -Syy maxErr=0 # build packages @@ -167,6 +166,7 @@ then err[${i}]=$? else # everything else is built directly + sudo pacman -Sy makepkg -fcsr --noconfirm err[${i}]=$? fi @@ -177,106 +177,94 @@ then fi [ ${err[${i}]} -gt ${maxErr} ] && maxErr=${err[${i}]} -# upload packages if ${upload} && [ ${err[${i}]} -eq 0 ] then - scp ${tmpDir}/${paket}/${paket}-${vers}-${arch}.pkg.tar.xz paule@127.0.0.1:${pkgDir}/${arch}/ - [ "${arch}" == "any" ] && ssh paule@127.0.0.1 '\ - cd '${pkgDir}' - for dir in * - do - [ "${dir}" == "any" ] && continue - [ ! -d "${dir}" ] && continue - [ -e "'"${pkgDir}"'/${dir}/'"${paket}-${vers}-${arch}.pkg.tar.xz"'" ] && rm "'"${pkgDir}"'/${dir}/'"${paket}-${vers}-${arch}.pkg.tar.xz"'" - ln -s "'"${pkgDir}/${arch}/${paket}-${vers}-${arch}.pkg.tar.xz"'" "'"${pkgDir}"'/${dir}/" - done \ - ' + +# upload package and update db + cat "${tmpDir}/${paket}/${paket}-${vers}-${arch}.pkg.tar.xz" | + ssh paule@127.0.0.1 ' + + rmPaket() { + repo-remove archlinuxewe.db.tar.gz "$1" + rm "$1" + } + + addPaket() { + neu="$1" + for alt in $(ls ${neu%-*-*-*.pkg.tar.xz}-*.pkg.tar.xz) + do + [ "${alt}" == "${neu}" ] && continue + rmPaket "${alt}" + done + repo-add archlinuxewe.db.tar.gz "${neu}" + } + + cd '${pkgDir}/${arch}/' + if [ -e "'${paket}-${vers}-${arch}.pkg.tar.xz'" ] + then + rmPaket "'${paket}-${vers}-${arch}.pkg.tar.xz'" + fi + cat > '${paket}-${vers}-${arch}.pkg.tar.xz' + addPaket "'${paket}-${vers}-${arch}.pkg.tar.xz'" + + if [ "'${arch}'" == "any" ] + then + cd .. + for lArch in * + do + [ ! -d "${lArch}" ] && continue + [ "${lArch}" == "any" ] && continue + cd "${lArch}" + + if [ -e "'${paket}-${vers}-${arch}.pkg.tar.xz'" ] + then + rmPaket "'${paket}-${vers}-${arch}.pkg.tar.xz'" + fi + ln -s "'${pkgDir}/any/${paket}-${vers}-${arch}.pkg.tar.xz'" "'${paket}-${vers}-${arch}.pkg.tar.xz'" + addPaket "'${paket}-${vers}-${arch}.pkg.tar.xz'" + + cd .. + done + fi + ' fi done -# update packagedb +# check db if ${upload} then - for ((i=0; i<${#pakete[@]}; i++)) - do - [ ${err[${i}]} == 0 ] || continue - echo "${pakete[${i}]}" - echo "${verss[${i}]}" - echo "${archs[${i}]}" - done | \ - ssh paule@127.0.0.1 ' \ - cd "'"${pkgDir}"'" - while read paket - do - read vers || break - read oarch || break - -# delete old versions of packages - - for arch in * - do - [ ! -d "${arch}" ] && continue - [ ! "${arch}" == "any" ] && [ ! "${arch}" == "${oarch}" ] && continue - - for zuLoeschen in $( \ - ls ${arch}/${paket}-*-${oarch}.pkg.tar.xz 2> /dev/null | \ - grep -v "${arch}/${paket}-${vers}-${oarch}.pkg.tar.xz" \ - ) - do - repo-remove \ - "${arch}/archlinuxewe.db.tar.gz" \ - "${zuLoeschen}" - rm "${zuLoeschen}" - done - done + ssh paule@127.0.0.1 ' + cd '${pkgDir}' + err=0 -# update db - - for arch in * - do - [ ! -d "${arch}" ] && continue - [ "${arch}" == "any" ] && continue - [ ! "${oarch}" == "any" ] && [ ! "${arch}" == "${oarch}" ] && continue + for arch in * + do + [ ! -d "${arch}" ] && continue + [ "${arch}" == "any" ] && continue + + for warnungen in $( \ + ( + tar -Oxzf '${pkgDir}'/${arch}/archlinuxewe.db.tar.gz | \ + grep -A1 "^%FILENAME%\$" | \ + grep -v "^%FILENAME%\$" | \ + grep -v -- "^--\$" + ls '${pkgDir}'/${arch} | \ + grep "^.*\.pkg\.tar\.xz\$" + ) | \ + sort | \ + uniq -u + ) + do - repo-add \ - '${pkgDir}'/${arch}/archlinuxewe.db.tar.gz \ - '${pkgDir}'/${arch}/${paket}-${vers}-${oarch}.pkg.tar.xz + err=1 + >&2 echo "FEHLER: Paket '${pkgDir}'/${arch}/${warnungen} ist entweder nur in der Datenbank oder nur im Verzeichnisbaum vorhanden." - done + done - done + done -# check db - err=0 - - for arch in * - do - [ ! -d "${arch}" ] && continue - [ "${arch}" == "any" ] && continue - - for warnungen in $( \ - ( - tar -Oxzf '${pkgDir}'/${arch}/archlinuxewe.db.tar.gz | \ - grep -A1 "^%FILENAME%\$" | \ - grep -v "^%FILENAME%\$" | \ - grep -v -- "^--\$" - ls '${pkgDir}'/${arch} | \ - grep "^.*\.pkg\.tar\.xz\$" - ) | \ - sort | \ - uniq -u - ) - do - - err=1 - >&2 echo "FEHLER: Paket '${pkgDir}'/${arch}/${warnungen} ist entweder nur in der Datenbank oder nur im Verzeichnisbaum vorhanden." - - done - - done - - exit ${err} - ' + exit ${err} + ' fi if [ ${maxErr} -ne 0 ] |