Change-Id: Iada6179331c78546471db7e7af6d9dd170b1d411
Reviewed-on: http://photon-jenkins.eng.vmware.com/657
Reviewed-by: Mahmoud Bassiouny <mbassiouny@vmware.com>
Tested-by: jenkins-photon <wangnan2015@hotmail.com>
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,44 @@ |
| 0 |
+Summary: initramfs |
|
| 1 |
+Name: initramfs |
|
| 2 |
+Version: 1.0 |
|
| 3 |
+Release: 1%{?dist}
|
|
| 4 |
+License: Apache License |
|
| 5 |
+Group: System Environment/Base |
|
| 6 |
+Source: photon-release-1.0.2.tar.gz |
|
| 7 |
+%define sha1 photon-release=4c03ec658315e25873e5e5f3e77c0006ddfeecc6 |
|
| 8 |
+Vendor: VMware, Inc. |
|
| 9 |
+Distribution: Photon |
|
| 10 |
+Provides: initramfs |
|
| 11 |
+BuildRequires: linux |
|
| 12 |
+BuildRequires: dracut |
|
| 13 |
+BuildRequires: ostree |
|
| 14 |
+ |
|
| 15 |
+%description |
|
| 16 |
+Photon release files such as yum configs and other /etc/ release related files |
|
| 17 |
+ |
|
| 18 |
+%prep |
|
| 19 |
+%setup -q -n photon-release-1.0.2 |
|
| 20 |
+echo 'add_drivers+="tmem xen-acpi-processor xen-evtchn xen-gntalloc xen-gntdev xen-privcmd xen-pciback xenfs hv_ballon hv_utils hv_vmbus cn"' >> /etc/dracut.conf |
|
| 21 |
+ |
|
| 22 |
+echo 'add_dracutmodules+=" ostree systemd "' > /etc/dracut.conf.d/ostree.conf |
|
| 23 |
+ |
|
| 24 |
+%build |
|
| 25 |
+dracut --force --kver 4.2.0 initrd.img-no-kmods |
|
| 26 |
+%install |
|
| 27 |
+rm -rf $RPM_BUILD_ROOT |
|
| 28 |
+install -d $RPM_BUILD_ROOT/boot |
|
| 29 |
+install -m 600 initrd.img-no-kmods $RPM_BUILD_ROOT/boot/initrd.img-no-kmods |
|
| 30 |
+ |
|
| 31 |
+%post |
|
| 32 |
+ |
|
| 33 |
+%clean |
|
| 34 |
+rm -rf $RPM_BUILD_ROOT |
|
| 35 |
+ |
|
| 36 |
+%files |
|
| 37 |
+%defattr(-,root,root,-) |
|
| 38 |
+%dir /boot |
|
| 39 |
+/boot/initrd.img-no-kmods |
|
| 40 |
+ |
|
| 41 |
+%changelog |
|
| 42 |
+* Thu Mar 24 2016 Xiaolin Li <xiaolinl@vmware.com> 1.0-1 |
|
| 43 |
+- Initial version. |
|
| 0 | 44 |
\ No newline at end of file |
| ... | ... |
@@ -1,18 +1,9 @@ |
| 1 | 1 |
{
|
| 2 |
- "packages": ["gc", "gmp", "libgcc", "libunistring", "libltdl", "libstdc++", "libffi", |
|
| 3 |
- "xz", "attr", "openssl", "pcre", "guile", "ca-certificates", |
|
| 4 |
- "kmod", "glib", "autogen", "libtasn1", "bzip2", "libcap", "Linux-PAM", |
|
| 5 |
- "nettle", "filesystem", "systemd", "gnutls", "python2", "glibc", "libgpg-error", |
|
| 6 |
- "bash", "libassuan", "gpgme", "libsolv", "util-linux", "glib-networking", |
|
| 7 |
- "openssl-devel", "libselinux", "libxml2", "expat", "curl", "coreutils", |
|
| 8 |
- "libsepol", "popt", "gobject-introspection", "rpm-devel", "db", "sqlite-autoconf", |
|
| 9 |
- "nspr", "libxml2-devel", "hawkey-devel", "lua", "libarchive", "nss", "rpm", "librepo", |
|
| 10 |
- "librepo-devel", "dracut", "cracklib", "ncurses", "zlib", "file", "elfutils-libelf", |
|
| 11 |
- "libsoup", "device-mapper-libs", "hawkey", "readline", "libsoup-devel", "device-mapper", |
|
| 12 |
- "mkinitcpio", "python2-libs", "python-xml", "dracut-tools", "libgsystem", "nettle-devel", "libhif", |
|
| 13 |
- "libtasn1-devel", "libarchive-devel", "cracklib-dicts", "findutils", "efivar", "grub2", |
|
| 14 |
- "cpio", "shadow", "dbus", "python-requests", "pkg-config", "dosfstools", "sed", "json-glib", |
|
| 15 |
- "python-hawkey", "libhif-devel", "grub2-efi", "linux", "cracklib-python", "gpgme-devel", |
|
| 16 |
- "grep", "ostree", "tar", "efibootmgr", "pciutils", "gnutls-devel", "e2fsprogs", "gzip", |
|
| 17 |
- "gptfdisk", "tdnf", "python-curses"] |
|
| 2 |
+ "packages": ["glibc","zlib","filesystem","file","gmp","libgcc","libstdc++","bash","sed", |
|
| 3 |
+ "bzip2","pkg-config","ncurses","cracklib","cracklib-dicts","cracklib-python", |
|
| 4 |
+ "shadow","coreutils","grep","readline","findutils","xz","util-linux","e2fsprogs", |
|
| 5 |
+ "libffi","expat","linux","cpio","Linux-PAM","attr","libcap", "systemd","dbus", |
|
| 6 |
+ "gzip", "sqlite-autoconf","nspr","nss","popt","lua","rpm","gptfdisk","tar", "librepo", |
|
| 7 |
+ "hawkey", "python2","python2-libs","pcre","glib", "tdnf", "python-requests", |
|
| 8 |
+ "grub2","dracut", "curl", "ostree"] |
|
| 18 | 9 |
} |
| ... | ... |
@@ -17,7 +17,6 @@ import signal |
| 17 | 17 |
import sys |
| 18 | 18 |
import glob |
| 19 | 19 |
import modules.commons |
| 20 |
-import xml.etree.ElementTree as ET |
|
| 21 | 20 |
from jsonwrapper import JsonWrapper |
| 22 | 21 |
from progressbar import ProgressBar |
| 23 | 22 |
from window import Window |
| ... | ... |
@@ -104,6 +103,13 @@ class Installer(object): |
| 104 | 104 |
if retval != 0: |
| 105 | 105 |
modules.commons.log(modules.commons.LOG_INFO, "Failed to reset repo") |
| 106 | 106 |
self.exit_gracefully(None, None) |
| 107 |
+ |
|
| 108 |
+ cmdoption = 's/cachedir=\/var/cachedir={}/g'.format(self.photon_root.replace('/','\/'))
|
|
| 109 |
+ process = subprocess.Popen(['sed', '-i', cmdoption,'/etc/tdnf/tdnf.conf']) |
|
| 110 |
+ retval = process.wait() |
|
| 111 |
+ if retval != 0: |
|
| 112 |
+ modules.commons.log(modules.commons.LOG_INFO, "Failed to reset tdnf cachedir") |
|
| 113 |
+ self.exit_gracefully(None, None) |
|
| 107 | 114 |
self.execute_modules(modules.commons.PRE_INSTALL) |
| 108 | 115 |
|
| 109 | 116 |
self.initialize_system() |
| ... | ... |
@@ -281,11 +287,7 @@ class Installer(object): |
| 281 | 281 |
#Setup the disk |
| 282 | 282 |
process = subprocess.Popen([self.chroot_command, '-w', self.photon_root, self.finalize_command, '-w', self.photon_root], stdout=self.output) |
| 283 | 283 |
retval = process.wait() |
| 284 |
- initrd_dir = 'boot' |
|
| 285 |
- initrd_file_name = 'initrd.img-no-kmods' |
|
| 286 | 284 |
if self.iso_installer: |
| 287 |
- # just copy the initramfs /boot -> /photon_mnt/boot |
|
| 288 |
- shutil.copy(os.path.join(initrd_dir, initrd_file_name), self.photon_root + '/boot/') |
|
| 289 | 285 |
|
| 290 | 286 |
modules.commons.dump(modules.commons.LOG_FILE_NAME) |
| 291 | 287 |
shutil.copy(modules.commons.LOG_FILE_NAME, self.photon_root + '/var/log/') |
| ... | ... |
@@ -296,39 +298,11 @@ class Installer(object): |
| 296 | 296 |
# remove the installer directory |
| 297 | 297 |
process = subprocess.Popen(['rm', '-rf', os.path.join(self.photon_root, "installer")], stdout=self.output) |
| 298 | 298 |
retval = process.wait() |
| 299 |
- elif not self.install_config['vmdk_install']: |
|
| 300 |
- #Build the initramfs by passing in the kernel version |
|
| 301 |
- version_string = '' |
|
| 302 |
- for root, dirs, files in os.walk(self.rpm_path): |
|
| 303 |
- for name in files: |
|
| 304 |
- if fnmatch.fnmatch(name, 'linux-[0-9]*.rpm'): |
|
| 305 |
- version_array = name.split('-')
|
|
| 306 |
- if len(version_array) > 2: |
|
| 307 |
- version_string = version_array[1] |
|
| 308 |
- |
|
| 309 |
- if 'initrd_dir' in self.install_config: |
|
| 310 |
- initrd_dir = self.install_config['initrd_dir'] |
|
| 311 |
- self.add_dracut_configuration() |
|
| 312 |
- process = subprocess.Popen([self.chroot_command, '-w', self.photon_root, 'dracut', '--force', '--kver', version_string, os.path.join(initrd_dir,initrd_file_name)], stdout=self.output, stderr=self.output) |
|
| 299 |
+ # Disable the swap file |
|
| 300 |
+ process = subprocess.Popen(['swapoff', '-a'], stdout=self.output) |
|
| 313 | 301 |
retval = process.wait() |
| 314 |
- |
|
| 315 |
- def add_dracut_configuration(self): |
|
| 316 |
- if self.install_config.has_key("dracut_configuration"):
|
|
| 317 |
- dracut_configuration = [] |
|
| 318 |
- |
|
| 319 |
- for key in self.install_config["dracut_configuration"].keys(): |
|
| 320 |
- keyValue = self.install_config["dracut_configuration"][key] |
|
| 321 |
- config=key |
|
| 322 |
- if isinstance(keyValue,list): |
|
| 323 |
- config=config+'+="'+" ".join(keyValue)+'"' |
|
| 324 |
- else: |
|
| 325 |
- config=config+'="'+keyValue+'"' |
|
| 326 |
- config=config+"\n" |
|
| 327 |
- dracut_configuration.append(config) |
|
| 328 |
- |
|
| 329 |
- f = open(self.photon_root+"/etc/dracut.conf","a") |
|
| 330 |
- f.writelines(dracut_configuration) |
|
| 331 |
- |
|
| 302 |
+ # remove the tdnf cache directory and the swapfile. |
|
| 303 |
+ process = subprocess.Popen(['rm', '-rf', os.path.join(self.photon_root, "cache")], stdout=self.output) |
|
| 332 | 304 |
|
| 333 | 305 |
def install_package(self, package_name): |
| 334 | 306 |
rpm_params = '' |
| ... | ... |
@@ -39,6 +39,7 @@ WORKINGDIR=${BUILDROOT}
|
| 39 | 39 |
BUILDROOT=${BUILDROOT}/photon-chroot
|
| 40 | 40 |
|
| 41 | 41 |
cp -r BUILD_DVD/isolinux ${WORKINGDIR}/
|
| 42 |
+cp BUILD_DVD/isolinux/splash.png ${BUILDROOT}/installer/boot/.
|
|
| 42 | 43 |
|
| 43 | 44 |
if [ "$LIVE_CD" = true ] ; then |
| 44 | 45 |
mv ${WORKINGDIR}/isolinux/live-menu.cfg ${WORKINGDIR}/isolinux/menu.cfg
|
| ... | ... |
@@ -163,6 +164,33 @@ if [ "$LIVE_CD" = false ] ; then |
| 163 | 163 |
#Remove the include files. |
| 164 | 164 |
rm -rf ${BUILDROOT}/usr/include
|
| 165 | 165 |
|
| 166 |
+ rm ${BUILDROOT}/lib64/libmvec*
|
|
| 167 |
+ rm ${BUILDROOT}/usr/sbin/grub2-bios-setup
|
|
| 168 |
+ rm ${BUILDROOT}/usr/sbin/grub2-probe
|
|
| 169 |
+ rm ${BUILDROOT}/usr/sbin/grub2-macbless
|
|
| 170 |
+ rm ${BUILDROOT}/usr/sbin/grub2-reboot
|
|
| 171 |
+ rm ${BUILDROOT}/usr/sbin/grub2-sparc64-setup
|
|
| 172 |
+ rm ${BUILDROOT}/usr/sbin/sln
|
|
| 173 |
+ |
|
| 174 |
+ rm ${BUILDROOT}/usr/bin/grub2-mkrescue
|
|
| 175 |
+ rm ${BUILDROOT}/usr/bin/grub2-fstest
|
|
| 176 |
+ rm ${BUILDROOT}/usr/bin/grub2-syslinux2cfg
|
|
| 177 |
+ rm ${BUILDROOT}/usr/bin/grub2-mkstandalone
|
|
| 178 |
+ |
|
| 179 |
+ rm ${BUILDROOT}/usr/bin/localedef
|
|
| 180 |
+ rm ${BUILDROOT}/usr/bin/systemd-nspawn
|
|
| 181 |
+ rm ${BUILDROOT}/usr/bin/systemd-analyze
|
|
| 182 |
+ rm -rf ${BUILDROOT}/usr/lib64/gconv
|
|
| 183 |
+ |
|
| 184 |
+ rm -rf ${BUILDROOT}/usr/lib/python2.7/lib2to3
|
|
| 185 |
+ rm -rf ${BUILDROOT}/usr/lib/python2.7/lib-tk
|
|
| 186 |
+ rm -rf ${BUILDROOT}/usr/lib/python2.7/ensurepip
|
|
| 187 |
+ rm -rf ${BUILDROOT}/usr/lib/python2.7/encoding
|
|
| 188 |
+ rm -rf ${BUILDROOT}/usr/lib/python2.7/distutils
|
|
| 189 |
+ rm -rf ${BUILDROOT}/usr/lib/python2.7/pydoc_data
|
|
| 190 |
+ rm -rf ${BUILDROOT}/usr/lib/python2.7/idlelib
|
|
| 191 |
+ rm -rf ${BUILDROOT}/usr/lib/python2.7/unittest
|
|
| 192 |
+ |
|
| 166 | 193 |
# TODO: mbassiouny, Find a clean way to do that |
| 167 | 194 |
for i in `ls ${BUILDROOT}/usr/share/`; do
|
| 168 | 195 |
if [ $i != 'terminfo' -a $i != 'cracklib' -a $i != 'grub' ]; then |
| ... | ... |
@@ -37,6 +37,11 @@ cd ${BUILDROOT} || fail "${PRGNAME}: Change directory: ${BUILDROOT}: FAILURE"
|
| 37 | 37 |
# |
| 38 | 38 |
if [[ $# -gt 0 ]] && [[ $1 == 'install' ]]; then |
| 39 | 39 |
mkdir -p ${BUILDROOT}/var/lib/rpm
|
| 40 |
+ mkdir -p ${BUILDROOT}/cache/tdnf
|
|
| 41 |
+ #Setup the disk |
|
| 42 |
+ dd if=/dev/zero of=${BUILDROOT}/cache/swapfile bs=1M count=64
|
|
| 43 |
+ mkswap -v1 ${BUILDROOT}/cache/swapfile
|
|
| 44 |
+ swapon ${BUILDROOT}/cache/swapfile
|
|
| 40 | 45 |
rpm --root ${BUILDROOT} --initdb
|
| 41 | 46 |
tdnf install filesystem --installroot ${BUILDROOT} --nogpgcheck --assumeyes
|
| 42 | 47 |
else |
| ... | ... |
@@ -85,7 +85,7 @@ fi |
| 85 | 85 |
|
| 86 | 86 |
cp boot/unifont.pf2 ${BUILDROOT}/boot/grub2/
|
| 87 | 87 |
mkdir -p ${BUILDROOT}/boot/grub2/themes/photon
|
| 88 |
-cp boot/splash.tga ${BUILDROOT}/boot/grub2/themes/photon/photon.tga
|
|
| 88 |
+cp boot/splash.png ${BUILDROOT}/boot/grub2/themes/photon/photon.png
|
|
| 89 | 89 |
cp boot/terminal_*.tga ${BUILDROOT}/boot/grub2/themes/photon/
|
| 90 | 90 |
cp boot/theme.txt ${BUILDROOT}/boot/grub2/themes/photon/
|
| 91 | 91 |
cat > $BUILDROOT/boot/grub2/grub.cfg << EOF |
| ... | ... |
@@ -111,6 +111,7 @@ loadfont "$BOOT_DIRECTORY"grub2/unifont.pf2 |
| 111 | 111 |
insmod gfxterm |
| 112 | 112 |
insmod vbe |
| 113 | 113 |
insmod tga |
| 114 |
+insmod png |
|
| 114 | 115 |
insmod ext2 |
| 115 | 116 |
insmod part_gpt |
| 116 | 117 |
|
| ... | ... |
@@ -94,16 +94,6 @@ class OstreeInstaller(Installer): |
| 94 | 94 |
self.progress_bar.initialize("Initializing installation...")
|
| 95 | 95 |
self.progress_bar.show() |
| 96 | 96 |
|
| 97 |
- self.progress_bar.show_loading("Unpacking local OSTree repo")
|
|
| 98 |
- |
|
| 99 |
- if self.default_repo: |
|
| 100 |
- self.run("mkdir repo")
|
|
| 101 |
- self.run("tar --warning=none -xf /mnt/cdrom/ostree-repo.tar.gz -C repo")
|
|
| 102 |
- self.local_repo_path = "/installer/repo/" |
|
| 103 |
- self.ostree_repo_url = self.repo_config['OSTREEREPOURL'] |
|
| 104 |
- self.ostree_ref = self.repo_config['OSTREEREFS'] |
|
| 105 |
- |
|
| 106 |
- |
|
| 107 | 97 |
self.execute_modules(modules.commons.PRE_INSTALL) |
| 108 | 98 |
|
| 109 | 99 |
disk = self.install_config['disk']['disk'] |
| ... | ... |
@@ -115,8 +105,30 @@ class OstreeInstaller(Installer): |
| 115 | 115 |
self.run("mkdir -p {} ".format(sysroot_boot))
|
| 116 | 116 |
self.run("mount {}2 {}".format(disk, sysroot_boot))
|
| 117 | 117 |
|
| 118 |
+ self.progress_bar.show_loading("Unpacking local OSTree repo")
|
|
| 119 |
+ |
|
| 120 |
+ #Setup the disk |
|
| 121 |
+ self.run("dd if=/dev/zero of={}/swapfile bs=1M count=64".format(self.photon_root))
|
|
| 122 |
+ self.run("mkswap -v1 {}/swapfile".format(self.photon_root))
|
|
| 123 |
+ self.run("swapon {}/swapfile".format(self.photon_root))
|
|
| 124 |
+ |
|
| 125 |
+ if self.default_repo: |
|
| 126 |
+ self.run("rm -rf /installer/boot")
|
|
| 127 |
+ self.run("mkdir -p {}/repo".format(self.photon_root))
|
|
| 128 |
+ self.run("tar --warning=none -xf /mnt/cdrom/ostree-repo.tar.gz -C {}/repo".format(self.photon_root))
|
|
| 129 |
+ self.local_repo_path = "{}/repo".format(self.photon_root)
|
|
| 130 |
+ self.ostree_repo_url = self.repo_config['OSTREEREPOURL'] |
|
| 131 |
+ self.ostree_ref = self.repo_config['OSTREEREFS'] |
|
| 132 |
+ |
|
| 133 |
+ |
|
| 134 |
+ self.progress_bar.update_loading_message("Unpacking done")
|
|
| 135 |
+ |
|
| 136 |
+ |
|
| 118 | 137 |
self.deploy_ostree(self.ostree_repo_url, self.ostree_ref) |
| 119 | 138 |
|
| 139 |
+ self.run("swapoff -a")
|
|
| 140 |
+ self.run("rm {}/swapfile".format(self.photon_root))
|
|
| 141 |
+ |
|
| 120 | 142 |
commit_number = self.get_commit_number(self.ostree_ref) |
| 121 | 143 |
self.do_systemd_tmpfiles_commands(commit_number) |
| 122 | 144 |
|