Add run-parts to libpaper.

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@14184 af4574ff-66df-0310-9fd7-8a98e5e911e0
This commit is contained in:
Ken Moffat 2014-09-03 17:41:32 +00:00
parent cf694de054
commit ff7c7bf83e
2 changed files with 74 additions and 4 deletions

View File

@ -96,8 +96,58 @@ make
</para>
<screen role="root"><userinput>make install &amp;&amp;
mkdir -v /etc/libpaper.d
</userinput></screen>
mkdir -v /etc/libpaper.d &amp;&amp;
cat &gt; /usr/bin/run-parts &lt;&lt; "EOF"
#!/bin/sh
# 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.
# keep going when something fails
set +e
if [ $# -lt 1 ]; then
echo "Usage: run-parts &lt;directory&gt;"
exit 1
fi
if [ ! -d $1 ]; then
echo "Not a directory: $1"
echo "Usage: run-parts &lt;directory&gt;"
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
EOF
chmod -v -m755 /usr/bin/run-parts</userinput></screen>
</sect2>
@ -111,6 +161,12 @@ mkdir -v /etc/libpaper.d
<application>libpaper</application> expects that packages will install files
into this directory.</para>
<para><command>cat &gt; /usr/bin/run-parts &lt;&lt; "EOF"</command> :
<filename>paperconfig</filename> is a script which will invoke
<command>run-parts</command> if
<filename class="directory">/etc/libpaper.d</filename> exists. No other BLFS
package installs this, so we create it here.</para>
</sect2>
<sect2 role="configuration">
@ -122,7 +178,7 @@ mkdir -v /etc/libpaper.d
<para>Create <filename>/etc/papersize</filename> to set the default
system paper size. Issue the following command as the
<systemitem class="username">root</systemitem> user to set this to
&apos;A4&apos; (libpaper expects the lowercase form). You may wish
&apos;A4&apos; (libpaper prefers the lowercase form). You may wish
to use a different size, such as letter.</para>
<screen role="root"><userinput>cat &gt; /etc/papersize &lt;&lt; "EOF"
@ -143,7 +199,7 @@ EOF</userinput></screen>
<seglistitem>
<seg>
paperconf, paperconfig
paperconf, paperconfig, run-parts
</seg>
<seg>
libpaper.so
@ -179,6 +235,16 @@ EOF</userinput></screen>
</listitem>
</varlistentry>
<varlistentry id="run-parts">
<term><command>run-parts</command></term>
<listitem>
<para>run all the scripts found in a directory.</para>
<indexterm zone="libpaper run-parts">
<primary sortas="b-run-parts">run-parts</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="libpaper-lib">
<term><filename class="libraryfile">libpaper.so</filename></term>
<listitem>

View File

@ -47,6 +47,10 @@
<listitem>
<para>September 3rd, 2014</para>
<itemizedlist>
<listitem>
<para>[ken] - add run-parts script (from Slackware) to the
libpaper page - thanks to akhiezer for his help.</para>
</listitem>
<listitem>
<para>[fernando] - LXDM-0.5.0 fixes: typo and some rewriting. Fix
again localization, Thanks Armin K.</para>