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