... | ... |
@@ -39,7 +39,7 @@ TOOLS_BIN := $(SRCROOT)/tools/bin |
39 | 39 |
CONTAIN := $(TOOLS_BIN)/contain |
40 | 40 |
|
41 | 41 |
.PHONY : all iso clean photon-build-machine photon-vagrant-build photon-vagrant-local cloud-image \ |
42 |
-check check-bison check-g++ check-gawk check-createrepo check-vagrant check-packer check-packer-ovf-plugin check-sanity \ |
|
42 |
+check check-docker check-bison check-g++ check-gawk check-createrepo check-vagrant check-packer check-packer-ovf-plugin check-sanity \ |
|
43 | 43 |
clean-install clean-chroot |
44 | 44 |
|
45 | 45 |
THREADS?=1 |
... | ... |
@@ -97,6 +97,17 @@ ostree-host-iso: check $(PHOTON_STAGE) ostree-repo |
97 | 97 |
-f > \ |
98 | 98 |
$(PHOTON_LOGS_DIR)/installer.log 2>&1 |
99 | 99 |
|
100 |
+live-iso: check $(PHOTON_STAGE) $(PHOTON_PACKAGES_MINIMAL) |
|
101 |
+ @echo "Building Photon Minimal LIVE ISO..." |
|
102 |
+ @cd $(PHOTON_INSTALLER_DIR) && \ |
|
103 |
+ $(PHOTON_INSTALLER) -i $(PHOTON_STAGE)/photon-live-iso.iso \ |
|
104 |
+ -w $(PHOTON_STAGE)/photon_iso \ |
|
105 |
+ -l $(PHOTON_STAGE)/LOGS \ |
|
106 |
+ -r $(PHOTON_STAGE)/RPMS \ |
|
107 |
+ -p $(PHOTON_DATA_DIR)/build_install_options_livecd.json \ |
|
108 |
+ -f > \ |
|
109 |
+ $(PHOTON_LOGS_DIR)/installer.log 2>&1 |
|
110 |
+ |
|
100 | 111 |
packages-minimal: check $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) |
101 | 112 |
@echo "Building all RPMS..." |
102 | 113 |
@cd $(PHOTON_PKG_BUILDER_DIR) && \ |
... | ... |
@@ -111,7 +122,7 @@ packages-minimal: check $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) |
111 | 111 |
-c $(PHOTON_BINTRAY_CONFIG) \ |
112 | 112 |
-t ${THREADS} |
113 | 113 |
|
114 |
-iso: check $(PHOTON_STAGE) $(PHOTON_PACKAGES) ostree-repo |
|
114 |
+iso: |
|
115 | 115 |
@echo "Building Photon FUll ISO..." |
116 | 116 |
@cd $(PHOTON_INSTALLER_DIR) && \ |
117 | 117 |
sudo $(PHOTON_INSTALLER) -i $(PHOTON_STAGE)/photon.iso \ |
... | ... |
@@ -291,7 +302,10 @@ cloud-image: $(PHOTON_STAGE) $(PHOTON_ISO_PATH) |
291 | 291 |
echo "Unable to find photon iso file... aborting build"; \ |
292 | 292 |
fi |
293 | 293 |
|
294 |
-check: check-bison check-g++ check-gawk check-createrepo check-texinfo check-sanity |
|
294 |
+check: check-bison check-g++ check-gawk check-createrepo check-texinfo check-sanity check-docker |
|
295 |
+ |
|
296 |
+check-docker: |
|
297 |
+ @command -v docker >/dev/null 2>&1 || { echo "Package docker not installed. Aborting." >&2; exit 1; } |
|
295 | 298 |
|
296 | 299 |
check-bison: |
297 | 300 |
@command -v bison >/dev/null 2>&1 || { echo "Package bison not installed. Aborting." >&2; exit 1; } |
0 | 9 |
new file mode 100755 |
... | ... |
@@ -0,0 +1,17 @@ |
0 |
+menu hshift 7 |
|
1 |
+menu width 61 |
|
2 |
+menu autoboot |
|
3 |
+timeout 1 |
|
4 |
+noescape 1 |
|
5 |
+totaltimeout 1 |
|
6 |
+menu title Photon boot menu |
|
7 |
+include stdmenu.cfg |
|
8 |
+ |
|
9 |
+default PhotonOS |
|
10 |
+label PhotonOS |
|
11 |
+ menu label ^PhotonOS |
|
12 |
+ menu default |
|
13 |
+ kernel vmlinuz |
|
14 |
+ append initrd=initrd.img root=/dev/ram0 loglevel=3 |
|
15 |
+ |
|
16 |
+ |
... | ... |
@@ -30,6 +30,7 @@ PACKAGE_LIST_FILE=$3 |
30 | 30 |
RPM_LIST=$4 |
31 | 31 |
STAGE_PATH=$5 |
32 | 32 |
ADDITIONAL_FILES_TO_COPY_FROM_STAGE=$6 |
33 |
+LIVE_CD=$7 |
|
33 | 34 |
PHOTON_COMMON_DIR=$(dirname "${PACKAGE_LIST_FILE}") |
34 | 35 |
PACKAGE_LIST_FILE_BASE_NAME=$(basename "${PACKAGE_LIST_FILE}") |
35 | 36 |
#- Step 3 Setting up the boot loader |
... | ... |
@@ -37,6 +38,7 @@ WORKINGDIR=${BUILDROOT} |
37 | 37 |
BUILDROOT=${BUILDROOT}/photon-chroot |
38 | 38 |
|
39 | 39 |
cp -r BUILD_DVD/isolinux ${WORKINGDIR}/ |
40 |
+mv ${WORKINGDIR}/isolinux/live-menu.cfg ${WORKINGDIR}/isolinux/menu.cfg |
|
40 | 41 |
cp sample_ks.cfg ${WORKINGDIR}/isolinux/ |
41 | 42 |
|
42 | 43 |
find ${BUILDROOT} -name linux-[0-9]*.rpm | head -1 | xargs rpm2cpio | cpio -iv --to-stdout ./boot/vmlinuz* > ${WORKINGDIR}/isolinux/vmlinuz |
... | ... |
@@ -65,6 +67,7 @@ mkdir -p ${BUILDROOT}/etc/systemd/scripts |
65 | 65 |
cp BUILD_DVD/fstab ${BUILDROOT}/etc/fstab |
66 | 66 |
|
67 | 67 |
#- Step 7 - Create installer script |
68 |
+if [ "$LIVE_CD" = false ] ; then |
|
68 | 69 |
|
69 | 70 |
cat >> ${BUILDROOT}/bin/bootphotoninstaller << EOF |
70 | 71 |
#!/bin/bash |
... | ... |
@@ -75,6 +78,8 @@ EOF |
75 | 75 |
|
76 | 76 |
chmod 755 ${BUILDROOT}/bin/bootphotoninstaller |
77 | 77 |
|
78 |
+fi |
|
79 |
+ |
|
78 | 80 |
cat >> ${BUILDROOT}/init << EOF |
79 | 81 |
mount -t proc proc /proc |
80 | 82 |
/lib/systemd/systemd |
... | ... |
@@ -84,7 +89,12 @@ chmod 755 ${BUILDROOT}/init |
84 | 84 |
#adding autologin to the root user |
85 | 85 |
sed -i "s/ExecStart.*/ExecStart=-\/sbin\/agetty --autologin root --noclear %I $TERM/g" ${BUILDROOT}/lib/systemd/system/getty@.service |
86 | 86 |
|
87 |
-sed -i "s/root:.*/root:x:0:0:root:\/root:\/bin\/bootphotoninstaller/g" ${BUILDROOT}/etc/passwd |
|
87 |
+#- Step 7 - Create installer script |
|
88 |
+if [ "$LIVE_CD" = false ] ; then |
|
89 |
+ |
|
90 |
+ sed -i "s/root:.*/root:x:0:0:root:\/root:\/bin\/bootphotoninstaller/g" ${BUILDROOT}/etc/passwd |
|
91 |
+ |
|
92 |
+fi |
|
88 | 93 |
|
89 | 94 |
mkdir -p ${BUILDROOT}/mnt/photon-root/photon-chroot |
90 | 95 |
rm -rf ${BUILDROOT}/RPMS |
... | ... |
@@ -116,23 +126,26 @@ createrepo --database ${WORKINGDIR}/RPMS |
116 | 116 |
|
117 | 117 |
rm -rf ${BUILDROOT}/LOGS |
118 | 118 |
|
119 |
-# Cleaning up |
|
120 |
-#Remove our rpm database as it fills up the ramdisk |
|
121 |
-rm -rf ${BUILDROOT}/home/* |
|
122 |
-rm -rf ${BUILDROOT}/var/lib/rpm |
|
119 |
+if [ "$LIVE_CD" = false ] ; then |
|
120 |
+ # Cleaning up |
|
121 |
+ #Remove our rpm database as it fills up the ramdisk |
|
122 |
+ rm -rf ${BUILDROOT}/home/* |
|
123 |
+ rm -rf ${BUILDROOT}/var/lib/rpm |
|
123 | 124 |
|
124 |
-# Remove the boot directory |
|
125 |
-rm -rf ${BUILDROOT}/boot |
|
125 |
+ # Remove the boot directory |
|
126 |
+ rm -rf ${BUILDROOT}/boot |
|
126 | 127 |
|
127 |
-#Remove the include files. |
|
128 |
-rm -rf ${BUILDROOT}/usr/include |
|
128 |
+ #Remove the include files. |
|
129 |
+ rm -rf ${BUILDROOT}/usr/include |
|
129 | 130 |
|
130 |
-# TODO: mbassiouny, Find a clean way to do that |
|
131 |
-for i in `ls ${BUILDROOT}/usr/share/`; do |
|
132 |
- if [ $i != 'terminfo' -a $i != 'cracklib' -a $i != 'grub' ]; then |
|
133 |
- rm -rf ${BUILDROOT}/usr/share/$i |
|
134 |
- fi |
|
135 |
-done |
|
131 |
+ # TODO: mbassiouny, Find a clean way to do that |
|
132 |
+ for i in `ls ${BUILDROOT}/usr/share/`; do |
|
133 |
+ if [ $i != 'terminfo' -a $i != 'cracklib' -a $i != 'grub' ]; then |
|
134 |
+ rm -rf ${BUILDROOT}/usr/share/$i |
|
135 |
+ fi |
|
136 |
+ done |
|
137 |
+ |
|
138 |
+fi |
|
136 | 139 |
|
137 | 140 |
# Generate the intird |
138 | 141 |
pushd $BUILDROOT |
... | ... |
@@ -88,10 +88,11 @@ def create_rpm_list_to_copy_in_iso(build_install_option): |
88 | 88 |
options_sorted = option_list_json.items() |
89 | 89 |
packages = [] |
90 | 90 |
for install_option in options_sorted: |
91 |
- file_path = os.path.join(base_path, install_option[1]["file"]) |
|
92 |
- json_wrapper_package_list = JsonWrapper(file_path) |
|
93 |
- package_list_json = json_wrapper_package_list.read() |
|
94 |
- packages = packages + package_list_json["packages"] |
|
91 |
+ if install_option[0] != "iso": |
|
92 |
+ file_path = os.path.join(base_path, install_option[1]["file"]) |
|
93 |
+ json_wrapper_package_list = JsonWrapper(file_path) |
|
94 |
+ package_list_json = json_wrapper_package_list.read() |
|
95 |
+ packages = packages + package_list_json["packages"] |
|
95 | 96 |
return packages |
96 | 97 |
|
97 | 98 |
def create_additional_file_list_to_copy_in_iso(base_path, build_install_option): |
... | ... |
@@ -104,6 +105,17 @@ def create_additional_file_list_to_copy_in_iso(base_path, build_install_option): |
104 | 104 |
file_list = file_list + map(lambda filename: os.path.join(base_path, filename), install_option[1].get("additional-files")) |
105 | 105 |
return file_list |
106 | 106 |
|
107 |
+def get_live_cd_status_string(build_install_option): |
|
108 |
+ json_wrapper_option_list = JsonWrapper(build_install_option) |
|
109 |
+ option_list_json = json_wrapper_option_list.read() |
|
110 |
+ options_sorted = option_list_json.items() |
|
111 |
+ file_list = [] |
|
112 |
+ for install_option in options_sorted: |
|
113 |
+ if install_option[1].has_key("live-cd"): |
|
114 |
+ if install_option[1].get("live-cd") == True: |
|
115 |
+ return "true" |
|
116 |
+ return "false" |
|
117 |
+ |
|
107 | 118 |
if __name__ == '__main__': |
108 | 119 |
usage = "Usage: %prog [options] <config file> <tools path>" |
109 | 120 |
parser = OptionParser(usage) |
... | ... |
@@ -205,7 +217,8 @@ if __name__ == '__main__': |
205 | 205 |
if config['iso_system']: |
206 | 206 |
rpm_list = " ".join(create_rpm_list_to_copy_in_iso(options.package_list_file)) |
207 | 207 |
files_to_copy = " ".join(create_additional_file_list_to_copy_in_iso(os.path.abspath(options.stage_path), options.package_list_file)) |
208 |
- process = subprocess.Popen(['./mk-install-iso.sh', '-w', options.working_directory, options.iso_path, options.rpm_path, options.package_list_file, rpm_list, options.stage_path, files_to_copy]) |
|
208 |
+ live_cd = get_live_cd_status_string(options.package_list_file) |
|
209 |
+ process = subprocess.Popen(['./mk-install-iso.sh', '-w', options.working_directory, options.iso_path, options.rpm_path, options.package_list_file, rpm_list, options.stage_path, files_to_copy, live_cd]) |
|
209 | 210 |
retval = process.wait() |
210 | 211 |
|
211 | 212 |
# Cleaning up for vmdk |