#!/bin/sh # raspi-hacks.SlackBuild # Modifications for Slackware ARM on Raspberry Pi -- see README file for details # # Copyright 2012 David Spencer, Baildon, West Yorkshire, U.K. # 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. PRGNAM="raspi-hacks" VERSION=${VERSION:-2.1} ARCH="arm" BUILD=${BUILD:-1} TAG=${TAG:-} CWD=$(pwd) TMP=${TMP:-/tmp} OUTPUT=${OUTPUT:-/tmp} PKG=$TMP/package-$PRGNAM mkdir -p $TMP rm -rf $PKG mkdir -p $PKG/etc mkdir -p $PKG/usr/lib mkdir -p $PKG/install cat $CWD/doinst.sh > $PKG/install/doinst.sh # Serial port fixup cat << EOF >> $PKG/install/doinst.sh # inittab -- modify serial port entry 's0' if grep -q '^s0:.*ttyS0' etc/inittab ; then sed -i \ -e 's;^s0:12345:respawn:/sbin/agetty 115200 ttyS0 vt100\$;#s0:12345:respawn:/sbin/agetty -L ttyAMA0 9600 vt100;' \ etc/inittab fi EOF # Hardware clock fixup (1) rc.local cat << EOF >> $PKG/install/doinst.sh # rc.local -- set time from network if ! grep -q sntp etc/rc.d/rc.local ; then echo '' >> etc/rc.d/rc.local echo "# Added by $PRGNAM-$VERSION-$ARCH-$BUILD$TAG" >> etc/rc.d/rc.local echo 'sntp -s pool.ntp.org >/dev/null &' >> etc/rc.d/rc.local fi EOF # Hardware clock fixup (2) e2fsck.conf cp $CWD/e2fsck.conf.new \ $PKG/etc cat << EOF >> $PKG/install/doinst.sh # e2fsck.conf -- hardware clock fix config etc/e2fsck.conf.new EOF # Hardware clock de-fixup :-) cat << EOF >> $PKG/install/doinst.sh # hwclock -- reinstate the original if moved by previous raspi-hacks if [ -f sbin/hwclock.orig ]; then rm -f sbin/hwclock mv sbin/hwclock.orig sbin/hwclock fi EOF # Tuning via /etc/sysctl.conf cp $CWD/sysctl.conf.new \ $PKG/etc cat << EOF >> $PKG/install/doinst.sh # sysctl.conf -- set vm.min_free_kbytes config etc/sysctl.conf.new EOF # Build and install libcofi_rpi ( cd libcofi_rpi rm -f *.s *.o *.so make libcofi_rpi.so ) mkdir -p $PKG/usr/lib cp libcofi_rpi/libcofi_rpi.so \ $PKG/usr/lib chmod 644 $PKG/usr/lib/libcofi_rpi.so rm -f \ libcofi_rpi/*.s \ libcofi_rpi/*.o \ libcofi_rpi/*.so mkdir -p $PKG/etc/profile.d cp \ libcofi_rpi/libcofi_rpi.sh.new \ libcofi_rpi/libcofi_rpi.csh.new \ $PKG/etc/profile.d chmod 644 \ $PKG/etc/profile.d/libcofi_rpi.sh.new \ $PKG/etc/profile.d/libcofi_rpi.csh.new cat << EOF >> $PKG/install/doinst.sh # libcofi_rpi.sh -- activate replacement memcpy/memset preserve_perms etc/profile.d/libcofi_rpi.sh.new preserve_perms etc/profile.d/libcofi_rpi.csh.new EOF # Documentation mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a \ $CWD/README \ $CWD/libcofi_rpi/README.libcofi_rpi \ $PKG/usr/doc/$PRGNAM-$VERSION # Finish off cat $CWD/slack-desc > $PKG/install/slack-desc cd $PKG /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}