This file is indexed.

/usr/sbin/dtc_write_xenhvm_conf is in dtc-xen 0.5.17-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/bin/sh

set -e

USAGE="Usage: $0 <xen id> <ram size> <allipaddrs> <vncpassword> <howtoboot>
Where allipaddrs is of the form '1.2.3.4 1.2.3.5' (eg: separated by space),
and howtoboot is 'name.iso' in /var/lib/dtc-xen/ttyssh_home/xenXX or 'hdd'"
if [ $# -lt 5 ]; then 
	echo $USAGE
fi

# Source the configuration in the config file!
if [ -f /etc/dtc-xen/dtc-xen.conf ] ; then
	. /etc/dtc-xen/dtc-xen.conf
fi

# Figure out the LVM name from dtc-xen.conf
LVMNAME=`dtc-xen-volgroup`
[ -z "$LVMNAME" ] && {
	echo "Could not determine volume group from which to provision the volume" 1>&2
	echo "You might want to set provisioning_volgroup in dtc-xen.conf" 1>&2
	exit 78
}
FSTAB_LVMNAME=`echo ${LVMNAME} | sed -e 's/-/--/g'`

# Figure out the VPS mount point
if [ -n "$provisioning_mount_point" ]
then
	VPSGLOBPATH="$provisioning_mount_point"
else
	VPSGLOBPATH="$VPS_MOUNTPOINT"
fi

INSTALL_KERNELPATH="/boot/netbsd-INSTALL_XENU"
NORMAL_KERNELPATH="/boot/netbsd-XENU"

# Get parameters from command line
VPSNUM=$1
VPSNAME=xen${VPSNUM}
VPSHOSTNAME=xen${NODE_NUM}${VPSNUM}
RAMSIZE=$2
ALL_IPADDRS=$3
VNC_PASSWORD=$4
HOW_TO_BOOT=$5

MAC_ADDR=${vps_mac_prefix}:${VPSNUM}
if [ ! -z "${MAC_ADDR}" ] ; then
	XEN_WRITE_MAC="mac=${MAC_ADDR}, "
else
	XEN_WRITE_MAC=""
fi

XEN_BR=${bridge}
if [ ! -z "${XEN_BR}" ] ; then
        BRIDGE_DIRECTIVE=", bridge=${XEN_BR}"
else
        BRIDGE_DIRECTIVE=""
fi
if [ ! -z "${VCPUS}" ] ; then
	VCPUSSET="vcpus=${VCPUS}"
else
	VCPUSSET="vcpus=1"
fi
if [ ! -z "${MAXMEM}" ] ; then
	MAXMEMSET="maxmem=${MAXMEM}"
else
	MAXMEMSET=""
fi
if [ ! -z "${PAE}" ] ; then
	PAESET="pae=${PAE}"
else
	PAESET=""
fi
if [ ! -z "${ACPI}" ] ; then
	ACPISET="acpi=${ACPI}"
else
	ACPISET=""
fi
if [ ! -z "${APIC}" ] ; then
	APICSET="apic=${APIC}"
else
	APICSET=""
fi
if [ ! -z "${KEYMAP}" ] ; then
	KEYMAPSET="keymap='${KEYMAP}'"
else
	KEYMAPSET=""
fi
if [ ! -z "${CPUS}" ] ; then
	CPUSSET="cpus=${CPUS}"
else
	CPUSSET=""
fi
if [ ! -z "${CPUCAP}" ] ; then
	CPUCAPSET="cpu_cap=${CPUCAP}"
else
	CPUCAPSET=""
fi
if [ ! -z "${CPUWEIGHT}" ] ; then
	CPUWEIGHTSET="cpu_weight=${CPUWEIGHT}"
else
	CPUWEIGHTSET=""
fi
if [ -f /usr/lib/xen-default/boot/hvmloader ] ; then
	HVMLOADER=/usr/lib/xen-default/boot/hvmloader
elif [ -f /usr/lib/xen/boot/hvmloader ] ; then
	HVMLOADER=/usr/lib/xen/boot/hvmloader
fi

echo -n "kernel = \"${HVMLOADER}\"
builder = 'hvm'
memory = ${RAMSIZE}
name = \"${VPSNAME}\"
${CPUSSET}
${CPUCAPSET}
${CPUWEIGHTSET}
${VCPUSSET}
${MAXMEMSET}
${PAESET}
${ACPISET}
${APICSET}
${KEYMAPSET}
vif = [ 'type=ioemu, ${XEN_WRITE_MAC}ip=${ALL_IPADDRS}${BRIDGE_DIRECTIVE}' ]
disk=[ 'phy:/dev/mapper/${FSTAB_LVMNAME}-xen${VPSNUM},ioemu:hda,w'" >/etc/xen/${VPSNAME}
# Set the additional cdrom drives: add all *.iso files to the config file
HDDLIST="bcdefghijklmnopqrstuvwxyz"
INCREMENT=2
for i in `find /var/lib/dtc-xen/ttyssh_home/xen${VPSNUM}/ -mindepth 1 -maxdepth 1 -iname '*.iso' | cut -d'/' -f7 | tr \\\r\\\n ,\ ` ; do
	DRIVE_LETTER=`echo ${HDDLIST} | awk '{print substr($0,'${INCREMENT}',1)}'`
	INCREMENT=$(( $INCREMENT + 1))
	echo -n ,\'file:/var/lib/dtc-xen/ttyssh_home/xen${VPSNUM}/$i,hd${DRIVE_LETTER}:cdrom,r\' >>/etc/xen/${VPSNAME}
done
echo " ]" >>/etc/xen/${VPSNAME}

# Set the VNC configuration
if [ -z "${VNC_PASSWORD}" -o "${VNC_PASSWORD}" = "no_vnc" ] ; then
	echo "nographic=1
vnc=0" >>/etc/xen/${VPSNAME}
else
	echo "vfb = [ \"type=vnc,vncdisplay=${VPSNUM},vncpasswd=${VNC_PASSWORD}\" ]
nographic=0
vnc=1
stdvga=1" >>/etc/xen/${VPSNAME}
fi

# Set the boot device
if [ ! "${HOW_TO_BOOT}" = "hdd" -a -e /var/lib/dtc-xen/ttyssh_home/xen${VPSNUM}/${HOW_TO_BOOT} ] ; then
	echo "cdrom=\"/var/lib/dtc-xen/ttyssh_home/xen${VPSNUM}/${HOW_TO_BOOT}\"
boot=\"d\"" >>/etc/xen/${VPSNAME}
else
	echo "boot=\"c\"" >>/etc/xen/${VPSNAME}
fi
echo "serial='pty'" >>/etc/xen/${VPSNAME}