diff options
Diffstat (limited to 'patches/lm_sensors')
-rwxr-xr-x | patches/lm_sensors/lm_sensors.SlackBuild | 246 |
1 files changed, 145 insertions, 101 deletions
diff --git a/patches/lm_sensors/lm_sensors.SlackBuild b/patches/lm_sensors/lm_sensors.SlackBuild index 668ab142..3bb6073a 100755 --- a/patches/lm_sensors/lm_sensors.SlackBuild +++ b/patches/lm_sensors/lm_sensors.SlackBuild @@ -1,126 +1,160 @@ #!/bin/bash # -# lm_sensors.SlackBuild is free software; you can redistribute -# it and/or modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the License, -# or any later version. +# lm_sensors.SlackBuild is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or any later version. # -# lm_sensors.SlackBuild is distributed in the hope that it will -# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. +# lm_sensors.SlackBuild is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 59 Temple # Place - Suite 330, Boston, MA 02111-1307, USA # -# slackbuild for lm_sensors, by Silvio Rhatto -# requires: -# tested: lm_sensors-3.0.0 +# slackbuild for lm_sensors # -# Look for slackbuildrc +if [ -s "slack-required" ]; then + echo Recomended and required packages for building lm_sensors are: + cat slack-required | sed -e 's/^/\t/' + if [ "$INTERACT" != "no" ]; then + echo If you dont have those installed, press Ctrl-C. Otherwise, hit ENTER. + read crap +# else +# echo Sleeping 3 seconds... +# sleep 3 + fi +fi + +CWD=`pwd` + if [ -f ~/.slackbuildrc ]; then source ~/.slackbuildrc elif [ -f /etc/slackbuildrc ]; then source /etc/slackbuildrc fi -# Set variables -CWD="$(pwd)" -SRC_NAME="lm_sensors" -PKG_NAME="lm_sensors" +# default settings +PRGNAM="lm_sensors" +PACKAGE="$PRGNAM" ARCH=${ARCH:=i486} -SRC_VERSION=${VERSION:=3.0.0} -PKG_VERSION="$(echo "$SRC_VERSION" | tr '[[:blank:]-]' '_')" -BUILD=${BUILD:=1rha} -SRC_DIR=${SRC_DIR:=$CWD}/$PKG_NAME +VERSION=${VERSION:=3.0.0} +BUILD=${BUILD:=3rha} +SRC_DIR=${SRC:=$CWD} TMP=${TMP:=/tmp} -PKG=${PKG:=$TMP/package-$PKG_NAME} REPOS=${REPOS:=$TMP} -PREFIX=${PREFIX:=/usr} -PKG_WORK="$TMP/$SRC_NAME" -CONF_OPTIONS=${CONF_OPTIONS:=""} -NUMJOBS=${NUMJOBS:=""} -# Set system libraries' path and optmization flags based on $ARCH -LIBDIR="$PREFIX/lib" +# ------- error codes for createpkg -------------- +ERROR_WGET=31; ERROR_MAKE=32; ERROR_INSTALL=33 +ERROR_MD5=34; ERROR_CONF=35; ERROR_HELP=36 +ERROR_TAR=37; ERROR_MKPKG=38; ERROR_GPG=39 +ERROR_PATCH=40 + +PACKAGE_EXT="gz" +SRC="$PACKAGE-$VERSION.tar.$PACKAGE_EXT" +URL="http://dl.lm-sensors.org/lm-sensors/releases/$SRC" + +RTOOL="wget" + +gpg --import << EOPGP +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: PGPfreeware 5.0i for non-commercial use + +mQCNAzaeL3sAAAEEAL7roqireHxJ43Xo1oOWAUbba5DVfQX8Cnv99I1VQ1suFxVn +HWpWjlI0BUaMZzP9JF9F/xZhpd9dyjj3giuFReyj8Qk5e6Q0eSWSL+0CADi9Pesm +zQQt4GmPpDfLKbzFUWCUNbB5vAC8p9Fj2frHBqcF7z3AR3u+3h8uYrXvyThJAAUR +tCVQaGlsaXAgRWRlbGJyb2NrIDxwaGlsQG5ldHJvZWRnZS5jb20+iQCVAwUQNp4v +ex8uYrXvyThJAQEJFwP+IED7wi0Spa1KpVp9ywK9r7Fu7WLUhv0stD2GlFL+USa7 +UTB0XuFXuOFVVNtBauj5a1morjVGIcwYkJ4prTLYe+ok+AjfeCjodPxzrSqPgf3n +xbQqRg0vMCxIHHBP8dv2guEBii06GhvculveSvvyOZGEKLAV6btKXvIxJI7yRHU= +=Mzd5 +-----END PGP PUBLIC KEY BLOCK----- + +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: PGPfreeware 5.0i for non-commercial use + +mQGiBDfK4agRBADvyYYefBEaVxx7plH0qJayzZIEjJOjBwsDZl5HWfx+XbZrtGzg +ouhbw+a9vcA5birNt7GhlMHiKYQ20fTircGfJr1WgIDRQp2/LgFRBaL9sbYIpgBv +EM6+4y7vsSamkVl+xanhGDkLHn95zD+fSjTY4BbgsL7nqyVe6m96IZ1a2wCg/y61 +6iVL3rqRSzu4zeNoB4XPjJ8D/2ZMoKVvlKrW9zmfC/Ymty10BxPKmtXg2+UoWhLc +BO0Cn22iktmCHQIgn/tj0GqB+zxy87vOANlge2TXCgxbfp1mDFBPHZ3R5kLh4AU3 +qMG0eOIYl7Jng848WmMWeFCyw1rw8i3OdlOel+vtKJvw6IhJsThqL6UKjVVUSTcR +9TQfA/4uqG3rf+8xF6dFsoTCyk+Vk703Uli0MJmN36fuLw147LfZaC858V2fDCAF +PamhhFe5Tf90Ini/pSby6SCPd06iMLN8HdbfrAwPGGJYDrST1epnNr/7seYioFOe +mr7CUKqbQCR7um7VQbzIQ8PG5tsiphmebyKQ5YQlF24wfQMmyrQHcGhpbGRzc4kA +SwQQEQIACwUCN8rhqAQLAwECAAoJEOCiVzdlI2rVUdUAn0B81EIPhtLH6lM5kKf/ +LyEupz9gAJ44uLsibf2unlk8sE1Znox4BeDHZLQZcGhpbEBzdGltcHkubmV0cm9l +ZGdlLmNvbYkASwQQEQIACwUCN8rniwQLAwECAAoJEOCiVzdlI2rVj7sAoJyc5Yd4 +qTx8J+Uqx3blYGgbYCMGAKC41VDaAktzuW7x6/fisE1bOgangbkCDQQ3yuGoEAgA +9kJXtwh/CBdyorrWqULzBej5UxE5T7bxbrlLOCDaAadWoxTpj0BV89AHxstDqZSt +90xkhkn4DIO9ZekX1KHTUPj1WV/cdlJPPT2N286Z4VeSWc39uK50T8X8dryDxUcw +Yc58yWb/Ffm7/ZFexwGq01uejaClcjrUGvC/RgBYK+X0iP1YTknbzSC0neSRBzZr +M2w4DUUdD3yIsxx8Wy2O9vPJI8BD8KVbGI2Ou1WMuF040zT9fBdXQ6MdGGzeMyEs +tSr/POGxKUAYEY18hKcKctaGxAMZyAcpesqVDNmWn6vQClCbAkbTCD1mpF1Bn5x8 +vYlLIhkmuquiXsNV6TILOwACAgf/YDv43LHUBX4wGkVbLJ2DU8tOAp5Od0pxXaUF +FMGzTuR3W5IdS9YjTo9NdE6DlsX34yU1iLTyjnqApDfu2Uz2oeM1RULYmK9srA2M +LZoDAiVtwsqRX5x0QlkdrDn6ngZMnfe9n8d3fxxqC6wtI+EpXUEk+G4hafowyM2j +ogibnD8TGwjCFD5OQSG50yRCEykZez3thX2jRrlZLRhhtU1eb2GbJ7NMoFoAH079 +me+8kspMvYaPAQg/vpml89BNWmdu3OdtR7qFO9vNbDRFJMZLIucC6sWWMPSXltcI +rOHdFtnux8OxY+57juMgkOR5JsyY1WizxmWgIAptLv7KlLYkiokAPwMFGDfK4ajg +olc3ZSNq1REC58kAoLyb4jp4/9/QUEQrFFmyy4M/65xuAKCnpPd37PhwQn0kLIlo +BP7wPk2BgQ== +=l+kY +-----END PGP PUBLIC KEY BLOCK----- +EOPGP if [ "$ARCH" = "i386" ]; then SLKCFLAGS="-O2 -march=i386 -mcpu=i686" elif [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mcpu=i686" -elif [ "$ARCH" = "i686" ]; then - SLKCFLAGS="-O2 -march=i686" elif [ "$ARCH" = "s390" ]; then SLKCFLAGS="-O2" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2" - LIBDIR="$PREFIX/lib64" fi -# Set error codes (used by createpkg) -ERROR_WGET=31; ERROR_MAKE=32; ERROR_INSTALL=33 -ERROR_MD5=34; ERROR_CONF=35; ERROR_HELP=36 -ERROR_TAR=37; ERROR_MKPKG=38; ERROR_GPG=39 -ERROR_PATCH=40; ERROR_VCS=41; ERROR_MKDIR=42 +SRC_DIR="$SRC_DIR/$PACKAGE" +mkdir -p $SRC_DIR -# Clean up any leftovers of previous builds -rm -rf "$PKG_WORK" 2> /dev/null -rm -rf "$PKG" 2> /dev/null +if [ "$RTOOL" == "wget" ] && [ ! -f "$SRC_DIR/$SRC" ]; then + wget "$URL" -O "$SRC_DIR/$SRC" || exit $ERROR_WGET + wget "$URL.asc" -O "$SRC_DIR/$SRC.asc" || exit $ERROR_WGET +fi -# Create directories if necessary -mkdir -p "$SRC_DIR" || exit $ERROR_MKDIR -mkdir -p "$PKG" || exit $ERROR_MKDIR -mkdir -p "$REPOS" || exit $ERROR_MKDIR -mkdir -p "$PKG_WORK" || exit $ERROR_MKDIR +gpg --verify $SRC_DIR/$SRC.asc $SRC_DIR/$SRC || exit $ERROR_GPG -# Dowload source if necessary -SRC="$SRC_NAME-$VERSION.tar.bz2" -URL="http://dl.lm-sensors.org/lm-sensors/releases/$SRC" +TMP="$TMP/$PACKAGE" +rm -rf $TMP +mkdir -p $TMP +cd $TMP -if [ ! -s "$SRC_DIR/$SRC" ] || ! bunzip2 -t "$SRC_DIR/$SRC" 2> /dev/null; then - wget "$URL" -O "$SRC_DIR/$SRC" || exit $ERROR_WGET +rm -rf $PACKAGE-$VERSION $PACKAGE-$VERSION-$ARCH-$BUILD.tgz + +tar xvf $SRC_DIR/$PACKAGE-$VERSION.tar.$PACKAGE_EXT || exit $ERROR_TAR +cd $PACKAGE-$VERSION + +sed -e 's/^I2C_HEADERS := \/usr\/local\/include/I2C_HEADERS := \/usr\/include/' \ + -e 's/^PREFIX := \/usr\/local/PREFIX := \/usr/' Makefile > Makefile.new + +if [ "$ARCH" == "x86_64" ]; then + sed -e 's/LIBDIR := $(PREFIX)\/lib/LIBDIR := $(PREFIX)\/lib64/' Makefile.new > Makefile +else + mv Makefile.new Makefile fi -# Untar -cd "$PKG_WORK" -tar --no-same-owner --no-same-permissions -xvf "$SRC_DIR/$SRC" || exit $ERROR_TAR -PKG_SRC="$PWD/`ls -l | awk '/^d/ { print $8 }'`" -cd "$PKG_SRC" - -# Configure -CFLAGS="$SLKCFLAGS" \ - CXXFLAGS="$SLKCFLAGS" \ - ./configure \ - --prefix="$PREFIX" --libdir="$LIBDIR" $CONF_OPTIONS || exit $ERROR_CONF - -# Compile -make $NUMJOBS || exit $ERROR_MAKE - -# Install -make install DESTDIR="$PKG" || exit $ERROR_INSTALL - -# Strip binaries -( cd "$PKG" - find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \ - xargs strip --strip-unneeded 2> /dev/null - find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \ - xargs strip --strip-unneeded 2> /dev/null -) - -# Install documentation -DOCS="CHANGES CONTRIBUTORS COPYING README" -mkdir -p "$PKG/usr/doc/$PKG_NAME-$PKG_VERSION" || exit $ERROR_MKDIR -for doc in $DOCS; do - if [ -f "$doc" ]; then - cp -a $doc "$PKG/usr/doc/$PKG_NAME-$PKG_VERSION" - fi -done +make user || exit $ERROR_MAKE +make DESTDIR=$TMP/package-$PACKAGE user_install || exit $ERROR_INSTALL + +CWD="`pwd`" + +mkdir -p $TMP/package-$PACKAGE/install +cd $TMP/package-$PACKAGE + +find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null +find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null -# Add package description (slack-desc) -mkdir -p "$PKG/install" || exit $ERROR_MKDIR -cat << EODESC > "$PKG/install/slack-desc" +cat << EOF > install/slack-desc # 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 '|' @@ -128,25 +162,35 @@ cat << EODESC > "$PKG/install/slack-desc" # make exactly 11 lines for the formatting to be correct. It's also # customary to leave one space after the ':'. - _ |-----handy-ruler---------------------------------------------------| -lm_sensors: lm_sensors (hardware monitoring package) + |-----handy-ruler-----------------------------------------------------| +lm_sensors: lm_sensors (Linux sensors drivers and hardware monitoring tools) lm_sensors: -lm_sensors: lm_sensors provides tools for monitoring the temperatures, voltages, -lm_sensors: and fans of Linux systems with hardware monitoring devices. Included -lm_sensors: are text-based tools for sensor reporting, and a library for sensors -lm_sensors: access called libsensors. It also contains tools for sensor hardware -lm_sensors: identification and I2C bus probing. +lm_sensors: lm_sensors provides essential drivers for monitoring the +lm_sensors: temperatures, voltages, and fans of Linux systems with hardware +lm_sensors: monitoring devices. It contains Linux 2.4 drivers for sensor chips +lm_sensors: and I2C and SMBus masters, text-based tools for sensor reporting, +lm_sensors: and a library for sensors access called "libsensors". It also +lm_sensors: contains tools for sensor hardware identification and I2C bus probing. lm_sensors: -lm_sensors: IMPORTANT NOTE: If you have a Thinkpad, please read the warnings in -lm_sensors: the README.thinkpad file. lm_sensors has been known to cause damage -lm_sensors: to some Thinkpads. -EODESC +lm_sensors: +lm_sensors: +EOF + +# config +if [ -f "etc/sensors.conf" ]; then + mv etc/sensors.conf etc/sensors.conf.new +fi + +if [ -f "etc/sensors3.conf" ]; then + mv etc/sensors3.conf etc/sensors.conf.new +fi + +# docs +mkdir -p usr/doc/$PACKAGE-$VERSION +cp $CWD/{BACKGROUND,BUGS,CHANGES,CONTRIBUTORS,COPYING,INSTALL,QUICKSTART,README,README.thinkpad,TODO} usr/doc/$PACKAGE-$VERSION/ -# Build the package -cd "$PKG" -makepkg -l y -c n "$REPOS/$PKG_NAME-$PKG_VERSION-$ARCH-$BUILD.tgz" || exit $ERROR_MKPKG +makepkg -c y -l y $REPOS/$PACKAGE-$VERSION-$ARCH-$BUILD.tgz || exit $ERROR_MKPKG -# Delete source and build directories if requested if [ "$CLEANUP" == "yes" ]; then - rm -rf "$PKG_WORK" "$PKG" + rm -rf $TMP fi |