From 8c7340ae42a454a8d7a43e62c470be76b681c6d8 Mon Sep 17 00:00:00 2001 From: awg Date: Mon, 11 Mar 2019 09:27:25 +0700 Subject: system/bit-babbler: Update script. Signed-off-by: Willy Sudiarto Raharjo --- system/bit-babbler/README | 8 +++++- system/bit-babbler/README.Slackware | 43 +++++++++++++++++-------------- system/bit-babbler/bit-babbler.SlackBuild | 16 +++++++++--- system/bit-babbler/bit-babbler.info | 4 +-- system/bit-babbler/rc.seedd.new | 32 ++++++++++------------- system/bit-babbler/slack-desc | 2 +- 6 files changed, 59 insertions(+), 46 deletions(-) diff --git a/system/bit-babbler/README b/system/bit-babbler/README index 0359eb623e..83b01b51b0 100644 --- a/system/bit-babbler/README +++ b/system/bit-babbler/README @@ -2,4 +2,10 @@ The BitBabbler is a hardware True Random Number Generator (TRNG) manufactured by Voicetronix of Australia. This package installs the software necessary to control and test White and Black BB devices. -Please see README.Slackware for installation tips. +Socket control of BitBabbler devices is granted to group bit-babbler +by default. You can create it after installation like so: + groupadd bit-babbler +OR choose another suitable group (eg, wheel) when building: + GROUP="wheel" sh bit-babbler.SlackBuild + +Please see README.Slackware for additional installation tips. diff --git a/system/bit-babbler/README.Slackware b/system/bit-babbler/README.Slackware index d807cf93ed..a1b05b91eb 100644 --- a/system/bit-babbler/README.Slackware +++ b/system/bit-babbler/README.Slackware @@ -1,26 +1,29 @@ -To begin: groupadd "bit-babbler", or place a modified copy of -90-bit-babbler.rules (found in /lib/udev/rules.d/) into /etc/udev/rules.d -that uses an existing group (e.g., "wheel"). For consistency, change -socket-group in /etc/bit-babbler/seedd.conf to use the same group. +To have have BitBabbler device(s) begin feeding entropy to the kernel +at boot, add these lines to /etc/rc.d/rc.local: -To have your BitBabbler device(s) start feeding entropy to the -kernel at boot: + # Start BitBabbler TRNG. + if [ -x /etc/rc.d/rc.seedd ]; then + . /etc/rc.d/rc.seedd start + fi -1. Add the following lines to /etc/rc.d/rc.local: +It's a good idea to stop devices before capturing the entropy pool +on reboot/shutdown, so add these lines to /etc/rc.d/rc.local_shutdown: - # Start BitBabbler TRNG. - if [ -x /etc/rc.d/rc.seedd ]; then - . /etc/rc.d/rc.seedd start - fi + # Stop BitBabbler TRNG. + if [ -x /etc/rc.d/rc.seedd ]; then + . /etc/rc.d/rc.seedd stop + fi -2. Add the following to /etc/rc.d/rc.local_shutdown: +Additional changes to the operating configuration of BitBabbler +devices on boot can be set in /etc/bit-babbler/seedd.conf. - # Stop BitBabbler TRNG. - if [ -x /etc/rc.d/rc.seedd ]; then - . /etc/rc.d/rc.seedd stop - fi +Finally, ensure relevant files are executable: + chmod 755 /etc/rc.d/rc.local \ + /etc/rc.d/rc.local_shutdown \ + /etc/rc.d/rc.seedd + +N.B. If changes to the udev rules are needed, + cp /lib/udev/rules.d/90-bit-babbler.rules /etc/udev/rules.d +and modify the copy in /etc/udev/rules.d. eudev will only use the +copy in /etc/udev/rules.d if the filenames are the same. -3. Make sure the execute bit is set (chmod) for - /etc/rc.d/rc.local - /etc/rc.d/rc.local_shutdown - /etc/rc.d/rc.seedd diff --git a/system/bit-babbler/bit-babbler.SlackBuild b/system/bit-babbler/bit-babbler.SlackBuild index 6661ad3409..6f8f806e28 100644 --- a/system/bit-babbler/bit-babbler.SlackBuild +++ b/system/bit-babbler/bit-babbler.SlackBuild @@ -1,6 +1,6 @@ #!/bin/sh -# SlackBuild for bit-babbler, 5 March 2018 +# SlackBuild for bit-babbler, 6 March 2019 # awg # All rights reserved. # @@ -22,7 +22,7 @@ PRGNAM=bit-babbler VERSION=${VERSION:-0.8} -BUILD=${BUILD:-1} +BUILD=${BUILD:-2} TAG=${TAG:-_SBo} if [ -z "$ARCH" ]; then @@ -87,16 +87,24 @@ find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | gr find $PKG/usr/man -type f -exec gzip -9 {} \; for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done -mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION $PKG/usr/doc/$PRGNAM-$VERSION/examples cp -a debian/copyright debian/changelog debian/bit-babbler.NEWS doc/virtual_machines $PKG/usr/doc/$PRGNAM-$VERSION +cp -a doc/examples/*.pl $PKG/usr/doc/$PRGNAM-$VERSION/examples cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild # install sysctl setting, udev rules, and init script. install -D -m 0644 debian/bit-babbler-sysctl.conf $PKG/etc/sysctl.d/bit-babbler-sysctl.conf install -D -m 0644 debian/bit-babbler.udev $PKG/lib/udev/rules.d/90-bit-babbler.rules install -D -m 0644 $CWD/rc.seedd.new $PKG/etc/rc.d/rc.seedd.new +# set default socket control group in udev rules and seedd.conf for finished package. +if [ "${GROUP:=bit-babbler}" ]; then + sed -i -e "s/^\(GROUP=\"\)bit-babbler\(\"\)/\1$GROUP\2/" \ + -e "s/\(-m g:\)bit-babbler\(:rw\)/\1$GROUP\2/" $PKG/lib/udev/rules.d/90-bit-babbler.rules + sed -i -e "s/^\([[:blank:]]*socket-group[[:blank:]]*\)adm/\1$GROUP/" $PKG/etc/bit-babbler/seedd.conf + # group adm not a good default. +fi -# cut out unneeded files. +# remove trash. rm -rv $PKG/lib/systemd/ mkdir -p $PKG/install diff --git a/system/bit-babbler/bit-babbler.info b/system/bit-babbler/bit-babbler.info index d69abf65df..ec82ad4667 100644 --- a/system/bit-babbler/bit-babbler.info +++ b/system/bit-babbler/bit-babbler.info @@ -1,7 +1,7 @@ PRGNAM="bit-babbler" VERSION="0.8" -HOMEPAGE="http://bit-babbler.org/" -DOWNLOAD="http://bit-babbler.org/downloads/bit-babbler_0.8.tar.gz" +HOMEPAGE="http://bitbabbler.org/" +DOWNLOAD="http://bitbabbler.org/downloads/bit-babbler_0.8.tar.gz" MD5SUM="1def2a04c9f0783d8cc466b64b6b118e" DOWNLOAD_x86_64="" MD5SUM_x86_64="" diff --git a/system/bit-babbler/rc.seedd.new b/system/bit-babbler/rc.seedd.new index c7df6b2eff..6d0df20bc4 100644 --- a/system/bit-babbler/rc.seedd.new +++ b/system/bit-babbler/rc.seedd.new @@ -2,41 +2,37 @@ # # /etc/rc.d/rc.seedd: start and stop BitBabbler TRNG(s). -BBOPTS='--daemon --config=/etc/bit-babbler/seedd.conf' +BBOPTS="--daemon --config=/etc/bit-babbler/seedd.conf" +BBSOCKET=/run/bit-babbler/seedd.socket seedd_start() { - if [ -S /var/run/bit-babbler/seedd.socket ]; then + if [ -S $BBSOCKET ]; then echo 'seedd appears to be already running!' + exit 1 else - echo 'Checking for BitBabbler(s)...' - /usr/bin/seedd --scan + echo 'Checking for BitBabbler...' + /usr/bin/seedd --scan echo "Starting seedd: /usr/bin/seedd $BBOPTS" - /usr/bin/seedd $BBOPTS + /usr/bin/seedd $BBOPTS fi } seedd_stop() { echo 'Stopping seedd...' killall -w seedd - rm -f /var/run/bit-babbler/seedd.socket.lock + # daemon doesn't clean unused socket lock. + rm -f $BBSOCKET.lock } seedd_restart() { seedd_stop - sleep 2 + sleep 2 # ...take a breath... seedd_start } case "$1" in -'start') - seedd_start - ;; -'stop') - seedd_stop - ;; -'restart') - seedd_restart - ;; -*) - echo "usage $0 start|stop|restart" + 'start') seedd_start;; + 'restart') seedd_restart;; + 'stop') seedd_stop;; + *) echo "usage $0 start|restart|stop";; esac diff --git a/system/bit-babbler/slack-desc b/system/bit-babbler/slack-desc index 9653d63592..a68bd4b35b 100644 --- a/system/bit-babbler/slack-desc +++ b/system/bit-babbler/slack-desc @@ -12,7 +12,7 @@ bit-babbler: The BitBabbler is a hardware True Random Number Generator (TRNG) bit-babbler: manufactured by Voicetronix of Australia. This package installs the bit-babbler: software necessary to control and test White and Black BB devices. bit-babbler: -bit-babbler: http://bit-babbler.org/ +bit-babbler: http://bitbabbler.org/ bit-babbler: bit-babbler: bit-babbler: -- cgit v1.2.3