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
|
---|
16 | TARGET=$1
|
---|
17 |
|
---|
18 | # Variables
|
---|
19 | TMP_CONF=/tmp/mdadm.conf
|
---|
20 | BAK_CONF=$1/etc/mdadm/mdadm.conf.bak
|
---|
21 | ACT_CONF=$1/etc/mdadm/mdadm.conf
|
---|
22 |
|
---|
23 | # Make sure dpkg doesn't truncate output lines
|
---|
24 | export COLUMNS=200
|
---|
25 |
|
---|
26 | # Update mdadm.conf in target if it exists
|
---|
27 | if [ -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
|
---|
32 | fi
|
---|
33 |
|
---|
34 | # Mount proc and sys in restore target
|
---|
35 | mount -t proc proc $TARGET/proc
|
---|
36 | mount -t sysfs sys $TARGET/sys
|
---|
37 |
|
---|
38 | # Update configuration for installed 2.4 kernels
|
---|
39 | chroot $TARGET \
|
---|
40 | dpkg -l kernel-image\* | grep ^ii | \
|
---|
41 | while read status pkg junk ; do
|
---|
42 | chroot $TARGET dpkg-reconfigure -fnoninteractive $pkg
|
---|
43 | done
|
---|
44 |
|
---|
45 | # Update configuration for installed 2.6 kernels
|
---|
46 | chroot $TARGET \
|
---|
47 | dpkg -l linux-image\* | grep ^ii | \
|
---|
48 | while read status pkg junk ; do
|
---|
49 | chroot $TARGET dpkg-reconfigure -fnoninteractive $pkg
|
---|
50 | done
|
---|
51 |
|
---|
52 | # Bring down network interfaces in restore target
|
---|
53 | ifdown --all
|
---|
54 |
|
---|
55 | # Unmount sys and proc in restore target
|
---|
56 | umount $TARGET/proc $TARGET/sys
|
---|
57 |
|
---|
58 | # Finish script
|
---|
59 | exit 0
|
---|