diff options
Diffstat (limited to 'source/a')
-rwxr-xr-x | source/a/etc/etc.SlackBuild | 2 | ||||
-rw-r--r-- | source/a/etc/group.new | 1 | ||||
-rw-r--r-- | source/a/etc/passwd.new | 1 | ||||
-rw-r--r-- | source/a/etc/shadow.new | 1 | ||||
-rwxr-xr-x | source/a/genpower/genpower.SlackBuild | 112 | ||||
-rw-r--r-- | source/a/genpower/genpower.halt.diff | 32 | ||||
-rw-r--r-- | source/a/genpower/genpower.var.diff | 34 | ||||
-rw-r--r-- | source/a/genpower/slack-desc | 19 | ||||
-rw-r--r-- | source/a/nut/doinst.sh | 30 | ||||
-rwxr-xr-x | source/a/nut/nut.SlackBuild | 196 | ||||
-rw-r--r-- | source/a/nut/rc.nut-drvctl | 32 | ||||
-rw-r--r-- | source/a/nut/rc.nut-upsd | 41 | ||||
-rw-r--r-- | source/a/nut/rc.nut-upsmon | 46 | ||||
-rw-r--r-- | source/a/nut/slack-desc | 19 | ||||
-rw-r--r-- | source/a/sysvinit-scripts/scripts/rc.6 | 38 | ||||
-rw-r--r-- | source/a/sysvinit-scripts/scripts/rc.M | 32 | ||||
-rwxr-xr-x | source/a/sysvinit-scripts/sysvinit-scripts.SlackBuild | 2 |
17 files changed, 412 insertions, 226 deletions
diff --git a/source/a/etc/etc.SlackBuild b/source/a/etc/etc.SlackBuild index 4dc6e0d59..70455db93 100755 --- a/source/a/etc/etc.SlackBuild +++ b/source/a/etc/etc.SlackBuild @@ -24,7 +24,7 @@ cd $(dirname $0) ; CWD=$(pwd) PKGNAM=etc VERSION=15.1 -BUILD=${BUILD:-9} +BUILD=${BUILD:-10} # Automatically determine the architecture we're building on: if [ -z "$ARCH" ]; then diff --git a/source/a/etc/group.new b/source/a/etc/group.new index d4a516c68..2bcaf4ea9 100644 --- a/source/a/etc/group.new +++ b/source/a/etc/group.new @@ -59,6 +59,7 @@ nogroup:x:99: users:x:100: console:x:101: avahi:x:214: +nut:x:218: colord:x:303: nm-openvpn:x:320: ldap:x:330: diff --git a/source/a/etc/passwd.new b/source/a/etc/passwd.new index e926f2f4a..f7e8e0e26 100644 --- a/source/a/etc/passwd.new +++ b/source/a/etc/passwd.new @@ -37,6 +37,7 @@ dovenull:x:95:95:User for Dovecot login processing:/dev/null:/bin/false proftpd:x:97:97:User for ProFTPD:/:/bin/false nobody:x:99:99:nobody:/:/bin/false avahi:x:214:214:User for avahi:/dev/null:/bin/false +nut:x:218:218:User for NUT:/dev/null:/bin/false colord:x:303:303:User for colord:/var/lib/colord:/bin/false nm-openvpn:x:320:320:User for NetworkManager-openvpn:/var/lib/openvpn/chroot:/bin/false ldap:x:330:330:OpenLDAP server:/var/lib/openldap:/bin/false diff --git a/source/a/etc/shadow.new b/source/a/etc/shadow.new index f2acecf78..3cbc04070 100644 --- a/source/a/etc/shadow.new +++ b/source/a/etc/shadow.new @@ -37,6 +37,7 @@ dovenull:*:9797:0::::: proftpd:*:9797:0::::: nobody:*:9797:0::::: avahi:*:9797:0::::: +nut:*:9797:0::::: colord:*:9797:0::::: nm-openvpn:*:9797:0::::: ldap:*:9797:0::::: diff --git a/source/a/genpower/genpower.SlackBuild b/source/a/genpower/genpower.SlackBuild deleted file mode 100755 index bfcdf23c1..000000000 --- a/source/a/genpower/genpower.SlackBuild +++ /dev/null @@ -1,112 +0,0 @@ -#!/bin/bash - -# Copyright 2008, 2009, 2010, 2018 Patrick J. Volkerding, Sebeka, Minnesota, USA -# All rights reserved. -# -# Redistribution and use of this script, with or without modification, is -# permitted provided that the following conditions are met: -# -# 1. Redistributions of this script must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -cd $(dirname $0) ; CWD=$(pwd) - -PKGNAM=genpower -VERSION=${VERSION:-1.0.5} -BUILD=${BUILD:-5} - -# Automatically determine the architecture we're building on: -if [ -z "$ARCH" ]; then - case "$( uname -m )" in - i?86) export ARCH=i586 ;; - arm*) export ARCH=arm ;; - # Unless $ARCH is already set, use uname -m for all other archs: - *) export ARCH=$( uname -m ) ;; - esac -fi - -# If the variable PRINT_PACKAGE_NAME is set, then this script will report what -# the name of the created package would be, and then exit. This information -# could be useful to other scripts. -if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then - echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz" - exit 0 -fi - -TMP=${TMP:-/tmp} -PKG=$TMP/package-genpower - -rm -rf $PKG -mkdir -p $TMP $PKG - -cd $TMP -rm -rf genpower-$VERSION -tar xvf $CWD/genpower-$VERSION.tar.gz || exit 1 -cd genpower-$VERSION || exit 1 - -chown -R root:root . -find . \ - \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ - -exec chmod 755 {} \+ -o \ - \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ - -exec chmod 644 {} \+ - -find . -type d -name CVS -depth -exec rm -rf {} \+ - -zcat $CWD/genpower.var.diff.gz | patch -p1 -E --verbose || exit 1 -zcat $CWD/genpower.halt.diff.gz | patch -p1 --verbose || exit 1 - -make -j4 || make || exit 1 -mkdir -p $PKG/sbin -cat genpowerd > $PKG/sbin/genpowerd -cat gentest > $PKG/sbin/gentest -cat genpowerfail > $PKG/sbin/genpowerfail -mkdir -p $PKG/etc -cat genpowerd.conf > $PKG/etc/genpowerd.conf.new -chmod 755 $PKG/sbin/* - -find $PKG | xargs file | grep -e "executable" -e "shared object" \ - | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null - -mkdir -p $PKG/usr/man/man8 -cat genpowerd.8 | gzip -9c > $PKG/usr/man/man8/genpowerd.8.gz -cat gentest.8 | gzip -9c > $PKG/usr/man/man8/gentest.8.gz - -mkdir -p $PKG/usr/doc/genpower-$VERSION -cp -a \ - COPYING Change.Log README TODO genpower.docs cables \ - $PKG/usr/doc/genpower-$VERSION - -mkdir -p $PKG/install -cat << EOF > $PKG/install/doinst.sh -#!/bin/bash -config() { - NEW="\$1" - OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)" - # If there's no config file by that name, mv it over: - if [ ! -r \$OLD ]; then - mv \$NEW \$OLD - elif [ "\$(cat \$OLD | md5sum)" = "\$(cat \$NEW | md5sum)" ]; then # toss the redundant copy - rm \$NEW - fi - # Otherwise, we leave the .new copy for the admin to consider... -} -config etc/genpowerd.conf.new -EOF -cat $CWD/slack-desc > $PKG/install/slack-desc - -# Build the package: -cd $PKG -/sbin/makepkg -l y -c n $TMP/genpower-$VERSION-$ARCH-$BUILD.txz - diff --git a/source/a/genpower/genpower.halt.diff b/source/a/genpower/genpower.halt.diff deleted file mode 100644 index 05c6a23f1..000000000 --- a/source/a/genpower/genpower.halt.diff +++ /dev/null @@ -1,32 +0,0 @@ ---- ./genpowerfail.orig 2008-12-02 17:49:36.000000000 -0600 -+++ ./genpowerfail 2008-12-02 18:22:37.000000000 -0600 -@@ -36,23 +36,23 @@ - stats=`head -1 $statpath` - case "$stats" in - FAIL) # Power is down -- shutdown -r +2 "THE POWER IS DOWN! SHUTTING DOWN SYSTEM! PLEASE LOG OFF NOW!" < /dev/console & -+ shutdown -h +2 "THE POWER IS DOWN! SHUTTING DOWN SYSTEM! PLEASE LOG OFF NOW!" < /dev/console & - ;; - SCRAM) # Battery is low -- shutdown -r now "THE POWER IS DOWN! BATTERY POWER IS LOW! EMERGENCY SHUTDOWN!" < /dev/console & -+ shutdown -h now "THE POWER IS DOWN! BATTERY POWER IS LOW! EMERGENCY SHUTDOWN!" < /dev/console & - ;; - CABLE) # Possible bad cable -- shutdown -r +1 "POSSIBLE BAD CABLE! SHUTTING DOWN SYSTEM! PLEASE LOG OFF NOW!" < /dev/console & -+ shutdown -h +1 "POSSIBLE BAD CABLE! SHUTTING DOWN SYSTEM! PLEASE LOG OFF NOW!" < /dev/console & - ;; - *) # Unknown message, assume power is down -- shutdown -r +2 "THE POWER IS DOWN! SHUTTING DOWN SYSTEM! PLEASE LOG OFF NOW!" < /dev/console & -+ shutdown -h +2 "THE POWER IS DOWN! SHUTTING DOWN SYSTEM! PLEASE LOG OFF NOW!" < /dev/console & - ;; - - esac - else -- # genowerfail called, and upsstatus dosen't exist. -+ # genpowerfail called, and upsstatus dosen't exist. - # Assume user is using powerd, and shutdown. -- shutdown -r +2 "THE POWER IS DOWN! SHUTTING DOWN SYSTEM! PLEASE LOG OFF NOW!" < /dev/console & -+ shutdown -h +2 "THE POWER IS DOWN! SHUTTING DOWN SYSTEM! PLEASE LOG OFF NOW!" < /dev/console & - - fi - ;; diff --git a/source/a/genpower/genpower.var.diff b/source/a/genpower/genpower.var.diff deleted file mode 100644 index fa3c9e998..000000000 --- a/source/a/genpower/genpower.var.diff +++ /dev/null @@ -1,34 +0,0 @@ ---- ./genpowerfail.orig Wed Apr 10 18:25:07 2002 -+++ ./genpowerfail Wed Apr 10 19:14:27 2002 -@@ -6,19 +6,19 @@ - # This script is also being run when the power comes - # up again (if it does in time!) - # --# Version: /etc/genpowerfail 1.0.1 -+# Version: /sbin/genpowerfail 1.0.1 - # - # Author: Tom Webster <webster@kaiwan.com> - # - - # Set the path. --PATH=/sbin:/etc:/bin:/usr/bin -+PATH=/sbin:/bin:/usr/bin:/usr/sbin - - # Set location of upsstatus file - statpath="/etc/upsstatus" - - # Set location of file containing PID of running shutdowns --spidpath="/etc/shutdownpid" -+spidpath="/var/run/shutdownpid" - - # See what happened. - case "$1" in -@@ -63,7 +63,7 @@ - shutdown -c "THE POWER IS BACK" - ;; - *) -- echo "Usage: /etc/genpowerfail {start|stop}" -+ echo "Usage: /sbin/genpowerfail {start|stop}" - exit 1 - ;; - esac diff --git a/source/a/genpower/slack-desc b/source/a/genpower/slack-desc deleted file mode 100644 index 242614456..000000000 --- a/source/a/genpower/slack-desc +++ /dev/null @@ -1,19 +0,0 @@ -# HOW TO EDIT THIS FILE: -# The "handy ruler" below makes it easier to edit a package description. Line -# up the first '|' above the ':' following the base package name, and the '|' on -# the right side marks the last column you can put a character in. You must make -# exactly 11 lines for the formatting to be correct. It's also customary to -# leave one space after the ':'. - - |-----handy-ruler------------------------------------------------------| -genpower: genpower (UPS monitoring daemon) -genpower: -genpower: The genpower daemon, genpowerd, will monitor the status of a serial -genpower: line connected to a UPS (Uninterruptible Power Supply). If a power -genpower: failure is detected, genpowerd will notify the system to take the -genpower: needed steps to react to the condition of the UPS. This may include -genpower: shutting the system down, or canceling a pending shutdown if the -genpower: power is restored. -genpower: -genpower: -genpower: diff --git a/source/a/nut/doinst.sh b/source/a/nut/doinst.sh new file mode 100644 index 000000000..393069f41 --- /dev/null +++ b/source/a/nut/doinst.sh @@ -0,0 +1,30 @@ +config() { + NEW="$1" + OLD="`dirname $NEW`/`basename $NEW .new`" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + config $NEW +} + +preserve_perms etc/rc.d/rc.nut-drvctl.new +preserve_perms etc/rc.d/rc.nut-upsd.new +preserve_perms etc/rc.d/rc.nut-upsmon.new + +for file in etc/nut/*.new ; do + config $file +done diff --git a/source/a/nut/nut.SlackBuild b/source/a/nut/nut.SlackBuild new file mode 100755 index 000000000..b8c6cd520 --- /dev/null +++ b/source/a/nut/nut.SlackBuild @@ -0,0 +1,196 @@ +#!/bin/bash + +# Copyright 2010 V'yacheslav Stetskevych <slava18 dont_spam_me gmail com> +# Copyright 2024 Patrick J. Volkerding, Sebeka, Minnesota, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +cd $(dirname $0) ; CWD=$(pwd) + +PKGNAM=nut +VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)} +BUILD=${BUILD:-1} + +# Automatically determine the architecture we're building on: +if [ -z "$ARCH" ]; then + case "$(uname -m)" in + i?86) ARCH=i586 ;; + arm*) readelf /usr/bin/file -A | egrep -q "Tag_CPU.*[4,5]" && ARCH=arm || ARCH=armv7hl ;; + # Unless $ARCH is already set, use uname -m for all other archs: + *) ARCH=$(uname -m) ;; + esac + export ARCH +fi + +# If the variable PRINT_PACKAGE_NAME is set, then this script will report what +# the name of the created package would be, and then exit. This information +# could be useful to other scripts. +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz" + exit 0 +fi + +NUMJOBS=${NUMJOBS:-" -j $(expr $(nproc) + 1) "} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "s390" ]; then + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +elif [ "$ARCH" = "armv7hl" ]; then + SLKCFLAGS="-O3 -march=armv7-a -mfpu=vfpv3-d16" + LIBDIRSUFFIX="" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +TMP=${TMP:-/tmp} +PKG=$TMP/package-$PKGNAM + +rm -rf $PKG +mkdir -p $TMP $PKG + +cd $TMP +rm -rf $PKGNAM-$VERSION +tar xvf $CWD/$PKGNAM-$VERSION.tar.?z || exit 1 +cd $PKGNAM-$VERSION || exit 1 + +chown -R root:root . +find . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \+ -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \+ + +# Configure, build, and install: +if [ ! -r configure ]; then + if [ -x ./autogen.sh ]; then + NOCONFIGURE=1 ./autogen.sh + else + autoreconf -vif + fi +fi +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --libexecdir=/usr/lib${LIBDIRSUFFIX}/nut \ + --sbindir=/usr/sbin \ + --sysconfdir=/etc/nut \ + --localstatedir=/var \ + --datadir=/usr/share/nut \ + --mandir=/usr/man \ + --docdir=/usr/doc/nut-$VERSION \ + --disable-static \ + --without-python2 \ + --with-dev \ + --with-serial \ + --with-usb \ + --with-snmp \ + --with-neon \ + --with-wrap \ + --with-cgi\ + --with-openssl \ + --with-libldtl \ + --with-cgipath=/usr/share/nut/cgi-bin \ + --with-htmlpath=/usr/share/nut/html \ + --with-drvpath=/usr/lib${LIBDIRSUFFIX}/nut \ + --with-statepath=/run/nut \ + --with-pidpath=/run/nut \ + --with-altpidpath=/run/nut \ + --with-udevdir=/lib/udev \ + --with-user=nut \ + --with-group=nut \ + --build=$ARCH-slackware-linux || exit 1 + +make $NUMJOBS || make || exit 1 +make install DESTDIR=$PKG || exit 1 + +# Don't ship .la files: +rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la + +# Strip binaries: +find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null + +# Install the startup scripts: +mkdir -p $PKG/etc/rc.d +cp -a $CWD/rc.nut-drvctl $PKG/etc/rc.d/rc.nut-drvctl.new +cp -a $CWD/rc.nut-upsd $PKG/etc/rc.d/rc.nut-upsd.new +cp -a $CWD/rc.nut-upsmon $PKG/etc/rc.d/rc.nut-upsmon.new +chown root:root $PKG/etc/rc.d/rc.nut-* +chmod 644 $PKG/etc/rc.d/rc.nut-* + +# Install the bash_completion script: +mkdir -p $PKG/usr/share/bash-completion/completions +cp -a scripts/misc/nut.bash_completion $PKG/usr/share/bash-completion/completions/nut +chmod 755 $PKG/usr/share/bash-completion/completions/nut + +# Create the state directory: +mkdir -p $PKG/var/state/ups +chown nut:nut $PKG/var/state/ups +chmod 770 $PKG/var/state/ups + +# Change .sample files to .new: +for file in $PKG/etc/nut/*.sample ; do + mv $file $(echo $file | rev | cut -f 2- -d . | rev).new +done + +# Compress manual pages: +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 + +# Add a documentation directory: +mkdir -p $PKG/usr/doc/${PKGNAM}-$VERSION +cp -a \ + AUTHORS* COPYING* ChangeLog INSTALL* LICENSE* MAINTAINERS* NEWS* README* TODO* UPGRADING* \ + docs \ + $PKG/usr/doc/${PKGNAM}-$VERSION + +# Redundant: +rm -rf $PKG/usr/doc/${PKGNAM}-$VERSION/docs/man + +# Clean up zero-length in the docs: +find $PKG/usr/doc -type f -size 0 -exec rm -f "{}" \; + +# If there's a ChangeLog, installing at least part of the recent history +# is useful, but don't let it get totally out of control: +if [ -r ChangeLog ]; then + DOCSDIR=$(echo $PKG/usr/doc/${PKGNAM}-$VERSION) + cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog + touch -r ChangeLog $DOCSDIR/ChangeLog +fi + +mkdir -p $PKG/install +zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz diff --git a/source/a/nut/rc.nut-drvctl b/source/a/nut/rc.nut-drvctl new file mode 100644 index 000000000..c310d26c8 --- /dev/null +++ b/source/a/nut/rc.nut-drvctl @@ -0,0 +1,32 @@ +#!/bin/sh +# NUT ups model-specific drivers start-up and shutdown script. +# This should be started before rc.nut-upsd on the machine connected to the +# UPS's control port. See /etc/nut/ for configuration files. + +# Start upsdrvctl: +upsdrvctl_start() { + # Make sure the runtime directory is there: + mkdir -p /run/nut + chown -R nut:nut /run/nut + chmod 0770 /run/nut + # Load NUT driver(s): + echo "Starting the NUT UPS driver controller: upsdrvctl -u nut start" + upsdrvctl -u nut start +} + +# Stop upsdrvctl: +upsdrvctl_stop() { + echo "Stopping the NUT UPS driver controller." + upsdrvctl stop +} + +case "$1" in +'start') + upsdrvctl_start + ;; +'stop') + upsdrvctl_stop + ;; +*) + echo "usage $0 start|stop" +esac diff --git a/source/a/nut/rc.nut-upsd b/source/a/nut/rc.nut-upsd new file mode 100644 index 000000000..3ca7cdc0b --- /dev/null +++ b/source/a/nut/rc.nut-upsd @@ -0,0 +1,41 @@ +#!/bin/sh +# NUT upsd start-up and shutdown script. +# This should be started after rc.nut-drvctl on the machine connected to the +# UPS's control port. See /etc/nut/ for configuration files. + +# Start upsd: +upsd_start() { + # Make sure the runtime directory is there: + mkdir -p /run/nut + chown -R nut:nut /run/nut + chmod 0770 /run/nut + # Start the UPS daemon: + echo "Starting the NUT UPS information server: upsd -u nut" + upsd -u nut +} + +# Stop upsd: +upsd_stop() { + echo "Stopping the NUT UPS information server." + upsd -c stop +} + +# Reload configuration files for upsd: +upsd_reload() { + echo "Reloading configuration files for the NUT UPS information server: upsd -c reload" + upsd -c reload +} + +case "$1" in +'start') + upsd_start + ;; +'stop') + upsd_stop + ;; +'reload') + upsd_reload + ;; +*) + echo "usage $0 start|stop|reload" +esac diff --git a/source/a/nut/rc.nut-upsmon b/source/a/nut/rc.nut-upsmon new file mode 100644 index 000000000..8fc5ec8f8 --- /dev/null +++ b/source/a/nut/rc.nut-upsmon @@ -0,0 +1,46 @@ +#!/bin/sh +# NUT upsmon start-up and shutdown script. +# upsmon is the client process that is responsible for the most important part +# of UPS monitoring--shutting down the system when the power goes out. +# +# upsmon should be run on every machine that is powered by the UPS if you wish +# to support automatic shutdown on battery power. +# +# See /etc/nut/ for configuration files. + +# Start upsmon: +upsmon_start() { + # Make sure the runtime directory is there: + mkdir -p /run/nut + chown -R nut:nut /run/nut + chmod 0770 /run/nut + # Start the NUT UPS monitor and shutdown controller: + echo "Starting the NUT UPS monitor and shutdown controller: upsmon -u nut" + upsmon -u nut +} + +# Stop upsmon: +upsmon_stop() { + echo "Stopping the NUT UPS monitor and shutdown controller." + upsmon -c stop +} + +# Reload configuration files for upsmon: +upsmon_reload() { + echo "Reloading configuration files for the NUT UPS monitor and shutdown controller: upsmon -c reload" + upsmon -c reload +} + +case "$1" in +'start') + upsmon_start + ;; +'stop') + upsmon_stop + ;; +'reload') + upsmon_reload + ;; +*) + echo "usage $0 start|stop|reload" +esac diff --git a/source/a/nut/slack-desc b/source/a/nut/slack-desc new file mode 100644 index 000000000..cc5132318 --- /dev/null +++ b/source/a/nut/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +nut: nut (Network UPS Tools) +nut: +nut: The Network UPS Tools is a collection of programs which provide a +nut: common interface for monitoring and administering UPS hardware. +nut: It uses a layered apporoach to connect all the components. Drivers +nut: are provided for a wide assortment of equipment. The primary goal of +nut: the NUT project is to provide reliable monitoring of UPS hardware +nut: and ensure safe shutdowns of the systems which are connected. +nut: +nut: Homepage: https://www.networkupstools.org +nut: diff --git a/source/a/sysvinit-scripts/scripts/rc.6 b/source/a/sysvinit-scripts/scripts/rc.6 index 21b5c4782..5fec619c0 100644 --- a/source/a/sysvinit-scripts/scripts/rc.6 +++ b/source/a/sysvinit-scripts/scripts/rc.6 @@ -323,27 +323,33 @@ fi # This is to ensure all processes have completed on SMP machines: wait -if [ -x /sbin/genpowerd -a -z "$container" ]; then - # See if this is a powerfail situation: - if grep -E -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then - # Signal UPS to shut off the inverter: - /sbin/genpowerd -k - if [ ! $? = 0 ]; then - echo - echo "There was an error signaling the UPS." - echo "Perhaps you need to edit /etc/genpowerd.conf to configure" - echo "the serial line and UPS type." - # Wasting 15 seconds of precious power: - /bin/sleep 15 - fi - fi -fi - if [ "$container" = "lxc" ]; then # Confirm successful shutdown of the container: echo "LXC container stopped." fi +# NUT UPS inverter shutdown support: +# If we see a file /etc/killpower, that means we want to shut off the UPS +# inverter on the way down. This will save as much battery power as possible +# and avoid unnecessary full-drain/full-recharge cycles. +if [ -e /etc/killpower -a -z "$container" ]; then + # First we need to restart udev or we won't be able to contact the UPS: + echo "Restarting udev to be able to shut the UPS inverter off..." + /etc/rc.d/rc.udev start + # Wasting precious battery power: + sleep 10 + echo "Shutting down UPS inverter..." + upsdrvctl shutdown + # The power should shut off during the following sleep, but we'll give a + # bit of notice otherwise. Also, be sure to set your machine to start when + # the power resumes in the BIOS settings so that it doesn't stay off. + sleep 45 + echo "The UPS power should have stopped by now, but has not." + echo "It's possible that the power came back during the shutdown process." + echo "Otherwise, check communication with the UPS." + sleep 15 +fi + # Now halt (poweroff with APM or ACPI enabled kernels) or reboot. if [ "$shutdown_command" = "reboot" ]; then echo "Rebooting." diff --git a/source/a/sysvinit-scripts/scripts/rc.M b/source/a/sysvinit-scripts/scripts/rc.M index fc63ce083..d5bc169a8 100644 --- a/source/a/sysvinit-scripts/scripts/rc.M +++ b/source/a/sysvinit-scripts/scripts/rc.M @@ -298,17 +298,27 @@ if [ -x /etc/rc.d/rc.smartd -a -z "$container" ]; then /etc/rc.d/rc.smartd start fi -# Monitor the UPS with genpowerd. -# To use this, uncomment this section and edit your settings in -# /etc/genpowerd.conf (serial device, UPS type, etc). For more information, -# see "man genpowerd" or the extensive documentation in the -# /usr/doc/genpower-*/ directory. -# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want -# support for stopping the UPS's inverter after the machine halts. -#if [ -x /sbin/genpowerd -a -z "$container" ]; then -# echo "Starting genpowerd daemon..." -# /sbin/genpowerd -#fi +# Load model-specific drivers for NUT (Network Uninterruptible power supply +# Tools). This should be started on the machine that controls the UPS. See +# the /etc/nut/ directory for configuration files. +# If you manage your UPS using a serial port, you'll need to add the nut user +# to the "dialout" group. +if [ -x /etc/rc.d/rc.nut-drvctl -a -z "$container" ]; then + /etc/rc.d/rc.nut-drvctl start +fi + +# Start the NUT UPS information server. This should be started on the machine +# that controls the UPS. See the /etc/nut/ directory for configuration files. +if [ -x /etc/rc.d/rc.nut-upsd -a -z "$container" ]; then + /etc/rc.d/rc.nut-upsd start +fi + +# Start the NUT UPS monitor and shutdown controller. This should be run on any +# machine that is powered by the UPS to monitor the power supply and initiate +# shutdown if necessary. See the /etc/nut/ directory for configuration files. +if [ -x /etc/rc.d/rc.nut-upsmon -a -z "$container" ]; then + /etc/rc.d/rc.nut-upsmon start +fi # Turn on process accounting. To enable process accounting, make sure the # option for BSD process accounting is enabled in your kernel, and then diff --git a/source/a/sysvinit-scripts/sysvinit-scripts.SlackBuild b/source/a/sysvinit-scripts/sysvinit-scripts.SlackBuild index b4ea662e1..8180d4381 100755 --- a/source/a/sysvinit-scripts/sysvinit-scripts.SlackBuild +++ b/source/a/sysvinit-scripts/sysvinit-scripts.SlackBuild @@ -25,7 +25,7 @@ cd $(dirname $0) ; CWD=$(pwd) PKGNAM=sysvinit-scripts VERSION=${VERSION:-15.1} ARCH=noarch -BUILD=${BUILD:-15} +BUILD=${BUILD:-16} # If the variable PRINT_PACKAGE_NAME is set, then this script will report what # the name of the created package would be, and then exit. This information |