source: trunk/packages/invirt-autoinstaller/common/usr/sbin/invirt-create-image @ 3049

Last change on this file since 3049 was 2899, checked in by gdb, 15 years ago

Changed xen.network -> xen; fixed style for omitted option

File size: 901 bytes
Line 
1#!/bin/bash
2# Usage: no command-line args.
3# "arguments" come in environment:
4#  TARGET a device filename
5#  FSSIZE the desired filesystem size in mebibytes (rest will be swap)
6#  ARCH, DIST, MIRROR
7#  HOSTNAME, IP
8#
9# Optional: GATEWAY, NETMASK.  These default to values in invirt-getconf, if installed
10
11set -e
12
13if [ -z "$GATEWAY" ]; then
14    GATEWAY=$(invirt-getconf network.gateway)
15fi
16
17if [ -z "$NETMASK" ]; then
18    NETMASK=$(invirt-getconf network.netmask)
19fi
20
21echo ,"${FSSIZE}"$',L,*\n,,S\n;\n;' | sfdisk -uM -H 255 -S 63 "$TARGET"
22
23dmsetup info "$TARGET" 2>/dev/null && kpartx -a "$TARGET"
24
25xen-create-image --image-dev "${TARGET}1" --swap-dev "${TARGET}2" --fs ext3 --ide \
26 --hostname "$HOSTNAME" --ip="$IP" --netmask="$NETMASK" --gateway="$GATEWAY" \
27 --arch "$ARCH" --dist "$DIST" --mirror "$MIRROR" --cache=yes --verbose
28
29dmsetup info "$TARGET" 2>/dev/null && kpartx -d "$TARGET"
30
31exit 0
Note: See TracBrowser for help on using the repository browser.