Quote:
Originally Posted by TB0ne
We will be happy to HELP you...so post what you've written/tried so far, and where you're stuck. Otherwise, there are lots of very easily-found bash tutorials:
http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
http://tldp.org/LDP/abs/html/
...start with those. As with any programming task in any language, you have to break it down into steps. Think about each task you have to perform...those commands are what's going to make up your bash script. Start there.
|
#!/bin/bash
GUESTIMAGESTORAGE=/home/wahab/Desktop/linux
GUESTIMAGEFORMAT=qcow2
ISOSTORAGE=/home/wahab/Desktop/iso
ISOFILENAME=SL-63-x86_64-2012-08-02-Install-DVD.iso
NETWORKBRIDGE=guest_os_bridge
KICKSTARTFILEPATH=/home/wahab/Desktop/kickstart
GUESTRAM=1024
GUESTDISKSIZE=4
REPO64=http://ftp1.scientificlinux.org/linux/scientific/6.3/x86_64/os
GUESTNAME64=sl63x86_64_base
KICKSTARTFILENAME64=sl63x86_64_ks_base.cfg
KICKSTARTFILELOCATION64=$KICKSTARTFILEPATH/$KICKSTARTFILENAME64
echo "$KICKSTARTFILELOCATION64"
# Create images directory
mkdir -p /home/wahab/Desktop/iso
mkdir -p /home/wahab/Desktop/kickstart
mkdir -p $GUESTIMAGESTORAGE
cp /root/install/$KICKSTARTFILENAME64 $KICKSTARTFILEPATH/$KICKSTARTFILENAME64
virt-install --connect qemu:///system \
--name $GUESTNAME64 \
--ram $GUESTRAM \
--vcpus=1 \
--file $GUESTIMAGESTORAGE/$GUESTNAME64$(echo ".")$GUESTIMAGEFORMAT \
--file-size $GUESTDISKSIZE \
--location $REPO64 \
--vnc \
--noautoconsole \
--os-type linux \
--accelerate \
--network=bridge:$NETWORKBRIDGE,mac=00:00:00:00:00:00 \
--hvm \
--initrd-inject=$KICKSTARTFILELOCATION64 \
--extra-args "ks=file:/$KICKSTARTFILENAME64"
#
After running this file I am getting error... .
/home/wahab/Desktop/kickstart/sl63x86_64_ks_base.cfg
ERROR
--name is required
--ram amount in MB is required
--disk storage must be specified (override with --nodisks)
An install method must be specified
(--location URL, --cdrom CD/ISO, --pxe, --import, --boot hd|cdrom|...)
sample_create-1.sh: line 39: --name: command not found
sample_create-1.sh: line 41: --ram: command not found
sample_create-1.sh: line 44: --vcpus=1: command not found
sample_create-1.sh: line 45: --file: command not found
sample_create-1.sh: line 47: --file-size: command not found
sample_create-1.sh: line 49: --location: command not found
sample_create-1.sh: line 52: --vnc: command not found
sample_create-1.sh: line 54: --noautoconsole: command not found
sample_create-1.sh: line 55: --os-type: command not found
sample_create-1.sh: line 58: --accelerate: command not found
sample_create-1.sh: line 60: --network=bridge:guest_os_bridge,mac=00:00:00:00:00:00: command not found
sample_create-1.sh: line 62: --hvm: command not found
sample_create-1.sh: line 64: --initrd-inject=/home/wahab/Desktop/kickstart/sl63x86_64_ks_base.cfg: No such file or directory
sample_create-1.sh: line 65: --extra-args: command not found