1 |
commit: 65df2e34bf8a2edbbf20b226ac77ff1a92cbe52a |
2 |
Author: Matthew Thode <mthode <AT> mthode <DOT> org> |
3 |
AuthorDate: Fri Dec 18 01:54:15 2015 +0000 |
4 |
Commit: Matt Thode <prometheanfire <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Dec 18 01:54:15 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/releng.git/commit/?id=65df2e34 |
7 |
|
8 |
removed bad prep.sh, added correct prep.sh and renamed to cloud-prep.sh |
9 |
|
10 |
old script was the qcow generation script |
11 |
renamed to cloud-prep.sh to be more clear as to it's purpose |
12 |
|
13 |
releases/weekly/scripts/cloud-prep.sh | 79 ++++++++++++++++++++++ |
14 |
releases/weekly/scripts/prep.sh | 79 ---------------------- |
15 |
.../specs/amd64/hardened/stage4-nomultilib.spec | 2 +- |
16 |
releases/weekly/specs/amd64/hardened/stage4.spec | 2 +- |
17 |
releases/weekly/specs/amd64/stage4-nomultilib.spec | 2 +- |
18 |
releases/weekly/specs/amd64/stage4.spec | 2 +- |
19 |
6 files changed, 83 insertions(+), 83 deletions(-) |
20 |
|
21 |
diff --git a/releases/weekly/scripts/cloud-prep.sh b/releases/weekly/scripts/cloud-prep.sh |
22 |
new file mode 100644 |
23 |
index 0000000..6778713 |
24 |
--- /dev/null |
25 |
+++ b/releases/weekly/scripts/cloud-prep.sh |
26 |
@@ -0,0 +1,79 @@ |
27 |
+#!/bin/bash |
28 |
+ |
29 |
+# Set timezone |
30 |
+echo 'UTC' > /etc/timezone |
31 |
+ |
32 |
+# Set locale |
33 |
+echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen |
34 |
+echo 'en_US ISO-8859-1' >> /etc/locale.gen |
35 |
+locale-gen |
36 |
+eselect locale set en_US.utf8 |
37 |
+ |
38 |
+# Some rootfs stuff |
39 |
+grep -v rootfs /proc/mounts > /etc/mtab |
40 |
+ |
41 |
+# This is set in rackspaces prep, might help us |
42 |
+echo 'net.ipv4.conf.eth0.arp_notify = 1' >> /etc/sysctl.conf |
43 |
+echo 'vm.swappiness = 0' >> /etc/sysctl.conf |
44 |
+ |
45 |
+# Let's configure out grub |
46 |
+mkdir /boot/grub |
47 |
+echo 'GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8"' >> /etc/default/grub |
48 |
+grub2-mkconfig -o /boot/grub/grub.cfg |
49 |
+sed -r -i 's/loop[0-9]+p1/vda2/g' /boot/grub/grub.cfg |
50 |
+sed -i 's/UUID=[a-z,0-9,-]*/\/dev\/vda2/g' /boot/grub/grub.cfg |
51 |
+ |
52 |
+# And the fstab |
53 |
+echo '/dev/vda2 / ext4 defaults 0 0' > /etc/fstab |
54 |
+ |
55 |
+# allow the console log |
56 |
+sed -i 's/#s0/s0/g' /etc/inittab |
57 |
+ |
58 |
+# let ipv6 use normal slaac |
59 |
+sed -i 's/slaac/#slaac/g' /etc/dhcpcd.conf |
60 |
+# don't let dhcpcd set domain name or hostname |
61 |
+sed -i 's/domain_name\,\ domain_search\,\ host_name/domain_search/g' /etc/dhcpcd.conf |
62 |
+ |
63 |
+# need to do this here because it clobbers an openrc owned file |
64 |
+cat > /etc/conf.d/hostname << "EOL" |
65 |
+# Set to the hostname of this machine |
66 |
+if [ -f /etc/hostname ];then |
67 |
+ hostname=$(cat /etc/hostname 2> /dev/null | cut -d"." -f1 2> /dev/null) |
68 |
+else |
69 |
+ hostname="localhost" |
70 |
+fi |
71 |
+EOL |
72 |
+chmod 0644 /etc/conf.d/hostname |
73 |
+chown root:root /etc/conf.d/hostname |
74 |
+ |
75 |
+# set a nice default for /etc/resolv.conf |
76 |
+cat > /etc/resolv.conf << EOL |
77 |
+nameserver 8.8.8.8 |
78 |
+EOL |
79 |
+ |
80 |
+# let's upgrade (security fixes and otherwise) |
81 |
+USE="-build" emerge -uDNv --with-bdeps=y --jobs=2 @world |
82 |
+USE="-build" emerge --verbose=n --depclean |
83 |
+USE="-build" emerge -v --usepkg=n @preserved-rebuild |
84 |
+etc-update --automode -3 |
85 |
+ |
86 |
+# Clean up portage |
87 |
+emerge --verbose=n --depclean |
88 |
+eix-update |
89 |
+emaint all -f |
90 |
+eselect news read all |
91 |
+eclean-dist --destructive |
92 |
+sed -i '/^USE=\"\${USE}\ \ build\"$/d' /etc/portage/make.conf |
93 |
+ |
94 |
+# clean up system |
95 |
+passwd -d root |
96 |
+passwd -l root |
97 |
+rm -f /usr/portage/distfiles/* |
98 |
+rm -f /etc/ssh/ssh_host_* |
99 |
+rm -f /root/.bash_history |
100 |
+rm -f /root/.nano_history |
101 |
+rm -f /root/.lesshst |
102 |
+rm -f /root/.ssh/known_hosts |
103 |
+rm -f /usr/src/linux |
104 |
+for i in $(find /var/log -type f); do echo > $i; done |
105 |
+for i in $(find /tmp -type f); do rm -f $i; done |
106 |
|
107 |
diff --git a/releases/weekly/scripts/prep.sh b/releases/weekly/scripts/prep.sh |
108 |
deleted file mode 100644 |
109 |
index 22478a9..0000000 |
110 |
--- a/releases/weekly/scripts/prep.sh |
111 |
+++ /dev/null |
112 |
@@ -1,79 +0,0 @@ |
113 |
-#!/usr/bin/env bash |
114 |
-# |
115 |
-# Okay, so here's some real meat. We take a drive (as 02 said, I use a VM), |
116 |
-# and we spray that stage4 all over it. Then we rub some grub (0.97) all over |
117 |
-# it to make it feel better, and then we box it up and ship it out. |
118 |
- |
119 |
-set -e -u -x -o pipefail |
120 |
- |
121 |
-# Vars |
122 |
-export TEMP_DIR=${TEMP_DIR:-'/root/tmp/catalyst/gentoo'} |
123 |
-export MOUNT_DIR=${MOUNT_DIR:-'/mnt'} |
124 |
-export DATE=${DATE:-"$(date +%Y%m%d)"} |
125 |
-export PORTAGE_DIR=${PORTAGE_DIR:-"/var/tmp/catalyst/snapshots"} |
126 |
-# profiles supported are as follows |
127 |
-# default/linux/amd64/13.0 |
128 |
-# default/linux/amd64/13.0/no-multilib |
129 |
-# hardened/linux/amd64 |
130 |
-# hardened/linux/amd64/no-multilib |
131 |
-# hardened/linux/amd64/selinux (eventually) |
132 |
-# hardened/linux/amd64/no-multilib/selinux (eventually) |
133 |
-export PROFILE=${PROFILE:-"default/linux/amd64/13.0"} |
134 |
-if [[ "${PROFILE}" == "default/linux/amd64/13.0" ]]; then |
135 |
- PROFILE_SHORTNAME="amd64-default" |
136 |
-elif [[ "${PROFILE}" == "default/linux/amd64/13.0/no-multilib" ]]; then |
137 |
- PROFILE_SHORTNAME="amd64-default-nomultilib" |
138 |
-elif [[ "${PROFILE}" == "hardened/linux/amd64" ]]; then |
139 |
- PROFILE_SHORTNAME="amd64-hardened" |
140 |
-elif [[ "${PROFILE}" == "hardened/linux/amd64/no-multilib" ]]; then |
141 |
- PROFILE_SHORTNAME="amd64-hardened-nomultilib" |
142 |
-else |
143 |
- echo 'invalid profile, exiting' |
144 |
- exit 1 |
145 |
-fi |
146 |
-export TARBALL=${TARBALL:-"/root/tmp/catalyst/gentoo/stage4-${PROFILE_SHORTNAME}-${DATE}.tar.bz2"} |
147 |
-export TEMP_IMAGE=${TEMP_IMAGE:-"gentoo-${PROFILE_SHORTNAME}.img"} |
148 |
-export TARGET_IMAGE=${TARGET_IMAGE:-"/root/openstack-${PROFILE_SHORTNAME}-${DATE}.qcow2"} |
149 |
- |
150 |
-# create a raw partition and do stuff with it |
151 |
-fallocate -l 5G "${TEMP_DIR}/${TEMP_IMAGE}" |
152 |
-BLOCK_DEV=$(losetup -f --show "${TEMP_DIR}/${TEMP_IMAGE}") |
153 |
- |
154 |
-# Okay, we have the disk, let's prep it |
155 |
-echo 'Building disk' |
156 |
-parted -s "${BLOCK_DEV}" mklabel gpt |
157 |
-parted -s --align=none "${BLOCK_DEV}" mkpart bios_boot 0 2M |
158 |
-parted -s --align=none "${BLOCK_DEV}" mkpart primary 2M 100% |
159 |
-parted -s "${BLOCK_DEV}" set 1 boot on |
160 |
-parted -s "${BLOCK_DEV}" set 1 bios_grub on |
161 |
-mkfs.ext4 -F "${BLOCK_DEV}p2" |
162 |
- |
163 |
-# Mount it |
164 |
-echo 'Mounting disk' |
165 |
-mkdir -p "${MOUNT_DIR}/${PROFILE_SHORTNAME}" |
166 |
-mount "${BLOCK_DEV}p2" "${MOUNT_DIR}/${PROFILE_SHORTNAME}" |
167 |
- |
168 |
-# Expand the stage |
169 |
-echo 'Expanding tarball' |
170 |
-tar --xattrs -xjpf "${TARBALL}" -C "${MOUNT_DIR}/${PROFILE_SHORTNAME}" |
171 |
- |
172 |
-echo 'Adding in /usr/portage' |
173 |
-tar --xattrs -xjpf "${PORTAGE_DIR}/portage-latest.tar.bz2" -C "${MOUNT_DIR}/${PROFILE_SHORTNAME}/usr" |
174 |
- |
175 |
-# Install grub |
176 |
-echo 'Installing grub' |
177 |
-grub2-install "${BLOCK_DEV}" --boot-directory "${MOUNT_DIR}/${PROFILE_SHORTNAME}/boot" |
178 |
- |
179 |
-# Clean up |
180 |
-echo 'Syncing; unmounting' |
181 |
-sync |
182 |
-umount "${MOUNT_DIR}/${PROFILE_SHORTNAME}" |
183 |
- |
184 |
-# get rid of block mapping |
185 |
-losetup -d "${BLOCK_DEV}" |
186 |
- |
187 |
-echo 'Converting raw image to qcow2' |
188 |
-qemu-img convert -c -f raw -O qcow2 "${TEMP_DIR}/${TEMP_IMAGE}" "${TARGET_IMAGE}" |
189 |
- |
190 |
-echo 'Cleaning up' |
191 |
-rm "${TEMP_DIR}/${TEMP_IMAGE}" |
192 |
|
193 |
diff --git a/releases/weekly/specs/amd64/hardened/stage4-nomultilib.spec b/releases/weekly/specs/amd64/hardened/stage4-nomultilib.spec |
194 |
index 1ba0948..6f1bcfb 100644 |
195 |
--- a/releases/weekly/specs/amd64/hardened/stage4-nomultilib.spec |
196 |
+++ b/releases/weekly/specs/amd64/hardened/stage4-nomultilib.spec |
197 |
@@ -36,7 +36,7 @@ stage4/packages: |
198 |
sys-devel/bc |
199 |
sys-power/acpid |
200 |
sys-process/cronie |
201 |
-stage4/fsscript: /release/releng/releases/weekly/scripts/prep.sh |
202 |
+stage4/fsscript: /release/releng/releases/weekly/scripts/cloud-prep.sh |
203 |
stage4/root_overlay: /release/releng/releases/weekly/overlays/cloud-overlay |
204 |
stage4/rcadd: |
205 |
acpid|default |
206 |
|
207 |
diff --git a/releases/weekly/specs/amd64/hardened/stage4.spec b/releases/weekly/specs/amd64/hardened/stage4.spec |
208 |
index 707ec8a..136b511 100644 |
209 |
--- a/releases/weekly/specs/amd64/hardened/stage4.spec |
210 |
+++ b/releases/weekly/specs/amd64/hardened/stage4.spec |
211 |
@@ -36,7 +36,7 @@ stage4/packages: |
212 |
sys-devel/bc |
213 |
sys-power/acpid |
214 |
sys-process/cronie |
215 |
-stage4/fsscript: /release/releng/releases/weekly/scripts/prep.sh |
216 |
+stage4/fsscript: /release/releng/releases/weekly/scripts/cloud-prep.sh |
217 |
stage4/root_overlay: /release/releng/releases/weekly/overlays/cloud-overlay |
218 |
stage4/rcadd: |
219 |
acpid|default |
220 |
|
221 |
diff --git a/releases/weekly/specs/amd64/stage4-nomultilib.spec b/releases/weekly/specs/amd64/stage4-nomultilib.spec |
222 |
index e502645..c1b9c1d 100644 |
223 |
--- a/releases/weekly/specs/amd64/stage4-nomultilib.spec |
224 |
+++ b/releases/weekly/specs/amd64/stage4-nomultilib.spec |
225 |
@@ -36,7 +36,7 @@ stage4/packages: |
226 |
sys-devel/bc |
227 |
sys-power/acpid |
228 |
sys-process/cronie |
229 |
-stage4/fsscript: /release/releng/releases/weekly/scripts/prep.sh |
230 |
+stage4/fsscript: /release/releng/releases/weekly/scripts/cloud-prep.sh |
231 |
stage4/root_overlay: /release/releng/releases/weekly/overlays/cloud-overlay |
232 |
stage4/rcadd: |
233 |
acpid|default |
234 |
|
235 |
diff --git a/releases/weekly/specs/amd64/stage4.spec b/releases/weekly/specs/amd64/stage4.spec |
236 |
index 71e1ce9..aa8a3ff 100644 |
237 |
--- a/releases/weekly/specs/amd64/stage4.spec |
238 |
+++ b/releases/weekly/specs/amd64/stage4.spec |
239 |
@@ -36,7 +36,7 @@ stage4/packages: |
240 |
sys-devel/bc |
241 |
sys-power/acpid |
242 |
sys-process/cronie |
243 |
-stage4/fsscript: /release/releng/releases/weekly/scripts/prep.sh |
244 |
+stage4/fsscript: /release/releng/releases/weekly/scripts/cloud-prep.sh |
245 |
stage4/root_overlay: /release/releng/releases/weekly/overlays/cloud-overlay |
246 |
stage4/rcadd: |
247 |
acpid|default |