Skip to content

Commit 4b7809c

Browse files
committed
CLOUDSTACK-10013: Migrate to Debian9 for systemvmtemplate
WIP support for Debian9 Signed-off-by: Rohit Yadav <[email protected]>
1 parent a4cecd2 commit 4b7809c

File tree

8 files changed

+69
-65
lines changed

8 files changed

+69
-65
lines changed

tools/appliance/definitions/systemvmtemplate/apt_upgrade.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,16 @@ function add_backports() {
2323
sed -i '/cdrom/d' /etc/apt/sources.list
2424
sed -i '/deb-src/d' /etc/apt/sources.list
2525
sed -i '/backports/d' /etc/apt/sources.list
26-
echo 'deb http://http.debian.net/debian wheezy-backports main' >> /etc/apt/sources.list
26+
echo 'deb http://http.debian.net/debian stretch-backports main' >> /etc/apt/sources.list
2727
}
2828

2929
function apt_upgrade() {
3030
DEBIAN_FRONTEND=noninteractive
3131
DEBIAN_PRIORITY=critical
3232

33+
# Setup sudo
34+
echo 'cloud ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/cloud
35+
3336
add_backports
3437

3538
rm -fv /root/*.iso
@@ -38,6 +41,9 @@ function apt_upgrade() {
3841
apt-get -q -y --force-yes update
3942
apt-get -q -y --force-yes upgrade
4043

44+
apt-get -q -y --force-yes install linux-headers-$(uname -r) build-essential
45+
apt-get -q -y --force-yes install zlib1g-dev libssl-dev libreadline-gplv2-dev curl unzip
46+
4147
df -h
4248
}
4349

tools/appliance/definitions/systemvmtemplate/authorized_keys.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121
set -e
2222
set -x
2323

24-
# the key that we have in ../patches/debian/config/root/.ssh/authorized_keys for some reason
25-
key='ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAvFu3MLSPphFRBR1yM7nBukXWS9gPdAXfqq9cfC8ZqQN9ybi531aj44CybZ4BVT4kLfzbAs7+7nJeSIpPHxjv9XFqbxjIxoFeGYkj7s0RrJgtsEmvAAubZ3mYboUAYUivMgnJFLnv4VqyAbpjix6CfECUiU4ygwo24F3F6bAmhl4Vo1R5TSUdDIX876YePJTFtuVkLl4lu/+xw1QRWrgaSFosGICT37IKY7RjE79Ozb0GjNHyJPPgVAGkUVO4LawroL9dYOBlzdHpmqqA9Kc44oQBpvcU7s1+ezRTt7fZNnP7TG9ninZtrvnP4qmwAc4iUJ7N1bwh0mCblnoTfZ28hw== anthony@mobl-ant'
2624
mkdir -p /root/.ssh
2725
chmod 644 /root/.ssh
28-
echo ${key} > /root/.ssh/authorized_keys
26+
touch /root/.ssh/authorized_keys
2927
chmod 600 /root/.ssh/authorized_keys

tools/appliance/definitions/systemvmtemplate/cleanup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ set -e
2020
set -x
2121

2222
function cleanup_apt() {
23-
#apt-get -y remove linux-headers-$(uname -r) build-essential
23+
apt-get -y remove linux-headers-$(uname -r) build-essential
2424
apt-get -y remove dictionaries-common busybox
2525
apt-get -y autoremove
2626
apt-get autoclean

tools/appliance/definitions/systemvmtemplate/configure_login.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ root ALL=(ALL:ALL) ALL
4242
4343
#includedir /etc/sudoers.d
4444
END
45-
echo 'cloud ALL=NOPASSWD:/bin/chmod, /bin/cp, /bin/mkdir, /bin/mount, /bin/umount' > /etc/sudoers.d/cloud
45+
echo 'cloud ALL=NOPASSWD:/bin/chmod, /bin/cp, /bin/mkdir, /bin/mount, /bin/umount, /sbin/halt' > /etc/sudoers.d/cloud
4646
}
4747

4848
# sshd_config is overwritten from cloud_scripts
@@ -58,7 +58,7 @@ END
5858
#}
5959

6060
function configure_inittab() {
61-
grep "vc:2345:respawn:/sbin/getty" /etc/inittab && return
61+
#grep "vc:2345:respawn:/sbin/getty" /etc/inittab && return
6262

6363
# Fix inittab
6464
cat >> /etc/inittab << EOF
@@ -68,11 +68,11 @@ EOF
6868
}
6969

7070
function configure_login() {
71-
add_admin_group
72-
configure_cloud_user
73-
configure_sudoers
7471
# configure_sshd
7572
configure_inittab
73+
add_admin_group
74+
configure_sudoers
75+
configure_cloud_user
7676
}
7777

7878
return 2>/dev/null || configure_login

tools/appliance/definitions/systemvmtemplate/configure_systemvm_services.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
set -e
2020
set -x
2121

22-
CLOUDSTACK_RELEASE=4.6.0
22+
CLOUDSTACK_RELEASE=4.11.0
2323

2424
function configure_apache2() {
2525
# Enable ssl, rewrite and auth
2626
a2enmod ssl rewrite auth_basic auth_digest
2727
a2ensite default-ssl
2828
# Backup stock apache configuration since we may modify it in Secondary Storage VM
29-
cp /etc/apache2/sites-available/default /etc/apache2/sites-available/default.orig
30-
cp /etc/apache2/sites-available/default-ssl /etc/apache2/sites-available/default-ssl.orig
29+
cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/default.orig
30+
cp /etc/apache2/sites-available/default-ssl.conf /etc/apache2/sites-available/default-ssl.orig
3131
sed -i 's/SSLProtocol all -SSLv2$/SSLProtocol all -SSLv2 -SSLv3/g' /etc/apache2/mods-available/ssl.conf
3232
}
3333

tools/appliance/definitions/systemvmtemplate/definition.rb

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
arch = ENV['VM_ARCH'] || 'i386'
18+
arch = 'amd64'
1919

2020
#
2121
# NOTE: Before changing the version of the debian image make
@@ -25,25 +25,19 @@
2525
# removed from the debian mirrors
2626
#
2727
architectures = {
28-
:i386 => {
29-
:os_type_id => 'Debian',
30-
:iso_file => 'debian-7.11.0-i386-netinst.iso',
31-
:iso_src => 'http://cdimage.debian.org/cdimage/archive/7.11.0/i386/iso-cd/debian-7.11.0-i386-netinst.iso',
32-
:iso_md5 => '75055a694508f5b891038ec12d703c9e',
33-
},
3428
:amd64 => {
3529
:os_type_id => 'Debian_64',
36-
:iso_file => 'debian-7.11.0-amd64-netinst.iso',
37-
:iso_src => 'http://cdimage.debian.org/cdimage/archive/7.11.0/amd64/iso-cd/debian-7.11.0-amd64-netinst.iso',
38-
:iso_md5 => '096c1c18b44c269808bd815d58c53c8f'
30+
:iso_file => 'debian-9.1.0-amd64-netinst.iso',
31+
:iso_src => 'https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-9.1.0-amd64-netinst.iso',
32+
:iso_md5 => 'ddd8f6542dae8baf410e90b9ae0fe986'
3933
}
4034
}
4135

4236
config = {
4337
:cpu_count => '1',
4438
:memory_size => '256',
45-
:disk_size => '3200', :disk_format => 'VDI', :hostiocache => 'off',
46-
:iso_download_timeout => '1200',
39+
:disk_size => '4096', :disk_format => 'VDI', :hostiocache => 'off',
40+
:iso_download_timeout => '1000',
4741
:boot_wait => '10',
4842
:boot_cmd_sequence => [
4943
'<Esc>',
@@ -63,23 +57,22 @@
6357
'<Enter>'
6458
],
6559
:kickstart_port => '7122',
66-
:kickstart_timeout => '1200',
60+
:kickstart_timeout => '1000',
6761
:kickstart_file => 'preseed.cfg',
68-
:ssh_login_timeout => '1200',
69-
:ssh_user => 'root',
70-
:ssh_password => 'password',
62+
:ssh_login_timeout => '10000',
63+
:ssh_user => 'cloud',
64+
:ssh_password => 'cloud',
7165
:ssh_key => '',
7266
:ssh_host_port => '7222',
7367
:ssh_guest_port => '22',
7468
:sudo_cmd => "echo '%p'|sudo -S bash '%f'",
7569
:shutdown_cmd => 'halt -p',
7670
:postinstall_files => [
7771
# basic minimal vm creation
78-
'build_time.sh',
72+
#'build_time.sh',
7973
'apt_upgrade.sh',
8074
'configure_grub.sh',
8175
'configure_locale.sh',
82-
'configure_login.sh',
8376
'configure_networking.sh',
8477
'configure_acpid.sh',
8578
# turning it into a systemvm
@@ -91,9 +84,11 @@
9184
'configure_persistent_config.sh',
9285
# cleanup & space-saving
9386
'cleanup.sh',
94-
'zerodisk.sh'
87+
'zerodisk.sh',
88+
# setup login stuff
89+
'configure_login.sh'
9590
],
96-
:postinstall_timeout => '1200'
91+
:postinstall_timeout => '10000'
9792
}
9893

9994
config.merge! architectures[arch.to_sym]

tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function install_packages() {
5454

5555
${apt_get} install \
5656
rsyslog logrotate cron chkconfig insserv net-tools ifupdown vim-tiny netbase iptables \
57-
openssh-server e2fsprogs dhcp3-client tcpdump socat wget \
57+
openssh-server e2fsprogs isc-dhcp tcpdump socat wget \
5858
python bzip2 sed gawk diffutils grep gzip less tar telnet ftp rsync traceroute psmisc lsof procps \
5959
inetutils-ping iputils-arping httping curl \
6060
dnsutils zip unzip ethtool uuid file iproute acpid virt-what sudo \
@@ -67,16 +67,16 @@ function install_packages() {
6767
xenstore-utils libxenstore3.0 \
6868
conntrackd ipvsadm libnetfilter-conntrack3 libnl-3-200 libnl-genl-3-200 \
6969
ipcalc \
70+
openjdk-8-jre-headless \
7071
ipset \
7172
iptables-persistent \
7273
libtcnative-1 libssl-dev libapr1-dev \
7374
python-flask \
7475
haproxy \
7576
radvd \
76-
sharutils
77-
78-
${apt_get} -t wheezy-backports install keepalived irqbalance open-vm-tools qemu-guest-agent
79-
${apt_get} -t wheezy-backports install strongswan libcharon-extra-plugins libstrongswan-extra-plugins
77+
sharutils \
78+
keepalived irqbalance open-vm-tools qemu-guest-agent \
79+
strongswan libcharon-extra-plugins libstrongswan-extra-plugins
8080

8181
apt-get update
8282
apt-get -y --force-yes upgrade
@@ -93,16 +93,6 @@ function install_packages() {
9393
dpkg -i xe-guest-utilities_6.5.0_amd64.deb
9494
rm -f xe-guest-utilities_6.5.0_amd64.deb
9595
fi
96-
97-
# Install OpenJDK8 pkgs maintained by Azul
98-
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0x219BD9C9
99-
echo 'deb http://repos.azulsystems.com/debian stable main' > /etc/apt/sources.list.d/zulu.list
100-
apt-get -y autoremove
101-
apt-get autoclean
102-
apt-get clean
103-
apt-get update
104-
${apt_get} install zulu-8
105-
java -version
10696
}
10797

10898
return 2>/dev/null || install_packages

tools/appliance/definitions/systemvmtemplate/preseed.cfg

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,35 @@
1717

1818
### Localization
1919
# Locale sets language and country.
20-
d-i debian-installer/locale string en_US
20+
d-i debian-installer/locale string en_US.UTF-8
2121

2222
# Keyboard selection.
23-
d-i console-keymaps-at/keymap select us
23+
d-i keyboard-configuration/xkb-keymap select us
2424

2525
### Network configuration
2626
d-i netcfg/choose_interface select auto
2727
d-i netcfg/get_hostname string systemvm
28-
d-i netcfg/get_domain string cloudstack.org
28+
d-i netcfg/get_domain string apache.org
29+
d-i netcfg/wireless_wep string
30+
31+
d-i hw-detect/load_firmware boolean true
2932

3033
### Mirror settings
3134
d-i mirror/country string manual
32-
d-i mirror/http/hostname string http.us.debian.org
35+
d-i mirror/http/hostname string http.debian.net
3336
d-i mirror/http/directory string /debian
3437
d-i mirror/http/proxy string
3538

39+
### Apt setup
40+
d-i apt-setup/cdrom/set-first false
41+
#d-i apt-setup/non-free boolean true
42+
#d-i apt-setup/contrib boolean true
43+
#d-i apt-setup/use_mirror boolean true
44+
d-i apt-setup/services-select multiselect security, updates
45+
d-i apt-setup/security_host string security.debian.org
46+
d-i apt-setup/local0/source boolean false
47+
d-i apt-setup/multiarch string i386
48+
3649
### Clock and time zone setup
3750
d-i clock-setup/utc boolean true
3851
d-i time/zone string UTC
@@ -44,13 +57,13 @@ d-i partman-auto/method string regular
4457
d-i partman-auto/choose_recipe select atomic
4558
d-i partman-auto/expert_recipe string \
4659
boot-root :: \
47-
80 50 160 ext4 \
60+
90 50 120 ext4 \
4861
$primary{ } $bootable{ } \
4962
method{ format } format{ } \
5063
use_filesystem{ } filesystem{ ext4 } \
5164
mountpoint{ /boot } \
5265
. \
53-
500 40 800 ext4 \
66+
450 40 500 ext4 \
5467
method{ format } format{ } \
5568
use_filesystem{ } filesystem{ ext4 } \
5669
mountpoint{ / } \
@@ -60,7 +73,7 @@ d-i partman-auto/expert_recipe string \
6073
use_filesystem{ } filesystem{ ext4 } \
6174
mountpoint{ /home } \
6275
. \
63-
1000 60 1400 ext4 \
76+
1000 60 1800 ext4 \
6477
method{ format } format{ } \
6578
use_filesystem{ } filesystem{ ext4 } \
6679
mountpoint{ /usr } \
@@ -70,12 +83,12 @@ d-i partman-auto/expert_recipe string \
7083
use_filesystem{ } filesystem{ ext4 } \
7184
mountpoint{ /opt } \
7285
. \
73-
600 70 1200 ext4 \
86+
600 70 1600 ext4 \
7487
method{ format } format{ } \
7588
use_filesystem{ } filesystem{ ext4 } \
7689
mountpoint{ /var } \
7790
. \
78-
400 50 500 ext4 \
91+
400 50 600 ext4 \
7992
method{ format } format{ } \
8093
use_filesystem{ } filesystem{ ext4 } \
8194
mountpoint{ /var/log } \
@@ -88,7 +101,9 @@ d-i partman-auto/expert_recipe string \
88101
256 100 1024 linux-swap \
89102
method{ swap } format{ } \
90103
.
91-
d-i partman/confirm_write_new_label boolean true
104+
105+
d-i partman-md/confirm boolean true
106+
d-i partman-partitioning/confirm_write_new_label boolean true
92107
d-i partman/choose_partition select finish
93108
d-i partman/confirm boolean true
94109
d-i partman/confirm_nooverwrite boolean true
@@ -97,36 +112,36 @@ d-i partman/confirm_nooverwrite boolean true
97112
# ...
98113

99114
### Account setup
100-
d-i passwd/root-login boolean true
115+
d-i passwd/root-login boolean false
101116
d-i passwd/root-password password password
102117
d-i passwd/root-password-again password password
103-
d-i passwd/user-fullname string Cloud Stack
118+
d-i passwd/user-fullname string CloudStack User
104119
d-i passwd/username string cloud
105120
d-i passwd/user-password password cloud
106121
d-i passwd/user-password-again password cloud
107122
d-i user-setup/encrypt-home boolean false
108123
d-i user-setup/allow-password-weak boolean true
109124
d-i passwd/user-default-groups string audio cdrom video admin
110125

126+
#openssh-server openssh-server/permit-root-login boolean true
127+
111128
### Apt setup
112129
# ...
113130

114131
### Package selection
115132
tasksel tasksel/first multiselect ssh-server
116-
d-i pkgsel/include string openssh-server ntp acpid sudo bzip2 openssl
133+
d-i pkgsel/include string openssh-server ntp acpid sudo bzip2 openssl
117134
# Allowed values: none, safe-upgrade, full-upgrade
118135
d-i pkgsel/upgrade select none
119136

120137
popularity-contest popularity-contest/participate boolean false
121138

122139
### Boot loader installation
123140
d-i grub-installer/only_debian boolean true
141+
d-i grub-installer/with_other_os boolean true
142+
d-i grub-installer/bootdev string default
124143
d-i finish-install/reboot_in_progress note
125144

126-
### Preseeding other packages
127-
libssl1.0.0 libssl1.0.0/restart-services string
128-
libssl1.0.0 libssl1.0.0/restart-failed error
129-
130145
#### Advanced options
131146
# Prevent packaged version of VirtualBox Guest Additions being installed:
132147
d-i preseed/early_command string sed -i \

0 commit comments

Comments
 (0)