From cc62e29a50433096e87788a790116601cf7c5934 Mon Sep 17 00:00:00 2001 From: Ray Kohler Date: Sun, 21 Aug 2011 19:17:19 -0400 Subject: [PATCH] Several changes: - Add monthly cron job to run update-usbid.sh, and conf.d file to disable it. - Download usb.ids file at build time. - PKGBUILD syntax cleanups. --- PKGBUILD | 33 ++++++++++++++++++--------------- usbutils.conf.d | 3 +++ usbutils.cron.monthly | 7 +++++++ 3 files changed, 28 insertions(+), 15 deletions(-) create mode 100644 usbutils.conf.d create mode 100755 usbutils.cron.monthly diff --git a/PKGBUILD b/PKGBUILD index a578fa6..534b8b4 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -3,8 +3,7 @@ # Contributor: Curtis Campbell pkgname=usbutils pkgver=004 -pkgrel=1 -_usb_ids_date=2011.08.17 +pkgrel=2 pkgdesc="USB Device Utilities" arch=(i686 x86_64) license=('GPL') @@ -13,31 +12,35 @@ makedepends=('wget') depends=('glibc' 'libusb') optdepends=('python2: for lsusb.py usage' 'coreutils: for lsusb.py usage') +backup=(etc/conf.d/usbutils) url="http://linux-usb.sourceforge.net/" -source=(http://www.kernel.org/pub/linux/utils/usb/$pkgname/$pkgname-$pkgver.tar.gz +source=(http://www.kernel.org/pub/linux/utils/usb/${pkgname}/${pkgname}-${pkgver}.tar.gz fix-python2.patch - usb.ids-${_usb_ids_date}) # from http://linux-usb.sourceforge.net/usb.ids + usbutils.conf.d + usbutils.cron.monthly) md5sums=('481e1de453bcabbd5f43125bb4df2ab7' '45766196895b4cc50b53cd56e1bbf3d1' - 'f04c301b5363ef618f0ec776deff3117') + 'e7134fa691dbe23923f1f125956fc0c1' + 'f9d12112f7e4ea8d532388df553dfd43') build() { - cd $srcdir/$pkgname-$pkgver + cd "${srcdir}/${pkgname}-${pkgver}" rm usb.ids - cp $srcdir/usb.ids-${_usb_ids_date} usb.ids + wget http://linux-usb.sourceforge.net/usb.ids # patch lsusb.py to use correct usb.ids file and python2 interpreter - patch -Np1 -i $srcdir/fix-python2.patch + patch -Np1 -i "${srcdir}/fix-python2.patch" ./configure --prefix=/usr --datadir=/usr/share/hwdata --disable-zlib make } package() { - cd $srcdir/$pkgname-$pkgver - make DESTDIR=$pkgdir install + cd "${srcdir}/${pkgname}-${pkgver}" + make DESTDIR="${pkgdir}" install # fix pkgconfig file - install -dm755 $pkgdir/usr/lib - mv $pkgdir/usr/share/pkgconfig $pkgdir/usr/lib/ + install -dm755 "${pkgdir}/usr/lib" + mv "${pkgdir}/usr/share/pkgconfig" "${pkgdir}/usr/lib/" + install -dm755 "${pkgdir}/etc/conf.d" + install -m644 "${srcdir}/usbutils.conf.d" "${pkgdir}/etc/conf.d/usbutils" + install -dm755 "${pkgdir}/etc/cron.monthly" + install -m755 "${srcdir}/usbutils.cron.monthly" "${pkgdir}/etc/cron.monthly/usbutils" } -md5sums=('481e1de453bcabbd5f43125bb4df2ab7' - '45766196895b4cc50b53cd56e1bbf3d1' - 'f04c301b5363ef618f0ec776deff3117') diff --git a/usbutils.conf.d b/usbutils.conf.d new file mode 100644 index 0000000..f33c22f --- /dev/null +++ b/usbutils.conf.d @@ -0,0 +1,3 @@ +# Settings for the usbutils package +# CRON_USB_IDS= : whether to enable the cron job that updates usb.ids +CRON_USB_IDS=1 diff --git a/usbutils.cron.monthly b/usbutils.cron.monthly new file mode 100755 index 0000000..7add1ef --- /dev/null +++ b/usbutils.cron.monthly @@ -0,0 +1,7 @@ +#!/bin/bash + +. /etc/conf.d/usbutils + +if (( $CRON_USB_IDS )); then + /usr/sbin/update-usbids.sh -q +fi -- 1.7.6