"Fossies" - the Fresh Open Source Software Archive

Member "bup-0.30/t/configure-sampledata" (28 Sep 2019, 1654 Bytes) of package /linux/privat/bup-0.30.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "configure-sampledata": 0.29.3_vs_0.30.

    1 #!/usr/bin/env bash
    2 
    3 set -o pipefail
    4 
    5 # NOTE: any relevant changes to var/ must be accompanied by an
    6 # increment to the revision.
    7 
    8 revision=2
    9 readonly revision
   10 
   11 top="$(pwd)" || exit $?
   12 
   13 usage()
   14 {
   15     echo 'Usage: t/configure-sampledata [--setup | --clean | --revision]'
   16 }
   17 
   18 if test "$#" -ne 1; then
   19     usage 1>&2; exit 1
   20 fi
   21 
   22 rm_symlinks()
   23 {
   24     for p in "$@"; do
   25         # test -e is false for dangling symlinks.
   26         if test -h "$p" -o -e "$p"; then rm "$p" || exit $?; fi
   27     done
   28 }
   29 
   30 clean()
   31 (
   32     cd t/sampledata || exit $?
   33     if test -e var; then rm -r var || exit $?; fi
   34     # Remove legacy content (before everything moved to var/).
   35     rm_symlinks abs-symlink b c etc
   36 )
   37 
   38 case "$1" in
   39     --setup)
   40         (
   41             clean
   42             mkdir -p t/sampledata/var/rev || exit $?
   43             cd t/sampledata/var || exit $?
   44             ln -sf a b || exit $?
   45             ln -sf b c || exit $?
   46             ln -sf "$(pwd)/abs-symlink-target" abs-symlink || exit $?
   47             mkfifo fifo
   48             mkdir -p cmd doc lib/bup || exit $?
   49             cp -pP "$top"/cmd/*.py cmd/ || exit $?
   50             cp -pP "$top"/Documentation/*.md doc/ || exit $?
   51             cp -pP "$top"/lib/bup/*.py lib/bup || exit $?
   52             # The "v" ensures that if "configure-sampledata
   53             # --revision" and/or the setup above fails somehow,
   54             # callers like make will be looking for a file that won't
   55             # exist.
   56             touch rev/v$revision || exit $?
   57         ) || exit $?
   58         ;;
   59     --clean)
   60         clean
   61         ;;
   62     --revision)
   63         echo "$revision" || exit $?
   64         ;;
   65     *)
   66         usage 1>&2; exit 1
   67         ;;
   68 esac