diff options
author | Manuel Reimer | 2018-12-25 16:55:23 +0100 |
---|---|---|
committer | Manuel Reimer | 2018-12-25 16:55:23 +0100 |
commit | a4ecf2200d1a03df3dd13d3451d4eff0035e663e (patch) | |
tree | 558457f5ec451ab23dfa1a3183a0270357299206 | |
download | aur-a4ecf2200d1a03df3dd13d3451d4eff0035e663e.tar.gz |
Sync from VDR4Arch (https://github.com/VDR4Arch/vdr4arch/commit/40c5e4ae6a68f79dc39eef2e47c4de0745b354d3)
-rw-r--r-- | .SRCINFO | 21 | ||||
-rw-r--r-- | PKGBUILD | 28 | ||||
-rw-r--r-- | kodi-setwakeup.c | 27 | ||||
-rwxr-xr-x | setwakeup.sh | 13 |
4 files changed, 89 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..cb27c0ebeb34 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,21 @@ +# Generated by makepkg 5.1.1 +# Tue Dec 25 15:55:22 UTC 2018 +pkgbase = kodi-setwakeup + pkgdesc = Helper binary to call kodi setwakeup.sh with root privileges + pkgver = 1.0.1 + pkgrel = 1 + url = https://github.com/VDR4Arch/vdr4arch + arch = x86_64 + arch = i686 + arch = arm + arch = armv6h + arch = armv7h + license = GPL3 + depends = kodi-standalone-service + source = kodi-setwakeup.c + source = setwakeup.sh + md5sums = 45e179324952f5aba8980e8dad7e91be + md5sums = 333278349fb355c01323f42b8105f333 + +pkgname = kodi-setwakeup + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..ca6e99c7e182 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,28 @@ +# This PKGBUILD is part of the VDR4Arch project [https://github.com/vdr4arch] + +# Maintainer: Manuel Reimer <manuel.reimer@gmx.de> +pkgname=kodi-setwakeup +pkgver=1.0.1 +pkgrel=1 +pkgdesc="Helper binary to call kodi setwakeup.sh with root privileges" +url="https://github.com/VDR4Arch/vdr4arch" +arch=('x86_64' 'i686' 'arm' 'armv6h' 'armv7h') +license=('GPL3') +depends=('kodi-standalone-service') +makedepends=() +source=('kodi-setwakeup.c' + 'setwakeup.sh') +md5sums=('45e179324952f5aba8980e8dad7e91be' + '333278349fb355c01323f42b8105f333') + +build() { + gcc -o kodi-setwakeup kodi-setwakeup.c +} + +package() { + install -Dm754 kodi-setwakeup "$pkgdir/usr/bin/kodi-setwakeup" + chgrp 420 "$pkgdir/usr/bin/kodi-setwakeup" + chmod u+s "$pkgdir/usr/bin/kodi-setwakeup" + + install -Dm755 setwakeup.sh "$pkgdir/usr/lib/kodi/bin/setwakeup.sh" +} diff --git a/kodi-setwakeup.c b/kodi-setwakeup.c new file mode 100644 index 000000000000..d9bc678cc73a --- /dev/null +++ b/kodi-setwakeup.c @@ -0,0 +1,27 @@ +// +// Simple shutdown-wrapper with focus on security +// +// Version: 1.0 Thu Jul 9 16:28:42 CEST 2009 +// +// Author: Manuel Reimer <manuel.reimer@gmx.de> +// + +#define REAL_PATH "/usr/lib/kodi/bin/setwakeup.sh" + +#include <unistd.h> + +int main(int argc, char *argv[]){ + // We pass a secure environment to the called script. + char *const envParms[4] = { + "PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin", + "HOME=/root", + "TERM=linux", + NULL + }; + // Drop whatever working directory the caller set for us and go HOME + chdir("/root"); + // Get root and execute setwakeup.sh + setuid(0); + execve(REAL_PATH, argv, envParms); + return 0; +} diff --git a/setwakeup.sh b/setwakeup.sh new file mode 100755 index 000000000000..4a66b4389016 --- /dev/null +++ b/setwakeup.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +#Sync back system time to hardware time (Maybe VDR has changed it) +hwclock --systohc --utc + +#Unset previous timer +echo '0' > /sys/class/rtc/rtc0/wakealarm + +#Set new timer +echo "$1" > /sys/class/rtc/rtc0/wakealarm + +#Log success to journal +echo "Set wakeup time to timestamp $1" | logger -t kodi-setwakeup |