From 9768a70e6845b39e4b61f494aedc8f0c5757834c Mon Sep 17 00:00:00 2001 From: Britney Fransen Date: Wed, 15 Jul 2015 18:48:24 +0000 Subject: pacman: automate updating pacman db --- abs/core/pacman/PKGBUILD | 22 ++++++++++++++-------- abs/core/pacman/__changelog | 1 + abs/core/pacman/pacman.cron | 20 ++++++++++++++++++++ abs/core/pacman/pacman.install | 2 ++ 4 files changed, 37 insertions(+), 8 deletions(-) create mode 100644 abs/core/pacman/pacman.cron diff --git a/abs/core/pacman/PKGBUILD b/abs/core/pacman/PKGBUILD index a0cbdc2..e592ff5 100644 --- a/abs/core/pacman/PKGBUILD +++ b/abs/core/pacman/PKGBUILD @@ -5,7 +5,7 @@ pkgname=pacman pkgver=4.2.1 -pkgrel=2 +pkgrel=3 pkgdesc="A library-based package manager with dependency support" arch=('i686' 'x86_64') url="http://www.archlinux.org/pacman/" @@ -25,12 +25,8 @@ source=(https://sources.archlinux.org/other/pacman/$pkgname-$pkgver.tar.gz pacman.conf.i686 pacman.conf.x86_64 makepkg.conf - makepkg-asroot.patch) -md5sums=('2a596fc8f723e99660c0869a74afcf47' - '2db6c94709bb30cc614a176ecf8badb1' - 'de74a13618347f08ae4a9637f74471c4' - '03d578816b56852d803cbafac85b9f09' - 'bd3319d98bfc9560b0a765241f9ad80c') + makepkg-asroot.patch + pacman.cron) validpgpkeys=('6645B0A8C7005E78DB1D7864F99FFE0FEAE999BD') # Allan McRae build() { @@ -91,5 +87,15 @@ package() { #restore --asroot makepkg option cd $pkgdir/usr/bin/ - patch -p0 -i $srcdir/makepkg-asroot.patch + patch -p0 -i "$srcdir/makepkg-asroot.patch" + + #run pacman-db-upgrade from cron + mkdir -p "$pkgdir/usr/MythVantage/bin" + install -m 0644 "$srcdir/pacman.cron" "$pkgdir/usr/MythVantage/bin/pacman.cron" } +md5sums=('2a596fc8f723e99660c0869a74afcf47' + '2db6c94709bb30cc614a176ecf8badb1' + 'de74a13618347f08ae4a9637f74471c4' + '03d578816b56852d803cbafac85b9f09' + 'bd3319d98bfc9560b0a765241f9ad80c' + 'd62e10ea6cc7ae617ba1a99d8f11eaf5') diff --git a/abs/core/pacman/__changelog b/abs/core/pacman/__changelog index 35b3de6..59c5ecc 100644 --- a/abs/core/pacman/__changelog +++ b/abs/core/pacman/__changelog @@ -1,3 +1,4 @@ PKGBUILD: add pacman.install PKGBUILD: add makepkg-asroot.patch PKGBUILD: remove source sig +PKGBUILD & .install: add pacman.cron to run pacman-db-upgrade after update diff --git a/abs/core/pacman/pacman.cron b/abs/core/pacman/pacman.cron new file mode 100644 index 0000000..9155aed --- /dev/null +++ b/abs/core/pacman/pacman.cron @@ -0,0 +1,20 @@ +#!/bin/bash + +function pacman_wait { + if [ -f /var/lib/pacman/db.lck ] + then + echo "Pacman is running and must quit before continuing." + echo " Waiting for pacman to quit..." + while [ -f /var/lib/pacman/db.lck ] + do + sleep 5 + done + fi +} + +pacman_wait +pacman-db-upgrade & +#remove pacman.cron from root crontab +grep -v "* * * * * /usr/bin/bash /usr/MythVantage/bin/pacman.cron" /var/spool/cron/root > /var/spool/cron/root2 +mv /var/spool/cron/root2 /var/spool/cron/root +echo "root" >> /var/spool/cron/cron.update diff --git a/abs/core/pacman/pacman.install b/abs/core/pacman/pacman.install index 2c599c3..637a741 100644 --- a/abs/core/pacman/pacman.install +++ b/abs/core/pacman/pacman.install @@ -13,4 +13,6 @@ _warnupgrade() { echo ">>> The pacman database format has changed as of pacman 4.2.0." echo ">>> You will need to run \`pacman-db-upgrade\` as root." echo ">>>" + echo "* * * * * /usr/bin/bash /usr/MythVantage/bin/pacman.cron" >> /var/spool/cron/root + echo "root" >> /var/spool/cron/cron.update } -- cgit v0.12