5
$0 [OPTION] ... <release>: build a landscape-client VM for the specified release
9
-m, --mirror <mirror> The Ubuntu mirror to use to build the VM, and
10
for the APT sources inside the VM itself.
12
If you want to use apt-proxy, you have to modify the
13
apt-proxy-v2.conf file to make apt-proxy listen to
14
your actual network interface address, instead of
15
the loopback one. For example:
17
;; Server IP to listen on
18
address = 192.168.1.162
20
-s, --server <host> The hostname of the Landscape server the client
23
-a, --account <account> The name of the Landscape account to use.
25
-p, --password <password> The password for the Landscape account.
27
-P, --profile <profile> Package profile to use, can be server or desktop.
29
-k, --ssl-key <key> Specify an SSL key to be used in the client config.
31
For example, this script can be invoked like this:
33
./dev/landscape-client-vm --password <LANDSCAPE_DEVEL_ACCOUNT_PW> intrepid
35
where <LANDSCAPE_DEVEL_ACCOUNT_PW> is the account password of the landscape-devel
36
account on the Landscape staging server (or you can specify another account with
37
the --account parameter).
39
The built VM will be stored under ./build/intrepid along with some other
40
files. To launch the VM, cd to ./build/intrepid and issue:
44
Once it's booted you can log into it with:
51
OPTS=$(getopt -o hm:s:a:p:P:k: --long help,mirror:,server:,account:,password:,profile:,ssl-key: -- "$@")
59
MIRROR=http://archive.ubuntu.com/ubuntu
60
SERVER=staging.landscape.canonical.com
61
ACCOUNT=landscape-devel
68
-h|--help) help; exit 1; shift ;;
69
-m|--mirror) MIRROR=$2; shift 2 ;;
70
-s|--server) SERVER=$2; shift 2;;
71
-a|--account) ACCOUNT=$2; shift 2;;
72
-p|--password) PASSWORD=$2; shift 2;;
73
-P|--profile) PROFILE=$2; shift 2;;
74
-S|--ssl-key) SSL_KEY=$2; shift 2;;
76
*) echo "Internal error!" ; exit 1 ;;
80
if [ "$1" = "" ]; then
86
TOPDIR=$(pwd)/build/${RELEASE}-${PROFILE}
87
SSH_KEY=$TOPDIR/ssh_key
94
ssh-keygen -N '' -f $SSH_KEY
100
url = https://${SERVER}/message-system
101
computer_title = ${RELEASE} test VM $$
102
data_path = /var/lib/landscape/client
104
ping_url = http://${SERVER}/ping
105
include_manager_plugins = ScriptExecution
106
account_name = ${ACCOUNT}
107
registration_password = ${PASSWORD}
111
if ! [ "$WITH_SSL" = "" ]; then
112
echo ssl_public_key = $SSL_KEY >> config
115
cat > script-wrapper <<EOF
117
chroot \$1 /root/script
119
chmod 755 script-wrapper
122
-----BEGIN PGP PUBLIC KEY BLOCK-----
125
mI0ESXN/egEEAOgRYISU9dnQm4BB5ZEEwKT+NKUDNd/DhMYdtBMw9Yk7S5cyoqpbtwoPJVzK
126
AXxq+ng5e3yYypSv98pLMr5UF09FGaeyGlD4s1uaVFWkFCO4jsTg7pWIY6qzO/jMxB5+Yu/G
127
0GjWQMNKxFk0oHMa0PhNBZtdPacVz65mOVmCsh/lABEBAAG0G0xhdW5jaHBhZCBQUEEgZm9y
128
IExhbmRzY2FwZYi2BBMBAgAgBQJJc396AhsDBgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQ
129
boWobkZStOb+rwP+ONKUWeX+MTIPqGWkknBPV7jm8nyyIUojC4IhS+9YR6GYnn0hMABSkEHm
130
IV73feKmrT2GESYI1UdYeKiOkWsPN/JyBk+eTvKet0qsw5TluqiHSW+LEi/+zUyrS3dDMX3o
131
yaLgYa+UkjIyxnaKLkQuCiS+D+fYwnJulIkhaKObtdE=
133
-----END PGP PUBLIC KEY BLOCK-----
138
chown landscape /etc/landscape/client.conf
139
chmod 600 /etc/landscape/client.conf
140
apt-key add /root/ppa-key
141
echo "RUN=1" > /etc/default/landscape-client
148
config /etc/landscape/client.conf
151
if [ "$WITH_SSL" = "yes" ]; then
152
echo /etc/landscape/certs/sample_ca.crt /etc/landscape/client.conf.ssl_public_key >> manifest
157
exec ssh -p $SSH_PORT -i $SSH_KEY -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@localhost
163
exec kvm --redir tcp:$SSH_PORT::22 -m 1280 -smp 1 -drive file=$TOPDIR/ubuntu-kvm/disk0.qcow2 "$@"
167
ADDPKGS="--addpkg=landscape-client --addpkg=openssh-server"
169
if [ "$PROFILE" = "server" ]; then
170
ADDPKGS="$ADDPKGS --addpkg apache2-mpm-prefork --addpkg postgresql --addpkg postfix"
172
ADDPKGS="$ADDPKGS --addpkg ubuntu-desktop"
175
if [ -n "$TMPDIR" ]; then
176
TEMP_DIR_OPT="-t $TMPDIR"
179
sudo ubuntu-vm-builder kvm "$RELEASE" --rootsize=$ROOTSIZE --mirror="$MIRROR" --ppa="$PPA" $ADDPKGS --execscript=./script-wrapper --copy=manifest --ssh-key=$SSH_KEY.pub $TEMP_DIR_OPT