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 07:16:11 UTC
[cloudstack] branch debian9-systemvmtemplate updated (210f2cf ->
be06f2f)
This is an automated email from the ASF dual-hosted git repository.
bhaisaab pushed a change to branch debian9-systemvmtemplate
in repository https://gitbox.apache.org/repos/asf/cloudstack.git.
discard 210f2cf Fix cleanup and halting of template
new be06f2f Fix cleanup and halting of template
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (210f2cf)
\
N -- N -- N refs/heads/debian9-systemvmtemplate (be06f2f)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../systemvmtemplate/configure_login.sh | 17 -----------------
.../definitions/systemvmtemplate/definition.rb | 2 +-
.../systemvmtemplate/{halt.sh => finalize.sh} | 22 +++++++++++++++++++++-
3 files changed, 22 insertions(+), 19 deletions(-)
rename tools/appliance/definitions/systemvmtemplate/{halt.sh => finalize.sh} (63%)
--
To stop receiving notification emails like this one, please contact
['"commits@cloudstack.apache.org" <co...@cloudstack.apache.org>'].
[cloudstack] 01/01: Fix cleanup and halting of template
Posted by bh...@apache.org.
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
commit be06f2f29fc8428f2da0f6d005491b4c95c99678
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 | 21 ----------------
.../definitions/systemvmtemplate/definition.rb | 5 ++--
.../{configure_login.sh => finalize.sh} | 29 +++-------------------
.../definitions/systemvmtemplate/zerodisk.sh | 14 +++++------
5 files changed, 15 insertions(+), 56 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..1d9de06 100644
--- a/tools/appliance/definitions/systemvmtemplate/configure_login.sh
+++ b/tools/appliance/definitions/systemvmtemplate/configure_login.sh
@@ -27,25 +27,9 @@ 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
}
-function configure_sudoers() {
- cat >/etc/sudoers <<END
-Defaults env_reset
-Defaults exempt_group=admin
-Defaults mail_badpass
-Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
-
-root ALL=(ALL:ALL) ALL
-%admin ALL=NOPASSWD:/bin/chmod, /bin/cp, /bin/mkdir, /bin/mount, /bin/umount
-
-#includedir /etc/sudoers.d
-END
- echo 'cloud ALL=NOPASSWD:/bin/chmod, /bin/cp, /bin/mkdir, /bin/mount, /bin/umount, /sbin/halt' > /etc/sudoers.d/cloud
-}
-
function configure_inittab() {
# Fix inittab
cat >> /etc/inittab << EOF
@@ -56,14 +40,9 @@ EOF
}
function configure_login() {
- # configure_sshd
configure_inittab
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..9e4faef 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'
+ 'finalize.sh'
],
:postinstall_timeout => '10000'
}
diff --git a/tools/appliance/definitions/systemvmtemplate/configure_login.sh b/tools/appliance/definitions/systemvmtemplate/finalize.sh
similarity index 71%
copy from tools/appliance/definitions/systemvmtemplate/configure_login.sh
copy to tools/appliance/definitions/systemvmtemplate/finalize.sh
index 743d7ef..10cb048 100644
--- a/tools/appliance/definitions/systemvmtemplate/configure_login.sh
+++ b/tools/appliance/definitions/systemvmtemplate/finalize.sh
@@ -19,16 +19,8 @@
set -e
set -x
-function add_admin_group() {
- groupadd -f -r admin
-}
-
-function configure_user() {
- usermod -a -G admin cloud
- mkdir -p /home/cloud/.ssh
- chmod 700 /home/cloud/.ssh
+function randomize_password() {
echo "cloud:`openssl rand -base64 32`" | chpasswd
- echo "root:password" | chpasswd
}
function configure_sudoers() {
@@ -46,24 +38,11 @@ END
echo 'cloud ALL=NOPASSWD:/bin/chmod, /bin/cp, /bin/mkdir, /bin/mount, /bin/umount, /sbin/halt' > /etc/sudoers.d/cloud
}
-function configure_inittab() {
- # Fix inittab
- cat >> /etc/inittab << EOF
-
-0:2345:respawn:/sbin/getty -L 115200 ttyS0 vt102
-vc:2345:respawn:/sbin/getty 38400 hvc0
-EOF
-}
-
-function configure_login() {
- # configure_sshd
- configure_inittab
- add_admin_group
+function finalize() {
+ randomize_password
configure_sudoers
- configure_user
- rm -fv /home/cloud/configure_login.sh
sync
halt -p
}
-return 2>/dev/null || configure_login
+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>.