Warning!

Notice: the grml team is migrating from Mercurial to Git.
Please visit git.grml.org instead!

* Support '-config' option to read in configuration file
authorMichael Prokop <mika@grml.org>
Fri Nov 24 20:45:30 2006 +0100 (2 years ago)
changeset 627ffe4c539d5
manifest27ffe4c539d5
parent 5214caeccf2a0
child 7cc8497b4909c
* Support '-config' option to read in configuration file
/etc/grml/autoconfig where CONFIG_FSTAB_{USER,GROUP} can be
defined.
* Use a wrapper function around logger for logging.
debian/changelog
rebuildfstab
--- a/debian/changelog Wed Nov 08 14:05:25 2006 +0100
+++ b/debian/changelog Fri Nov 24 20:45:30 2006 +0100
@@ -1,3 +1,12 @@ grml-rebuildfstab (0.3-15) unstable; urg
+grml-rebuildfstab (0.3-16) unstable; urgency=low
+
+ * Support '-config' option to read in configuration file
+ /etc/grml/autoconfig where CONFIG_FSTAB_{USER,GROUP} can be
+ defined.
+ * Use a wrapper function around logger for logging.
+
+ -- Michael Prokop <mika@grml.org> Fri, 24 Nov 2006 18:46:20 +0100
+
grml-rebuildfstab (0.3-15) unstable; urgency=low
* Replace '<<' with '<<<', otherwise it does not work.
--- a/rebuildfstab Wed Nov 08 14:05:25 2006 +0100
+++ b/rebuildfstab Fri Nov 24 20:45:30 2006 +0100
@@ -4,20 +4,26 @@
# Authors: grml-team (grml.org), (c) Klaus Knopper Nov 2002, (c) Michael Prokop <mika@grml.org>
# Bug-Reports: see http://grml.org/bugs/
# License: This file is licensed under the GPL v2.
-# Latest change: Mit Nov 08 14:03:39 CET 2006 [mika]
+# Latest change: Fre Nov 24 20:44:15 CET 2006 [mika]
################################################################################
# This script is based on the package rebuildfstab-knoppix_0.5-4 of Klaus Knopper.
# (C) Klaus Knopper Nov 2002
+function logit() {
+ if [ -x /usr/bin/logger ] ; then
+ /usr/bin/logger -i -t rebuildfstab "$*"
+ fi
+}
+
[ ! -e /proc/partitions ] && {
echo "$0: /proc not mounted, exiting" >&2
- [ -x /usr/bin/logger ] && /usr/bin/logger -i -t rebuildfstab "fatal - /proc not mounted, exiting"
+ logit "fatal - /proc not mounted, exiting"
exit 1
}
[ ! -w /etc/fstab ] && {
echo "$0: /etc/fstab not writeable, exiting" >&2
- [ -x /usr/bin/logger ] && /usr/bin/logger -i -t rebuildfstab "fatal - /etc/fstab not writeable, exiting"
+ logit "fatal - /etc/fstab not writeable, exiting"
exit 1
}
@@ -120,31 +126,48 @@ while [ -n "$arg" ] ; do
(-v*) verbose="yes" ;;
(-r*) remove="yes" ;;
(-f*) force="yes" ;;
+ (-config) config="yes" ;;
(-u*) shift
user="$1" ;;
(-g*) shift
group="$1" ;;
- (*) echo "Usage: $0 [-v[erbose]] [-r[emove_old]] [-u[ser] uid] [ -g[roup] gid]" ;;
+ (*) echo "Usage: $0 [-v[erbose]] [-config] [-r[emove_old]] [-u[ser] uid] [ -g[roup] gid]" ;;
esac
shift
arg="$1"
done
+
+logit "re-generating /etc/fstab - see 'man rebuildfstab'"
+
+if [ -n "$config" ] ; then
+ if [ -r /etc/grml/autoconfig ] ; then
+ . /etc/grml/autoconfig
+ if [ -n "$CONFIG_FSTAB_USER" ] ; then
+ user="$CONFIG_FSTAB_USER"
+ else
+ user='1000' # take default
+ logit 'warning: CONFIG_FSTAB_USER not set via /etc/grml/autoconfig but used option -config, assuming default'
+ fi
+ if [ -n "$CONFIG_FSTAB_GROUP" ] ; then
+ group="$CONFIG_FSTAB_GROUP"
+ else
+ group='users' # take default
+ logit 'warning: CONFIG_FSTAB_GROUP not set via /etc/grml/autoconfig but used option -config, assuming default'
+ fi
+ else
+ logit 'warning: option -config found but /etc/grml/autoconfig could not be read'
+ fi
+fi
if [ -n "$NOFSTAB" ] ; then
if [ -z "$force" ] ; then
echo "Warning: ${MESSAGE}, ignoring request to re-generate /etc/fstab without force option" >&2
echo "Use the -f option to force re-generatation of /etc/fstab." >&2
- if [ -x /usr/bin/logger ] ; then
- /usr/bin/logger -i -t rebuildfstab "${MESSAGE}, ignoring request to re-generate /etc/fstab without force option"
- fi
+ logit "${MESSAGE}, ignoring request to re-generate /etc/fstab without force option"
exit 1
else
echo "Warning: ${MESSAGE}, re-generating /etc/fstab anyway due to use of force option." >&2
fi
-fi
-
-if [ -x /usr/bin/logger ] ; then
- /usr/bin/logger -i -t rebuildfstab "re-generating /etc/fstab - see 'man rebuildfstab'"
fi
[ -n "$verbose" ] && echo "Scanning for new harddisks/partitions/devices." >& 2