diff options
-rw-r--r-- | .SRCINFO | 12 | ||||
-rw-r--r-- | PKGBUILD | 44 | ||||
-rw-r--r-- | tuptime.install | 54 |
3 files changed, 69 insertions, 41 deletions
@@ -1,13 +1,13 @@ pkgbase = tuptime - pkgdesc = Report the historical and statistical running time of system - pkgver = 5.1.0 + pkgdesc = Historical and statistical system uptime reporting + pkgver = 5.2.2 pkgrel = 1 - url = https://github.com/rfrail3/tuptime + url = https://github.com/rfmoz/tuptime install = tuptime.install arch = any - license = GPL + license = GPL2 depends = python - source = tuptime-5.1.0.tar.gz::https://github.com/rfrail3/tuptime/archive/5.1.0.tar.gz - sha256sums = 8aa5adddba6ee8e1c70819b45de49637e20083bac92b608590bd71d2b7f7973c + source = https://github.com/rfmoz/tuptime/archive/5.2.2/tuptime-5.2.2.tar.gz + sha256sums = 2db03803f3d44c2d4a4bba424eb6cc392092c63a6a281c003adb9bdeb4c57f55 pkgname = tuptime @@ -1,28 +1,34 @@ -# Maintainer: Dennis Stengele <d.stengele (at) derintendant (dot) de> +# Maintainer: Allddd <allddd (at) proton (dot) me> pkgname=tuptime -pkgver=5.1.0 +pkgver=5.2.2 pkgrel=1 -pkgdesc="Report the historical and statistical running time of system" +pkgdesc='Historical and statistical system uptime reporting' arch=('any') -url="https://github.com/rfrail3/tuptime" -license=('GPL') -depends=( - 'python' - ) +url='https://github.com/rfmoz/tuptime' +license=('GPL2') +depends=('python') +source=("${url}/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz") +sha256sums=('2db03803f3d44c2d4a4bba424eb6cc392092c63a6a281c003adb9bdeb4c57f55') install=tuptime.install -source=("$pkgname-$pkgver.tar.gz::https://github.com/rfrail3/tuptime/archive/${pkgver}.tar.gz") -sha256sums=('8aa5adddba6ee8e1c70819b45de49637e20083bac92b608590bd71d2b7f7973c') + +prepare() { + cd ${pkgname}-${pkgver}/src/systemd + + sed -ni '1p' tuptime.sysusers +} package() { - cd "$srcdir/$pkgname-${pkgver}" + cd ${pkgname}-${pkgver} + + install -Dm755 "src/tuptime" "${pkgdir}/usr/bin/tuptime" + + install -Dm644 "src/systemd/tuptime.sysusers" "${pkgdir}/usr/lib/sysusers.d/tuptime.conf" - install -D -m755 "src/tuptime" "$pkgdir/usr/bin/tuptime" - install -D -m644 "src/systemd/tuptime.service" "$pkgdir/usr/lib/systemd/system/tuptime.service" - install -D -m644 "src/systemd/tuptime-cron.service" "$pkgdir/usr/lib/systemd/system/tuptime-cron.service" - install -D -m644 "src/systemd/tuptime-cron.timer" "$pkgdir/usr/lib/systemd/system/tuptime-cron.timer" - install -d -m755 "$pkgdir/usr/lib/systemd/system/timers.target.wants" - install -d -m755 "$pkgdir/usr/lib/systemd/system/multi-user.target.wants" + install -Dm644 "src/systemd/tuptime.service" "${pkgdir}/usr/lib/systemd/system/tuptime.service" + install -Dm644 "src/systemd/tuptime-sync.timer" "${pkgdir}/usr/lib/systemd/system/tuptime-sync.timer" + install -Dm644 "src/systemd/tuptime-sync.service" "${pkgdir}/usr/lib/systemd/system/tuptime-sync.service" - ln -s "$pkgdir/usr/lib/systemd/system/tuptime.service" "$pkgdir/usr/lib/systemd/system/multi-user.target.wants/tuptime.service" - ln -s "$pkgdir/usr/lib/systemd/system/tuptime-cron.timer" "$pkgdir/usr/lib/systemd/system/timers.target.wants/tuptime-cron.timer" + install -Dm644 "src/man/tuptime.1" "${pkgdir}/usr/share/man/man1/tuptime.1" + install -Dm644 "tuptime-manual.txt" "${pkgdir}/usr/share/doc/${pkgname}/tuptime-manual.txt" + install -Dm644 "LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" } diff --git a/tuptime.install b/tuptime.install index 0c579a27ba49..2611dbf0a885 100644 --- a/tuptime.install +++ b/tuptime.install @@ -1,21 +1,43 @@ post_install() { - if [ -d /var/lib/tuptime ]; then - chown --recursive _tuptime: /var/lib/tuptime - fi - - echo "" - echo "tuptime has been installed and the required units" - echo "have been enabled. To start tuptime now, run" - echo " # systemctl start tuptime-cron.timer" - echo " # systemctl start tuptime.service" - echo "" + echo -e '\nTo activate use: \nsystemctl enable --now tuptime.service tuptime-sync.timer \n' + + /usr/bin/systemd-sysusers + + local dir='/var/lib/tuptime' + if [ ! -d ${dir} ]; then + mkdir -p ${dir} + fi + + chown -R _tuptime:_tuptime ${dir} + chmod 0755 ${dir} } post_upgrade() { - if id tuptime > /dev/null 2>&1; then - usermod --login _tuptime tuptime - echo "" - echo "User tuptime has been renamed to _tuptime" - echo "" - fi + if id tuptime &>/dev/null; then + echo -e '\nUser "tuptime" was replaced with "_tuptime", you may remove it. \n' + fi + + local dir='/var/lib/tuptime' + if [ -d ${dir} ]; then + local owner=$(stat -c %U%G ${dir}) + + if [[ "${owner}" != "_tuptime_tuptime" ]]; then + chown -R _tuptime:_tuptime ${dir} + chmod 0755 ${dir} + fi + else + mkdir -p ${dir} + chown _tuptime:_tuptime ${dir} + chmod 0755 ${dir} + fi +} + +post_remove() { + if [ -d /var/lib/tuptime ]; then + rm -rf /var/lib/tuptime + fi + + if id _tuptime &>/dev/null; then + userdel -f _tuptime + fi } |