Bug#765803: Status of prompting / notification on upgrade for init system switch?
On Sun, 19 Oct 2014 21:10:10 +1100 Stuart Prescott <stuart@debian.org> wrote:
> > inittab_unusual_lines="$(
> > grep '^[^#]' /etc/inittab |
> > while read line ; do
> > case "$line" in
> > 'id:2:initdefault:') ;;
> [...]
>
> I wonder if it would just be easier to look at the md5sum of the file and
> compare it to the md5sum of the inittab that was shipped in various releases
> -- that's a fairly idiomatic approach to dealing with config files that
> changed.
I considered that approach, but that has two issues:
- It doesn't take into account inittab files that have a mixture of
lines from the inittab files of multiple releases, all of which are
supported. The approach I used can include lines from any number of
inittab variations.
- It can't check for generated lines for serial consoles or similar;
finish-install can generate various additional inittab lines, which
the check should include.
- It unnecessarily prompts even if only comments or whitespace have been
edited.
> > modified_initscripts="$(
> > grep -lE '^/etc/init\.d/' /var/lib/dpkg/info/*.conffiles |
> > xargs basename -s '.conffiles' |
> > xargs dpkg -V |
> > grep '^..5...... c /etc/init\.d/' |
> > cut -d' ' -f3
> > )"
>
> For testing for modified init scripts, see also #760897 -- note that dpkg -V
> requires jessie's dpkg (it is not available in wheezy). For some upgrades
> between releases, we have advocated that people upgrade dpkg and apt first and
> then upgrade to the new release using the new versions of the tools but this
> is far from idiot proof. There's a persistent expectation that just doing a
> dist-upgrade should be enough and we see day-in-day-out that people do *not*
> read the release notes.
Gah, I didn't realize that dpkg -V didn't exist in wheezy. The package
with this check in its init script could have a Pre-Depends on jessie's
dpkg, which would solve the problem, but that may or may not be
desirable.
Based on the code from 760897, here's a version that should work with
wheezy's dpkg:
modified_initscripts="$(
dpkg-query --show -f'${Conffiles}' |
sed 's, /,\n/,g' |
sed -n '/^\/etc\/init\.d\//s/^\([^ ]*\) \(.*\)$/\2 \1/p' |
md5sum --quiet -c 2>/dev/null |
cut -d: -f1
)"
(Note that md5sum exits with non-zero if any of the checksums fail, but
since it isn't the last thing in the pipe, that doesn't actually matter
here.)
- Josh Triplett
Reply to: