slackbuilds

Personal Slackbuilds in the style of slackbuilds.org
git clone git://git.danielmoch.com/slackbuilds.git
Log | Files | Refs

update-motd.SlackBuild (3104B)


      1 #!/bin/sh
      2 
      3 # Slackware build script for backup
      4 #
      5 # Copyright 2020 Daniel Moch <daniel@danielmoch.com>
      6 #
      7 # Permission is hereby granted, free of charge, to any person obtaining a
      8 # copy of this software and associated documentation files (the "Software"),
      9 # to deal in the Software without restriction, including without limitation
     10 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
     11 # and/or sell copies of the Software, and to permit persons to whom the
     12 # Software is furnished to do so, subject to the following conditions:
     13 #
     14 # The above copyright notice and this permission notice shall be included
     15 # in all copies or substantial portions of the Software.
     16 #
     17 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     18 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     19 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
     20 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
     21 # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
     22 # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     23 # OTHER DEALINGS IN THE SOFTWARE.
     24 
     25 PRGNAM=update-motd
     26 GITSVR=git.danielmoch.com
     27 GITHASH=${GITHASH:-829a4c6b226bc431d3139146abb7743efcbd211d}
     28 SHORTHASH=${SHORTHASH:-829a4c6}
     29 VERSION=${VERSION:-0.1.1.$SHORTHASH}
     30 BUILD=${BUILD:-1}
     31 TAG=${TAG:-_djmoch}
     32 
     33 if [ -z "$ARCH" ]; then
     34   case "$( uname -m )" in
     35     i?86) ARCH=i586 ;;
     36     arm*) ARCH=arm ;;
     37        *) ARCH=$( uname -m ) ;;
     38   esac
     39 fi
     40 
     41 CWD=$(pwd)
     42 TMP=${TMP:-/tmp/djmoch}
     43 PKG=$TMP/package-$PRGNAM
     44 OUTPUT=${OUTPUT:-/tmp}
     45 
     46 set -e
     47 
     48 rm -rf $PKG
     49 mkdir -p $TMP $PKG $OUTPUT
     50 cd $TMP
     51 rm -rf $PRGNAM
     52 git clone git://$GITSVR/$PRGNAM
     53 cd $PRGNAM
     54 git checkout $GITHASH
     55 chown -R root:root .
     56 find -L . \
     57  \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
     58  -exec chmod 755 {} \; -o \
     59  \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
     60  -exec chmod 644 {} \;
     61 
     62 install -Dm644 $CWD/slack-desc $PKG/install/slack-desc
     63 install -Dm644 $CWD/update-motd.SlackBuild $PKG/usr/doc/$PRGNAM-$VERSION/update-motd.SlackBuild
     64 install -Dm755 src/update-motd $PKG/usr/libexec/update-motd/update-motd
     65 install -Dm755 src/update-motd.d/00-header $PKG/usr/libexec/update-motd/update-motd.d/00-header
     66 install -Dm755 src/update-motd.d/10-fortune $PKG/usr/libexec/update-motd/update-motd.d/10-fortune
     67 install -Dm755 src/update-motd.d/99-footer $PKG/usr/libexec/update-motd/update-motd.d/99-footer
     68 install -Dm755 contrib/slackware/20-slackpkg $PKG/usr/libexec/update-motd/update-motd.d/20-slackpkg
     69 install -dm755 $PKG/etc/update-motd.d
     70 ln -s ../../usr/libexec/update-motd/update-motd.d/00-header $PKG/etc/update-motd.d/00-header
     71 ln -s ../../usr/libexec/update-motd/update-motd.d/10-fortune $PKG/etc/update-motd.d/10-fortune
     72 ln -s ../../usr/libexec/update-motd/update-motd.d/20-slackpkg $PKG/etc/update-motd.d/20-slackpkg
     73 ln -s ../../usr/libexec/update-motd/update-motd.d/99-footer $PKG/etc/update-motd.d/99-footer
     74 
     75 cd $PKG
     76 /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-noarch-$BUILD$TAG.${PKGTYPE:-tgz}