aboutsummaryrefslogtreecommitdiff
path: root/reproduce/software/shell/run-parts.in
diff options
context:
space:
mode:
authorMohammad Akhlaghi <mohammad@akhlaghi.org>2020-06-27 23:49:36 +0100
committerMohammad Akhlaghi <mohammad@akhlaghi.org>2020-06-27 23:49:36 +0100
commit3d7d8cedfe0698e895949027906ce5ca996aad17 (patch)
tree108627d6dcb039ad340e75b1b14081524cc5a3df /reproduce/software/shell/run-parts.in
parent57f922480d62a826b3e6030c81b85b412794fd4c (diff)
parentc151eddbcc5f4208b40dc3037a8ae8adb0ff9173 (diff)
Imported recent work in master, minor conflict fixed in paper.mk
Only two conflicts came up in the newly added comments of 'paper.mk' in the Maneage branch. It happened because in this project we don't use 'pdflatex', but 'latex' alone.
Diffstat (limited to 'reproduce/software/shell/run-parts.in')
-rwxr-xr-xreproduce/software/shell/run-parts.in71
1 files changed, 71 insertions, 0 deletions
diff --git a/reproduce/software/shell/run-parts.in b/reproduce/software/shell/run-parts.in
new file mode 100755
index 0000000..9213585
--- /dev/null
+++ b/reproduce/software/shell/run-parts.in
@@ -0,0 +1,71 @@
+#!MANEAGESHELL
+# run-parts: Runs all the scripts found in a directory.
+# from Slackware, by Patrick J. Volkerding with ideas borrowed
+# from the Red Hat and Debian versions of this utility.
+#
+# USAGE IN MANEAGE: this script is built with the 'libpaper' package.
+#
+# The original file was taken from Linux From Scratch:
+# http://www.linuxfromscratch.org/blfs/view/svn/general/libpaper.html
+# However, it didn't have a copyright statement. So one is being added
+# here.
+#
+# Copyright (C) 2020 Authors mentioned above.
+# Copyright (C) 2020 Mohammad Akhlaghi <mohammad@akhlaghi.org>
+#
+# This script is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This script is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this script. If not, see <http://www.gnu.org/licenses/>.
+
+# keep going when something fails
+set +e
+
+if [ $# -lt 1 ]; then
+ echo "Usage: run-parts <directory>"
+ exit 1
+fi
+
+if [ ! -d $1 ]; then
+ echo "Not a directory: $1"
+ echo "Usage: run-parts <directory>"
+ exit 1
+fi
+
+# There are several types of files that we would like to
+# ignore automatically, as they are likely to be backups
+# of other scripts:
+IGNORE_SUFFIXES="~ ^ , .bak .new .rpmsave .rpmorig .rpmnew .swp"
+
+# Main loop:
+for SCRIPT in $1/* ; do
+ # If this is not a regular file, skip it:
+ if [ ! -f $SCRIPT ]; then
+ continue
+ fi
+ # Determine if this file should be skipped by suffix:
+ SKIP=false
+ for SUFFIX in $IGNORE_SUFFIXES ; do
+ if [ ! "$(basename $SCRIPT $SUFFIX)" = "$(basename $SCRIPT)" ]; then
+ SKIP=true
+ break
+ fi
+ done
+ if [ "$SKIP" = "true" ]; then
+ continue
+ fi
+ # If we've made it this far, then run the script if it's executable:
+ if [ -x $SCRIPT ]; then
+ $SCRIPT || echo "$SCRIPT failed."
+ fi
+done
+
+exit 0