wok-next diff libpaper/stuff/run-parts @ rev 21540

updated cantarell-fonts (0.111 -> 0.201)
author Hans-G?nter Theisgen
date Sun Jun 21 16:26:44 2020 +0100 (2020-06-21)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/libpaper/stuff/run-parts	Sun Jun 21 16:26:44 2020 +0100
     1.3 @@ -0,0 +1,48 @@
     1.4 +#!/bin/sh
     1.5 +# run-parts:  Runs all the scripts found in a directory.
     1.6 +# from Slackware, by Patrick J. Volkerding with ideas borrowed
     1.7 +# from the Red Hat and Debian versions of this utility.
     1.8 +
     1.9 +# keep going when something fails
    1.10 +set +e
    1.11 +
    1.12 +if [ $# -lt 1 ]; then
    1.13 +  echo "Usage: run-parts <directory>"
    1.14 +  exit 1
    1.15 +fi
    1.16 +
    1.17 +if [ ! -d $1 ]; then
    1.18 +  echo "Not a directory: $1"
    1.19 +  echo "Usage: run-parts <directory>"
    1.20 +  exit 1
    1.21 +fi
    1.22 +
    1.23 +# There are several types of files that we would like to
    1.24 +# ignore automatically, as they are likely to be backups
    1.25 +# of other scripts:
    1.26 +IGNORE_SUFFIXES="~ ^ , .bak .new .rpmsave .rpmorig .rpmnew .swp"
    1.27 +
    1.28 +# Main loop:
    1.29 +for SCRIPT in $1/* ; do
    1.30 +  # If this is not a regular file, skip it:
    1.31 +  if [ ! -f $SCRIPT ]; then
    1.32 +    continue
    1.33 +  fi
    1.34 +  # Determine if this file should be skipped by suffix:
    1.35 +  SKIP=false
    1.36 +  for SUFFIX in $IGNORE_SUFFIXES ; do
    1.37 +    if [ ! "$(basename $SCRIPT $SUFFIX)" = "$(basename $SCRIPT)" ]; then
    1.38 +      SKIP=true
    1.39 +      break
    1.40 +    fi
    1.41 +  done
    1.42 +  if [ "$SKIP" = "true" ]; then
    1.43 +    continue
    1.44 +  fi
    1.45 +  # If we've made it this far, then run the script if it's executable:
    1.46 +  if [ -x $SCRIPT ]; then
    1.47 +    $SCRIPT || echo "$SCRIPT failed."
    1.48 +  fi
    1.49 +done
    1.50 +
    1.51 +exit 0