diff --git a/system/powernowd/doinst.sh b/system/powernowd/doinst.sh new file mode 100644 index 0000000000..7a50fb2987 --- /dev/null +++ b/system/powernowd/doinst.sh @@ -0,0 +1,25 @@ +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.powernowd.new diff --git a/system/powernowd/powernowd.SlackBuild b/system/powernowd/powernowd.SlackBuild index 02e28b0d48..f17ad33837 100644 --- a/system/powernowd/powernowd.SlackBuild +++ b/system/powernowd/powernowd.SlackBuild @@ -6,12 +6,12 @@ PRGNAM=powernowd VERSION=${VERSION:-1.00} -BUILD=${BUILD:-1} +BUILD=${BUILD:-2} TAG=${TAG:-_SBo} if [ -z "$ARCH" ]; then case "$( uname -m )" in - i?86) ARCH=i486 ;; + i?86) ARCH=i586 ;; arm*) ARCH=arm ;; *) ARCH=$( uname -m ) ;; esac @@ -22,8 +22,8 @@ TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} -if [ "$ARCH" = "i486" ]; then - SLKCFLAGS="-O2 -march=i486 -mtune=i686" +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" LIBDIRSUFFIX="" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" @@ -39,7 +39,7 @@ fi set -e rm -rf $PKG -mkdir -p $TMP $OUTPUT $PKG/usr/sbin +mkdir -p $TMP $OUTPUT $PKG/usr/sbin $PKG/etc/rc.d cd $TMP rm -rf $PRGNAM-$VERSION tar xvf $CWD/$PRGNAM-$VERSION.tar.gz @@ -51,21 +51,27 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ -exec chmod 644 {} \; +sed -i "s%-O2%$SLKCFLAGS%" Makefile +sed -i "s%/usr/sbin%$PKG/usr/sbin%" Makefile + make -install -m 755 powernowd $PKG/usr/sbin +make install + +# Remove trailing whitespace at the same time +cat powernowd.init | sed "s%\s*$%%" > $PKG/etc/rc.d/rc.powernowd.new find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a \ - powernowd.init \ + README LICENSE \ $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh cd $PKG /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} - diff --git a/system/powernowd/slack-desc b/system/powernowd/slack-desc index 4dd88ee514..1adad0d604 100644 --- a/system/powernowd/slack-desc +++ b/system/powernowd/slack-desc @@ -15,5 +15,5 @@ powernowd: management scheme, as it's algorithm works better if there are more powernowd: then two CPU speeds available. (aka, ARM, AMD K6/K7, Via C3, and powernowd: Crusoe as opposed to traditional Intel and Ultrasparc). powernowd: -powernowd: +powernowd: http://www.deater.net/john/powernowd.html powernowd: