source: MondoRescue/branches/2.2.9/mondo/src/post-nuke.sample/usr/bin/post-nuke.debian@ 2870

Last change on this file since 2870 was 2870, checked in by Bruno Cornec, 13 years ago
  • Fix some markup in man pages
  • adds the post-nuke script sample for Debian (Guillaume Pernot/Andrée Leidenfrost)
File size: 1.5 KB
Line 
1#!/bin/sh
2#
3# Update Debian installation after retore:
4# - update mdadm.conf if applicable
5# - update configuration of installed kernel packages
6#
7# Original version by Guillaume Pernot - thank you!
8#
9# Changelog:
10# 03Jun06AL: - initial version
11# 08Oct06AL: - added COLUMNS parameter so that dpkg outputs all information
12# (sarge compatibility) - thank you, Augustin Amann
13#
14
15# Restore target
16TARGET=$1
17
18# Variables
19TMP_CONF=/tmp/mdadm.conf
20BAK_CONF=$1/etc/mdadm/mdadm.conf.bak
21ACT_CONF=$1/etc/mdadm/mdadm.conf
22
23# Make sure dpkg doesn't truncate output lines
24export COLUMNS=200
25
26# Update mdadm.conf in target if it exists
27if [ -f $ACT_CONF ]; then
28 echo "DEVICE partitions" > $TMP_CONF
29 mdadm --detail --scan >> $TMP_CONF
30 cp $ACT_CONF $BAK_CONF
31 cp $TMP_CONF $ACT_CONF
32fi
33
34# Mount proc and sys in restore target
35mount -t proc proc $TARGET/proc
36mount -t sysfs sys $TARGET/sys
37
38# Update configuration for installed 2.4 kernels
39chroot $TARGET \
40dpkg -l kernel-image\* | grep ^ii | \
41while read status pkg junk ; do
42 chroot $TARGET dpkg-reconfigure -fnoninteractive $pkg
43done
44
45# Update configuration for installed 2.6 kernels
46chroot $TARGET \
47dpkg -l linux-image\* | grep ^ii | \
48while read status pkg junk ; do
49 chroot $TARGET dpkg-reconfigure -fnoninteractive $pkg
50done
51
52# Bring down network interfaces in restore target
53ifdown --all
54
55# Unmount sys and proc in restore target
56umount $TARGET/proc $TARGET/sys
57
58# Finish script
59exit 0
Note: See TracBrowser for help on using the repository browser.