system/bit-babbler: Update script.

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
awg 2019-03-11 09:27:25 +07:00 committed by Willy Sudiarto Raharjo
parent 9bc9b438ce
commit 8c7340ae42
No known key found for this signature in database
GPG Key ID: 887B8374D7333381
6 changed files with 59 additions and 46 deletions

View File

@ -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.

View File

@ -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

View File

@ -1,6 +1,6 @@
#!/bin/sh
# SlackBuild for bit-babbler, 5 March 2018
# SlackBuild for bit-babbler, 6 March 2019
# awg <awg@cock.li>
# 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

View File

@ -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=""

View File

@ -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

View File

@ -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: