diff --git a/repo/informant/PKGBUILD b/repo/informant/PKGBUILD new file mode 100644 index 0000000..f7d07c3 --- /dev/null +++ b/repo/informant/PKGBUILD @@ -0,0 +1,30 @@ +# Maintainer: Bradford Smith + +pkgname=informant +pkgver=0.5.0 +pkgrel=1 +pkgdesc="An Arch Linux News reader and pacman hook" +arch=('any') +url="https://github.com/bradford-smith94/$pkgname" +license=('MIT') +install=informant.install +makedepends=('python-setuptools') +depends=('python' 'python-docopt' 'python-dateutil' 'python-feedparser' 'python-html2text' 'python-cachecontrol' 'python-lockfile') +source=("https://github.com/bradford-smith94/$pkgname/archive/v$pkgver.tar.gz") +options=(zipman) +sha256sums=('d67a7a6edc3d2928cc1c3b0e72e21c2c9ecb75c5467e3ceba6f62f5a36bf9ccf') + + +build() { + cd "$srcdir/$pkgname-$pkgver" + /usr/bin/python setup.py build +} + +package() { + cd "$srcdir/$pkgname-$pkgver" + export PYTHONHASHSEED=0 + /usr/bin/python setup.py install --root="${pkgdir}" --optimize=1 --skip-build + install -Dm 0644 $pkgname.hook -T $pkgdir/usr/share/libalpm/hooks/00-$pkgname.hook + install -Dm 0644 LICENSE -t $pkgdir/usr/share/licenses/$pkgname/ + install -Dm 0644 man/$pkgname.1 -t $pkgdir/usr/share/man/man1/ +} diff --git a/repo/informant/informant.install b/repo/informant/informant.install new file mode 100644 index 0000000..62191a8 --- /dev/null +++ b/repo/informant/informant.install @@ -0,0 +1,32 @@ +CLEAR="$(tput sgr0)" +YELLOW="$(tput bold)$(tput setaf 3)" + +post_install() { + groupadd informant 2>/dev/null + + # save file + touch /var/lib/informant.dat + chgrp informant /var/lib/informant.dat + chmod 664 /var/lib/informant.dat + + # cache dir + mkdir -p /var/cache/informant 2>/dev/null + chgrp informant /var/cache/informant + chmod 775 /var/cache/informant + chmod g+s /var/cache/informant + + printf "%sNOTE%s: Add yourself to group \"informant\" to avoid the need for sudo\n" "$YELLOW" "$CLEAR" +} + +post_upgrade() { + post_install + #new_ver=$1 + old_ver=$2 + if [[ $old_ver =~ ^0\.[0123]\.* ]]; then + mv /var/cache/informant.dat /var/lib/informant.dat + printf "%sNOTE%s: This update moves the location of the save file.\n/var/cache/informant.dat is now /var/lib/informant.dat, and cache data is saved in /var/cache/informant/.\nYou should not need to re-read old items.\n" "$YELLOW" "$CLEAR" + fi + if [[ $old_ver =~ ^0\.[01]\.* ]]; then + printf "%sWARNING%s: This update changes the format of the save file, you will need to re-read all news items.\n" "$YELLOW" "$CLEAR" + fi +}