slackbuilds

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

backup.SlackBuild (2362B)


      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=backup
     26 GITSVR=git.danielmoch.com
     27 GITHASH=${GITHASH:-c1825db8b22788f91eddda28f680f09a482b0299}
     28 SHORTHASH=${SHORTHASH:-c1825db}
     29 VERSION=${VERSION:-0.0.$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/backup.SlackBuild $PKG/usr/doc/$PRGNAM-$VERSION/backup.SlackBuild
     64 install -Dm644 TODO.txt $PKG/usr/doc/$PRGNAM-$VERSION/TODO
     65 install -Dm755 backup $PKG/usr/lib/backup/backup
     66 install -Dm644 config $PKG/etc/backup/config
     67 
     68 cd $PKG
     69 /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-noarch-$BUILD$TAG.${PKGTYPE:-tgz}