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

Last change on this file since 2870 was 2123, checked in by broder, 16 years ago

Use aptitude in invirt-update-ai-guest, and guarantee that it'll be
installed.

  • Property svn:executable set to *
File size: 843 bytes
RevLine 
[2018]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
[2123]40chroot /mnt/install aptitude update
41chroot /mnt/install aptitude dist-upgrade
[2018]42
43clean_up
Note: See TracBrowser for help on using the repository browser.