source: trunk/packages/invirt-autoinstaller/host/usr/sbin/invirt-update-ai-guest @ 2064

Last change on this file since 2064 was 2018, checked in by broder, 16 years ago

Add a script to automate updating the autoinstaller guest.

  • Property svn:executable set to *
File size: 841 bytes
Line 
1#!/bin/bash
2
3set -e
4
5export VG=xenvg
6export INSTALLLV=s_install_hda
7export INSTALLPATH="/dev/$VG/$INSTALLLV"
8export UPDATEPATH="/dev/$VG/update_$INSTALLLV"
9export MAPPERPATH="/dev/mapper/$VG-update_$INSTALLLV"
10export MOUNTDIRS="/dev /proc /sys"
11
12clean_up() {
13    set +e
14   
15    for i in $MOUNTDIRS; do
16        umount "/mnt/install$i"
17    done
18   
19    umount /mnt/install
20    kpartx -d "$UPDATEPATH"
21    lvchange -a y "$UPDATEPATH"
22    lvrename "$UPDATEPATH" "$INSTALLPATH"
23    exit 0
24}
25
26trap clean_up ERR
27
28lvchange -a n "$INSTALLPATH"
29lvrename "$INSTALLPATH" "$UPDATEPATH"
30lvchange -a ey "$UPDATEPATH"
31kpartx -a "$UPDATEPATH"
32
33mkdir -p /mnt/install
34mount "${MAPPERPATH}1" /mnt/install
35
36for i in $MOUNTDIRS; do
37    mount --bind $i "/mnt/install$i"
38done
39
40chroot /mnt/install apt-get update
41chroot /mnt/install apt-get dist-upgrade
42
43clean_up
Note: See TracBrowser for help on using the repository browser.