source: branches/wsgi/packages/sipb-xen-guest-installer/partial/xen-create-image-mods/90-make-fstab @ 3038

Last change on this file since 3038 was 496, checked in by neboat, 17 years ago

xen-create-image frobbing for deboostrap-commands

  • Property svn:executable set to *
File size: 2.0 KB
Line 
1#!/bin/sh
2#
3#  This script is responsible for setting up /etc/fstab upon the
4# new instance.
5#
6#  This should be a simple job, but it is complicated by some of the
7# differences between filesystems - some root filesystems will require
8# the installation of new packages, and we have to handle that here.
9#
10# Steve
11# --
12# http://www.steve.org.uk/
13
14prefix=$1
15
16#
17#  Source our common functions
18#
19if [ -e /usr/lib/xen-tools/common.sh ]; then
20    . /usr/lib/xen-tools/common.sh
21else
22    . ./hooks/common.sh
23fi
24
25
26#
27# Log our start
28#
29logMessage Script $0 starting
30
31
32#
33# Make sure we use ide style device names if required
34#
35device=sda
36if [ "${ide}" ]; then
37    device=hda
38fi
39
40#
41#  Now we have the options we can create the fstab.
42#
43has_xfs=0
44has_reiserfs=0
45cat <<E_O_FSTAB > ${prefix}/etc/fstab
46# /etc/fstab: static file system information.
47#
48# <file system> <mount point>   <type>  <options>       <dump>  <pass>
49proc            /proc           proc    defaults        0       0
50E_O_FSTAB
51for part in `seq 1 ${NUMPARTITIONS}`; do
52    eval "PARTITION=\"\${PARTITION${part}}\""
53    OLDIFS="${IFS}"
54    IFS=:
55    x=0
56    for partdata in ${PARTITION}; do
57        eval "partdata${x}=\"${partdata}\""
58        x=$(( $x+1 ))
59    done
60    IFS="${OLDIFS}"
61   
62    case "${partdata2}" in
63        xfs)
64            has_xfs=1
65            ;;
66        reiserfs)
67            has_reiserfs=1
68            ;;
69    esac
70   
71    # This assumes a particular partition table for our ParaVM's (SIPB)
72    if [ "${partdata2}" = "swap" ]; then
73        echo "/dev/${device}2 none swap sw 0 0" >> ${prefix}/etc/fstab
74    else
75        echo "/dev/${device}1 ${partdata3} ${partdata2} ${partdata4} 0 1" >> ${prefix}/etc/fstab
76    fi
77done
78
79
80#
81#  Finally we can install any required packages for the given root
82# filesystem
83#
84if [ $has_xfs -eq 1 ]; then
85    installDebianPackage ${prefix} xfsprogs
86fi
87if [ $has_reiserfs -eq 1 ]; then
88    installDebianPackage ${prefix} reiserfsprogs
89fi
90
91
92#
93#  Log our finish
94#
95logMessage Script $0 finished
Note: See TracBrowser for help on using the repository browser.