incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [1/3] git commit: refs/heads/master - CLOUDSTACK-1340: Install scripts and packages which were in previous systemvm
Date Wed, 27 Feb 2013 11:38:04 GMT
CLOUDSTACK-1340: Install scripts and packages which were in previous systemvm

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/aabaf25c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/aabaf25c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/aabaf25c

Branch: refs/heads/master
Commit: aabaf25ce46df39def7dcfd66e3b1f4dbdc33ec5
Parents: e2bd88b
Author: Rohit Yadav <bhaisaab@apache.org>
Authored: Wed Feb 27 16:37:57 2013 +0530
Committer: Rohit Yadav <bhaisaab@apache.org>
Committed: Wed Feb 27 16:37:57 2013 +0530

----------------------------------------------------------------------
 .../definitions/systemvmtemplate/postinstall.sh    |   98 ++++++++++-----
 1 files changed, 67 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/aabaf25c/tools/appliance/definitions/systemvmtemplate/postinstall.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/definitions/systemvmtemplate/postinstall.sh b/tools/appliance/definitions/systemvmtemplate/postinstall.sh
index 97de81a..97175fa 100644
--- a/tools/appliance/definitions/systemvmtemplate/postinstall.sh
+++ b/tools/appliance/definitions/systemvmtemplate/postinstall.sh
@@ -25,39 +25,39 @@ install_packages() {
   DEBIAN_FRONTEND=noninteractive
   DEBIAN_PRIORITY=critical
 
-  #basic stuff
-   apt-get --no-install-recommends -q -y --force-yes install rsyslog logrotate cron chkconfig
insserv net-tools ifupdown vim-tiny netbase iptables
-   apt-get --no-install-recommends -q -y --force-yes install openssh-server openssl grub-legacy
e2fsprogs dhcp3-client dnsmasq tcpdump socat wget
-   apt-get --no-install-recommends -q -y --force-yes install python bzip2 sed gawk diffutils
grep gzip less tar telnet ftp rsync traceroute psmisc lsof procps monit inetutils-ping iputils-arping
httping
-   apt-get --no-install-recommends -q -y --force-yes install dnsutils zip unzip ethtool uuid
file iproute acpid virt-what sudo
+  # Basic packages
+  apt-get --no-install-recommends -q -y --force-yes install rsyslog logrotate cron chkconfig
insserv net-tools ifupdown vim-tiny netbase iptables
+  apt-get --no-install-recommends -q -y --force-yes install openssh-server openssl grub-legacy
e2fsprogs dhcp3-client dnsmasq tcpdump socat wget
+  apt-get --no-install-recommends -q -y --force-yes install python bzip2 sed gawk diffutils
grep gzip less tar telnet ftp rsync traceroute psmisc lsof procps monit inetutils-ping iputils-arping
httping
+  apt-get --no-install-recommends -q -y --force-yes install dnsutils zip unzip ethtool uuid
file iproute acpid virt-what sudo
 
-  #sysstat
+  # sysstat
   echo 'sysstat sysstat/enable boolean true' | debconf-set-selections
   apt-get --no-install-recommends -q -y --force-yes install sysstat
-  #apache
+  # apache
   apt-get --no-install-recommends -q -y --force-yes install apache2 ssl-cert
-  #haproxy
+  # haproxy
   apt-get --no-install-recommends -q -y --force-yes install haproxy
-  #dnsmasq
+  # dnsmasq
   apt-get --no-install-recommends -q -y --force-yes install dnsmasq
-  #nfs client
+  # nfs client
   apt-get --no-install-recommends -q -y --force-yes install nfs-common
 
-  #vpn stuff
+  # vpn stuff
   apt-get --no-install-recommends -q -y --force-yes install xl2tpd bcrelay ppp ipsec-tools
tdb-tools
   echo "openswan openswan/install_x509_certificate boolean false" | debconf-set-selections
   echo "openswan openswan/install_x509_certificate seen true" | debconf-set-selections
   apt-get --no-install-recommends -q -y --force-yes install openswan
 
-  #vmware tools
+  # vmware tools
   apt-get --no-install-recommends -q -y --force-yes install open-vm-tools
-  #xenstore utils
+  # xenstore utils
   apt-get --no-install-recommends -q -y --force-yes install xenstore-utils libxenstore3.0
-  #keepalived and conntrackd for redundant router
+  # keepalived and conntrackd for redundant router
   apt-get --no-install-recommends -q -y --force-yes install keepalived conntrackd ipvsadm
libnetfilter-conntrack3 libnl1
-  #ipcalc
+  # ipcalc
   apt-get --no-install-recommends -q -y --force-yes install ipcalc
-  #java
+  # java
   apt-get --no-install-recommends -q -y --force-yes install  default-jre-headless
 
   echo "iptables-persistent iptables-persistent/autosave_v4 boolean true" | debconf-set-selections
@@ -68,7 +68,7 @@ install_packages() {
 setup_accounts() {
   # Setup sudo to allow no-password sudo for "admin"
   groupadd -r admin
-  #create a 'cloud' user
+  # Create a 'cloud' user
   useradd -G admin cloud
   echo "root:$ROOTPW" | chpasswd
   echo "cloud:`openssl rand -base64 32`" | chpasswd
@@ -82,31 +82,57 @@ setup_accounts() {
 }
 
 fix_nameserver() {
-  #replace /etc/resolv.conf also
+  # Replace /etc/resolv.conf also
   cat > /etc/resolv.conf << EOF
 nameserver 8.8.8.8
 nameserver 4.4.4.4
 EOF
+}
+
+fix_inittab() {
+  # Fix inittab
+  cat >> etc/inittab << EOF
 
+vc:2345:respawn:/sbin/getty 38400 hvc0
+EOF
 }
 
-do_fixes() {
-  #fix hostname in openssh-server generated keys
+fix_acpid() {
+  # Fix acpid
+  mkdir -p etc/acpi/events
+  cat >> etc/acpi/events/power << EOF
+event=button/power.*
+action=/usr/local/sbin/power.sh "%e"
+EOF
+  cat >> usr/local/sbin/power.sh << EOF
+#!/bin/bash
+/sbin/poweroff
+EOF
+  chmod a+x usr/local/sbin/power.sh
+}
+
+fix_hostname() {
+  # Fix hostname in openssh-server generated keys
   sed -i "s/root@\(.*\)$/root@$HOSTNAME/g" /etc/ssh/ssh_host_*.pub
-  #fix hostname to override one provided by dhcp during vm build
+  # Fix hostname to override one provided by dhcp during vm build
   echo "$HOSTNAME" > /etc/hostname
   hostname $HOSTNAME
-  #delete entry in /etc/hosts derived from dhcp
+  # Delete entry in /etc/hosts derived from dhcp
   sed -i '/127.0.1.1/d' /etc/hosts
+}
 
+do_fixes() {
   fix_nameserver
+  fix_inittab
+  fix_acpid
+  fix_hostname
 }
 
 configure_apache2() {
-   #enable ssl, rewrite and auth
+   # Enable ssl, rewrite and auth
    a2enmod ssl rewrite auth_basic auth_digest
    a2ensite default-ssl
-   #backup stock apache configuration since we may modify it in Secondary Storage VM
+   # Backup stock apache configuration since we may modify it in Secondary Storage VM
    cp /etc/apache2/sites-available/default /etc/apache2/sites-available/default.orig
    cp /etc/apache2/sites-available/default-ssl /etc/apache2/sites-available/default-ssl.orig
 }
@@ -118,16 +144,26 @@ configure_services() {
   mkdir -p /usr/share/cloud
   mkdir -p /usr/local/cloud
   mkdir -p /root/.ssh
-  #Fix haproxy directory issue
+  # Fix haproxy directory issue
   mkdir -p /var/lib/haproxy
 
-  wget 'https://git-wip-us.apache.org/repos/asf?p=incubator-cloudstack.git;a=blob_plain;f=patches/systemvm/debian/config/etc/init.d/cloud-early-config;hb=HEAD'
-O /etc/init.d/cloud-early-config
+  # Get config files from master
+  snapshot_url="https://git-wip-us.apache.org/repos/asf?p=incubator-cloudstack.git;a=snapshot;h=HEAD;sf=tgz"
+  snapshot_dir="/tmp/incubator-cloudstack*"
+  cd /tmp
+  wget $snapshot_url -O cloudstack.tar.gz
+  tar -zxvf cloudstack.tar.gz
+  cp -rv $snapshot_dir/patches/systemvm/debian/config/* /
+  cp -rv $snapshot_dir/patches/systemvm/debian/vpn/* /
+  mkdir -p /usr/share/cloud/
+  tar -cvf /usr/share/cloud/cloud-scripts.tar $snapshot_dir/patches/systemvm/debian/config
+  tar -rvf /usr/share/cloud/cloud-scripts.tar cd $snapshot_dir/patches/systemvm/debian/vpn
+  rm -fr $snapshot_dir cloudstack.tar.gz
+
   chkconfig --add cloud-early-config
   chkconfig cloud-early-config on
-  wget 'https://git-wip-us.apache.org/repos/asf?p=incubator-cloudstack.git;a=blob_plain;f=patches/systemvm/debian/config/etc/init.d/cloud-passwd-srvr;hb=HEAD'
-O /etc/init.d/cloud-passwd-srvr
   chkconfig --add cloud-passwd-srvr
   chkconfig cloud-passwd-srvr off
-  wget 'https://git-wip-us.apache.org/repos/asf?p=incubator-cloudstack.git;a=blob_plain;f=patches/systemvm/debian/config/etc/init.d/cloud;hb=HEAD'
-O /etc/init.d/cloud
   chkconfig --add cloud
   chkconfig cloud off
   chkconfig monit off
@@ -136,8 +172,8 @@ configure_services() {
 
 do_signature() {
   mkdir -p /var/cache/cloud/
-  touch /var/cache/cloud/cloud-scripts-signature
-  #FIXME: signature should be generated from scripts package that can get updated
+  gzip -c /usr/share/cloud/cloud-scripts.tar > /usr/share/cloud/cloud-scripts.tgz
+  md5sum /usr/share/cloud/cloud-scripts.tgz | awk '{print $1}' > /var/cache/cloud/cloud-scripts-signature
   echo "Cloudstack Release $CLOUDSTACK_RELEASE $(date)" > /etc/cloudstack-release
 }
 
@@ -147,8 +183,8 @@ echo "*************INSTALLING PACKAGES********************"
 install_packages
 echo "*************DONE INSTALLING PACKAGES********************"
 setup_accounts
-configure_apache2
 configure_services
+configure_apache2
 do_fixes
 do_signature
 


Mime
View raw message