debian/update-reader.conf: add a SHA1 on the first line of the
configuration file to detect manual edition. Closes: #565896 "pcscd: overwrites changes in configuration files" urgency=medium because of RC bug.
This commit is contained in:
parent
3068de54b8
commit
4c69c3a259
|
@ -1,3 +1,12 @@
|
||||||
|
pcsc-lite (1.5.5-2) unstable; urgency=medium
|
||||||
|
|
||||||
|
* debian/update-reader.conf: add a SHA1 on the first line of the
|
||||||
|
configuration file to detect manual edition. Closes: #565896 "pcscd:
|
||||||
|
overwrites changes in configuration files"
|
||||||
|
urgency=medium because of RC bug.
|
||||||
|
|
||||||
|
-- Ludovic Rousseau <rousseau@debian.org> Sat, 30 Jan 2010 17:40:44 +0100
|
||||||
|
|
||||||
pcsc-lite (1.5.5-1) unstable; urgency=low
|
pcsc-lite (1.5.5-1) unstable; urgency=low
|
||||||
|
|
||||||
* New upstream release
|
* New upstream release
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#! /bin/sh
|
#! /bin/bash
|
||||||
#
|
#
|
||||||
# This is the update-reader.conf script for Debian GNU/Linux.
|
# This is the update-reader.conf script for Debian GNU/Linux.
|
||||||
# Written by Ludovic Rousseau <ludovic.rousseau@free.fr>
|
# Written by Ludovic Rousseau <ludovic.rousseau@free.fr>
|
||||||
|
@ -27,24 +27,44 @@ CFGFILE=/etc/reader.conf
|
||||||
TMPFILE=`mktemp /tmp/reader.conf.XXXXXX`
|
TMPFILE=`mktemp /tmp/reader.conf.XXXXXX`
|
||||||
HEADER="### This file is automatically generated by update-reader.conf"
|
HEADER="### This file is automatically generated by update-reader.conf"
|
||||||
|
|
||||||
|
trap "rm -f $TMPFILE; exit" INT TERM EXIT
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Reset the sorting order since we depend on it
|
# Reset the sorting order since we depend on it
|
||||||
LC_COLLATE=C
|
LC_COLLATE=C
|
||||||
export LC_COLLATE
|
export LC_COLLATE
|
||||||
|
|
||||||
|
needforce=0
|
||||||
if [ -f "$CFGFILE" ]; then
|
if [ -f "$CFGFILE" ]; then
|
||||||
if ! sed -ne 1p "$CFGFILE" | grep -q "^$HEADER" ; then
|
FIRSTLINE=$(head -1 "$CFGFILE")
|
||||||
echo "Error: the current $CFGFILE is not automatically generated."
|
if [ "$FIRSTLINE" != "$HEADER" ]; then
|
||||||
if [ "$1" != "force" ]; then
|
#echo "new format or manual"
|
||||||
echo "Use \"update-reader.conf force\" to force (re)generation."
|
sha=$(echo "$FIRSTLINE" | cut -f2 -d' ')
|
||||||
exit 1
|
#echo $sha
|
||||||
|
if [ ${#sha} -ne 40 ]; then
|
||||||
|
echo "Error: file $CFGFILE is not automatically generated."
|
||||||
|
needforce=1
|
||||||
else
|
else
|
||||||
echo "force specified, (re)generating file anyway."
|
sha2=$(tail --lines=+2 "$CFGFILE" | sha1sum | cut -f1 -d' ')
|
||||||
|
#echo $sha2
|
||||||
|
if [ $sha != $sha2 ]; then
|
||||||
|
echo "Error: file $CFGFILE was manually edited."
|
||||||
|
needforce=1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$1" = "force" ]; then
|
||||||
|
echo "force specified, (re)generating file anyway."
|
||||||
|
needforce=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $needforce -eq 1 ]; then
|
||||||
|
echo "Use \"update-reader.conf force\" to force (re)generation."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ 0 -ne "`id -u`" ]; then
|
if [ 0 -ne "`id -u`" ]; then
|
||||||
echo "You have to be root to run $0"
|
echo "You have to be root to run $0"
|
||||||
exit 2
|
exit 2
|
||||||
|
@ -54,11 +74,10 @@ if [ -e "$CFGFILE" ]; then
|
||||||
cp -f "$CFGFILE" "${CFGFILE}.old"
|
cp -f "$CFGFILE" "${CFGFILE}.old"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$HEADER" > "$TMPFILE"
|
|
||||||
|
|
||||||
for cfg in /etc/reader.conf.d/* ; do
|
for cfg in /etc/reader.conf.d/* ; do
|
||||||
if ! echo "$cfg" | grep -q '\(\.dpkg-[a-z]*\|~\)$' ; then
|
if ! echo "$cfg" | grep -q '\(\.dpkg-[a-z]*\|~\)$' ; then
|
||||||
echo "### update-reader.conf: start processing $cfg" >> "$TMPFILE"
|
echo "### update-reader.conf: start processing $cfg" >> "$TMPFILE"
|
||||||
|
echo >> "$TMPFILE"
|
||||||
if [ -x "$cfg" ]; then
|
if [ -x "$cfg" ]; then
|
||||||
"$cfg" >> "$TMPFILE"
|
"$cfg" >> "$TMPFILE"
|
||||||
else
|
else
|
||||||
|
@ -70,7 +89,9 @@ for cfg in /etc/reader.conf.d/* ; do
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
cp "$TMPFILE" "$CFGFILE"
|
echo -n "#SHA1 " > "$CFGFILE"
|
||||||
|
sha1sum "$TMPFILE" >> "$CFGFILE"
|
||||||
|
cat "$TMPFILE" >> "$CFGFILE"
|
||||||
chmod 644 "$CFGFILE"
|
chmod 644 "$CFGFILE"
|
||||||
|
|
||||||
rm -f "$TMPFILE"
|
rm -f "$TMPFILE"
|
||||||
|
|
Loading…
Reference in New Issue