1 |
commit: 6e2cef0da192dbb18f950c190051cbabc2fc1a98 |
2 |
Author: Jorge Manuel B. S. Vicetto (jmbsvicetto) <jmbsvicetto <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Dec 18 01:45:28 2015 +0000 |
4 |
Commit: Jorge Manuel B. S. Vicetto <jmbsvicetto <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Dec 18 01:45:28 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/releng.git/commit/?id=6e2cef0d |
7 |
|
8 |
Add prep.sh to the repo and fix the stage3 name for the stage4 specs. |
9 |
|
10 |
Signed-off-by: Jorge Manuel B. S. Vicetto (jmbsvicetto) <jmbsvicetto <AT> gentoo.org> |
11 |
|
12 |
releases/weekly/scripts/prep.sh | 79 ++++++++++++++++++++++ |
13 |
.../specs/amd64/hardened/stage4-nomultilib.spec | 2 +- |
14 |
releases/weekly/specs/amd64/hardened/stage4.spec | 2 +- |
15 |
releases/weekly/specs/amd64/stage4-nomultilib.spec | 2 +- |
16 |
releases/weekly/specs/amd64/stage4.spec | 2 +- |
17 |
5 files changed, 83 insertions(+), 4 deletions(-) |
18 |
|
19 |
diff --git a/releases/weekly/scripts/prep.sh b/releases/weekly/scripts/prep.sh |
20 |
new file mode 100644 |
21 |
index 0000000..22478a9 |
22 |
--- /dev/null |
23 |
+++ b/releases/weekly/scripts/prep.sh |
24 |
@@ -0,0 +1,79 @@ |
25 |
+#!/usr/bin/env bash |
26 |
+# |
27 |
+# Okay, so here's some real meat. We take a drive (as 02 said, I use a VM), |
28 |
+# and we spray that stage4 all over it. Then we rub some grub (0.97) all over |
29 |
+# it to make it feel better, and then we box it up and ship it out. |
30 |
+ |
31 |
+set -e -u -x -o pipefail |
32 |
+ |
33 |
+# Vars |
34 |
+export TEMP_DIR=${TEMP_DIR:-'/root/tmp/catalyst/gentoo'} |
35 |
+export MOUNT_DIR=${MOUNT_DIR:-'/mnt'} |
36 |
+export DATE=${DATE:-"$(date +%Y%m%d)"} |
37 |
+export PORTAGE_DIR=${PORTAGE_DIR:-"/var/tmp/catalyst/snapshots"} |
38 |
+# profiles supported are as follows |
39 |
+# default/linux/amd64/13.0 |
40 |
+# default/linux/amd64/13.0/no-multilib |
41 |
+# hardened/linux/amd64 |
42 |
+# hardened/linux/amd64/no-multilib |
43 |
+# hardened/linux/amd64/selinux (eventually) |
44 |
+# hardened/linux/amd64/no-multilib/selinux (eventually) |
45 |
+export PROFILE=${PROFILE:-"default/linux/amd64/13.0"} |
46 |
+if [[ "${PROFILE}" == "default/linux/amd64/13.0" ]]; then |
47 |
+ PROFILE_SHORTNAME="amd64-default" |
48 |
+elif [[ "${PROFILE}" == "default/linux/amd64/13.0/no-multilib" ]]; then |
49 |
+ PROFILE_SHORTNAME="amd64-default-nomultilib" |
50 |
+elif [[ "${PROFILE}" == "hardened/linux/amd64" ]]; then |
51 |
+ PROFILE_SHORTNAME="amd64-hardened" |
52 |
+elif [[ "${PROFILE}" == "hardened/linux/amd64/no-multilib" ]]; then |
53 |
+ PROFILE_SHORTNAME="amd64-hardened-nomultilib" |
54 |
+else |
55 |
+ echo 'invalid profile, exiting' |
56 |
+ exit 1 |
57 |
+fi |
58 |
+export TARBALL=${TARBALL:-"/root/tmp/catalyst/gentoo/stage4-${PROFILE_SHORTNAME}-${DATE}.tar.bz2"} |
59 |
+export TEMP_IMAGE=${TEMP_IMAGE:-"gentoo-${PROFILE_SHORTNAME}.img"} |
60 |
+export TARGET_IMAGE=${TARGET_IMAGE:-"/root/openstack-${PROFILE_SHORTNAME}-${DATE}.qcow2"} |
61 |
+ |
62 |
+# create a raw partition and do stuff with it |
63 |
+fallocate -l 5G "${TEMP_DIR}/${TEMP_IMAGE}" |
64 |
+BLOCK_DEV=$(losetup -f --show "${TEMP_DIR}/${TEMP_IMAGE}") |
65 |
+ |
66 |
+# Okay, we have the disk, let's prep it |
67 |
+echo 'Building disk' |
68 |
+parted -s "${BLOCK_DEV}" mklabel gpt |
69 |
+parted -s --align=none "${BLOCK_DEV}" mkpart bios_boot 0 2M |
70 |
+parted -s --align=none "${BLOCK_DEV}" mkpart primary 2M 100% |
71 |
+parted -s "${BLOCK_DEV}" set 1 boot on |
72 |
+parted -s "${BLOCK_DEV}" set 1 bios_grub on |
73 |
+mkfs.ext4 -F "${BLOCK_DEV}p2" |
74 |
+ |
75 |
+# Mount it |
76 |
+echo 'Mounting disk' |
77 |
+mkdir -p "${MOUNT_DIR}/${PROFILE_SHORTNAME}" |
78 |
+mount "${BLOCK_DEV}p2" "${MOUNT_DIR}/${PROFILE_SHORTNAME}" |
79 |
+ |
80 |
+# Expand the stage |
81 |
+echo 'Expanding tarball' |
82 |
+tar --xattrs -xjpf "${TARBALL}" -C "${MOUNT_DIR}/${PROFILE_SHORTNAME}" |
83 |
+ |
84 |
+echo 'Adding in /usr/portage' |
85 |
+tar --xattrs -xjpf "${PORTAGE_DIR}/portage-latest.tar.bz2" -C "${MOUNT_DIR}/${PROFILE_SHORTNAME}/usr" |
86 |
+ |
87 |
+# Install grub |
88 |
+echo 'Installing grub' |
89 |
+grub2-install "${BLOCK_DEV}" --boot-directory "${MOUNT_DIR}/${PROFILE_SHORTNAME}/boot" |
90 |
+ |
91 |
+# Clean up |
92 |
+echo 'Syncing; unmounting' |
93 |
+sync |
94 |
+umount "${MOUNT_DIR}/${PROFILE_SHORTNAME}" |
95 |
+ |
96 |
+# get rid of block mapping |
97 |
+losetup -d "${BLOCK_DEV}" |
98 |
+ |
99 |
+echo 'Converting raw image to qcow2' |
100 |
+qemu-img convert -c -f raw -O qcow2 "${TEMP_DIR}/${TEMP_IMAGE}" "${TARGET_IMAGE}" |
101 |
+ |
102 |
+echo 'Cleaning up' |
103 |
+rm "${TEMP_DIR}/${TEMP_IMAGE}" |
104 |
|
105 |
diff --git a/releases/weekly/specs/amd64/hardened/stage4-nomultilib.spec b/releases/weekly/specs/amd64/hardened/stage4-nomultilib.spec |
106 |
index ec6e4cb..1ba0948 100644 |
107 |
--- a/releases/weekly/specs/amd64/hardened/stage4-nomultilib.spec |
108 |
+++ b/releases/weekly/specs/amd64/hardened/stage4-nomultilib.spec |
109 |
@@ -4,7 +4,7 @@ version_stamp: hardened+cloud-nomultilib-2008.0 |
110 |
rel_type: hardened |
111 |
profile: hardened/linux/amd64/no-multilib |
112 |
snapshot: 2008.0 |
113 |
-source_subpath: hardened/stage3-amd64-hardened+cloud-nomultilib-2008.0 |
114 |
+source_subpath: hardened/stage3-amd64-hardened+nomultilib-2008.0 |
115 |
portage_confdir: /release/releng/releases/weekly/portage/stages |
116 |
|
117 |
stage4/use: |
118 |
|
119 |
diff --git a/releases/weekly/specs/amd64/hardened/stage4.spec b/releases/weekly/specs/amd64/hardened/stage4.spec |
120 |
index 7c7233c..707ec8a 100644 |
121 |
--- a/releases/weekly/specs/amd64/hardened/stage4.spec |
122 |
+++ b/releases/weekly/specs/amd64/hardened/stage4.spec |
123 |
@@ -4,7 +4,7 @@ version_stamp: hardened+cloud-2008.0 |
124 |
rel_type: hardened |
125 |
profile: hardened/linux/amd64 |
126 |
snapshot: 2008.0 |
127 |
-source_subpath: hardened/stage3-amd64-cloud-hardened-2008.0 |
128 |
+source_subpath: hardened/stage3-amd64-hardened-2008.0 |
129 |
portage_confdir: /release/releng/releases/weekly/portage/stages |
130 |
|
131 |
stage4/use: |
132 |
|
133 |
diff --git a/releases/weekly/specs/amd64/stage4-nomultilib.spec b/releases/weekly/specs/amd64/stage4-nomultilib.spec |
134 |
index 55297e9..e502645 100644 |
135 |
--- a/releases/weekly/specs/amd64/stage4-nomultilib.spec |
136 |
+++ b/releases/weekly/specs/amd64/stage4-nomultilib.spec |
137 |
@@ -4,7 +4,7 @@ version_stamp: cloud-nomultilib-2008.0 |
138 |
rel_type: default |
139 |
profile: default/linux/amd64/13.0/no-multilib |
140 |
snapshot: 2008.0 |
141 |
-source_subpath: default/stage3-amd64-cloud-nomultilib-2008.0 |
142 |
+source_subpath: default/stage3-amd64-nomultilib-2008.0 |
143 |
portage_confdir: /release/releng/releases/weekly/portage/stages |
144 |
|
145 |
stage4/use: |
146 |
|
147 |
diff --git a/releases/weekly/specs/amd64/stage4.spec b/releases/weekly/specs/amd64/stage4.spec |
148 |
index 74075d6..71e1ce9 100644 |
149 |
--- a/releases/weekly/specs/amd64/stage4.spec |
150 |
+++ b/releases/weekly/specs/amd64/stage4.spec |
151 |
@@ -4,7 +4,7 @@ version_stamp: cloud-2008.0 |
152 |
rel_type: default |
153 |
profile: default/linux/amd64/13.0 |
154 |
snapshot: 2008.0 |
155 |
-source_subpath: default/stage3-amd64-cloud-2008.0 |
156 |
+source_subpath: default/stage3-amd64-2008.0 |
157 |
portage_confdir: /release/releng/releases/weekly/portage/stages |
158 |
|
159 |
stage4/use: |