You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2017/12/05 06:52:36 UTC
[cloudstack] branch debian9-systemvmtemplate updated: Fix cleanup
and halting of template
This is an automated email from the ASF dual-hosted git repository.
bhaisaab pushed a commit to branch debian9-systemvmtemplate
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/debian9-systemvmtemplate by this push:
new 210f2cf Fix cleanup and halting of template
210f2cf is described below
commit 210f2cf05e9bf875e8776fb79c2b30cd188caa9a
Author: Rohit Yadav <ro...@shapeblue.com>
AuthorDate: Tue Dec 5 12:22:07 2017 +0530
Fix cleanup and halting of template
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
---
.../definitions/systemvmtemplate/cleanup.sh | 2 +-
.../systemvmtemplate/configure_login.sh | 4 ----
.../definitions/systemvmtemplate/definition.rb | 5 ++--
.../appliance/definitions/systemvmtemplate/halt.sh | 28 ++++++++++++++++++++++
.../definitions/systemvmtemplate/zerodisk.sh | 14 +++++------
5 files changed, 39 insertions(+), 14 deletions(-)
diff --git a/tools/appliance/definitions/systemvmtemplate/cleanup.sh b/tools/appliance/definitions/systemvmtemplate/cleanup.sh
index ab911f3..4f5fccf 100644
--- a/tools/appliance/definitions/systemvmtemplate/cleanup.sh
+++ b/tools/appliance/definitions/systemvmtemplate/cleanup.sh
@@ -45,6 +45,7 @@ function cleanup_dev() {
function cleanup_misc() {
# Scripts
+ rm -fv /home/cloud/*.sh
rm -fr /home/cloud/cloud_scripts*
rm -f /root/.rnd
rm -f /var/www/html/index.html
@@ -65,7 +66,6 @@ function cleanup_misc() {
rm -fr /usr/share/man
rm -fr /usr/share/info
rm -fr /usr/share/lintian
- rm -fr /usr/share/vim
}
function cleanup() {
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_login.sh b/tools/appliance/definitions/systemvmtemplate/configure_login.sh
index 743d7ef..b25ea73 100644
--- a/tools/appliance/definitions/systemvmtemplate/configure_login.sh
+++ b/tools/appliance/definitions/systemvmtemplate/configure_login.sh
@@ -27,7 +27,6 @@ function configure_user() {
usermod -a -G admin cloud
mkdir -p /home/cloud/.ssh
chmod 700 /home/cloud/.ssh
- echo "cloud:`openssl rand -base64 32`" | chpasswd
echo "root:password" | chpasswd
}
@@ -61,9 +60,6 @@ function configure_login() {
add_admin_group
configure_sudoers
configure_user
- rm -fv /home/cloud/configure_login.sh
- sync
- halt -p
}
return 2>/dev/null || configure_login
diff --git a/tools/appliance/definitions/systemvmtemplate/definition.rb b/tools/appliance/definitions/systemvmtemplate/definition.rb
index 33c8e8b..ead9d09 100644
--- a/tools/appliance/definitions/systemvmtemplate/definition.rb
+++ b/tools/appliance/definitions/systemvmtemplate/definition.rb
@@ -81,11 +81,12 @@ config = {
'configure_systemvm_services.sh',
'authorized_keys.sh',
'configure_persistent_config.sh',
+ # setup login stuff
+ 'configure_login.sh',
# cleanup & space-saving
'cleanup.sh',
'zerodisk.sh',
- # setup login stuff
- 'configure_login.sh'
+ 'halt.sh'
],
:postinstall_timeout => '10000'
}
diff --git a/tools/appliance/definitions/systemvmtemplate/halt.sh b/tools/appliance/definitions/systemvmtemplate/halt.sh
new file mode 100644
index 0000000..e51531a
--- /dev/null
+++ b/tools/appliance/definitions/systemvmtemplate/halt.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -e
+set -x
+
+function finalize() {
+ echo "cloud:`openssl rand -base64 32`" | chpasswd
+ sync
+ halt -p
+}
+
+return 2>/dev/null || finalize
diff --git a/tools/appliance/definitions/systemvmtemplate/zerodisk.sh b/tools/appliance/definitions/systemvmtemplate/zerodisk.sh
index d002316..0b72363 100644
--- a/tools/appliance/definitions/systemvmtemplate/zerodisk.sh
+++ b/tools/appliance/definitions/systemvmtemplate/zerodisk.sh
@@ -24,26 +24,26 @@ function cleanup_veewee() {
# this has to be here since it is the last file to run (and we remove ourselves)
cd /home/cloud
rm -fv *.iso
- rm -fv {apt_upgrade,authorized_keys,cleanup,install_systemvm_packages,zerodisk}.sh
- rm -fv configure_{acpid,conntrack,grub,locale,networking,persistent_config,systemvm_services}.sh /home/cloud/install_systemvm_packages.sh
+ rm -fv *.sh
rm -fv .veewee_version .veewee_params .vbox_version
+ df -h
}
# Zero out the free space to save space in the final image:
function zero_disk() {
cleanup_veewee
+ for partition in $(blkid -o list | grep ext | awk '{print $1}')
+ do
+ tune2fs -m0 $partition
+ done
+
for path in / /boot /var/log /tmp
do
dd if=/dev/zero of=${path}/zero bs=1M || true
sync
rm -f ${path}/zero
done
-
- for partition in $(blkid -o list | grep ext | awk '{print $1}')
- do
- tune2fs -m0 $partition
- done
}
return 2>/dev/null || zero_disk
--
To stop receiving notification emails like this one, please contact
['"commits@cloudstack.apache.org" <co...@cloudstack.apache.org>'].