#!/bin/bash ############################# ## Build script for: digitemp ## Creator: kaneda@bohater.net ## Date: 21 Jun 05 ## Builds package: Yes ## Source location: http://www.digitemp.com ## Downloads Source: Yes ## Build script version: 1.0 ## Requirements: None ## ## Notes: Any special notes the person may need to edit this file. ## ## Include the slackware-pkg conf file if [ -a /etc/slack-package.conf ]; then . /etc/slack-package.conf else echo "Sorry you need to have the slack-package.conf file to run these" echo "please install the slackbuilds package from LinuxPackages.net" exit fi ## Lets set the name of the program here so we can use it later. NAME=digitemp ## Set the versions for packages here, these must match the source file version. PROGRAM_VER=3.3.2 ## Set the BUILD the $MYIN comes from the global config file in /etc BUILD=1$MYIN ## Location to download the source SRC_LOC="http://www.digitemp.com/software/linux/$NAME-$PROGRAM_VER.tar.gz" ## Set initial variables these should be standard in most packages: PKG=$TMP/package-$NAME ## Now we go grab the source for the user. Again global config has the wget line ## We will check if it is here and if not then download if [ -a $CWD/$NAME-$PROGRAM_VER.tar.gz ]; then echo "Source present not downloading" else $WGET $SRC_LOC || true fi ## Ok time to make sure the area is clean and unarchive the file rm -rf $PKG mkdir -p $PKG cd $TMP rm -rf $NAME-$PROGRAM_VER tar xvzf $CWD/$NAME-$PROGRAM_VER.tar.gz ## Now from this point on we do all the package prep and building. I like to organize them in sections ## like compile, prepare, description, build like below as an example compile() { cd $TMP/$NAME-$PROGRAM_VER chown -R root.root . sed s/"CFLAGS ="/"CFLAGS = -march=i486 -mcpu=i686 "/g Makefile > /tmp/$$.temp mv -f /tmp/$$.temp Makefile mkdir -p $PKG/usr/bin/ for FILE in ds9097 ds9097u ds2490 ; do make $FILE done for FILE in DS9097 DS9097U DS2490 ; do cp -f digitemp_$FILE $PKG/usr/bin/ done } ## The next area I use for getting the documents set and maybe config files. prepare() { mkdir -p $PKG/usr/doc/$NAME-$PROGRAM_VER cp -f ChangeLog COPYING COPYRIGHT CREDITS FAQ README TODO $PKG/usr/doc/$NAME-$PROGRAM_VER/ mkdir -p $PKG/usr/man/man1/ cp -f digitemp.1 $PKG/usr/man/man1/ ##Some functions from the global config to help with the cleanup ( cd $PKG strip_bin # Strips the libs files reduces the size and removes unneeded cruft strip_lib ) # Every good package should gzip those man pages gzip_man $PKG # Set group ownership for the bin directory bin_perms $PKG # Set group ownership for the sbin directory #sbin_perms $PKG # Fix bad permission find $PKG -perm +0111 -exec chmod 755 {} \; find $PKG \! -perm +0111 -exec chmod 644 {} \; } ## The next area is for the description. You can use this method or just cat a slack-desc file into ## the install area. I will use apache here as a sample description() { mkdir -p $PKG/install cat > $PKG/install/slack-desc << END |-----handy-ruler------------------------------------------------------| digitemp: $NAME $PROGRAM_VER (Temperature Sensors from 1-wire devices) digitemp: digitemp: DigiTemp is a simple to use program for reading values from 1-wire digitemp: devices. Its main use is for reading temperature sensors, but it also digitemp: reads counters, and understands the 1-wire hubs with devices on digitemp: different branches of the network. DigiTemp now supports the digitemp: following 1-wire temperature sensors: DS18S20 (and DS1820), DS18B20, digitemp: DS1822, the DS2438 Smart Battery Monitor, DS2422 and DS2423 Counters, digitemp: DS2409 MicroLAN Coupler (used in 1-wire hubs), and the AAG TAI-8540 digitemp: humidity sensor. digitemp: My other Slack packages: http://kaneda.bohater.net/slackware END } ## The last part is the build build() { # Build the package: cd $PKG makepkg -l y -c n $TMP/$NAME-$PROGRAM_VER-$ARCH-$BUILD.tgz mv $TMP/$NAME-$PROGRAM_VER-$ARCH-$BUILD.tgz $PKG_DIR/ echo "Your $NAME package is complete, make sure you open it up before installing it." echo "It is located in $PKG_DIR thanks for your support The Linuxpackages.net Folks" } ### Now we call all those functions in order compile prepare description build