diff options
Diffstat (limited to 'community/cdemu-daemon')
-rw-r--r-- | community/cdemu-daemon/PKGBUILD | 29 | ||||
-rw-r--r-- | community/cdemu-daemon/cdemu-daemon.install | 37 | ||||
-rw-r--r-- | community/cdemu-daemon/cdemu-daemon.service | 10 | ||||
-rw-r--r-- | community/cdemu-daemon/cdemud-dbus.conf | 24 | ||||
-rw-r--r-- | community/cdemu-daemon/cdemud.conf | 3 | ||||
-rw-r--r-- | community/cdemu-daemon/cdemud.rc | 25 |
6 files changed, 77 insertions, 51 deletions
diff --git a/community/cdemu-daemon/PKGBUILD b/community/cdemu-daemon/PKGBUILD index 4163ffbc1..4dec04ed8 100644 --- a/community/cdemu-daemon/PKGBUILD +++ b/community/cdemu-daemon/PKGBUILD @@ -1,11 +1,11 @@ -# $Id: PKGBUILD 68530 2012-03-26 10:24:56Z schiv $ +# $Id: PKGBUILD 73196 2012-07-03 19:16:11Z dreisner $ # Maintainer: Ray Rashif <schiv@archlinux.org> # Contributor: Mateusz Herych <heniekk@gmail.com> # Contributor: Charles Lindsay <charles@chaoslizard.org> pkgname=cdemu-daemon pkgver=1.5.0 -pkgrel=5 +pkgrel=6 pkgdesc="CD/DVD-ROM device emulator daemon" arch=('i686' 'x86_64') url="http://cdemu.sourceforge.net/" @@ -17,13 +17,14 @@ backup=('etc/conf.d/cdemud' 'etc/dbus-1/system.d/cdemud-dbus.conf') install=$pkgname.install source=("http://downloads.sourceforge.net/cdemu/$pkgname-$pkgver.tar.bz2" - 'cdemud.conf' - 'cdemud.rc' - 'system.patch') + 'cdemud.conf' 'cdemud.rc' 'system.patch' 'cdemu-daemon.service' + 'cdemud-dbus.conf') md5sums=('5ba780caa26d855942512b5b3c22405a' - '5d9e08255e45ca3c0987329b7920e206' - '4bbf42b69133e4e91c1be2c6825fa392' - '90a2516639c05737fa10a110a1cba467') + '6f31ad7a64d320cf4d6820432184070b' + 'cbc0937ef4ac50db3ce5cdbbe2e17a3b' + '90a2516639c05737fa10a110a1cba467' + 'be9a8f50da3f42129c0a0e3dea8cd56c' + 'afbf24bcdec382f58d95ba5de29bff71') build() { cd "$srcdir/$pkgname-$pkgver" @@ -42,13 +43,21 @@ package() { make DESTDIR="$pkgdir" install + # Custom dbus policy, tightening security to console and 'cdemu' group + install -m644 "$srcdir/cdemud-dbus.conf" \ + "$pkgdir/etc/dbus-1/system.d/cdemud-dbus.conf" + # the init stuff install -Dm644 "$srcdir/cdemud.conf" "$pkgdir/etc/conf.d/cdemud" install -Dm755 "$srcdir/cdemud.rc" "$pkgdir/etc/rc.d/cdemud" - - # for systemd install -d "$pkgdir/usr/lib/modules-load.d" echo "vhba" > "$pkgdir/usr/lib/modules-load.d/cdemu.conf" + + # for systemd + install -Dm644 "$srcdir/cdemu-daemon.service" \ + "$pkgdir/usr/lib/systemd/system/cdemu-daemon.service" + echo "SystemdService=cdemu-daemon.service" >> \ + "$pkgdir/usr/share/dbus-1/system-services/net.sf.cdemu.CDEMUD_Daemon.service" } # vim:set ts=2 sw=2 et: diff --git a/community/cdemu-daemon/cdemu-daemon.install b/community/cdemu-daemon/cdemu-daemon.install index 7a3e8a9f5..ba34d1ea0 100644 --- a/community/cdemu-daemon/cdemu-daemon.install +++ b/community/cdemu-daemon/cdemu-daemon.install @@ -1,20 +1,27 @@ -post_upgrade() { - echo " > The 'cdemu' group is now created by vhba-module" - echo " >> you may have to re-add yourself to the group and relogin" - echo - echo " > Daemon can be used in session mode as user, simply run 'cdemud'" - echo " >> you do not need to use the init script in this case" - echo " >> put your configuration in ~/.cdemud instead" +post_install () { + cat <<MSG + > The daemon is automatically started, but can be manually + started via /etc/rc.d/cdemud or cdemu-daemon.service. + > See /etc/conf.d/cdemud for further configuration. + + > Only users at the console or in the 'cdemu' group can + communicate with the system daemon or use a session + daemon. + + > If you want to output CD-Audio, write AUDIO_DRIVER=pulse or + AUDIO_DRIVER=alsa to ~/.cdemud and use "cdemu -b session" + to control a session daemon. +MSG + + return 0 } -post_install () { - echo " > Add yourself to the 'cdemu' group for non-root access" - echo " > Start the daemon as root with /etc/rc.d/cdemud" - echo " > See /etc/conf.d/cdemud for further configuration" - echo - echo " > Daemon can be used in session mode as user, simply run 'cdemud'" - echo " >> you do not need to use the init script in this case" - echo " >> put your configuration in ~/.cdemud instead" +post_upgrade () { + # Repeat install message due to policy changes + # Added on 2012-06-19, remove after a grace period + post_install + + return 0 } # vim:set ts=2 sw=2 et: diff --git a/community/cdemu-daemon/cdemu-daemon.service b/community/cdemu-daemon/cdemu-daemon.service new file mode 100644 index 000000000..9879a3e6f --- /dev/null +++ b/community/cdemu-daemon/cdemu-daemon.service @@ -0,0 +1,10 @@ +[Unit] +Description=CDEmu Daemon + +[Service] +Type=dbus +BusName=net.sf.cdemu.CDEMUD_Daemon +ExecStart=/usr/lib/cdemu-daemon/cdemu-daemon-system.sh + +[Install] +WantedBy=multi-user.target diff --git a/community/cdemu-daemon/cdemud-dbus.conf b/community/cdemu-daemon/cdemud-dbus.conf new file mode 100644 index 000000000..3043fe251 --- /dev/null +++ b/community/cdemu-daemon/cdemud-dbus.conf @@ -0,0 +1,24 @@ +<!DOCTYPE busconfig PUBLIC + "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" + "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> + +<busconfig> + <!-- Only root can own the CDEMUD_Daemon service on bus --> + <policy user="root"> + <allow own="net.sf.cdemu.CDEMUD_Daemon"/> + </policy> + <policy group="root"> + <allow own="net.sf.cdemu.CDEMUD_Daemon"/> + </policy> + + <!-- Allow users at the console to invoke methods on the interface --> + <policy at_console="true"> + <allow send_destination="net.sf.cdemu.CDEMUD_Daemon"/> + </policy> + + <!-- Allow users in the 'cdemu' group to invoke methods on the interface --> + <policy group="cdemu"> + <allow send_destination="net.sf.cdemu.CDEMUD_Daemon"/> + </policy> +</busconfig> + diff --git a/community/cdemu-daemon/cdemud.conf b/community/cdemu-daemon/cdemud.conf index 6f14947a6..1d8c55fe6 100644 --- a/community/cdemu-daemon/cdemud.conf +++ b/community/cdemu-daemon/cdemud.conf @@ -6,6 +6,3 @@ AUDIO_DRIVER=null # log file LOG_FILE=/var/log/cdemud.log - -# bus to use (system or session) -BUS="system" diff --git a/community/cdemu-daemon/cdemud.rc b/community/cdemu-daemon/cdemud.rc index e8dab1f08..09b9ec345 100644 --- a/community/cdemu-daemon/cdemud.rc +++ b/community/cdemu-daemon/cdemud.rc @@ -2,32 +2,11 @@ . /etc/rc.conf . /etc/rc.d/functions -. /etc/conf.d/cdemud case "$1" in start) - stat_busy "Loading vhba and loop modules" - modprobe vhba - if [ $? -ne 0 ]; then - stat_fail - else - stat_done - fi - - stat_busy "Waiting for /dev/vhba_ctl" - i=0 - until [ -c /dev/vhba_ctl -o $i -ge 10 ]; do - i=`expr $i + 1` - sleep 1 - done - if [ -c /dev/vhba_ctl ]; then - stat_done - else - stat_fail - fi - stat_busy "Starting cdemud" - cdemud --ctl-device=/dev/vhba_ctl --bus=$BUS --num-devices=$NUM_DEVICES --audio-driver=$AUDIO_DRIVER --logfile=$LOG_FILE & + /usr/lib/cdemu-daemon/cdemu-daemon-system.sh & if [ $? -ne 0 ]; then stat_fail else @@ -37,7 +16,7 @@ case "$1" in ;; stop) stat_busy "Stopping cdemud" - kill -9 `pidof cdemud` &>/dev/null && sleep 1 && rmmod vhba + kill `pidof cdemud` &>/dev/null if [ $? -ne 0 ]; then stat_fail else |