From 9c677156f6f43218cc61f9dd2124f4c34b74cf02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20Sch=C3=A4fer?= Date: Fri, 1 Aug 2014 11:30:16 +0200 Subject: [PATCH] - Update indention level to 4 spaces --- .archive | 10 +- .catalog.xml | 6 +- .changelog | 84 +- .doit | 380 +- .filter | 110 +- .indent | 15 +- .links | 272 +- .lutime | 26 +- .newversion | 20 +- .perlcriticrc | 2 +- .releasetags | 22 +- .travis.yml | 8 +- .../KIWIBasePlugin.pm | 366 +- .../KIWIContentPlugin.pm | 276 +- .../KIWIDescrPlugin.pm | 370 +- .../KIWIEulaPlugin.pm | 270 +- .../KIWIMiniIsoPlugin.pm | 436 +- .../KIWIPatternsPlugin.pm | 246 +- .../KIWIBasePlugin.pm | 366 +- .../KIWIContentPlugin.pm | 276 +- .../KIWIDescrPlugin.pm | 634 +- .../KIWIFinishEFIPlugin.pm | 144 +- .../KIWILicensePlugin.pm | 186 +- .../KIWILiveTreePlugin.pm | 184 +- .../KIWIMiniIsoPlugin.pm | 436 +- .../KIWIPromoDVDPlugin.pm | 164 +- .../KIWIBasePlugin.pm | 366 +- .../KIWIContentPlugin.pm | 276 +- .../KIWIDescrPlugin.pm | 370 +- .../KIWIEulaPlugin.pm | 270 +- .../KIWIMiniIsoPlugin.pm | 436 +- .../KIWIPatternsPlugin.pm | 246 +- .../KIWIBasePlugin.pm | 366 +- .../KIWIContentPlugin.pm | 276 +- .../KIWIDescrPlugin.pm | 370 +- .../KIWILiveTreePlugin.pm | 184 +- .../KIWIMiniIsoPlugin.pm | 436 +- .../KIWIPatternsPlugin.pm | 246 +- .../KIWIBasePlugin.pm | 366 +- .../KIWIContentPlugin.pm | 276 +- .../KIWIDescrPlugin.pm | 370 +- .../KIWILiveTreePlugin.pm | 184 +- .../KIWIMiniIsoPlugin.pm | 436 +- .../KIWIPatternsPlugin.pm | 246 +- .../KIWIBasePlugin.pm | 366 +- .../KIWIContentPlugin.pm | 276 +- .../KIWIDescrPlugin.pm | 634 +- .../KIWIFinishEFIPlugin.pm | 144 +- .../KIWILiveTreePlugin.pm | 184 +- .../KIWIMiniIsoPlugin.pm | 436 +- .../KIWIPatternsPlugin.pm | 246 +- .../KIWIPromoDVDPlugin.pm | 164 +- .../KIWIBasePlugin.pm | 366 +- .../KIWIContentPlugin.pm | 276 +- .../KIWIDescrPlugin.pm | 634 +- .../KIWIEulaPlugin.pm | 270 +- .../KIWIMiniIsoPlugin.pm | 436 +- doc/devdoc/genDevDoc | 1076 +- doc/devdoc/susesync | 2 +- doc/docbook/etc/fop.xml | 50 +- doc/docbook/kiwi-doc-appendix.xml | 22 +- doc/docbook/kiwi-doc-appliance.xml | 470 +- doc/docbook/kiwi-doc-caches.xml | 160 +- doc/docbook/kiwi-doc-contributors.xml | 136 +- doc/docbook/kiwi-doc-description.xml | 4110 ++-- doc/docbook/kiwi-doc-ec2.xml | 1324 +- doc/docbook/kiwi-doc-installation.xml | 196 +- doc/docbook/kiwi-doc-introduction.xml | 124 +- doc/docbook/kiwi-doc-iso.xml | 444 +- doc/docbook/kiwi-doc-license.xml | 46 +- doc/docbook/kiwi-doc-lxc.xml | 240 +- doc/docbook/kiwi-doc-maintenance.xml | 190 +- doc/docbook/kiwi-doc-migrate.xml | 268 +- doc/docbook/kiwi-doc-oem.xml | 514 +- doc/docbook/kiwi-doc-pxe.xml | 2272 +- doc/docbook/kiwi-doc-signkey.xml | 54 +- doc/docbook/kiwi-doc-source.xml | 136 +- doc/docbook/kiwi-doc-vmx.xml | 372 +- doc/docbook/kiwi-doc-workflow.xml | 1886 +- doc/docbook/kiwi-doc-xen.xml | 130 +- doc/docbook/kiwi-doc.xml | 162 +- doc/docbook/kiwi-man-config.sh.xml | 954 +- doc/docbook/kiwi-man-images.sh.xml | 554 +- doc/docbook/kiwi-man-kiwirc.xml | 218 +- doc/docbook/kiwi-man.xml | 1544 +- doc/docbook/xslt/fo/docbook.xsl | 898 +- doc/docbook/xslt/html/docbook.xsl | 16 +- doc/docbook/xslt/html/formal.xsl | 44 +- doc/docbook/xslt/html/sections.xsl | 156 +- .../xslt/profiling/db4index-profile.xsl | 16 +- doc/docbook/xslt/profiling/db4index.xsl | 290 +- .../suse-nebula-cloud/cloud_cloud/config.xml | 132 +- .../share/firstboot/scripts/cloudNodeConfig | 680 +- .../suse-nebula-cloud/cloud_guest/config.xml | 68 +- .../cloud_guest/root/etc/init.d/boot | 248 +- .../suse-nebula-cloud/cloud_head/config.xml | 144 +- .../cloud_head/root/etc/YaST2/firstboot.xml | 114 +- .../root/home/ctester/testVM.README | 10 +- .../cloud_head/root/home/ctester/testVM.vmd | 12 +- .../root/usr/sbin/suseNebulaConfSrv | 302 +- .../cloud_head/root/usr/sbin/suseNebulaRegSrv | 226 +- .../usr/share/YaST2/clients/opennebula.ycp | 654 +- .../usr/share/firstboot/scripts/finalizeSetup | 56 +- .../suse-nebula-cloud/cloud_cloud/config.xml | 142 +- .../share/firstboot/scripts/cloudNodeConfig | 680 +- .../suse-nebula-cloud/cloud_guest/config.xml | 80 +- .../cloud_guest/root/etc/init.d/boot | 248 +- .../suse-nebula-cloud/cloud_head/config.xml | 156 +- .../cloud_head/root/etc/YaST2/firstboot.xml | 102 +- .../root/home/ctester/testVM.README | 10 +- .../cloud_head/root/home/ctester/testVM.vmd | 12 +- .../root/usr/sbin/suseNebulaConfSrv | 302 +- .../cloud_head/root/usr/sbin/suseNebulaRegSrv | 226 +- .../usr/share/YaST2/clients/opennebula.ycp | 654 +- .../usr/share/firstboot/scripts/finalizeSetup | 56 +- .../suse-13.1/suse-vagrant-box/config.xml | 126 +- .../suse-SLES11/suse-min-gnome/config.xml | 122 +- .../suse-SLES11/suse-vagrant-box/config.xml | 120 +- .../suse-12.2/suse-ec2-guest/config.xml | 80 +- .../suse-live-iso/config-yast-firstboot.xml | 246 +- .../suse-12.2/suse-live-iso/config.xml | 76 +- .../suse-live-iso/root/etc/init.d/boot.local | 14 +- .../config-yast-firstboot.xml | 246 +- .../suse-12.2/suse-live-usbstick/config.xml | 96 +- .../root/etc/init.d/boot.local | 14 +- .../suse-12.2/suse-lxc-guest/config.xml | 72 +- .../suse-12.2/suse-oem-preload/config.xml | 74 +- .../suse-12.2/suse-pxe-client/config.xml | 132 +- .../suse-12.2/suse-pxe-client/images.sh | 12 +- .../suse-pxe-client/root/etc/asound.state | 710 +- .../suse-12.2/suse-vm-guest/config.xml | 78 +- .../suse-12.2/suse-xen-guest/config.xml | 82 +- .../suse-12.3/suse-ec2-guest/config.xml | 76 +- .../suse-live-iso/config-yast-firstboot.xml | 234 +- .../suse-12.3/suse-live-iso/config.xml | 106 +- .../suse-live-iso/root/etc/init.d/boot.local | 14 +- .../config-yast-firstboot.xml | 246 +- .../suse-12.3/suse-live-usbstick/config.xml | 98 +- .../root/etc/init.d/boot.local | 14 +- .../suse-12.3/suse-lxc-guest/config.xml | 74 +- .../suse-12.3/suse-oem-preload/config.xml | 78 +- .../suse-12.3/suse-pxe-client/config.xml | 136 +- .../suse-12.3/suse-pxe-client/images.sh | 12 +- .../suse-pxe-client/root/etc/asound.state | 710 +- .../suse-12.3/suse-vm-guest/config.xml | 80 +- .../suse-12.3/suse-xen-guest/config.xml | 84 +- .../suse-docker-container/config.xml | 72 +- .../suse-13.1/suse-ec2-guest/config.xml | 76 +- .../suse-live-iso/config-yast-firstboot.xml | 234 +- .../suse-13.1/suse-live-iso/config.xml | 106 +- .../suse-live-iso/root/etc/init.d/boot.local | 14 +- .../config-yast-firstboot.xml | 234 +- .../suse-13.1/suse-live-usbstick/config.xml | 98 +- .../root/etc/init.d/boot.local | 14 +- .../suse-13.1/suse-vm-guest/config.xml | 78 +- .../suse-live-iso/config-yast-firstboot.xml | 234 +- .../suse-13.2/suse-live-iso/config.xml | 106 +- doc/schema/susesync | 4 +- doc/susebooks.css | 562 +- doc/susesync | 2 +- editing/kiwi.sh | 536 +- editing/suse-start-kiwi-mode.el | 6 +- editing/suse-start-kiwi-xmllocator.xml | 6 +- kiwi | 18 +- kiwi.pl | 4042 ++-- locale/.fuzzy | 60 +- locale/.locale | 68 +- metadata/KIWIAnalyseSUSE.kiwi | 54 +- metadata/KIWIConfig.xml | 598 +- metadata/KIWISplit.xml | 28 +- metadata/d3/d3.js | 6130 +++--- metadata/d3/d3.layout.js | 3118 +-- metadata/d3/img/.DS_Store | Bin 6148 -> 6148 bytes metadata/d3/img/header.svg | 2580 +-- metadata/d3/img/menu/RPM-conflicts.jpg | Bin 3204 -> 3206 bytes metadata/d3/img/menu/RPM-lost.jpg | Bin 3636 -> 3636 bytes metadata/d3/img/menu/RPM-packages.jpg | Bin 2777 -> 2777 bytes .../img/menu/custom-files-visualisation.jpg | Bin 2794 -> 2794 bytes metadata/d3/img/menu/custom-files.jpg | Bin 2271 -> 2271 bytes metadata/d3/img/menu/gems.jpg | Bin 2724 -> 2724 bytes metadata/d3/img/menu/kernel.jpg | Bin 2558 -> 2558 bytes metadata/d3/img/menu/local-repositories.jpg | Bin 2195 -> 2195 bytes metadata/d3/img/menu/multiple-RPM.jpg | Bin 3180 -> 3180 bytes metadata/d3/kiwi.css | 176 +- metadata/d3/kiwi.js | 188 +- metadata/d3/style.css | 96 +- metadata/d3/theme.css | 114 +- modules/KIWIAnalyseCustomData.sh | 202 +- modules/KIWIAnalyseReport.pm | 1494 +- modules/KIWIAnalyseSoftware.pm | 962 +- modules/KIWIAnalyseSystem.pm | 1930 +- modules/KIWIAnalyseTemplate.pm | 556 +- modules/KIWIArch.pm | 86 +- modules/KIWIArchList.pm | 278 +- modules/KIWIBoot.pm | 13980 ++++++------ modules/KIWICache.pm | 690 +- modules/KIWICollect.pm | 5140 ++--- modules/KIWICommandLine.pm | 1448 +- modules/KIWIConfig.sh | 3032 +-- modules/KIWIConfigWriter.pm | 170 +- modules/KIWIConfigWriterFactory.pm | 128 +- modules/KIWIConfigure.pm | 1460 +- modules/KIWIContainerBuilder.pm | 1346 +- modules/KIWIContainerConfigWriter.pm | 264 +- modules/KIWIFilesystemOptions.pm | 310 +- modules/KIWIGlobals.pm | 3374 +-- modules/KIWIImage.pm | 8952 ++++---- modules/KIWIImageBuildFactory.pm | 116 +- modules/KIWIImageBuilderBase.pm | 414 +- modules/KIWIImageCreator.pm | 4074 ++-- modules/KIWIImageFormat.pm | 2380 +-- modules/KIWIIsoLinux.pm | 2408 +-- modules/KIWILinuxRC.sh | 17708 ++++++++-------- modules/KIWILocator.pm | 598 +- modules/KIWILog.pm | 1048 +- modules/KIWIManager.pm | 1024 +- modules/KIWIManagerApt.pm | 1144 +- modules/KIWIManagerEnsconce.pm | 504 +- modules/KIWIManagerSmart.pm | 1336 +- modules/KIWIManagerYum.pm | 1208 +- modules/KIWIManagerZypper.pm | 1640 +- modules/KIWIOVFConfigWriter.pm | 1700 +- modules/KIWIOverlay.pm | 264 +- modules/KIWIProductData.pm | 550 +- modules/KIWIProfileFile.pm | 1164 +- modules/KIWIQX.pm | 58 +- modules/KIWIRepoMetaHandler.pm | 434 +- modules/KIWIResult.pm | 710 +- modules/KIWIRoot.pm | 3082 +-- modules/KIWIRuntimeChecker.pm | 2536 +-- modules/KIWISatSolver.pm | 1108 +- modules/KIWISchema.rnc | 4174 ++-- modules/KIWITarArchiveBuilder.pm | 150 +- modules/KIWITrace.pm | 32 +- modules/KIWIURL.pm | 1158 +- modules/KIWIUtil.pm | 884 +- modules/KIWIXML.pm | 10348 ++++----- modules/KIWIXMLDataBase.pm | 444 +- modules/KIWIXMLDefStripData.pm | 164 +- modules/KIWIXMLDescriptionData.pm | 454 +- modules/KIWIXMLDriverData.pm | 24 +- modules/KIWIXMLExceptData.pm | 26 +- modules/KIWIXMLFileData.pm | 204 +- modules/KIWIXMLInfo.pm | 1666 +- modules/KIWIXMLInstRepositoryData.pm | 196 +- modules/KIWIXMLOEMConfigData.pm | 1692 +- modules/KIWIXMLPXEDeployConfigData.pm | 164 +- modules/KIWIXMLPXEDeployData.pm | 1414 +- modules/KIWIXMLPackageArchiveData.pm | 96 +- modules/KIWIXMLPackageCollectData.pm | 114 +- modules/KIWIXMLPackageData.pm | 226 +- modules/KIWIXMLPackageIgnoreData.pm | 26 +- modules/KIWIXMLPackageProductData.pm | 42 +- modules/KIWIXMLPreferenceData.pm | 1314 +- modules/KIWIXMLProductArchitectureData.pm | 198 +- modules/KIWIXMLProductMetaChrootData.pm | 142 +- modules/KIWIXMLProductMetaFileData.pm | 160 +- modules/KIWIXMLProductOptionsData.pm | 374 +- modules/KIWIXMLProductPackageData.pm | 244 +- modules/KIWIXMLProfileData.pm | 286 +- modules/KIWIXMLRepositoryBaseData.pm | 320 +- modules/KIWIXMLRepositoryData.pm | 588 +- modules/KIWIXMLSplitData.pm | 948 +- modules/KIWIXMLStripData.pm | 24 +- modules/KIWIXMLSystemdiskData.pm | 1038 +- modules/KIWIXMLTypeData.pm | 3374 +-- modules/KIWIXMLUserData.pm | 1056 +- modules/KIWIXMLVMachineData.pm | 2374 +-- modules/KIWIXMLVagrantConfigData.pm | 172 +- modules/KIWIXMLValidator.pm | 3132 +-- pxeboot/kiwiboot.sh | 36 +- pxeboot/pxelinux.0.config | 8 +- pxeboot/pxelinux.0.config.xen | 8 +- rpm/kiwi-find-boot-requires.sh | 24 +- rpm/kiwi.spec | 70 +- system/boot/armv7l/.md5 | 12 +- .../boot/armv7l/oemboot/suse-12.2/config.sh | 2 +- .../boot/armv7l/oemboot/suse-12.2/config.xml | 318 +- .../boot/armv7l/oemboot/suse-12.3/config.sh | 2 +- .../boot/armv7l/oemboot/suse-12.3/config.xml | 320 +- .../boot/armv7l/oemboot/suse-13.1/config.sh | 2 +- .../boot/armv7l/oemboot/suse-13.1/config.xml | 320 +- .../boot/armv7l/oemboot/suse-13.2/config.sh | 2 +- .../boot/armv7l/oemboot/suse-13.2/config.xml | 324 +- system/boot/armv7l/oemboot/suse-dump | 2040 +- system/boot/armv7l/oemboot/suse-linuxrc | 858 +- system/boot/armv7l/oemboot/suse-preinit | 104 +- system/boot/armv7l/oemboot/suse-repart | 1636 +- system/boot/ia64/.md5 | 12 +- system/boot/ix86/.md5 | 12 +- system/boot/ix86/isoboot/rhel-06.0/config.sh | 2 +- system/boot/ix86/isoboot/rhel-06.0/config.xml | 278 +- system/boot/ix86/isoboot/rhel-linuxrc | 250 +- system/boot/ix86/isoboot/suse-12.2/config.sh | 2 +- system/boot/ix86/isoboot/suse-12.2/config.xml | 332 +- system/boot/ix86/isoboot/suse-12.3/config.sh | 2 +- system/boot/ix86/isoboot/suse-12.3/config.xml | 352 +- system/boot/ix86/isoboot/suse-13.1/config.sh | 2 +- system/boot/ix86/isoboot/suse-13.1/config.xml | 358 +- system/boot/ix86/isoboot/suse-13.2/config.sh | 2 +- system/boot/ix86/isoboot/suse-13.2/config.xml | 358 +- .../boot/ix86/isoboot/suse-SLED11/config.sh | 2 +- .../boot/ix86/isoboot/suse-SLED11/config.xml | 420 +- .../boot/ix86/isoboot/suse-SLED12/config.sh | 2 +- .../boot/ix86/isoboot/suse-SLED12/config.xml | 344 +- .../boot/ix86/isoboot/suse-SLES11/config.sh | 2 +- .../boot/ix86/isoboot/suse-SLES11/config.xml | 422 +- .../boot/ix86/isoboot/suse-SLES12/config.sh | 2 +- .../boot/ix86/isoboot/suse-SLES12/config.xml | 344 +- system/boot/ix86/isoboot/suse-linuxrc | 250 +- system/boot/ix86/netboot/suse-12.2/config.sh | 2 +- system/boot/ix86/netboot/suse-12.2/config.xml | 472 +- system/boot/ix86/netboot/suse-12.3/config.sh | 2 +- system/boot/ix86/netboot/suse-12.3/config.xml | 484 +- system/boot/ix86/netboot/suse-13.1/config.sh | 2 +- system/boot/ix86/netboot/suse-13.1/config.xml | 488 +- system/boot/ix86/netboot/suse-13.2/config.sh | 2 +- system/boot/ix86/netboot/suse-13.2/config.xml | 488 +- .../boot/ix86/netboot/suse-SLED11/config.sh | 2 +- .../boot/ix86/netboot/suse-SLED11/config.xml | 574 +- .../boot/ix86/netboot/suse-SLED12/config.sh | 2 +- .../boot/ix86/netboot/suse-SLED12/config.xml | 472 +- .../boot/ix86/netboot/suse-SLES11/config.sh | 2 +- .../boot/ix86/netboot/suse-SLES11/config.xml | 586 +- .../boot/ix86/netboot/suse-SLES12/config.sh | 2 +- .../boot/ix86/netboot/suse-SLES12/config.xml | 472 +- system/boot/ix86/netboot/suse-linuxrc | 1520 +- system/boot/ix86/netboot/suse-preinit | 86 +- system/boot/ix86/oemboot/rhel-06.0/config.sh | 2 +- system/boot/ix86/oemboot/rhel-06.0/config.xml | 282 +- system/boot/ix86/oemboot/rhel-dump | 2040 +- system/boot/ix86/oemboot/rhel-linuxrc | 858 +- system/boot/ix86/oemboot/rhel-preinit | 104 +- system/boot/ix86/oemboot/rhel-repart | 1636 +- system/boot/ix86/oemboot/suse-12.2/config.sh | 2 +- system/boot/ix86/oemboot/suse-12.2/config.xml | 358 +- system/boot/ix86/oemboot/suse-12.3/config.sh | 2 +- system/boot/ix86/oemboot/suse-12.3/config.xml | 372 +- system/boot/ix86/oemboot/suse-13.1/config.sh | 2 +- system/boot/ix86/oemboot/suse-13.1/config.xml | 376 +- system/boot/ix86/oemboot/suse-13.2/config.sh | 2 +- system/boot/ix86/oemboot/suse-13.2/config.xml | 380 +- .../boot/ix86/oemboot/suse-SLED11/config.sh | 2 +- .../boot/ix86/oemboot/suse-SLED11/config.xml | 370 +- .../boot/ix86/oemboot/suse-SLED12/config.sh | 2 +- .../boot/ix86/oemboot/suse-SLED12/config.xml | 368 +- .../boot/ix86/oemboot/suse-SLES11/config.sh | 2 +- .../boot/ix86/oemboot/suse-SLES11/config.xml | 390 +- .../boot/ix86/oemboot/suse-SLES12/config.sh | 2 +- .../boot/ix86/oemboot/suse-SLES12/config.xml | 370 +- system/boot/ix86/oemboot/suse-dump | 2040 +- system/boot/ix86/oemboot/suse-linuxrc | 858 +- system/boot/ix86/oemboot/suse-preinit | 104 +- system/boot/ix86/oemboot/suse-repart | 1636 +- system/boot/ix86/vmxboot/rhel-06.0/config.sh | 2 +- system/boot/ix86/vmxboot/rhel-06.0/config.xml | 270 +- system/boot/ix86/vmxboot/rhel-linuxrc | 134 +- system/boot/ix86/vmxboot/rhel-preinit | 24 +- system/boot/ix86/vmxboot/suse-12.2/config.sh | 2 +- system/boot/ix86/vmxboot/suse-12.2/config.xml | 304 +- system/boot/ix86/vmxboot/suse-12.3/config.sh | 2 +- system/boot/ix86/vmxboot/suse-12.3/config.xml | 318 +- system/boot/ix86/vmxboot/suse-13.1/config.sh | 2 +- system/boot/ix86/vmxboot/suse-13.1/config.xml | 322 +- system/boot/ix86/vmxboot/suse-13.2/config.sh | 2 +- system/boot/ix86/vmxboot/suse-13.2/config.xml | 324 +- .../boot/ix86/vmxboot/suse-SLED11/config.sh | 2 +- .../boot/ix86/vmxboot/suse-SLED11/config.xml | 334 +- .../boot/ix86/vmxboot/suse-SLED12/config.sh | 2 +- .../boot/ix86/vmxboot/suse-SLED12/config.xml | 312 +- .../boot/ix86/vmxboot/suse-SLES11/config.sh | 2 +- .../boot/ix86/vmxboot/suse-SLES11/config.xml | 346 +- .../boot/ix86/vmxboot/suse-SLES12/config.sh | 2 +- .../boot/ix86/vmxboot/suse-SLES12/config.xml | 312 +- system/boot/ix86/vmxboot/suse-linuxrc | 134 +- system/boot/ix86/vmxboot/suse-preinit | 24 +- system/boot/m68k/.md5 | 12 +- system/boot/ppc/.md5 | 12 +- system/boot/ppc/netboot/suse-SLES11/config.sh | 2 +- .../boot/ppc/netboot/suse-SLES11/config.xml | 532 +- system/boot/ppc/netboot/suse-SLES12/config.sh | 2 +- .../boot/ppc/netboot/suse-SLES12/config.xml | 320 +- system/boot/ppc/netboot/suse-linuxrc | 1520 +- system/boot/ppc/netboot/suse-preinit | 86 +- system/boot/ppc/oemboot/suse-SLES11/config.sh | 2 +- .../boot/ppc/oemboot/suse-SLES11/config.xml | 316 +- system/boot/ppc/oemboot/suse-SLES12/config.sh | 2 +- .../boot/ppc/oemboot/suse-SLES12/config.xml | 326 +- system/boot/ppc/oemboot/suse-dump | 2040 +- system/boot/ppc/oemboot/suse-linuxrc | 858 +- system/boot/ppc/oemboot/suse-preinit | 104 +- system/boot/ppc/oemboot/suse-repart | 1654 +- system/boot/ppc/vmxboot/suse-SLES11/config.sh | 2 +- .../boot/ppc/vmxboot/suse-SLES11/config.xml | 286 +- system/boot/ppc/vmxboot/suse-SLES12/config.sh | 2 +- .../boot/ppc/vmxboot/suse-SLES12/config.xml | 322 +- system/boot/ppc/vmxboot/suse-linuxrc | 136 +- system/boot/ppc/vmxboot/suse-preinit | 24 +- system/boot/s390/.md5 | 12 +- .../boot/s390/netboot/suse-SLES11/config.sh | 2 +- .../boot/s390/netboot/suse-SLES11/config.xml | 306 +- .../boot/s390/netboot/suse-SLES12/config.sh | 2 +- .../boot/s390/netboot/suse-SLES12/config.xml | 310 +- system/boot/s390/netboot/suse-linuxrc | 1538 +- system/boot/s390/netboot/suse-preinit | 96 +- .../boot/s390/oemboot/suse-SLES11/config.sh | 2 +- .../boot/s390/oemboot/suse-SLES11/config.xml | 292 +- .../boot/s390/oemboot/suse-SLES12/config.sh | 2 +- .../boot/s390/oemboot/suse-SLES12/config.xml | 324 +- system/boot/s390/oemboot/suse-dump | 2040 +- system/boot/s390/oemboot/suse-linuxrc | 866 +- system/boot/s390/oemboot/suse-preinit | 124 +- system/boot/s390/oemboot/suse-repart | 1686 +- .../boot/s390/vmxboot/suse-SLES11/config.sh | 2 +- .../boot/s390/vmxboot/suse-SLES11/config.xml | 266 +- .../boot/s390/vmxboot/suse-SLES12/config.sh | 2 +- .../boot/s390/vmxboot/suse-SLES12/config.xml | 318 +- system/boot/s390/vmxboot/suse-linuxrc | 142 +- system/boot/s390/vmxboot/suse-preinit | 44 +- template/armv7l/suse-12.2-JeOS/config.xml | 208 +- template/armv7l/suse-12.2-JeOS/root/etc/motd | 4 +- .../armv7l/suse-12.2-JeOS/uboot-image-install | 20 +- .../armv7l/suse-12.2-JeOS/uboot-image-setup | 12 +- template/armv7l/suse-12.3-JeOS/config.xml | 238 +- template/armv7l/suse-12.3-JeOS/root/etc/motd | 4 +- .../armv7l/suse-12.3-JeOS/uboot-image-install | 36 +- .../armv7l/suse-12.3-JeOS/uboot-image-setup | 12 +- template/armv7l/suse-13.1-JeOS/config.xml | 200 +- template/armv7l/suse-13.1-JeOS/root/etc/motd | 4 +- .../armv7l/suse-13.1-JeOS/uboot-image-install | 20 +- .../armv7l/suse-13.1-JeOS/uboot-image-setup | 18 +- .../suse-13.2-JeOS/berryboot-image-setup | 12 +- template/armv7l/suse-13.2-JeOS/config.xml | 160 +- template/armv7l/suse-13.2-JeOS/root/etc/motd | 4 +- template/ix86/rhel-06.0-JeOS/config.sh | 2 +- template/ix86/rhel-06.0-JeOS/config.xml | 242 +- .../rhel-06.0-JeOS/root/etc/X11/xorg.conf | 312 +- template/ix86/suse-12.2-JeOS/config.xml | 226 +- template/ix86/suse-12.2-JeOS/root/etc/motd | 4 +- template/ix86/suse-12.3-JeOS/config.xml | 222 +- template/ix86/suse-12.3-JeOS/root/etc/motd | 4 +- template/ix86/suse-13.1-JeOS/config.xml | 242 +- template/ix86/suse-13.1-JeOS/root/etc/motd | 4 +- template/ix86/suse-13.2-JeOS/config.xml | 274 +- template/ix86/suse-13.2-JeOS/root/etc/motd | 4 +- template/ix86/suse-SLE11-JeOS/config.xml | 418 +- .../suse-SLE11-JeOS/root/etc/X11/xorg.conf | 312 +- template/ix86/suse-SLE11-JeOS/root/etc/motd | 6 +- .../ix86/suse-SLE11-JeOS/test/iso/main.pm | 4 +- .../test/iso/test.d/001_boot.pm | 40 +- template/ix86/suse-SLE12-JeOS/config.xml | 270 +- template/ix86/suse-SLE12-JeOS/root/etc/motd | 6 +- .../ix86/suse-SLE12-JeOS/test/iso/main.pm | 4 +- .../test/iso/needles/text-login.json | 28 +- .../test/iso/test.d/001_boot.pm | 42 +- template/ppc/suse-SLE11-JeOS/config.xml | 82 +- .../suse-SLE11-JeOS/root/etc/X11/xorg.conf | 312 +- template/ppc/suse-SLE11-JeOS/root/etc/motd | 6 +- template/ppc/suse-SLE12-JeOS/config.xml | 76 +- template/ppc/suse-SLE12-JeOS/root/etc/motd | 6 +- template/s390/suse-SLE11-JeOS/config.xml | 102 +- .../suse-SLE11-JeOS/root/etc/X11/xorg.conf | 312 +- .../root/etc/init.d/kiwi/dasd/01-network.sh | 2 +- .../root/etc/init.d/kiwi/zfcp/01-network.sh | 2 +- template/s390/suse-SLE11-JeOS/root/etc/motd | 6 +- template/s390/suse-SLE12-JeOS/config.xml | 96 +- .../root/etc/init.d/kiwi/dasd/01-network.sh | 2 +- .../root/etc/init.d/kiwi/zfcp/01-network.sh | 2 +- template/s390/suse-SLE12-JeOS/root/etc/motd | 6 +- tests/jenkins/prepare.sh | 38 +- tests/jenkins/product.sh | 16 +- tests/runTests | 142 +- tests/unit/cleanup.sh | 8 +- .../data/kiwiConfigWriterFactory/config.xml | 68 +- .../container/config.xml | 66 +- .../data/kiwiContainerConfWriter/config.xml | 76 +- .../data/kiwiImageBuildFactory/config.xml | 66 +- .../prepareCmdRoot/config.xml | 54 +- .../kiwiImageCreator/prepareNoRoot/config.xml | 46 +- .../prepareXmlRoot/config.xml | 56 +- tests/unit/data/kiwiLocator/config.xml | 76 +- .../kiwiLocator/multiConf/config_one.kiwi | 76 +- .../kiwiLocator/multiConf/config_two.kiwi | 76 +- .../data/kiwiLocator/sglConf/config_one.kiwi | 76 +- .../baseOVFConfig/config.xml | 72 +- .../kiwiOVFConfWriter/dvdIdeConfig/config.xml | 74 +- .../dvdScsiConfig/config.xml | 74 +- .../genericGuestOSConfig/config.xml | 72 +- .../hwEightConfig/config.xml | 72 +- .../ideCntrlConfig/config.xml | 72 +- .../maxCPUOVFConfig/config.xml | 72 +- .../maxMemoryOVFConfig/config.xml | 72 +- .../minCPUOVFConfig/config.xml | 72 +- .../minGTMaxCPUOVFConfig/config.xml | 72 +- .../minGTMaxMemoryOVFConfig/config.xml | 72 +- .../minMaxCPUOVFConfig/config.xml | 72 +- .../minMaxMemoryOVFConfig/config.xml | 72 +- .../minMemoryOVFConfig/config.xml | 72 +- .../multiNICOVFConfig/config.xml | 74 +- .../kiwiOVFConfWriter/noCPUspec/config.xml | 72 +- .../kiwiOVFConfWriter/noDiskCntrl/config.xml | 72 +- .../noDiskCrtlSpec/config.xml | 72 +- .../kiwiOVFConfWriter/noMemorySpec/config.xml | 72 +- .../noOVFMachineConfig/config.xml | 64 +- .../noOVFTypeConfig/config.xml | 72 +- .../kiwiOVFConfWriter/noSizeConfig/config.xml | 70 +- .../powerOVFConfig/config.xml | 72 +- .../rhel-64GuestOSConfig/config.xml | 72 +- .../rhelGuestOSConfig/config.xml | 72 +- .../sles-64GuestOSConfig/config.xml | 72 +- .../slesGuestOSConfig/config.xml | 72 +- .../suse-64GuestOSConfig/config.xml | 72 +- .../suseGuestOSConfig/config.xml | 72 +- .../kiwiOVFConfWriter/xenOVFConfig/config.xml | 72 +- .../kiwiOVFConfWriter/zvmOVFConfig/config.xml | 72 +- tests/unit/data/kiwiProfileFile/config.xml | 114 +- tests/unit/data/kiwiRuntimeChecker/config.xml | 102 +- .../conflictUsers/config.xml | 118 +- .../fileSysImg/btrfs/config.xml | 64 +- .../fileSysImg/ext2/config.xml | 64 +- .../fileSysImg/ext3/config.xml | 64 +- .../fileSysImg/ext4/config.xml | 64 +- .../fileSysImg/reiserfs/config.xml | 64 +- .../fileSysImg/xfs/config.xml | 64 +- .../haveDefaultPkgs/config.xml | 114 +- .../liveIsoImg/clic/config.xml | 64 +- .../liveIsoImg/compressed/config.xml | 64 +- .../liveIsoImg/efi/config.xml | 64 +- .../liveIsoImg/efiOEM/config.xml | 64 +- .../lvmAndSwapGreaterSysSize/config.xml | 84 +- .../lvmGreaterSysSize/config.xml | 84 +- .../kiwiRuntimeChecker/lvmSetup/config.xml | 84 +- .../kiwiRuntimeChecker/lvmSetup2/config.xml | 84 +- .../kiwiRuntimeChecker/lxcMissing/config.xml | 64 +- .../kiwiRuntimeChecker/minSysSize/config.xml | 68 +- .../noDefaultBuildType/config.xml | 102 +- .../noRepoAliasUnique/config.xml | 90 +- .../kiwiRuntimeChecker/oemBtrfs/config.xml | 76 +- .../kiwiRuntimeChecker/splitImg/config.xml | 64 +- tests/unit/data/kiwiXML/defPkgMgr/config.xml | 76 +- .../unit/data/kiwiXML/descriptData/config.xml | 68 +- .../data/kiwiXML/driversConfig/config.xml | 74 +- .../kiwiXML/driversWithProfAndArch/config.xml | 110 +- tests/unit/data/kiwiXML/lvmConfig/config.xml | 76 +- .../kiwiXML/lvmConfigDisallowedDir/config.xml | 74 +- .../data/kiwiXML/lvmConfigWithRoot/config.xml | 74 +- .../kiwiXML/multiPkgMgrWithProf/config.xml | 88 +- .../unit/data/kiwiXML/oemSettings/config.xml | 94 +- .../data/kiwiXML/ovfConfigSettings/config.xml | 64 +- .../kiwiXML/packageReplSettings/config.xml | 56 +- .../data/kiwiXML/packageSettings/config.xml | 128 +- .../packageSettingsInstallDelete/config.xml | 74 +- .../packageSettingsNoBootstrap/config.xml | 58 +- .../packageSettingsNoDefault/config.xml | 62 +- .../kiwiXML/packageSettingsNoImage/config.xml | 46 +- .../packageSettingsNoPattern/config.xml | 62 +- .../kiwiXML/preferenceSettings/config.xml | 74 +- .../kiwiXML/preferenceSettingsProf/config.xml | 148 +- .../preferenceSettingsProfNoDef/config.xml | 168 +- .../data/kiwiXML/productSetings/config.xml | 140 +- .../data/kiwiXML/profilesConfig/config.xml | 74 +- .../kiwiXML/profilesConfigNoDef/config.xml | 74 +- .../unit/data/kiwiXML/pxeSettings/config.xml | 82 +- .../kiwiXML/pxeSettingsInvArch/config.xml | 80 +- tests/unit/data/kiwiXML/replRepos/config.xml | 96 +- .../unit/data/kiwiXML/reposConfig/config.xml | 82 +- .../data/kiwiXML/reposConfigNoRepl/config.xml | 70 +- .../kiwiXML/reposConfigWithProf/config.xml | 92 +- .../data/kiwiXML/roundtripWrite/config.xml | 244 +- tests/unit/data/kiwiXML/specPkgMgr/config.xml | 76 +- .../data/kiwiXML/splitSettings/config.xml | 82 +- .../kiwiXML/splitSettingsInvArch/config.xml | 82 +- .../unit/data/kiwiXML/stripConfig/config.xml | 78 +- .../kiwiXML/stripWithProfAndArch/config.xml | 178 +- .../unit/data/kiwiXML/typeSettings/config.xml | 108 +- .../typeSettingsNoTypeDefPref/config.xml | 136 +- .../config.xml | 136 +- .../kiwiXML/typeSettingsTwoPrimary/config.xml | 148 +- tests/unit/data/kiwiXML/userConfig/config.xml | 78 +- .../kiwiXML/userConfigWithProf/config.xml | 118 +- .../kiwiXML/vmwareConfigSettings/config.xml | 70 +- .../data/kiwiXML/xenConfigSettings/config.xml | 68 +- tests/unit/data/kiwiXMLDefStrip/invalid.xml | 16 +- tests/unit/data/kiwiXMLDefStrip/valid.xml | 46 +- tests/unit/data/kiwiXMLInfo/config.xml | 70 +- .../archiveUniqueInvalid_1.xml | 80 +- .../kiwiXMLValidator/archiveUniqueValid_1.xml | 100 +- .../bootDescriptInvalid_1.xml | 64 +- .../bootDescriptInvalid_2.xml | 74 +- .../bootDescriptInvalid_3.xml | 64 +- .../bootDescriptInvalid_4.xml | 64 +- .../bootDescriptInvalid_5.xml | 72 +- .../kiwiXMLValidator/bootDescriptValid_1.xml | 64 +- .../kiwiXMLValidator/bootDescriptValid_2.xml | 74 +- .../kiwiXMLValidator/bootDescriptValid_3.xml | 64 +- .../kiwiXMLValidator/bootDescriptValid_4.xml | 64 +- .../kiwiXMLValidator/bootDescriptValid_5.xml | 72 +- .../conflictInstallVerifyInvalid_1.xml | 76 +- .../conflictInstallVerifyValid_1.xml | 76 +- .../conflictInstallVerifyValid_2.xml | 76 +- .../containerSpecInvalid_1.xml | 64 +- .../containerSpecInvalid_2.xml | 64 +- .../kiwiXMLValidator/containerSpecValid_1.xml | 66 +- .../defaultProfileInvalid_1.xml | 128 +- .../defaultProfileValid_1.xml | 128 +- .../defaultProfileValid_2.xml | 74 +- .../defaultProfileValid_3.xml | 128 +- .../kiwiXMLValidator/defaultTypeInvalid_1.xml | 144 +- .../kiwiXMLValidator/defaultTypeInvalid_2.xml | 92 +- .../kiwiXMLValidator/defaultTypeValid_1.xml | 76 +- .../kiwiXMLValidator/defaultTypeValid_2.xml | 142 +- .../kiwiXMLValidator/defaultTypeValid_3.xml | 142 +- .../data/kiwiXMLValidator/deleteArchive.xml | 84 +- .../data/kiwiXMLValidator/deletePattern.xml | 84 +- .../data/kiwiXMLValidator/deleteProduct.xml | 84 +- .../kiwiXMLValidator/displayNameInvalid_1.xml | 74 +- .../kiwiXMLValidator/displayNameValid_1.xml | 74 +- .../data/kiwiXMLValidator/ec2IsInvalid_1.xml | 76 +- .../data/kiwiXMLValidator/ec2IsValid_1.xml | 76 +- .../data/kiwiXMLValidator/genericValid.xml | 76 +- .../groupDefinitionInvalid_1.xml | 78 +- .../groupDefinitionInvalid_2.xml | 78 +- .../groupDefinitionValid_1.xml | 78 +- .../groupDefinitionValid_2.xml | 78 +- .../groupDefinitionValid_3.xml | 78 +- .../httpsRepoCredentialsInvalid_1.xml | 74 +- .../httpsRepoCredentialsInvalid_2.xml | 74 +- .../httpsRepoCredentialsInvalid_3.xml | 80 +- .../httpsRepoCredentialsInvalid_4.xml | 80 +- .../httpsRepoCredentialsInvalid_5.xml | 86 +- .../httpsRepoCredentialsInvalid_6.xml | 86 +- .../httpsRepoCredentialsValid_1.xml | 74 +- .../httpsRepoCredentialsValid_2.xml | 80 +- .../httpsRepoCredentialsValid_3.xml | 86 +- .../kiwiXMLValidator/improperRevision.xml | 76 +- .../missingFilesysAttrInvalid_1.xml | 74 +- .../missingFilesysAttrInvalid_2.xml | 76 +- .../missingFilesysAttrValid_1.xml | 74 +- .../netIfaceUniqueInvalid_1.xml | 78 +- .../netIfaceUniqueMACInvalid_1.xml | 78 +- .../netIfaceUniqueMACValid_1.xml | 106 +- .../netIfaceUniqueValid_1.xml | 106 +- .../noBootVolumeInvalid_1.xml | 74 +- .../noBootVolumeInvalid_2.xml | 74 +- .../kiwiXMLValidator/noBootVolumeValid_1.xml | 74 +- .../kiwiXMLValidator/noBootVolumeValid_2.xml | 74 +- .../kiwiXMLValidator/noBootVolumeValid_3.xml | 74 +- .../kiwiXMLValidator/noBootVolumeValid_4.xml | 74 +- .../unit/data/kiwiXMLValidator/noIDSysGrp.xml | 76 +- .../noProfsBootstrapInvalid_1.xml | 100 +- .../kiwiXMLValidator/oemPostDumpInvalid_1.xml | 78 +- .../kiwiXMLValidator/oemPostDumpInvalid_2.xml | 78 +- .../kiwiXMLValidator/oemPostDumpInvalid_3.xml | 76 +- .../kiwiXMLValidator/oemPostDumpInvalid_4.xml | 76 +- .../kiwiXMLValidator/oemPostDumpInvalid_5.xml | 76 +- .../kiwiXMLValidator/oemPostDumpInvalid_7.xml | 76 +- .../kiwiXMLValidator/oemPostDumpValid_1.xml | 74 +- .../kiwiXMLValidator/oemPostDumpValid_2.xml | 78 +- .../kiwiXMLValidator/oemPostDumpValid_3.xml | 78 +- .../kiwiXMLValidator/oemPostDumpValid_4.xml | 76 +- .../kiwiXMLValidator/oemPostDumpValid_5.xml | 76 +- .../kiwiXMLValidator/oemPostDumpValid_6.xml | 76 +- .../kiwiXMLValidator/oemPostDumpValid_7.xml | 76 +- .../kiwiXMLValidator/ovftypeInvalid_1.xml | 68 +- .../kiwiXMLValidator/ovftypeInvalid_2.xml | 82 +- .../kiwiXMLValidator/ovftypeInvalid_3.xml | 98 +- .../data/kiwiXMLValidator/ovftypeValid_1.xml | 82 +- .../packageUniqueInvalid_1.xml | 78 +- .../packageUniqueInvalid_2.xml | 78 +- .../kiwiXMLValidator/packageUniqueValid_1.xml | 78 +- .../kiwiXMLValidator/packageUniqueValid_2.xml | 80 +- .../patternTattrConsInvalid_1.xml | 116 +- .../patternTattrConsInvalid_2.xml | 108 +- .../patternTattrConsValid_1.xml | 102 +- .../patternTattrConsValid_2.xml | 108 +- .../patternTattrConsValid_3.xml | 108 +- .../patternTattrConsValid_4.xml | 102 +- .../patternTattrUseInvalid_1.xml | 84 +- .../patternTattrUseValid_1.xml | 76 +- .../patternTattrUseValid_10.xml | 96 +- .../patternTattrUseValid_2.xml | 76 +- .../patternTattrUseValid_3.xml | 84 +- .../patternTattrUseValid_4.xml | 84 +- .../patternTattrUseValid_5.xml | 84 +- .../patternTattrUseValid_6.xml | 84 +- .../patternTattrUseValid_8.xml | 76 +- .../patternTattrUseValid_9.xml | 84 +- .../patternUniqueInvalid_1.xml | 80 +- .../patternUniqueInvalid_2.xml | 80 +- .../kiwiXMLValidator/patternUniqueValid_1.xml | 80 +- .../kiwiXMLValidator/patternUniqueValid_2.xml | 82 +- .../kiwiXMLValidator/preferLicInvalid_1.xml | 134 +- .../kiwiXMLValidator/preferLicInvalid_2.xml | 146 +- .../kiwiXMLValidator/preferLicInvalid_3.xml | 146 +- .../kiwiXMLValidator/preferLicInvalid_4.xml | 158 +- .../kiwiXMLValidator/preferLicValid_1.xml | 140 +- .../kiwiXMLValidator/preferLicValid_2.xml | 158 +- .../preferenceUniqueInvalid_1.xml | 78 +- .../preferenceUniqueInvalid_2.xml | 132 +- .../preferenceUniqueValid_1.xml | 128 +- .../kiwiXMLValidator/profileNameInvalid_1.xml | 106 +- .../kiwiXMLValidator/profileNameInvalid_2.xml | 106 +- .../kiwiXMLValidator/profileNameInvalid_3.xml | 106 +- .../kiwiXMLValidator/profileNameValid_1.xml | 106 +- .../profileReferenceExistInvalid_1.xml | 120 +- .../profileReferenceExistInvalid_2.xml | 90 +- .../profileReferenceExistInvalid_3.xml | 90 +- .../profileReferenceExistInvalid_4.xml | 84 +- .../profileReferenceExistInvalid_5.xml | 84 +- .../profileReferenceExistValid_1.xml | 88 +- .../sysdiskVolAttrsInvalid_1.xml | 74 +- .../sysdiskVolAttrsValid_1.xml | 76 +- .../sysdiskWhitespaceInvalid_1.xml | 78 +- .../sysdiskWhitespaceInvalid_2.xml | 78 +- .../sysdiskWhitespaceValid_1.xml | 78 +- .../sysdiskWhitespaceValid_2.xml | 72 +- .../typeConfigConsistInvalid_1.xml | 74 +- .../typeConfigConsistInvalid_2.xml | 84 +- .../typeConfigConsistValid_1.xml | 78 +- .../typeConfigConsistValid_2.xml | 80 +- .../typeConfigConsistValid_4.xml | 90 +- .../typeInstMediaInvalid_1.xml | 76 +- .../typeInstMediaInvalid_2.xml | 76 +- .../kiwiXMLValidator/typeInstMediaValid_1.xml | 76 +- .../kiwiXMLValidator/typeInstMediaValid_2.xml | 76 +- .../kiwiXMLValidator/typeInstMediaValid_3.xml | 76 +- .../kiwiXMLValidator/typeInstMediaValid_4.xml | 76 +- .../kiwiXMLValidator/typeInstMediaValid_5.xml | 76 +- .../typePcksTypeExistsInvalid_1.xml | 70 +- .../typePcksTypeExistsInvalid_2.xml | 100 +- .../typePcksTypeExistsInvalid_3.xml | 100 +- .../typePcksTypeExistsValid_1.xml | 100 +- .../kiwiXMLValidator/typeUniqueInvalid_1.xml | 132 +- .../kiwiXMLValidator/typeUniqueInvalid_2.xml | 78 +- .../userDefinitionInvalid_1.xml | 78 +- .../userDefinitionInvalid_10.xml | 78 +- .../userDefinitionInvalid_11.xml | 78 +- .../userDefinitionInvalid_2.xml | 78 +- .../userDefinitionInvalid_3.xml | 78 +- .../userDefinitionInvalid_4.xml | 80 +- .../userDefinitionInvalid_5.xml | 78 +- .../userDefinitionInvalid_6.xml | 78 +- .../userDefinitionInvalid_7.xml | 78 +- .../userDefinitionInvalid_8.xml | 78 +- .../userDefinitionInvalid_9.xml | 78 +- .../userDefinitionValid_1.xml | 78 +- .../userDefinitionValid_2.xml | 78 +- .../versionFormatInvalid_1.xml | 74 +- .../versionFormatInvalid_2.xml | 74 +- .../versionFormatInvalid_3.xml | 72 +- .../versionFormatInvalid_4.xml | 130 +- .../kiwiXMLValidator/volNameNonUnique.xml | 94 +- .../volumeWhitespaceInvalid_1.xml | 78 +- .../volumeWhitespaceInvalid_2.xml | 78 +- .../volumeWhitespaceValid_1.xml | 78 +- .../volumeWhitespaceValid_2.xml | 72 +- tests/unit/lib/Common/ktLog.pm | 750 +- tests/unit/lib/Common/ktTestCase.pm | 294 +- tests/unit/lib/Test/kiwiCommandLine.pm | 1970 +- .../unit/lib/Test/kiwiConfigWriterFactory.pm | 272 +- tests/unit/lib/Test/kiwiContainerBuilder.pm | 1118 +- .../lib/Test/kiwiContainerConfigWriter.pm | 570 +- tests/unit/lib/Test/kiwiFilesystemOptions.pm | 568 +- tests/unit/lib/Test/kiwiImage.pm | 416 +- tests/unit/lib/Test/kiwiImageBuildFactory.pm | 448 +- tests/unit/lib/Test/kiwiImageBuilderBase.pm | 846 +- tests/unit/lib/Test/kiwiImageCreator.pm | 392 +- tests/unit/lib/Test/kiwiLocator.pm | 1042 +- tests/unit/lib/Test/kiwiOVFConfigWriter.pm | 2442 +-- tests/unit/lib/Test/kiwiProfileFile.pm | 290 +- tests/unit/lib/Test/kiwiRuntimeChecker.pm | 1760 +- tests/unit/lib/Test/kiwiTarArchiveBuilder.pm | 568 +- tests/unit/lib/Test/kiwiXML.pm | 12418 +++++------ tests/unit/lib/Test/kiwiXMLDefStripData.pm | 282 +- tests/unit/lib/Test/kiwiXMLDescriptionData.pm | 1060 +- tests/unit/lib/Test/kiwiXMLDriverData.pm | 460 +- tests/unit/lib/Test/kiwiXMLExceptData.pm | 446 +- tests/unit/lib/Test/kiwiXMLFileData.pm | 436 +- tests/unit/lib/Test/kiwiXMLInfo.pm | 798 +- .../lib/Test/kiwiXMLInstRepositoryData.pm | 1008 +- tests/unit/lib/Test/kiwiXMLOEMConfigData.pm | 4972 ++--- .../lib/Test/kiwiXMLPXEDeployConfigData.pm | 330 +- tests/unit/lib/Test/kiwiXMLPXEDeployData.pm | 4882 ++--- .../lib/Test/kiwiXMLPackageArchiveData.pm | 658 +- .../lib/Test/kiwiXMLPackageCollectData.pm | 724 +- tests/unit/lib/Test/kiwiXMLPackageData.pm | 986 +- .../unit/lib/Test/kiwiXMLPackageIgnoreData.pm | 460 +- .../lib/Test/kiwiXMLPackageProductData.pm | 460 +- tests/unit/lib/Test/kiwiXMLPreferenceData.pm | 2850 +-- .../Test/kiwiXMLProductArchitectureData.pm | 426 +- .../lib/Test/kiwiXMLProductMetaChrootData.pm | 344 +- .../lib/Test/kiwiXMLProductMetaFileData.pm | 378 +- .../lib/Test/kiwiXMLProductOptionsData.pm | 826 +- .../lib/Test/kiwiXMLProductPackageData.pm | 760 +- tests/unit/lib/Test/kiwiXMLProfileData.pm | 754 +- tests/unit/lib/Test/kiwiXMLRepositoryData.pm | 1678 +- tests/unit/lib/Test/kiwiXMLSplitData.pm | 2586 +-- tests/unit/lib/Test/kiwiXMLStripData.pm | 460 +- tests/unit/lib/Test/kiwiXMLSystemdiskData.pm | 2378 +-- tests/unit/lib/Test/kiwiXMLTypeData.pm | 7870 +++---- tests/unit/lib/Test/kiwiXMLUserData.pm | 2872 +-- tests/unit/lib/Test/kiwiXMLVMachineData.pm | 5354 ++--- .../unit/lib/Test/kiwiXMLVagrantConfigData.pm | 232 +- tests/unit/lib/Test/kiwiXMLValidator.pm | 2424 +-- tests/writeTester | 20 +- tools/bootnext/bootnext.asm | 254 +- tools/dcounter/dcounter.c | 102 +- tools/driveready/driveready.c | 98 +- tools/init/boot.xen | 102 +- tools/isconsole/isconsole.c | 26 +- tools/klogconsole/klogconsole.c | 100 +- tools/kversion/kversion.c | 332 +- tools/livestick/livestick | 152 +- tools/setctsid/setctsid.c | 114 +- tools/startshell/startshell.c | 64 +- tools/utimer/utimer.c | 66 +- xsl/convert14to20.xsl | 112 +- xsl/convert20to24.xsl | 94 +- xsl/convert24to35.xsl | 52 +- xsl/convert35to37.xsl | 102 +- xsl/convert37to38.xsl | 56 +- xsl/convert38to39.xsl | 116 +- xsl/convert39to41.xsl | 294 +- xsl/convert41to42.xsl | 140 +- xsl/convert42to43.xsl | 106 +- xsl/convert43to44.xsl | 54 +- xsl/convert44to45.xsl | 54 +- xsl/convert45to46.xsl | 56 +- xsl/convert46to47.xsl | 158 +- xsl/convert47to48.xsl | 176 +- xsl/convert48to49.xsl | 50 +- xsl/convert49to50.xsl | 132 +- xsl/convert50to51.xsl | 54 +- xsl/convert51to52.xsl | 58 +- xsl/convert52to53.xsl | 66 +- xsl/convert53to54.xsl | 52 +- xsl/convert54to55.xsl | 46 +- xsl/convert55to56.xsl | 108 +- xsl/convert56to57.xsl | 54 +- xsl/convert57to58.xsl | 52 +- xsl/convert58to59.xsl | 80 +- xsl/convert59to60.xsl | 44 +- xsl/convert60to61.xsl | 54 +- xsl/master.xsl | 174 +- xsl/pretty.xsl | 74 +- xsl/print.xsl | 76 +- 846 files changed, 176747 insertions(+), 176740 deletions(-) diff --git a/.archive b/.archive index 2f994146c..76993b88c 100755 --- a/.archive +++ b/.archive @@ -23,11 +23,11 @@ tar -cjf ../kiwi-repo.tar.bz2 system/*repo cd .. touch -c -r kiwi/kiwi.pl kiwi tar -cjf kiwi.tar.bz2 \ - --exclude=system/*repo \ - --exclude=rpm \ - --exclude=doc \ - --exclude=.git \ - kiwi/ + --exclude=system/*repo \ + --exclude=rpm \ + --exclude=doc \ + --exclude=.git \ + kiwi/ mv kiwi.tar.bz2 kiwi/ mv kiwi-repo.tar.bz2 kiwi/ diff --git a/.catalog.xml b/.catalog.xml index db5fe02ff..750087699 100644 --- a/.catalog.xml +++ b/.catalog.xml @@ -1,7 +1,7 @@ - - - + + + diff --git a/.changelog b/.changelog index 2e44ff650..714574300 100755 --- a/.changelog +++ b/.changelog @@ -8,49 +8,49 @@ my $indent; $ENV{LC_ALL} = "C"; while (my $line = <>) { - if ($ignore < 2) { - $ignore = 0; - } - if ($line =~ /^commit/) { - $ignore = 1; - } - if ($line =~ /^Merge|Conflicts/) { - $ignore = 2; - } - if (($ignore < 2) && ($line =~ /^Author: .*<(.*)@.*>/)) { - $name = $1; - $ignore = 1; - } - next if ($ignore); - - if ($line =~ /^Date: (.*) [\+-].*/) { - if (@out) { - my $outstr = join (" ",@out); - if ($outstr !~ /added changelog|Merge branch|git-svn-id:/i) { - print @out; - } - undef @out; + if ($ignore < 2) { + $ignore = 0; + } + if ($line =~ /^commit/) { + $ignore = 1; + } + if ($line =~ /^Merge|Conflicts/) { + $ignore = 2; } - my $date = qx /date --date="$1"/; chomp $date; - push @out, "------------------------------------------------------------------\n"; - push @out, "$date - $name\@suse.de\n"; - undef $date; - $ignore = 0; - $count = 0; - } else { - $line =~ s/^ +//; - if ($line =~ /^-/) { - push @out, $line; - $indent = $indent_l1; - } elsif (($line =~ /^[a-zA-Z]/) && ($count == 1)) { - push @out, "- ".$line; - $indent = $indent_l1; - } elsif ($line =~ /^[\*,\+]/) { - push @out, $indent_l1.$line; - $indent = $indent_l2; + if (($ignore < 2) && ($line =~ /^Author: .*<(.*)@.*>/)) { + $name = $1; + $ignore = 1; + } + next if ($ignore); + + if ($line =~ /^Date: (.*) [\+-].*/) { + if (@out) { + my $outstr = join (" ",@out); + if ($outstr !~ /added changelog|Merge branch|git-svn-id:/i) { + print @out; + } + undef @out; + } + my $date = qx /date --date="$1"/; chomp $date; + push @out, "------------------------------------------------------------------\n"; + push @out, "$date - $name\@suse.de\n"; + undef $date; + $ignore = 0; + $count = 0; } else { - push @out, $indent.$line; + $line =~ s/^ +//; + if ($line =~ /^-/) { + push @out, $line; + $indent = $indent_l1; + } elsif (($line =~ /^[a-zA-Z]/) && ($count == 1)) { + push @out, "- ".$line; + $indent = $indent_l1; + } elsif ($line =~ /^[\*,\+]/) { + push @out, $indent_l1.$line; + $indent = $indent_l2; + } else { + push @out, $indent.$line; + } + $count++; } - $count++; - } } diff --git a/.doit b/.doit index b6df2768a..7b59361c9 100755 --- a/.doit +++ b/.doit @@ -30,49 +30,49 @@ sub main { # main routine to prepare for all the # package and version stuff # - my $result = GetOptions( - "prepare|p" => \$Prepare, - "local|L" => \$LocalSource, - "help|h" => \&usage, - "<>" => \&usage - ); - if ( $result != 1 ) { - usage(); - } - #============================================== - # Check user privileges... - #---------------------------------------------- - if (! defined $Prepare) { - usage(); - } - #============================================== - # Checkout source - #---------------------------------------------- - my $pacdir = checkout ( $LocalSource ); - #============================================== - # Add %changelog - #---------------------------------------------- - if (open (FD,">>$pacdir/kiwi.spec")) { - print FD "\n"; - print FD '%changelog -n kiwi'; - print FD "\n"; - convert_changes_to_rpm_changelog ("$pacdir/kiwi.changes",*FD); - close FD; - } - #============================================== - # convert spec to utf8 - #---------------------------------------------- - qx (iconv -f ISO-8859-1 -t utf8 $pacdir/kiwi.spec > $pacdir/kiwi.spec.new); - qx (mv $pacdir/kiwi.spec.new $pacdir/kiwi.spec); - qx (iconv -f ISO-8859-1 -t utf8 $pacdir/kiwi.changes > $pacdir/kiwi.c.new); - qx (mv $pacdir/kiwi.c.new $pacdir/kiwi.changes); - #============================================== - # Cleanup - #---------------------------------------------- - my $host = qx (hostname); - chomp ($host); - print 'Retrieve archive with: '; - print '[ scp -r root@'.$host.':'.$pacdir." . ]\n"; + my $result = GetOptions( + "prepare|p" => \$Prepare, + "local|L" => \$LocalSource, + "help|h" => \&usage, + "<>" => \&usage + ); + if ( $result != 1 ) { + usage(); + } + #============================================== + # Check user privileges... + #---------------------------------------------- + if (! defined $Prepare) { + usage(); + } + #============================================== + # Checkout source + #---------------------------------------------- + my $pacdir = checkout ( $LocalSource ); + #============================================== + # Add %changelog + #---------------------------------------------- + if (open (FD,">>$pacdir/kiwi.spec")) { + print FD "\n"; + print FD '%changelog -n kiwi'; + print FD "\n"; + convert_changes_to_rpm_changelog ("$pacdir/kiwi.changes",*FD); + close FD; + } + #============================================== + # convert spec to utf8 + #---------------------------------------------- + qx (iconv -f ISO-8859-1 -t utf8 $pacdir/kiwi.spec > $pacdir/kiwi.spec.new); + qx (mv $pacdir/kiwi.spec.new $pacdir/kiwi.spec); + qx (iconv -f ISO-8859-1 -t utf8 $pacdir/kiwi.changes > $pacdir/kiwi.c.new); + qx (mv $pacdir/kiwi.c.new $pacdir/kiwi.changes); + #============================================== + # Cleanup + #---------------------------------------------- + my $host = qx (hostname); + chomp ($host); + print 'Retrieve archive with: '; + print '[ scp -r root@'.$host.':'.$pacdir." . ]\n"; } #---[ checkout ]-----# @@ -81,15 +81,15 @@ sub checkout { # checkout sources and create a package directory # ready to go to /work/src/done # - my $pacdir = repoup (@_); - chdir $pacdir; - qx( cp -a -p kiwi/rpm/* . ); - chdir "./kiwi"; - qx (./.archive); - chdir $pacdir; - qx( mv kiwi/*.bz2 . ); - qx( rm -rf kiwi ); - return $pacdir; + my $pacdir = repoup (@_); + chdir $pacdir; + qx( cp -a -p kiwi/rpm/* . ); + chdir "./kiwi"; + qx (./.archive); + chdir $pacdir; + qx( mv kiwi/*.bz2 . ); + qx( rm -rf kiwi ); + return $pacdir; } #----[ repoup ]----------------# @@ -99,26 +99,26 @@ sub repoup { # tag and return the pathname of the temp directory # where the new sources are located # - #=========================================== - # create tmp directory and change into it - #------------------------------------------- - my $parent = qx ( pwd ); - my $tmpdir = qx ( - mktemp -q -d /tmp/gitkiwi.XXXXXX - ); - chomp $parent; - chomp $tmpdir; - chdir $tmpdir - || die "Could not create temp dir: $!"; - #=========================================== - # pack up local source - #------------------------------------------- - print "Checkout source level [local]...\n"; - qx( cp -a -p $parent/ $tmpdir/kiwi ); - qx ($parent/.lutime $parent $tmpdir); - chdir $tmpdir - || die "Could not create temp dir: $!"; - return $tmpdir; + #=========================================== + # create tmp directory and change into it + #------------------------------------------- + my $parent = qx ( pwd ); + my $tmpdir = qx ( + mktemp -q -d /tmp/gitkiwi.XXXXXX + ); + chomp $parent; + chomp $tmpdir; + chdir $tmpdir + || die "Could not create temp dir: $!"; + #=========================================== + # pack up local source + #------------------------------------------- + print "Checkout source level [local]...\n"; + qx( cp -a -p $parent/ $tmpdir/kiwi ); + qx ($parent/.lutime $parent $tmpdir); + chdir $tmpdir + || die "Could not create temp dir: $!"; + return $tmpdir; } #----[ usage ]------------# @@ -126,9 +126,9 @@ sub usage { #---------------------------------------- # give me a usage message # - print "usage: doit -p --local\n"; - print "--\n"; - exit (0); + print "usage: doit -p --local\n"; + print "--\n"; + exit (0); } #----[ convert_changes_to_rpm_changelog ]------------# @@ -136,127 +136,127 @@ sub convert_changes_to_rpm_changelog { #---------------------------------------- # convert changes to rpm changelog # - my $file = shift; - local *FD = shift; - my @entries = (); - my %entries = (); - my @datarray= (); - my @hourarray=(); - my $outstr; - my $rpm_birth = 852159600; - my $rpm_birth_str = "Thu Jan 02 1997"; - my $actual = 999999999999; - my %month_to_num = (Jan=>0,Feb=>1,Mar=>2,Apr=>3,May=>4,Jun=>5,Jul=>6,Aug=>7,Sep=>8,Oct=>9,Nov=>10,Dec=>11); - # handle first line in entry specially - my $firstline = 0; - open (LG,$file); - while () { - chomp ($_); - next if (/^--------------/); - next if (/^========================/); - if ( - /^[A-Za-z]*\s*[A-Za-z]*\s*[0-9]*\s*[0-9][0-9]:[0-9][0-9].*-.*\@.*/ - || /^[A-Za-z]*\s*[A-Za-z]*\s*[0-9]*\s*[0-9][0-9][0-9][0-9]\s*-.*\@.*/ - ) { - #warn ("found changes style dateline $_\n"); - if ( - /^Mon / || /^Tue / || /^Wed / || /^Thu / || /^Fri / - || /^Sat / || /^Sun / - ) { - my @xline = split ( '-', $_); - my $datestr = shift ( @xline ); - my $address = join ('-', @xline); - #my ($datestr,$address) = split ( '-', $_); - $datestr =~ s/CEST/MEST/; - @datarray = split ( ' ',$datestr); - if ($datarray[3] =~ /:/) { - @hourarray = split ( ':',$datarray[3]); - } else { - @hourarray = ("00","00","00"); + my $file = shift; + local *FD = shift; + my @entries = (); + my %entries = (); + my @datarray= (); + my @hourarray=(); + my $outstr; + my $rpm_birth = 852159600; + my $rpm_birth_str = "Thu Jan 02 1997"; + my $actual = 999999999999; + my %month_to_num = (Jan=>0,Feb=>1,Mar=>2,Apr=>3,May=>4,Jun=>5,Jul=>6,Aug=>7,Sep=>8,Oct=>9,Nov=>10,Dec=>11); + # handle first line in entry specially + my $firstline = 0; + open (LG,$file); + while () { + chomp ($_); + next if (/^--------------/); + next if (/^========================/); + if ( + /^[A-Za-z]*\s*[A-Za-z]*\s*[0-9]*\s*[0-9][0-9]:[0-9][0-9].*-.*\@.*/ + || /^[A-Za-z]*\s*[A-Za-z]*\s*[0-9]*\s*[0-9][0-9][0-9][0-9]\s*-.*\@.*/ + ) { + #warn ("found changes style dateline $_\n"); + if ( + /^Mon / || /^Tue / || /^Wed / || /^Thu / || /^Fri / + || /^Sat / || /^Sun / + ) { + my @xline = split ( '-', $_); + my $datestr = shift ( @xline ); + my $address = join ('-', @xline); + #my ($datestr,$address) = split ( '-', $_); + $datestr =~ s/CEST/MEST/; + @datarray = split ( ' ',$datestr); + if ($datarray[3] =~ /:/) { + @hourarray = split ( ':',$datarray[3]); + } else { + @hourarray = ("00","00","00"); + } + $actual = timelocal ($hourarray[2],$hourarray[1],$hourarray[0], + $datarray[2],$month_to_num{$datarray[1]}, + $datarray[$#datarray]-1900); + $address =~ s/^\s*(.*)/\1/; + $address =~ s/\s+/ /g; + my $datestr; + if ( ! $actual ) { + print "INVALID DATESTR=\"$datestr\" !!!"; + print "$actual Skipping rest..."; + exit 1; + } + if ( $actual < $rpm_birth ) { + $datestr = $rpm_birth_str; + } else { + my $ltime = localtime $actual; + $datestr = sprintf("%s %s %02d %4d", + (qw(Sun Mon Tue Wed Thu Fri Sat Sun))[$ltime->wday], + (qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec))[$ltime->mon], + $ltime->mday,1900+$ltime->year); + } + chomp ($datestr); + $outstr = "$datestr - $address"; + if ( $entries{$actual} =~ /$outstr/ ) { + # nope + } else { + $entries{$actual} .= "* $outstr\n"; + } + $firstline = 1; + next; + } else { + warn ("$_ is not in english locale\n"); + $actual = timelocal ( 0,0,0,1,0,100); # Jan 1st 2000 + $entries{$actual} .= "* Tue Jan 01 2000 - nobody\@suse.de\n" unless ( $entries{$actual} =~ /$outstr/ ); + } } - $actual = timelocal ($hourarray[2],$hourarray[1],$hourarray[0], - $datarray[2],$month_to_num{$datarray[1]}, - $datarray[$#datarray]-1900); - $address =~ s/^\s*(.*)/\1/; - $address =~ s/\s+/ /g; - my $datestr; - if ( ! $actual ) { - print "INVALID DATESTR=\"$datestr\" !!!"; - print "$actual Skipping rest..."; - exit 1; + if ( + /^\* Mon / || /^\* Tue / || /^\* Wed / || /^\* Thu / || + /^\* Fri / || /^\* Sat / || /^\* Sun / + ) { + my ($datestr,$address) = split ( '-', $_); + @datarray = split ( ' ',$datestr); + $actual = timelocal(0,0,0,$datarray[3],$month_to_num{$datarray[2]}, + $datarray[$#datarray]-1900); + $address =~ s/^\s*(.*)/\1/; + $address =~ s/\s+/ /g; + if ( ! $actual ) { + print "INVALID DATESTR=\"$datestr\" !!!"; + print "$actual Skipping rest..."; + exit 1; + } + $entries{$actual} .= "$_\n"; + $firstline = 1; + next; } - if ( $actual < $rpm_birth ) { - $datestr = $rpm_birth_str; - } else { - my $ltime = localtime $actual; - $datestr = sprintf("%s %s %02d %4d", - (qw(Sun Mon Tue Wed Thu Fri Sat Sun))[$ltime->wday], - (qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec))[$ltime->mon], - $ltime->mday,1900+$ltime->year); + $_ =~ s/([^%])%([^%])/\1%%\2/g; + if (/^-/ || /^\s*-/) { + $_ =~ s/^\s*(\S*)/\1/ if($firstline); + $_ =~ s/(\S*)\s*$/\1/; + $entries{$actual} .= "$_\n"; + $firstline = 0; + next; } - chomp ($datestr); - $outstr = "$datestr - $address"; - if ( $entries{$actual} =~ /$outstr/ ) { - # nope - } else { - $entries{$actual} .= "* $outstr\n"; + if (/^\s*\#/) { + # hash is comment, try to escape + s/^(\s*)(\#\d*)/$1\[$2\]/; + } + if (/\S/) { + $_ =~ s/^\s*(\S*)/\1/; + $_ =~ s/(\S*)\s*$/\1/; + $entries{$actual} .= " $_\n"; + $firstline = 0; } - $firstline = 1; - next; - } else { - warn ("$_ is not in english locale\n"); - $actual = timelocal ( 0,0,0,1,0,100); # Jan 1st 2000 - $entries{$actual} .= "* Tue Jan 01 2000 - nobody\@suse.de\n" unless ( $entries{$actual} =~ /$outstr/ ); - } - } - if ( - /^\* Mon / || /^\* Tue / || /^\* Wed / || /^\* Thu / || - /^\* Fri / || /^\* Sat / || /^\* Sun / - ) { - my ($datestr,$address) = split ( '-', $_); - @datarray = split ( ' ',$datestr); - $actual = timelocal(0,0,0,$datarray[3],$month_to_num{$datarray[2]}, - $datarray[$#datarray]-1900); - $address =~ s/^\s*(.*)/\1/; - $address =~ s/\s+/ /g; - if ( ! $actual ) { - print "INVALID DATESTR=\"$datestr\" !!!"; - print "$actual Skipping rest..."; - exit 1; - } - $entries{$actual} .= "$_\n"; - $firstline = 1; - next; - } - $_ =~ s/([^%])%([^%])/\1%%\2/g; - if (/^-/ || /^\s*-/) { - $_ =~ s/^\s*(\S*)/\1/ if($firstline); - $_ =~ s/(\S*)\s*$/\1/; - $entries{$actual} .= "$_\n"; - $firstline = 0; - next; - } - if (/^\s*\#/) { - # hash is comment, try to escape - s/^(\s*)(\#\d*)/$1\[$2\]/; - } - if (/\S/) { - $_ =~ s/^\s*(\S*)/\1/; - $_ =~ s/(\S*)\s*$/\1/; - $entries{$actual} .= " $_\n"; - $firstline = 0; } - } - my $first = "1"; - foreach my $key (sort {0+$b <=> 0+$a} (keys %entries)) { - if ( $first eq "1" && $entries{$key} !~ /^\*/ ) { - my $dst = `date`; - chomp ($dst); - print "* $dst - broken\@suse.de\n"; + my $first = "1"; + foreach my $key (sort {0+$b <=> 0+$a} (keys %entries)) { + if ( $first eq "1" && $entries{$key} !~ /^\*/ ) { + my $dst = `date`; + chomp ($dst); + print "* $dst - broken\@suse.de\n"; + } + $first = "0"; + print FD "$entries{$key}"; } - $first = "0"; - print FD "$entries{$key}"; - } } main(); diff --git a/.filter b/.filter index 35666726b..0d4e40fad 100755 --- a/.filter +++ b/.filter @@ -16,73 +16,73 @@ my %logs; my $logmsg; while (<>) { - next if (/^--------------/); + next if (/^--------------/); - if (/^(?:\* )?([A-Za-z]+\s+[A-Za-z]+\s+[0-9].*[0-9][0-9][0-9][0-9])(.*\@.*)$/) { - my $dt = $1; - my $who = $2; - $dt = lc($dt); - $who =~ s/^\s+//; - $who =~ s/^-\s*//; - $dt =~ /([0-9][0-9][0-9][0-9])/; - my $year = $1; - if (!defined($zone) && $dt =~ /\s([a-z]{3,4})(dst)?\s[0-9]{4}/) { - my $dst = $2; - $zone = tz_offset($1); - $zone += 3600 if defined($zone) && $dst; - } - my $tdt = str2time($dt); - $dt =~ /([0-9]+)/; - my $day = $1; - if (!$tdt) { - if ($dt =~ /([a-z]{3})\s+([a-z]{3})/) { - $tdt = str2time("$1 $2 $day $year"); - } - } - if (!$tdt) { - if ($dt =~ /([a-z]{3})/) { - $tdt = str2time("$1 $day $year"); - } - } - if (!$tdt) { - $tdt = str2time("$year-1-1"); - } - # 12:00 if not specified - $tdt += 12 * 3600 unless $dt =~ /\d:\d/; - $tdt += ($zone || 0); - - if (defined($lastt) && $logmsg) { - if (defined($logs{$lastt})) { - #warn "Double commit detected:\n" . $logs{$lastt} ."\n"; - my @message = split /\n/,$logmsg; - shift @message; - shift @message; - $logmsg = join ("\n",@message); - $logs{$lastt} .= $logmsg ."\n"; - #$logs{$lastt} .= "-------------------------------------------------------------------\n" . $logmsg; - } else { - $logs{$lastt} = $logmsg; - } - } + if (/^(?:\* )?([A-Za-z]+\s+[A-Za-z]+\s+[0-9].*[0-9][0-9][0-9][0-9])(.*\@.*)$/) { + my $dt = $1; + my $who = $2; + $dt = lc($dt); + $who =~ s/^\s+//; + $who =~ s/^-\s*//; + $dt =~ /([0-9][0-9][0-9][0-9])/; + my $year = $1; + if (!defined($zone) && $dt =~ /\s([a-z]{3,4})(dst)?\s[0-9]{4}/) { + my $dst = $2; + $zone = tz_offset($1); + $zone += 3600 if defined($zone) && $dst; + } + my $tdt = str2time($dt); + $dt =~ /([0-9]+)/; + my $day = $1; + if (!$tdt) { + if ($dt =~ /([a-z]{3})\s+([a-z]{3})/) { + $tdt = str2time("$1 $2 $day $year"); + } + } + if (!$tdt) { + if ($dt =~ /([a-z]{3})/) { + $tdt = str2time("$1 $day $year"); + } + } + if (!$tdt) { + $tdt = str2time("$year-1-1"); + } + # 12:00 if not specified + $tdt += 12 * 3600 unless $dt =~ /\d:\d/; + $tdt += ($zone || 0); - $lastt = $tdt; - $logmsg = $_; - next; + if (defined($lastt) && $logmsg) { + if (defined($logs{$lastt})) { + #warn "Double commit detected:\n" . $logs{$lastt} ."\n"; + my @message = split /\n/,$logmsg; + shift @message; + shift @message; + $logmsg = join ("\n",@message); + $logs{$lastt} .= $logmsg ."\n"; + #$logs{$lastt} .= "-------------------------------------------------------------------\n" . $logmsg; + } else { + $logs{$lastt} = $logmsg; + } } - $logmsg .= $_; + $lastt = $tdt; + $logmsg = $_; + next; + } + + $logmsg .= $_; } if (defined($lastt) && $logmsg) { - $logs{$lastt} = $logmsg; + $logs{$lastt} = $logmsg; } sub hashValueDescendingNum { - $b <=> $a; + $b <=> $a; } foreach my $key (sort hashValueDescendingNum (keys(%logs))) { - print "-------------------------------------------------------------------\n"; - print "$logs{$key}"; + print "-------------------------------------------------------------------\n"; + print "$logs{$key}"; } diff --git a/.indent b/.indent index cb5ef268a..9ce11ebea 100755 --- a/.indent +++ b/.indent @@ -1,8 +1,15 @@ #!/bin/bash -for file in $(find -type f | grep -v Makefile | grep -v .git | grep -v refresults | grep -v kiwiTestRepo ); do - mode=$(stat -c %a $file) - expand -t 4 $file > $file.tmp && mv $file.tmp $file - chmod $mode $file +for file in $(find -type f |\ + grep -v Makefile |\ + grep -v .git |\ + grep -v refresults |\ + grep -v kiwiTestRepo |\ + grep -v .indent +); do + mode=$(stat -c %a $file) + unexpand --first-only -t 2 $file > $file.tmp && \ + expand -t 4 $file.tmp > $file + chmod $mode $file done rm modules/KIWISchema.rng make modules/KIWISchema.rng diff --git a/.links b/.links index 3a0e6b214..a4deb4686 100755 --- a/.links +++ b/.links @@ -17,7 +17,7 @@ # If using normal root, avoid changing anything. if [ -z "$RPM_BUILD_ROOT" ]; then - exit 0 + exit 0 fi LC_ALL= @@ -35,148 +35,148 @@ had_errors=0 links=`find . -type l | sed -e "s,^./,/,"` for link in $links do - link_dest=`$READLINK ./$link` - orig_link_dest=$link_dest - - new_link_dest=NONE - link_dir=`$DIRNAME $link` - - case $link_dest in - .|..|../..) # link to current dir - continue ;; - .*) # relative links up - link_dest="$link_dir/$link_dest" - ;; - /*) # absolute links - ;; - */*) # relative links down - link_dest="$link_dir/$link_dest" - ;; - *) # the rest - continue + link_dest=`$READLINK ./$link` + orig_link_dest=$link_dest + + new_link_dest=NONE + link_dir=`$DIRNAME $link` + + case $link_dest in + .|..|../..) # link to current dir + continue ;; + .*) # relative links up + link_dest="$link_dir/$link_dest" + ;; + /*) # absolute links + ;; + */*) # relative links down + link_dest="$link_dir/$link_dest" + ;; + *) # the rest + continue + esac + + # cleaning out double slash + link_dest=`echo $link_dest | sed -e 's,//*,/,g; s,/\.$,/,; s,/$,,'` + + # eliminating /./ components + link_dest=`echo $link_dest | sed -e "s,/\./,/,g"`; + + counter=0 + # eliminating back references + while echo $link_dest | egrep -q '/\.\.'; do + link_dest=`echo $link_dest | sed -e "s,/[^/]*/\.\.,,"`; + case $link_dest in + /..*) # this is very mean + echo "ERROR: $link points to illegal $link_dest" + exit 1 + ;; esac - - # cleaning out double slash - link_dest=`echo $link_dest | sed -e 's,//*,/,g; s,/\.$,/,; s,/$,,'` - - # eliminating /./ components - link_dest=`echo $link_dest | sed -e "s,/\./,/,g"`; - - counter=0 - # eliminating back references - while echo $link_dest | egrep -q '/\.\.'; do - link_dest=`echo $link_dest | sed -e "s,/[^/]*/\.\.,,"`; - case $link_dest in - /..*) # this is very mean - echo "ERROR: $link points to illegal $link_dest" - exit 1 - ;; - esac - counter=$((counter + 1)) - if test $counter -gt 10; then - echo "ERROR: more than 10 back references in $link?" - exit 1 - fi - done - - # black list - case "$link,$link_dest" in - *,/var/lib/named*) - continue;; - /usr/etc,*|/usr/tmp,*) - continue;; - */share/texmf/*|/usr/share/terminfo/*) - continue;; - *share/automake-*) - echo "ERROR: link target $link points into automake directory" - echo " You might want to add a -c to the automake call (or just" - echo " skip the files from packaging)" - exit 1 - ;; - *,/opt/kde3/share/doc/HTML/*/common) # white listed for not existant - ;; - *,/proc/*) # links pointing into /proc file system - ;; - *) - if test ! -L ./$link_dest && test ! -e $link_dest && test ! -e ./$link_dest; then - echo "ERROR: link target doesn't exist (neither in build root nor in installed system):" - echo " $link -> $link_dest" - echo "Add the package providing the target to neededforbuild and Requires" - test "$NO_BRP_STALE_LINK_ERROR" != "yes" && had_errors=1 + counter=$((counter + 1)) + if test $counter -gt 10; then + echo "ERROR: more than 10 back references in $link?" + exit 1 fi - ;; - esac + done + + # black list + case "$link,$link_dest" in + *,/var/lib/named*) + continue;; + /usr/etc,*|/usr/tmp,*) + continue;; + */share/texmf/*|/usr/share/terminfo/*) + continue;; + *share/automake-*) + echo "ERROR: link target $link points into automake directory" + echo " You might want to add a -c to the automake call (or just" + echo " skip the files from packaging)" + exit 1 + ;; + *,/opt/kde3/share/doc/HTML/*/common) # white listed for not existant + ;; + *,/proc/*) # links pointing into /proc file system + ;; + *) + if test ! -L ./$link_dest && test ! -e $link_dest && test ! -e ./$link_dest; then + echo "ERROR: link target doesn't exist (neither in build root nor in installed system):" + echo " $link -> $link_dest" + echo "Add the package providing the target to neededforbuild and Requires" + test "$NO_BRP_STALE_LINK_ERROR" != "yes" && had_errors=1 + fi + ;; + esac + + forced_absolute=0 + for prefix in /usr/X11R6/lib/X11 /usr/X11R6/include/X11 /usr/X11R6/lib/X11/app-defaults ; do + if echo $link | grep -q "^$prefix/"; then + if echo $link_dest | grep -q "^$prefix/"; then + # if it's below it, it's fine + : + else + forced_absolute=1 + fi + fi + done + + dest_dir=`$DIRNAME $link_dest` + + # figuring out (currently) correct destination + if test "$link_dir" = "$dest_dir" || test "$dest_dir" = "."; then + new_link_dest=`$BASENAME $link_dest` + else + # figuring out top level directory + top_link=`echo $link | sed -e 's,^\(/[^/]*\)/.*,\1,'` + top_dest=`echo $link_dest | sed -e 's,^\(/[^/]*\)/.*,\1,'` + if test "$forced_absolute" = 0 && test "$top_link" = "$top_dest"; then # supposed to be relative + + # first we need to cut out the common prefix + link_tmp=$link + while test "$top_link" = "$top_dest"; do + link_orig=$link_tmp + dest_orig=$link_dest + link_tmp=`echo $link_tmp | sed -e 's,^\(/[^/]*\)/,/,'` + link_dest=`echo $link_dest | sed -e 's,^\(/[^/]*\)/,/,'` + top_link=`echo $link_tmp | sed -e 's,^\(/[^/]*\)/.*,\1,'` + top_dest=`echo $link_dest | sed -e 's,^\(/[^/]*\)/.*,\1,'` - forced_absolute=0 - for prefix in /usr/X11R6/lib/X11 /usr/X11R6/include/X11 /usr/X11R6/lib/X11/app-defaults ; do - if echo $link | grep -q "^$prefix/"; then - if echo $link_dest | grep -q "^$prefix/"; then - # if it's below it, it's fine - : - else - forced_absolute=1 - fi - fi - done - - dest_dir=`$DIRNAME $link_dest` - - # figuring out (currently) correct destination - if test "$link_dir" = "$dest_dir" || test "$dest_dir" = "."; then - new_link_dest=`$BASENAME $link_dest` + if test "$top_dest" = "$dest_orig" || test "$top_link" = "$link_orig"; then + link_tmp=$link_orig + link_dest=$dest_orig + break + fi + done + + # now we add a .. for every directory component + link_tmp=`$DIRNAME $link_tmp` + + if test "$link_tmp" = "$link_dest"; then + new_link_dest=. + elif test "$link_tmp" != "/"; then # we have a directory component + link_rel= + + while test -n "$link_tmp"; do + link_tmp=`echo $link_tmp | sed -e 's,^\(/[^/]*\),,'` + link_rel="../$link_rel" + done + + new_link_dest=`echo $link_rel/$link_dest | sed -e "s,//*,/,g"` + else + # get rid of the slash + link_dest=`echo $link_dest | sed -e 's,^/,,'` + new_link_dest=$link_dest + fi else - # figuring out top level directory - top_link=`echo $link | sed -e 's,^\(/[^/]*\)/.*,\1,'` - top_dest=`echo $link_dest | sed -e 's,^\(/[^/]*\)/.*,\1,'` - if test "$forced_absolute" = 0 && test "$top_link" = "$top_dest"; then # supposed to be relative - - # first we need to cut out the common prefix - link_tmp=$link - while test "$top_link" = "$top_dest"; do - link_orig=$link_tmp - dest_orig=$link_dest - link_tmp=`echo $link_tmp | sed -e 's,^\(/[^/]*\)/,/,'` - link_dest=`echo $link_dest | sed -e 's,^\(/[^/]*\)/,/,'` - top_link=`echo $link_tmp | sed -e 's,^\(/[^/]*\)/.*,\1,'` - top_dest=`echo $link_dest | sed -e 's,^\(/[^/]*\)/.*,\1,'` - - if test "$top_dest" = "$dest_orig" || test "$top_link" = "$link_orig"; then - link_tmp=$link_orig - link_dest=$dest_orig - break - fi - done - - # now we add a .. for every directory component - link_tmp=`$DIRNAME $link_tmp` - - if test "$link_tmp" = "$link_dest"; then - new_link_dest=. - elif test "$link_tmp" != "/"; then # we have a directory component - link_rel= - - while test -n "$link_tmp"; do - link_tmp=`echo $link_tmp | sed -e 's,^\(/[^/]*\),,'` - link_rel="../$link_rel" - done - - new_link_dest=`echo $link_rel/$link_dest | sed -e "s,//*,/,g"` - else - # get rid of the slash - link_dest=`echo $link_dest | sed -e 's,^/,,'` - new_link_dest=$link_dest - fi - else - new_link_dest=$link_dest - fi + new_link_dest=$link_dest fi + fi - if test "$new_link_dest" != NONE && test "$new_link_dest" != "$orig_link_dest"; then - #echo "INFO: relinking $link -> $new_link_dest (was $orig_link_dest)" - rm ./$link && ln -s $new_link_dest ./$link - fi + if test "$new_link_dest" != NONE && test "$new_link_dest" != "$orig_link_dest"; then + #echo "INFO: relinking $link -> $new_link_dest (was $orig_link_dest)" + rm ./$link && ln -s $new_link_dest ./$link + fi done if test "$had_errors" = 1; then - exit 1 + exit 1 fi diff --git a/.lutime b/.lutime index ed8dc7e1f..939675086 100755 --- a/.lutime +++ b/.lutime @@ -14,16 +14,16 @@ my $Source = $ARGV[0]; my $Target = $ARGV[1]."/kiwi"; sub generateWanted { - my $filehash = shift; - my $base = shift; - return sub { - if ((-l $File::Find::name) && (-e $File::Find::name)) { - my $file = $File::Find::name; - my $attr = lstat ($file); - $file =~ s/$base//; - $filehash->{$file} = $attr; + my $filehash = shift; + my $base = shift; + return sub { + if ((-l $File::Find::name) && (-e $File::Find::name)) { + my $file = $File::Find::name; + my $attr = lstat ($file); + $file =~ s/$base//; + $filehash->{$file} = $attr; + } } - } }; my $wref = generateWanted (\%reference,$Source); @@ -33,10 +33,10 @@ my $wref = generateWanted (\%result,$Target); find ({ wanted => $wref }, $Target ); foreach my $name (keys %result) { - my $atime; - my $mtime; - $atime = $mtime = $reference{$name}->mtime; - lutimes $atime, $mtime, $Target."/".$name; + my $atime; + my $mtime; + $atime = $mtime = $reference{$name}->mtime; + lutimes $atime, $mtime, $Target."/".$name; } diff --git a/.newversion b/.newversion index 8581d2e2b..c35d586f3 100755 --- a/.newversion +++ b/.newversion @@ -3,28 +3,28 @@ version=$1 schema=$2 if [ -z "$version" ] || [ -z "$schema" ];then - echo "Need a version and a schema version" - exit 1 + echo "Need a version and a schema version" + exit 1 fi if ! echo $version | grep -q -E "^[0-9]+\.[0-9]+\.[0-9]+$";then - echo "NOT A VERSION ! ... abort" - exit 1 + echo "NOT A VERSION ! ... abort" + exit 1 fi if ! echo $schema | grep -q -E "^[0-9]+\.[0-9]$";then - echo "NOT A SCHEMA VERSION ! ... abort" - exit 1 + echo "NOT A SCHEMA VERSION ! ... abort" + exit 1 fi # code version update cat modules/KIWIGlobals.pm | sed \ - -e s"@\$data{Version} = \".*\"@\$data\{Version\} = \"$version\"@" \ + -e s"@\$data{Version} = \".*\"@\$data\{Version\} = \"$version\"@" \ > modules/KIWIGlobals.pm.new && mv modules/KIWIGlobals.pm.new modules/KIWIGlobals.pm && chmod 644 modules/KIWIGlobals.pm # spec file version update cat rpm/kiwi.spec | sed \ - -e "0,/Version: .*/{s/Version: .*/Version: $version/}" \ - -e s"/kiwi-schema = .*/kiwi-schema = $schema/" \ - -e s"@kiwi (Version .*@kiwi (Version $version)@" \ + -e "0,/Version: .*/{s/Version: .*/Version: $version/}" \ + -e s"/kiwi-schema = .*/kiwi-schema = $schema/" \ + -e s"@kiwi (Version .*@kiwi (Version $version)@" \ > rpm/kiwi.spec.new && mv rpm/kiwi.spec.new rpm/kiwi.spec echo "update to version: ${version}... done" diff --git a/.perlcriticrc b/.perlcriticrc index 714d816f2..0f8e10871 100644 --- a/.perlcriticrc +++ b/.perlcriticrc @@ -2,4 +2,4 @@ [-NamingConventions::Capitalization] [-InputOutput::RequireBriefOpen] [Subroutines::ProhibitUnusedPrivateSubroutines] - allow = _new_instance + allow = _new_instance diff --git a/.releasetags b/.releasetags index c66a3c512..8ffc5bc9c 100755 --- a/.releasetags +++ b/.releasetags @@ -1,16 +1,16 @@ #!/bin/bash for item in $( - git log --grep "- v.*released" --format=oneline |\ - awk {'printf "%s,%s\n", $1,$3}' + git log --grep "- v.*released" --format=oneline |\ + awk {'printf "%s,%s\n", $1,$3}' ); do - commit=$(echo $item | cut -f1 -d,) - version=$(echo $item | cut -f2 -d,) - last_tagged=$(git tag --list --contains $commit 2>/dev/null) - if [ ! -z "$last_tagged" ];then - echo "Current tagged version: $last_tagged" - break - else - echo "--> git tag $version $commit" - fi + commit=$(echo $item | cut -f1 -d,) + version=$(echo $item | cut -f2 -d,) + last_tagged=$(git tag --list --contains $commit 2>/dev/null) + if [ ! -z "$last_tagged" ];then + echo "Current tagged version: $last_tagged" + break + else + echo "--> git tag $version $commit" + fi done diff --git a/.travis.yml b/.travis.yml index d28728dab..6698e1528 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ language: perl before_install: - - sudo apt-get update -qq - - sudo apt-get install -y xsltproc - - sudo apt-get install -y syslinux + - sudo apt-get update -qq + - sudo apt-get install -y xsltproc + - sudo apt-get install -y syslinux install: - - cpanm -f -n $(cat .perlmodules | tr "\n" " ") + - cpanm -f -n $(cat .perlmodules | tr "\n" " ") script: make test diff --git a/distribution/kiwi-instsource-plugins-SLE-11-SP2/KIWIBasePlugin.pm b/distribution/kiwi-instsource-plugins-SLE-11-SP2/KIWIBasePlugin.pm index 370a7ecff..a980922a2 100644 --- a/distribution/kiwi-instsource-plugins-SLE-11-SP2/KIWIBasePlugin.pm +++ b/distribution/kiwi-instsource-plugins-SLE-11-SP2/KIWIBasePlugin.pm @@ -25,222 +25,222 @@ use IPC::Open3; use Symbol; sub new { - my $class = shift; - my $this = { - m_handler => undef, - m_name => "KIWIBasePlugin", - m_order => undef, - m_requireddirs=> [], - m_descr => [], - m_requires => [], - m_ready => 0, - m_collect => 0 - }; - bless ($this, $class); - $this->{m_handler} = shift; - if (! ref($this->{m_handler})) { - return; - } - $this->{m_collect} = $this->{m_handler}->collect(); - return $this; + my $class = shift; + my $this = { + m_handler => undef, + m_name => "KIWIBasePlugin", + m_order => undef, + m_requireddirs=> [], + m_descr => [], + m_requires => [], + m_ready => 0, + m_collect => 0 + }; + bless ($this, $class); + $this->{m_handler} = shift; + if (! ref($this->{m_handler})) { + return; + } + $this->{m_collect} = $this->{m_handler}->collect(); + return $this; } sub name { - my $this = shift; - my $name = shift; - if (! ref($this)) { - return; - } - my $oldname = $this->{m_name}; - if($name) { - $this->{m_name} = $name; - } - return $oldname; + my $this = shift; + my $name = shift; + if (! ref($this)) { + return; + } + my $oldname = $this->{m_name}; + if($name) { + $this->{m_name} = $name; + } + return $oldname; } sub order { - my $this = shift; - my $order = shift; - if (! ref($this)) { - return; - } - my $oldorder = $this->{m_order}; - if($order) { - $this->{m_order} = $order; - } - return $oldorder; + my $this = shift; + my $order = shift; + if (! ref($this)) { + return; + } + my $oldorder = $this->{m_order}; + if($order) { + $this->{m_order} = $order; + } + return $oldorder; } sub ready { - my $this = shift; - my $ready = shift; - if (! ref($this)) { - return; - } - my $oldready = $this->{m_ready}; - if($ready) { - $this->{m_ready} = $ready; - } - return $oldready; + my $this = shift; + my $ready = shift; + if (! ref($this)) { + return; + } + my $oldready = $this->{m_ready}; + if($ready) { + $this->{m_ready} = $ready; + } + return $oldready; } sub requiredDirs { - my @params = @_; - my $this = shift @params; - my @dirs = @params; - if (! ref($this)) { - return; - } - my @oldrd = @{$this->{m_requireddirs}}; - foreach my $entry(@params) { - push @{$this->{m_requireddirs}}, $entry; - } - return @oldrd; + my @params = @_; + my $this = shift @params; + my @dirs = @params; + if (! ref($this)) { + return; + } + my @oldrd = @{$this->{m_requireddirs}}; + foreach my $entry(@params) { + push @{$this->{m_requireddirs}}, $entry; + } + return @oldrd; } sub description { - my @params = @_; - my $this = shift @params; - my @descr= @params; - if (! ref($this)) { - return; - } - my @olddesc = $this->{m_descr}; - foreach my $entry(@descr) { - push @{$this->{m_descr}}, $entry; - } - return @olddesc; + my @params = @_; + my $this = shift @params; + my @descr= @params; + if (! ref($this)) { + return; + } + my @olddesc = $this->{m_descr}; + foreach my $entry(@descr) { + push @{$this->{m_descr}}, $entry; + } + return @olddesc; } sub requires { - my @params = @_; - my $this = shift; - my @reqs = @params; - if (! ref($this)) { - return; - } - my @oldreq = $this->{m_requires}; - foreach my $entry(@reqs) { - push @{$this->{m_requires}}, $entry; - } - return @oldreq; + my @params = @_; + my $this = shift; + my @reqs = @params; + if (! ref($this)) { + return; + } + my @oldreq = $this->{m_requires}; + foreach my $entry(@reqs) { + push @{$this->{m_requires}}, $entry; + } + return @oldreq; } sub handler { - my $this = shift; - if (! ref($this)) { - return; - } - return $this->{m_handler}; + my $this = shift; + if (! ref($this)) { + return; + } + return $this->{m_handler}; } sub collect { - my $this = shift; - if (! ref($this)) { - return; - } - return $this->{m_collect}; + my $this = shift; + if (! ref($this)) { + return; + } + return $this->{m_collect}; } sub logMsg { - my $this = shift; - if (! ref($this)) { - return; - } - my $type = shift; - my $msg = shift; - if ((! defined($type)) || (! defined($msg))) { - return; - } - $this->{m_collect}->logMsg($type, $msg); - return $this; + my $this = shift; + if (! ref($this)) { + return; + } + my $type = shift; + my $msg = shift; + if ((! defined($type)) || (! defined($msg))) { + return; + } + $this->{m_collect}->logMsg($type, $msg); + return $this; } sub callCmd { - my $this = shift; - my $cmd = shift; - my $BUFSIZE = 1024; - my @result; - my @errors; - my $result_buf; - my $errors_buf; - my ($CHILDWRITE, $CHILDSTDOUT, $CHILDSTDERR) = map { gensym } 1..3; - my $pid = open3 ( - $CHILDWRITE, $CHILDSTDOUT, $CHILDSTDERR, "$cmd" - ); - my $sel = IO::Select->new(); - $sel->add($CHILDSTDOUT); - $sel->add($CHILDSTDERR); - while($sel->count()) { - foreach my $handle ($sel->can_read()) { - my $bytes_read = ''; - my $chunk_result = sysread($handle, $bytes_read, $BUFSIZE); - if ($handle == $CHILDSTDOUT) { - $result_buf .= $bytes_read; - } else { - $errors_buf .= $bytes_read; - } - if ($chunk_result == 0) { - $sel->remove($handle); - next; - } - } - } - if ($result_buf) { - @result = split (/\n/x,$result_buf); - chomp @result; - } - if ($errors_buf) { - @errors = split (/\n/x,$errors_buf); - chomp @errors; - } - waitpid( $pid, 0 ); - my $status = $? >> 8; - return [$status,\@result,\@errors]; + my $this = shift; + my $cmd = shift; + my $BUFSIZE = 1024; + my @result; + my @errors; + my $result_buf; + my $errors_buf; + my ($CHILDWRITE, $CHILDSTDOUT, $CHILDSTDERR) = map { gensym } 1..3; + my $pid = open3 ( + $CHILDWRITE, $CHILDSTDOUT, $CHILDSTDERR, "$cmd" + ); + my $sel = IO::Select->new(); + $sel->add($CHILDSTDOUT); + $sel->add($CHILDSTDERR); + while($sel->count()) { + foreach my $handle ($sel->can_read()) { + my $bytes_read = ''; + my $chunk_result = sysread($handle, $bytes_read, $BUFSIZE); + if ($handle == $CHILDSTDOUT) { + $result_buf .= $bytes_read; + } else { + $errors_buf .= $bytes_read; + } + if ($chunk_result == 0) { + $sel->remove($handle); + next; + } + } + } + if ($result_buf) { + @result = split (/\n/x,$result_buf); + chomp @result; + } + if ($errors_buf) { + @errors = split (/\n/x,$errors_buf); + chomp @errors; + } + waitpid( $pid, 0 ); + my $status = $? >> 8; + return [$status,\@result,\@errors]; } sub getSubdirLists { - # ... - # method to distinguish debugmedia and ftp media subdirectories. - # --- - my $this = shift; - if (! ref($this)) { - return; - } - my @ret = (); - my $coll = $this->{m_collect}; - my $dbm = $coll->productData()->getOpt("DEBUGMEDIUM"); - my $flavor = $coll->productData()->getVar("FLAVOR"); - my $basesubdirs = $coll->basesubdirs(); - my @paths = values(%{$basesubdirs}); - @paths = grep { $_ =~ /[^0]$/x } @paths; # remove Media0 - my %path = map { $_ => 1 } @paths; - if($flavor =~ m{ftp}i) { - # 1: FTP tree, all subdirs get a separate call. - my @d = sort(keys(%path)); - foreach(@d) { - my @tmp; - push @tmp, $_; - push @ret, \@tmp; - } - } elsif($dbm >= 2) { - # 2: non-ftp tree, may have separate DEBUGMEDIUM specified - my @deb; - my @rest; - foreach my $d(keys(%path)) { - if ($d =~ m{.*$dbm$}x) { - push @deb, $d; - } else { - push @rest, $d; - } - } - push @ret, \@deb; - push @ret, \@rest; - } else { - my @d = keys(%path); - push @ret, \@d; - } - return @ret; + # ... + # method to distinguish debugmedia and ftp media subdirectories. + # --- + my $this = shift; + if (! ref($this)) { + return; + } + my @ret = (); + my $coll = $this->{m_collect}; + my $dbm = $coll->productData()->getOpt("DEBUGMEDIUM"); + my $flavor = $coll->productData()->getVar("FLAVOR"); + my $basesubdirs = $coll->basesubdirs(); + my @paths = values(%{$basesubdirs}); + @paths = grep { $_ =~ /[^0]$/x } @paths; # remove Media0 + my %path = map { $_ => 1 } @paths; + if($flavor =~ m{ftp}i) { + # 1: FTP tree, all subdirs get a separate call. + my @d = sort(keys(%path)); + foreach(@d) { + my @tmp; + push @tmp, $_; + push @ret, \@tmp; + } + } elsif($dbm >= 2) { + # 2: non-ftp tree, may have separate DEBUGMEDIUM specified + my @deb; + my @rest; + foreach my $d(keys(%path)) { + if ($d =~ m{.*$dbm$}x) { + push @deb, $d; + } else { + push @rest, $d; + } + } + push @ret, \@deb; + push @ret, \@rest; + } else { + my @d = keys(%path); + push @ret, \@d; + } + return @ret; } 1; diff --git a/distribution/kiwi-instsource-plugins-SLE-11-SP2/KIWIContentPlugin.pm b/distribution/kiwi-instsource-plugins-SLE-11-SP2/KIWIContentPlugin.pm index d22b89a5a..3ff88aa5a 100644 --- a/distribution/kiwi-instsource-plugins-SLE-11-SP2/KIWIContentPlugin.pm +++ b/distribution/kiwi-instsource-plugins-SLE-11-SP2/KIWIContentPlugin.pm @@ -27,152 +27,152 @@ use Data::Dumper; use Config::IniFiles; sub new { - # ... - # Create a new KIWIContentPlugin object - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new ($handler); - bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if(not defined($configpath) or not defined($configfile)) { - $this->logMsg("E", "wrong parameters in plugin initialisation\n"); - return; - } - ## Gather all necessary information from the inifile: - #=== - # Issue: why duplicate code here? Why not put it into the base class? - # Answer: Each plugin may have different options. Some only need a - # target filename, whilst some others may need much more. I don't want - # to specify a complicated framework for the plugin, it shall just be - # a simple straightforward way to get information into the plugin. - # The idea is that the people who decide on the metadata write - # the plugin, and therefore damn well know what it needs and what not. - # I'm definitely not bothering PMs with Yet Another File Specification - #--- - ## plugin content: - #----------------- - #[base] - # name = KIWIEulaPlugin - # order = 3 - # defaultenable = 1 - # - #[target] - # targetfile = content - # targetdir = $PRODUCT_DIR - # media = (list of numbers XOR "all") - # - my $ini = Config::IniFiles -> new( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base', 'name'); # scalar value - my $order = $ini->val('base', 'order'); # scalar value - my $enable = $ini->val('base', 'defaultenable'); # scalar value - my $target = $ini->val('target', 'targetfile'); - my $targetdir = $ini->val('target', 'targetdir'); - my @media = $ini->val('target', 'media'); - # if any of those isn't set, complain! - if(not defined($name) - or not defined($order) - or not defined($enable) - or not defined($target) - or not defined($targetdir) - or not @media - ) { - $this->logMsg("E", "Plugin ini file <$config> seems broken!"); - return; - } - $this->name($name); - $this->order($order); - $targetdir = $this->collect()->productData()->_substitute("$targetdir"); - if($enable != 0) { - $this->ready(1); - } - $this->requiredDirs($targetdir); - $this->{m_target} = $target; - $this->{m_targetdir} = $targetdir; - @{$this->{m_media}} = @media; - return $this; + # ... + # Create a new KIWIContentPlugin object + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new ($handler); + bless ($this, $class); + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if(not defined($configpath) or not defined($configfile)) { + $this->logMsg("E", "wrong parameters in plugin initialisation\n"); + return; + } + ## Gather all necessary information from the inifile: + #=== + # Issue: why duplicate code here? Why not put it into the base class? + # Answer: Each plugin may have different options. Some only need a + # target filename, whilst some others may need much more. I don't want + # to specify a complicated framework for the plugin, it shall just be + # a simple straightforward way to get information into the plugin. + # The idea is that the people who decide on the metadata write + # the plugin, and therefore damn well know what it needs and what not. + # I'm definitely not bothering PMs with Yet Another File Specification + #--- + ## plugin content: + #----------------- + #[base] + # name = KIWIEulaPlugin + # order = 3 + # defaultenable = 1 + # + #[target] + # targetfile = content + # targetdir = $PRODUCT_DIR + # media = (list of numbers XOR "all") + # + my $ini = Config::IniFiles -> new( + -file => "$configpath/$configfile" + ); + my $name = $ini->val('base', 'name'); # scalar value + my $order = $ini->val('base', 'order'); # scalar value + my $enable = $ini->val('base', 'defaultenable'); # scalar value + my $target = $ini->val('target', 'targetfile'); + my $targetdir = $ini->val('target', 'targetdir'); + my @media = $ini->val('target', 'media'); + # if any of those isn't set, complain! + if(not defined($name) + or not defined($order) + or not defined($enable) + or not defined($target) + or not defined($targetdir) + or not @media + ) { + $this->logMsg("E", "Plugin ini file <$config> seems broken!"); + return; + } + $this->name($name); + $this->order($order); + $targetdir = $this->collect()->productData()->_substitute("$targetdir"); + if($enable != 0) { + $this->ready(1); + } + $this->requiredDirs($targetdir); + $this->{m_target} = $target; + $this->{m_targetdir} = $targetdir; + @{$this->{m_media}} = @media; + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - my $retval = 0; - if($this->{m_ready} == 0) { - return $retval; - } - my $descrdir = $this->collect()->productData()->getInfo("DESCRDIR"); - if ((! $descrdir) || ($descrdir eq "/")) { - $this->logMsg("I", - "Empty or (/) descrdir, skipping content file creation" - ); - return $retval; - } - my @targetmedia = $this->collect()->getMediaNumbers(); - my %targets; - if($this->{m_media}->[0] =~ m{all}i) { - %targets = map { $_ => 1 } @targetmedia; - } else { - foreach my $cd(@{$this->{m_media}}) { - if(grep { $cd } @targetmedia) { - $targets{$cd} = 1; - } + my $this = shift; + if(not ref($this)) { + return; } - } - my $info = $this->collect()->productData()->getSet("prodinfo"); - if(!$info) { - $this->logMsg("E", "data set named seems to be broken:"); - $this->logMsg("E", Dumper($info)); - return $retval; - } - foreach my $cd(keys(%targets)) { - $this->logMsg("I", "Creating content file on medium <$cd>:"); - my $dir = $this->collect()->basesubdirs()->{$cd}; - my $contentfile = "$dir/$this->{m_target}"; - my $CONT = FileHandle -> new(); - if (! $CONT -> open(">$contentfile")) { - $this->logMsg("E", "Cannot create <$contentfile> on medium <$cd>"); - next; + my $retval = 0; + if($this->{m_ready} == 0) { + return $retval; + } + my $descrdir = $this->collect()->productData()->getInfo("DESCRDIR"); + if ((! $descrdir) || ($descrdir eq "/")) { + $this->logMsg("I", + "Empty or (/) descrdir, skipping content file creation" + ); + return $retval; } - # compute maxlen: - my $len = 0; - foreach(keys(%{$info})) { - my $l = length($info->{$_}->[0]); - $len = ($l>$len)?$l:$len; + my @targetmedia = $this->collect()->getMediaNumbers(); + my %targets; + if($this->{m_media}->[0] =~ m{all}i) { + %targets = map { $_ => 1 } @targetmedia; + } else { + foreach my $cd(@{$this->{m_media}}) { + if(grep { $cd } @targetmedia) { + $targets{$cd} = 1; + } + } } - $len++; - # ftp media special mode ? - my $coll = $this->{m_collect}; - my $flavor = $coll->productData()->getVar("FLAVOR"); - my $ftpmode = ($flavor =~ m{ftp}i); + my $info = $this->collect()->productData()->getSet("prodinfo"); + if(!$info) { + $this->logMsg("E", "data set named seems to be broken:"); + $this->logMsg("E", Dumper($info)); + return $retval; + } + foreach my $cd(keys(%targets)) { + $this->logMsg("I", "Creating content file on medium <$cd>:"); + my $dir = $this->collect()->basesubdirs()->{$cd}; + my $contentfile = "$dir/$this->{m_target}"; + my $CONT = FileHandle -> new(); + if (! $CONT -> open(">$contentfile")) { + $this->logMsg("E", "Cannot create <$contentfile> on medium <$cd>"); + next; + } + # compute maxlen: + my $len = 0; + foreach(keys(%{$info})) { + my $l = length($info->{$_}->[0]); + $len = ($l>$len)?$l:$len; + } + $len++; + # ftp media special mode ? + my $coll = $this->{m_collect}; + my $flavor = $coll->productData()->getVar("FLAVOR"); + my $ftpmode = ($flavor =~ m{ftp}i); - my %ftpcontentkeys = map {$_ => 1} qw{ - CONTENTSTYLE REPOID DESCRDIR DATADIR VENDOR - }; - foreach my $i(sort { $a <=> $b } keys(%{$info})) { - # ftp medias beside first one should get provide the product - if ( !$ftpmode || $cd eq "1" || $ftpcontentkeys{$info->{$i}->[0]}) { - print $CONT sprintf( - '%-*s %s', $len, $info->{$i}->[0], $info->{$i}->[1] - )."\n"; - } + my %ftpcontentkeys = map {$_ => 1} qw{ + CONTENTSTYLE REPOID DESCRDIR DATADIR VENDOR + }; + foreach my $i(sort { $a <=> $b } keys(%{$info})) { + # ftp medias beside first one should get provide the product + if ( !$ftpmode || $cd eq "1" || $ftpcontentkeys{$info->{$i}->[0]}) { + print $CONT sprintf( + '%-*s %s', $len, $info->{$i}->[0], $info->{$i}->[1] + )."\n"; + } + } + $CONT -> close(); + $this->logMsg( + "I", "Wrote file <$contentfile> for medium <$cd> successfully." + ); + $retval++; } - $CONT -> close(); - $this->logMsg( - "I", "Wrote file <$contentfile> for medium <$cd> successfully." - ); - $retval++; - } - return $retval; + return $retval; } 1; diff --git a/distribution/kiwi-instsource-plugins-SLE-11-SP2/KIWIDescrPlugin.pm b/distribution/kiwi-instsource-plugins-SLE-11-SP2/KIWIDescrPlugin.pm index 7d389a799..5ebbf773b 100644 --- a/distribution/kiwi-instsource-plugins-SLE-11-SP2/KIWIDescrPlugin.pm +++ b/distribution/kiwi-instsource-plugins-SLE-11-SP2/KIWIDescrPlugin.pm @@ -28,207 +28,207 @@ use Data::Dumper; use Cwd 'abs_path'; sub new { - # ... - # Create a new KIWIDescrPlugin object - # creates patterns file - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new($handler); - bless ($this, $class); + # ... + # Create a new KIWIDescrPlugin object + # creates patterns file + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new($handler); + bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if((! $configpath) || (! $configfile)) { - $this->logMsg("E", - "wrong parameters in plugin initialisation" - ); - return; - } - my $ini = Config::IniFiles -> new( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base' , 'name'); - my $order = $ini->val('base' , 'order'); - my $tool = $ini->val('base' , 'tool'); - my $createrepo = $ini->val('base' , 'createrepo'); - my $rezip = $ini->val('base' , 'rezip'); - my $tdir = $ini->val('base' , 'tooldir'); - my $tpack = $ini->val('base' , 'toolpack'); - my $enable = $ini->val('base' , 'defaultenable'); - my $pdbfiles = $ini->val('options', 'pdbfiles'); - my @params = $ini->val('options', 'parameter'); - my @langs = $ini->val('options', 'language'); - my $gzip = $ini->val('target' , 'compress'); - # if any of those isn't set, complain! - if(not defined($name) - or not defined($order) - or not defined($tool) - or not defined($createrepo) - or not defined($rezip) - or not defined($tdir) - or not defined($tpack) - or not defined($enable) - or not defined($pdbfiles) - or not defined($gzip) - or not (@params) - ) { - $this->logMsg("E", - "Plugin ini file <$config> seems broken!" - ); - return; - } - # sanity check for tools' existence: - if(not( -f "$tdir/$tool" and -x "$tdir/$tool")) { - $this->logMsg("E", - "Plugin <$name>: tool <$tdir/$tool> is not executable!" - ); - $this->logMsg("I", - "Check if package <$tpack> is installed." + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if((! $configpath) || (! $configfile)) { + $this->logMsg("E", + "wrong parameters in plugin initialisation" + ); + return; + } + my $ini = Config::IniFiles -> new( + -file => "$configpath/$configfile" ); - return; - } - my $params = ""; - foreach my $p(@params) { - $p = $this->collect()->productData()->_substitute("$p"); - $params .= "$p "; - } - # add local kwd files as argument - my $extrafile = abs_path($this->collect()->{m_xml}->{xmlOrigFile}); - $extrafile =~ s/.kiwi$/.kwd/x; - if (-f $extrafile) { - $this->logMsg("W", "Found extra tags file $extrafile."); - $params .= "-T $extrafile "; - } - $this->name($name); - $this->order($order); - $this->{m_tool} = $tool; - $this->{m_tooldir} = $tdir; - $this->{m_toolpack} = $tpack; - $this->{m_pdbfiles} = $pdbfiles; - $this->{m_createrepo} = $createrepo; - $this->{m_rezip} = $rezip; - $this->{m_params} = $params; - $this->{m_languages} = join(' ', @langs); - $this->{m_compress} = $gzip; - if($enable != 0) { - $this->ready(1); - } - return $this; + my $name = $ini->val('base' , 'name'); + my $order = $ini->val('base' , 'order'); + my $tool = $ini->val('base' , 'tool'); + my $createrepo = $ini->val('base' , 'createrepo'); + my $rezip = $ini->val('base' , 'rezip'); + my $tdir = $ini->val('base' , 'tooldir'); + my $tpack = $ini->val('base' , 'toolpack'); + my $enable = $ini->val('base' , 'defaultenable'); + my $pdbfiles = $ini->val('options', 'pdbfiles'); + my @params = $ini->val('options', 'parameter'); + my @langs = $ini->val('options', 'language'); + my $gzip = $ini->val('target' , 'compress'); + # if any of those isn't set, complain! + if(not defined($name) + or not defined($order) + or not defined($tool) + or not defined($createrepo) + or not defined($rezip) + or not defined($tdir) + or not defined($tpack) + or not defined($enable) + or not defined($pdbfiles) + or not defined($gzip) + or not (@params) + ) { + $this->logMsg("E", + "Plugin ini file <$config> seems broken!" + ); + return; + } + # sanity check for tools' existence: + if(not( -f "$tdir/$tool" and -x "$tdir/$tool")) { + $this->logMsg("E", + "Plugin <$name>: tool <$tdir/$tool> is not executable!" + ); + $this->logMsg("I", + "Check if package <$tpack> is installed." + ); + return; + } + my $params = ""; + foreach my $p(@params) { + $p = $this->collect()->productData()->_substitute("$p"); + $params .= "$p "; + } + # add local kwd files as argument + my $extrafile = abs_path($this->collect()->{m_xml}->{xmlOrigFile}); + $extrafile =~ s/.kiwi$/.kwd/x; + if (-f $extrafile) { + $this->logMsg("W", "Found extra tags file $extrafile."); + $params .= "-T $extrafile "; + } + $this->name($name); + $this->order($order); + $this->{m_tool} = $tool; + $this->{m_tooldir} = $tdir; + $this->{m_toolpack} = $tpack; + $this->{m_pdbfiles} = $pdbfiles; + $this->{m_createrepo} = $createrepo; + $this->{m_rezip} = $rezip; + $this->{m_params} = $params; + $this->{m_languages} = join(' ', @langs); + $this->{m_compress} = $gzip; + if($enable != 0) { + $this->ready(1); + } + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - my $retval = 0; - # sanity check: - if($this->{m_ready} == 0) { - return $retval; - } - my $coll = $this->{m_collect}; - my $basesubdirs = $coll->basesubdirs(); - if(not defined($basesubdirs)) { - ## prevent crash when dereferencing - $this->logMsg("E", - " is undefined! Skipping <$this->name()>" - ); + my $this = shift; + if(not ref($this)) { + return; + } + my $retval = 0; + # sanity check: + if($this->{m_ready} == 0) { + return $retval; + } + my $coll = $this->{m_collect}; + my $basesubdirs = $coll->basesubdirs(); + if(not defined($basesubdirs)) { + ## prevent crash when dereferencing + $this->logMsg("E", + " is undefined! Skipping <$this->name()>" + ); + return $retval; + } + foreach my $dirlist($this->getSubdirLists()) { + my ($s,$m) = $this->executeDir(sort @{$dirlist}); + } return $retval; - } - foreach my $dirlist($this->getSubdirLists()) { - my ($s,$m) = $this->executeDir(sort @{$dirlist}); - } - return $retval; } sub executeDir { - my @params = @_; - my $this = shift @params; - my @paths = @params; - my $retval = 0; - my $status; - my $call; - if(!@paths) { - $this->logMsg("W", "Empty path list!"); - return $retval; - } - my $coll = $this->{m_collect}; - my $datadir = $coll->productData()->getInfo("DATADIR"); - my $descrdir = $coll->productData()->getInfo("DESCRDIR"); - my $createrepomd = $coll->productData()->getVar("CREATE_REPOMD"); - my $targetdir = $paths[0]."/".$descrdir; - ## this bits creates a parameter string from a list of directories: - # param = -d -d ... - # the order is important. Idea: use map to make hash => -d - # for all subdirs not ending with "0" (those are for metafile - # unpacking only). The result is evaluated in list context be reverse, - # so there's a list looking like " -d ... -d" which is - # reversed again, making the result '-d', '', ..., '-d', ''", - # after the join as string. - # ---- - my $pathlist = "-d ".join(' -d ', map{$_."/".$datadir}(@paths)); - $this->logMsg("I", - "Calling ".$this->name()." for directories <@paths>:" - ); - my $cmd = "$this->{m_tooldir}/$this->{m_tool} " - . "$this->{m_pdbfiles} $pathlist $this->{m_params} " - . "$this->{m_languages} -o " - . $paths[0] - . "/".$descrdir; - $this->logMsg("I", "Executing command <$cmd>"); - $call = $this -> callCmd($cmd); - $status = $call->[0]; - if($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called <$cmd> exit status: <$status> output: $out" - ); - return $retval; - } - if ( $createrepomd eq "true" ) { - foreach my $p (@paths) { - my $cmd_repo = "$this->{m_createrepo} $p/$datadir "; - $this->logMsg("I", "Executing command <$cmd_repo>"); - $call = $this -> callCmd($cmd_repo); - $status = $call->[0]; - if ($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called <$cmd_repo> exit status: <$status> output: $out" - ); + my @params = @_; + my $this = shift @params; + my @paths = @params; + my $retval = 0; + my $status; + my $call; + if(!@paths) { + $this->logMsg("W", "Empty path list!"); return $retval; - } - my $cmd_zipp = "$this->{m_rezip} $p/$datadir "; - $this->logMsg("I", "Executing command <$cmd_zipp>"); - $call = $this -> callCmd($cmd_zipp); - $status = $call->[0]; - if($status) { + } + my $coll = $this->{m_collect}; + my $datadir = $coll->productData()->getInfo("DATADIR"); + my $descrdir = $coll->productData()->getInfo("DESCRDIR"); + my $createrepomd = $coll->productData()->getVar("CREATE_REPOMD"); + my $targetdir = $paths[0]."/".$descrdir; + ## this bits creates a parameter string from a list of directories: + # param = -d -d ... + # the order is important. Idea: use map to make hash => -d + # for all subdirs not ending with "0" (those are for metafile + # unpacking only). The result is evaluated in list context be reverse, + # so there's a list looking like " -d ... -d" which is + # reversed again, making the result '-d', '', ..., '-d', ''", + # after the join as string. + # ---- + my $pathlist = "-d ".join(' -d ', map{$_."/".$datadir}(@paths)); + $this->logMsg("I", + "Calling ".$this->name()." for directories <@paths>:" + ); + my $cmd = "$this->{m_tooldir}/$this->{m_tool} " + . "$this->{m_pdbfiles} $pathlist $this->{m_params} " + . "$this->{m_languages} -o " + . $paths[0] + . "/".$descrdir; + $this->logMsg("I", "Executing command <$cmd>"); + $call = $this -> callCmd($cmd); + $status = $call->[0]; + if($status) { my $out = join("\n",@{$call->[1]}); $this->logMsg("E", - "Called <$cmd_zipp> exit status: <$status> output: $out" + "Called <$cmd> exit status: <$status> output: $out" ); return $retval; - } } - } - if($this->{m_compress} =~ m{yes}i) { - foreach my $pfile(glob("$targetdir/packages*")) { - if(system("gzip", "--rsyncable", "$pfile") == 0) { - unlink "$targetdir/$pfile"; - } else { - $this->logMsg("W", - "Can't compress file <$targetdir/$pfile>!" - ); - } + if ( $createrepomd eq "true" ) { + foreach my $p (@paths) { + my $cmd_repo = "$this->{m_createrepo} $p/$datadir "; + $this->logMsg("I", "Executing command <$cmd_repo>"); + $call = $this -> callCmd($cmd_repo); + $status = $call->[0]; + if ($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called <$cmd_repo> exit status: <$status> output: $out" + ); + return $retval; + } + my $cmd_zipp = "$this->{m_rezip} $p/$datadir "; + $this->logMsg("I", "Executing command <$cmd_zipp>"); + $call = $this -> callCmd($cmd_zipp); + $status = $call->[0]; + if($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called <$cmd_zipp> exit status: <$status> output: $out" + ); + return $retval; + } + } + } + if($this->{m_compress} =~ m{yes}i) { + foreach my $pfile(glob("$targetdir/packages*")) { + if(system("gzip", "--rsyncable", "$pfile") == 0) { + unlink "$targetdir/$pfile"; + } else { + $this->logMsg("W", + "Can't compress file <$targetdir/$pfile>!" + ); + } + } } - } - return 1; + return 1; } 1; diff --git a/distribution/kiwi-instsource-plugins-SLE-11-SP2/KIWIEulaPlugin.pm b/distribution/kiwi-instsource-plugins-SLE-11-SP2/KIWIEulaPlugin.pm index 5a4d14e7c..01c5b31b9 100644 --- a/distribution/kiwi-instsource-plugins-SLE-11-SP2/KIWIEulaPlugin.pm +++ b/distribution/kiwi-instsource-plugins-SLE-11-SP2/KIWIEulaPlugin.pm @@ -26,146 +26,146 @@ use Config::IniFiles; use FileHandle; sub new { - # ... - # Create a new KIWIEulaPlugin object - # creates patterns file - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new($handler); - bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if ((! $configpath) || (! $configfile)) { - $this->logMsg("E", - "wrong parameters in plugin initialisation\n" + # ... + # Create a new KIWIEulaPlugin object + # creates patterns file + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new($handler); + bless ($this, $class); + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if ((! $configpath) || (! $configfile)) { + $this->logMsg("E", + "wrong parameters in plugin initialisation\n" + ); + return; + } + ## plugin content: + #----------------- + #[base] + # name = KIWIEulaPlugin + # order = 3 + # src = packages.en[.gz] + # srcdir = $DESCRDIR + # tool = packages2eula.pl + # tooldir = /usr/bin + # toolpack = inst-source-utils + # defaultenable = 1 + # + #[target] + # targetfile = EULA.txt + # targetdir = $PRODUCT_DIR + # + my $ini = Config::IniFiles -> new( + -file => "$configpath/$configfile" ); - return; - } - ## plugin content: - #----------------- - #[base] - # name = KIWIEulaPlugin - # order = 3 - # src = packages.en[.gz] - # srcdir = $DESCRDIR - # tool = packages2eula.pl - # tooldir = /usr/bin - # toolpack = inst-source-utils - # defaultenable = 1 - # - #[target] - # targetfile = EULA.txt - # targetdir = $PRODUCT_DIR - # - my $ini = Config::IniFiles -> new( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base', 'name'); - my $order = $ini->val('base', 'order'); - my $tool = $ini->val('base', 'tool'); - my $tooldir = $ini->val('base', 'tooldir'); - my $toolpack = $ini->val('base', 'toolpack'); - my $enable = $ini->val('base', 'defaultenable'); - my $src = $ini->val('base', 'sourcefile'); - my $srcdir = $ini->val('base', 'sourcedir'); - my $iopt = $ini->val('option', 'in'); - my $oopt = $ini->val('option', 'out'); - my $popt = $ini->val('option', 'packfile'); - my $target = $ini->val('target', 'targetfile'); - my $targetdir= $ini->val('target', 'targetdir'); - # if any of those isn't set, complain! - if(not defined($name) - or not defined($order) - or not defined($tool) - or not defined($tooldir) - or not defined($toolpack) - or not defined($enable) - or not defined($target) - or not defined($targetdir) - or not defined($iopt) - or not defined($oopt) - or not defined($popt) - ) { - $this->logMsg("E", - "Plugin ini file <$config> seems broken!\n" - ); - return; - } - $this->name($name); - $this->order($order); - $targetdir = $this->collect() - ->productData()->_substitute("$targetdir"); - $srcdir = $this->collect() - ->productData()->_substitute("$srcdir"); - $this->{m_target} = $target; - if($enable != 0) { - $this->ready(1); - } - $this->{m_source} = $src; - $this->{m_srcdir} = $srcdir; - $this->{m_tool} = $tool; - $this->{m_toolpath} = $this->collect() - ->productData()->_substitute("$tooldir"); - $this->{m_toolpack} = $toolpack; - $this->{m_iopt} = $iopt; - $this->{m_oopt} = $oopt; - $this->{m_popt} = $popt; - $this->requiredDirs($srcdir, $targetdir); - return $this; + my $name = $ini->val('base', 'name'); + my $order = $ini->val('base', 'order'); + my $tool = $ini->val('base', 'tool'); + my $tooldir = $ini->val('base', 'tooldir'); + my $toolpack = $ini->val('base', 'toolpack'); + my $enable = $ini->val('base', 'defaultenable'); + my $src = $ini->val('base', 'sourcefile'); + my $srcdir = $ini->val('base', 'sourcedir'); + my $iopt = $ini->val('option', 'in'); + my $oopt = $ini->val('option', 'out'); + my $popt = $ini->val('option', 'packfile'); + my $target = $ini->val('target', 'targetfile'); + my $targetdir= $ini->val('target', 'targetdir'); + # if any of those isn't set, complain! + if(not defined($name) + or not defined($order) + or not defined($tool) + or not defined($tooldir) + or not defined($toolpack) + or not defined($enable) + or not defined($target) + or not defined($targetdir) + or not defined($iopt) + or not defined($oopt) + or not defined($popt) + ) { + $this->logMsg("E", + "Plugin ini file <$config> seems broken!\n" + ); + return; + } + $this->name($name); + $this->order($order); + $targetdir = $this->collect() + ->productData()->_substitute("$targetdir"); + $srcdir = $this->collect() + ->productData()->_substitute("$srcdir"); + $this->{m_target} = $target; + if($enable != 0) { + $this->ready(1); + } + $this->{m_source} = $src; + $this->{m_srcdir} = $srcdir; + $this->{m_tool} = $tool; + $this->{m_toolpath} = $this->collect() + ->productData()->_substitute("$tooldir"); + $this->{m_toolpack} = $toolpack; + $this->{m_iopt} = $iopt; + $this->{m_oopt} = $oopt; + $this->{m_popt} = $popt; + $this->requiredDirs($srcdir, $targetdir); + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - my $retval = 0; - if($this->{m_ready} == 0) { - return $retval; - } - my @dirlist = $this->getSubdirLists(); - return unless @dirlist && $dirlist[0] && - ref ($dirlist[0] eq "ARRAY") && $dirlist[0]->[0]; - my $dirname = $dirlist[0]->[0]; - my $srcdir = $dirname."/".$this->{m_requireddirs}->[0]; - my $targetdir = $dirname."/".$this->{m_requireddirs}->[1]; - my $SRCFILE = FileHandle -> new(); - if (! $SRCFILE -> open ("<$srcdir/$this->{m_source}")) { - $this->logMsg("E", - "PatternsPlugin: cannot read <$srcdir/".$this->{m_source}.">" - ); - $this->logMsg("I", "Skipping plugin <".$this->name().">"); + my $this = shift; + if(not ref($this)) { + return; + } + my $retval = 0; + if($this->{m_ready} == 0) { + return $retval; + } + my @dirlist = $this->getSubdirLists(); + return unless @dirlist && $dirlist[0] && + ref ($dirlist[0] eq "ARRAY") && $dirlist[0]->[0]; + my $dirname = $dirlist[0]->[0]; + my $srcdir = $dirname."/".$this->{m_requireddirs}->[0]; + my $targetdir = $dirname."/".$this->{m_requireddirs}->[1]; + my $SRCFILE = FileHandle -> new(); + if (! $SRCFILE -> open ("<$srcdir/$this->{m_source}")) { + $this->logMsg("E", + "PatternsPlugin: cannot read <$srcdir/".$this->{m_source}.">" + ); + $this->logMsg("I", "Skipping plugin <".$this->name().">"); + return $retval; + } + $SRCFILE -> close(); + my $cmd = "$this->{m_toolpath}/$this->{m_tool} " + . "$this->{m_iopt} $targetdir/$this->{m_target} " + . "$this->{m_popt} $srcdir/$this->{m_source} " + . "$this->{m_oopt} $targetdir/$this->{m_target}.new"; + my $call = $this -> callCmd($cmd); + my $status = $call->[0]; + my @data = @{$call->[1]}; + $this->logMsg("I", "output of command $this->{m_tool}:\n"); + foreach my $l(@data) { + $this->logMsg("I", "\t$l\n"); + } + if($status) { + $this->logMsg("I", + "command $this->{m_tool} exited with <$status>\n" + ); + } else { + $this->logMsg("I", + "command $this->{m_tool} exited successfully.\n" + ); + $retval = 1; + } return $retval; - } - $SRCFILE -> close(); - my $cmd = "$this->{m_toolpath}/$this->{m_tool} " - . "$this->{m_iopt} $targetdir/$this->{m_target} " - . "$this->{m_popt} $srcdir/$this->{m_source} " - . "$this->{m_oopt} $targetdir/$this->{m_target}.new"; - my $call = $this -> callCmd($cmd); - my $status = $call->[0]; - my @data = @{$call->[1]}; - $this->logMsg("I", "output of command $this->{m_tool}:\n"); - foreach my $l(@data) { - $this->logMsg("I", "\t$l\n"); - } - if($status) { - $this->logMsg("I", - "command $this->{m_tool} exited with <$status>\n" - ); - } else { - $this->logMsg("I", - "command $this->{m_tool} exited successfully.\n" - ); - $retval = 1; - } - return $retval; } 1; diff --git a/distribution/kiwi-instsource-plugins-SLE-11-SP2/KIWIMiniIsoPlugin.pm b/distribution/kiwi-instsource-plugins-SLE-11-SP2/KIWIMiniIsoPlugin.pm index 82d6de925..3bb4a6943 100644 --- a/distribution/kiwi-instsource-plugins-SLE-11-SP2/KIWIMiniIsoPlugin.pm +++ b/distribution/kiwi-instsource-plugins-SLE-11-SP2/KIWIMiniIsoPlugin.pm @@ -29,245 +29,245 @@ use FileHandle; use Carp; sub new { - # ... - # Create a new KIWIMiniIsoPlugin object - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new($handler); - bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if ((! $configpath) || (! $configfile)) { - $this->logMsg("E", - "wrong parameters in plugin initialisation\n" - ); - return; - } - ## plugin content: - #----------------- - #[base] - # name = KIWIEulaPlugin - # order = 3 - # defaultenable = 1 - # - #[target] - # targetfile = content - # targetdir = $PRODUCT_DIR - # media = (list of numbers XOR "all") - # - my $ini = Config::IniFiles -> new ( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base', 'name'); - my $order = $ini->val('base', 'order'); - my $enable = $ini->val('base', 'defaultenable'); - # if any of those isn't set, complain! - if (not defined($name) - or not defined($order) - or not defined($enable) - ) { - $this->logMsg("E", - "Plugin ini file <$config> seems broken!\n" + # ... + # Create a new KIWIMiniIsoPlugin object + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new($handler); + bless ($this, $class); + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if ((! $configpath) || (! $configfile)) { + $this->logMsg("E", + "wrong parameters in plugin initialisation\n" + ); + return; + } + ## plugin content: + #----------------- + #[base] + # name = KIWIEulaPlugin + # order = 3 + # defaultenable = 1 + # + #[target] + # targetfile = content + # targetdir = $PRODUCT_DIR + # media = (list of numbers XOR "all") + # + my $ini = Config::IniFiles -> new ( + -file => "$configpath/$configfile" ); - return; - } - $this->name($name); - $this->order($order); - if($enable != 0) { - $this->ready(1); - } - return $this; + my $name = $ini->val('base', 'name'); + my $order = $ini->val('base', 'order'); + my $enable = $ini->val('base', 'defaultenable'); + # if any of those isn't set, complain! + if (not defined($name) + or not defined($order) + or not defined($enable) + ) { + $this->logMsg("E", + "Plugin ini file <$config> seems broken!\n" + ); + return; + } + $this->name($name); + $this->order($order); + if($enable != 0) { + $this->ready(1); + } + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - my $retval = 0; - if($this->{m_ready} == 0) { - return $retval; - } - my $repoloc = $this->collect()->productData()->getOpt("REPO_LOCATION"); - my $ismini = $this->collect()->productData()->getVar("FLAVOR"); - if(not defined($ismini)) { - $this->logMsg("W", "FLAVOR not set?"); - return $retval; - } - if ($ismini !~ m{mini}i) { - $this->logMsg("I", - "Nothing to for for media type <$ismini>" + my $this = shift; + if(not ref($this)) { + return; + } + my $retval = 0; + if($this->{m_ready} == 0) { + return $retval; + } + my $repoloc = $this->collect()->productData()->getOpt("REPO_LOCATION"); + my $ismini = $this->collect()->productData()->getVar("FLAVOR"); + if(not defined($ismini)) { + $this->logMsg("W", "FLAVOR not set?"); + return $retval; + } + if ($ismini !~ m{mini}i) { + $this->logMsg("I", + "Nothing to for for media type <$ismini>" + ); + return $retval; + } + my ($srv, $path); + if (not defined($repoloc)) { + $this->logMsg("I", + " is unset, boot protocol will be set to 'slp'!" + ); + } else { + if ($repoloc =~ m{^http://([^/]+)/(.+)}x) { + ($srv, $path) = ($1, $2); + } + if(not defined($srv) or not defined($path)) { + $this->logMsg("W", + "Parsing repo-location=<$repoloc> failed!" + ); + return $retval; + } + } + my @gfxbootfiles; + find( + sub { find_cb($this, '.*/gfxboot\.cfg$', \@gfxbootfiles) }, + $this->handler()->collect()->basedir() ); - return $retval; - } - my ($srv, $path); - if (not defined($repoloc)) { - $this->logMsg("I", - " is unset, boot protocol will be set to 'slp'!" + my @rootfiles; + find( + sub { find_cb($this, '.*/root$', \@rootfiles) }, + $this->handler()->collect()->basedir() ); - } else { - if ($repoloc =~ m{^http://([^/]+)/(.+)}x) { - ($srv, $path) = ($1, $2); + foreach(@rootfiles) { + $this->logMsg("I", "removing file <$_>"); + unlink $_; } - if(not defined($srv) or not defined($path)) { - $this->logMsg("W", - "Parsing repo-location=<$repoloc> failed!" - ); - return $retval; + if (!@gfxbootfiles) { + my $msg = "No gfxboot.cfg file found! " + . "This _MIGHT_ be ok for S/390. " + . "Please verify package(s)"; + $this->logMsg("W", $msg); + return $retval; } - } - my @gfxbootfiles; - find( - sub { find_cb($this, '.*/gfxboot\.cfg$', \@gfxbootfiles) }, - $this->handler()->collect()->basedir() - ); - my @rootfiles; - find( - sub { find_cb($this, '.*/root$', \@rootfiles) }, - $this->handler()->collect()->basedir() - ); - foreach(@rootfiles) { - $this->logMsg("I", "removing file <$_>"); - unlink $_; - } - if (!@gfxbootfiles) { - my $msg = "No gfxboot.cfg file found! " - . "This _MIGHT_ be ok for S/390. " - . "Please verify package(s)"; - $this->logMsg("W", $msg); + $this -> updateEFIGrubConfig($repoloc); + $retval = $this -> updateGraphicsBootConfig ( + \@gfxbootfiles, $repoloc, $srv, $path + ); return $retval; - } - $this -> updateEFIGrubConfig($repoloc); - $retval = $this -> updateGraphicsBootConfig ( - \@gfxbootfiles, $repoloc, $srv, $path - ); - return $retval; } sub updateGraphicsBootConfig { - my $this = shift; - my $gfxbootfiles = shift; - my $repoloc = shift; - my $srv = shift; - my $path = shift; - my $retval = 0; - foreach my $cfg(@{$gfxbootfiles}) { - $this->logMsg("I", "Processing file <$cfg>: "); - my $F = FileHandle -> new(); - if (! $F -> open($cfg)) { - $this->logMsg("E", "Cant open file <$cfg>!"); - next; + my $this = shift; + my $gfxbootfiles = shift; + my $repoloc = shift; + my $srv = shift; + my $path = shift; + my $retval = 0; + foreach my $cfg(@{$gfxbootfiles}) { + $this->logMsg("I", "Processing file <$cfg>: "); + my $F = FileHandle -> new(); + if (! $F -> open($cfg)) { + $this->logMsg("E", "Cant open file <$cfg>!"); + next; + } + my @lines = <$F>; + $F -> close(); + chomp(@lines); + my $install = -1; + my $ihs = -1; + my $ihp = -1; + my $i = -1; + foreach my $line(@lines) { + $i++; + next if $line !~ m{^install}x; + if($line =~ m{^install=.*}x) { + $install = $i; + } + if ($line =~ m{^install.http.server=+}x) { + $ihs = $i; + } + if($line =~ m{^install.http.path=+}x) { + $ihp = $i; + } + } + if(!$repoloc) { + if($install == -1) { + push @lines, "install=slp"; + } else { + $lines[$install] =~ s{^install.*}{install=slp}x; + } + } elsif($srv) { + if($ihs == -1) { + push @lines, "install.http.server=$srv"; + } else { + $lines[$ihs] =~ s{^(install.http.server).*}{$1=$srv}x; + } + if($ihp == -1) { + push @lines, "install.http.path=$path"; + } else { + $lines[$ihp] =~ s{^(install.http.path).*}{$1=$path}x; + } + if($install == -1) { + push @lines, "install=http"; + } else { + $lines[$install] =~ s{^install.*}{install=http}x; + } + } + unlink $cfg; + if (! $F -> open(">$cfg")) { + $this->logMsg("E", "Cant open file for writing <$cfg>!"); + next; + } + foreach(@lines) { + print $F "$_\n"; + } + $F -> close(); + $retval++; } - my @lines = <$F>; - $F -> close(); - chomp(@lines); - my $install = -1; - my $ihs = -1; - my $ihp = -1; - my $i = -1; - foreach my $line(@lines) { - $i++; - next if $line !~ m{^install}x; - if($line =~ m{^install=.*}x) { - $install = $i; - } - if ($line =~ m{^install.http.server=+}x) { - $ihs = $i; - } - if($line =~ m{^install.http.path=+}x) { - $ihp = $i; - } + return $retval; +} + +sub updateEFIGrubConfig { + my $this = shift; + my $repoloc = shift; + my $grubcfg = $this->collect() + ->basesubdirs()->{1} . "/EFI/BOOT/grub.cfg"; + if (! -f $grubcfg ) { + $this->logMsg("I", "no grub.cfg at <$grubcfg>"); + return; } - if(!$repoloc) { - if($install == -1) { - push @lines, "install=slp"; - } else { - $lines[$install] =~ s{^install.*}{install=slp}x; - } - } elsif($srv) { - if($ihs == -1) { - push @lines, "install.http.server=$srv"; - } else { - $lines[$ihs] =~ s{^(install.http.server).*}{$1=$srv}x; - } - if($ihp == -1) { - push @lines, "install.http.path=$path"; - } else { - $lines[$ihp] =~ s{^(install.http.path).*}{$1=$path}x; - } - if($install == -1) { - push @lines, "install=http"; - } else { - $lines[$install] =~ s{^install.*}{install=http}x; - } + $this->logMsg("I", "editing <$grubcfg>"); + my $IN = FileHandle -> new(); + my $OUT = FileHandle -> new(); + if (! $IN -> open($grubcfg)) { + croak "Cant open file for reading $grubcfg: $!"; } - unlink $cfg; - if (! $F -> open(">$cfg")) { - $this->logMsg("E", "Cant open file for writing <$cfg>!"); - next; + if (! $OUT -> open(">$grubcfg.new")) { + croak "Cant open file for writing $grubcfg.new: $!"; } - foreach(@lines) { - print $F "$_\n"; + while(<$IN>) { + my $line = $_; + chomp $line; + $this->logMsg("I", "-$line"); + $line =~ + s,(linuxefi /boot/x86_64/loader/linux),$1 install=$repoloc,x; + $this->logMsg("I", "+$line"); + print $OUT "$line\n"; } - $F -> close(); - $retval++; - } - return $retval; -} - -sub updateEFIGrubConfig { - my $this = shift; - my $repoloc = shift; - my $grubcfg = $this->collect() - ->basesubdirs()->{1} . "/EFI/BOOT/grub.cfg"; - if (! -f $grubcfg ) { - $this->logMsg("I", "no grub.cfg at <$grubcfg>"); - return; - } - $this->logMsg("I", "editing <$grubcfg>"); - my $IN = FileHandle -> new(); - my $OUT = FileHandle -> new(); - if (! $IN -> open($grubcfg)) { - croak "Cant open file for reading $grubcfg: $!"; - } - if (! $OUT -> open(">$grubcfg.new")) { - croak "Cant open file for writing $grubcfg.new: $!"; - } - while(<$IN>) { - my $line = $_; - chomp $line; - $this->logMsg("I", "-$line"); - $line =~ - s,(linuxefi /boot/x86_64/loader/linux),$1 install=$repoloc,x; - $this->logMsg("I", "+$line"); - print $OUT "$line\n"; - } - $OUT -> close(); - $IN -> close(); - $this -> callCmd("diff -u $grubcfg $grubcfg.new"); - rename("$grubcfg.new", $grubcfg); - return $this; + $OUT -> close(); + $IN -> close(); + $this -> callCmd("diff -u $grubcfg $grubcfg.new"); + rename("$grubcfg.new", $grubcfg); + return $this; } sub find_cb { - my $this = shift; - return if not ref($this); + my $this = shift; + return if not ref($this); - my $pat = shift; - my $listref = shift; - if(not defined($listref) or not defined($pat)) { - return; - } - if($File::Find::name =~ m{$pat}x) { - push @{$listref}, $File::Find::name; - } - return $this; + my $pat = shift; + my $listref = shift; + if(not defined($listref) or not defined($pat)) { + return; + } + if($File::Find::name =~ m{$pat}x) { + push @{$listref}, $File::Find::name; + } + return $this; } 1; diff --git a/distribution/kiwi-instsource-plugins-SLE-11-SP2/KIWIPatternsPlugin.pm b/distribution/kiwi-instsource-plugins-SLE-11-SP2/KIWIPatternsPlugin.pm index a4df6924a..01685ef14 100644 --- a/distribution/kiwi-instsource-plugins-SLE-11-SP2/KIWIPatternsPlugin.pm +++ b/distribution/kiwi-instsource-plugins-SLE-11-SP2/KIWIPatternsPlugin.pm @@ -25,135 +25,135 @@ use base "KIWIBasePlugin"; use Config::IniFiles; sub new { - # ... - # Create a new KIWIPatternsPlugin object - # creates patterns file - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new($handler); - bless ($this, $class); + # ... + # Create a new KIWIPatternsPlugin object + # creates patterns file + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new($handler); + bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if ((! $configpath) || (! $configfile)) { - $this->logMsg("E", - "wrong parameters in plugin initialisation\n" - ); - return; - } - ## plugin content: - #----------------- - #[base] - # name = KIWIPatternsPlugin - # dir = $DATADIR/setup/descr - # order = 1 - # tool = create_package_descr - # tooldir = /usr/bin - # toolpack = inst-source-utils - # defaultenabled = 1 - # media = 1 - # - #[target] - # targetfile = patterns - # compress = yes|no - # - my $ini = Config::IniFiles ->new( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base', 'name'); - my $order = $ini->val('base', 'order'); - my @dirs = $ini->val('base', 'dir'); - my $enable = $ini->val('base', 'defaultenable'); - my @media = $ini->val('base', 'media'); - my $target = $ini->val('target', 'targetfile'); - my $gzip = $ini->val('target', 'compress'); - # if any of those isn't set, complain! - if(not defined($name) - or not defined($order) - or not @dirs - or not defined($enable) - or not defined($target) - or not defined($gzip) - or not @media - ) { - $this->logMsg("E", - "Plugin ini file <$config> seems broken!\n" + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if ((! $configpath) || (! $configfile)) { + $this->logMsg("E", + "wrong parameters in plugin initialisation\n" + ); + return; + } + ## plugin content: + #----------------- + #[base] + # name = KIWIPatternsPlugin + # dir = $DATADIR/setup/descr + # order = 1 + # tool = create_package_descr + # tooldir = /usr/bin + # toolpack = inst-source-utils + # defaultenabled = 1 + # media = 1 + # + #[target] + # targetfile = patterns + # compress = yes|no + # + my $ini = Config::IniFiles ->new( + -file => "$configpath/$configfile" ); - return; - } - # parse dirs for productvars content: - for(my $i=0; $i <= $#dirs; $i++) { - $dirs[$i] = $this->collect() - ->productData()->_substitute("$dirs[$i]"); - } - $this->name($name); - $this->order($order); - $this->requiredDirs(@dirs); - $this->{m_media} = @media; - if($enable != 0) { - $this->ready(1); - } - $this->{m_compress} = $gzip; - $this->{m_target} = $target; - return $this; + my $name = $ini->val('base', 'name'); + my $order = $ini->val('base', 'order'); + my @dirs = $ini->val('base', 'dir'); + my $enable = $ini->val('base', 'defaultenable'); + my @media = $ini->val('base', 'media'); + my $target = $ini->val('target', 'targetfile'); + my $gzip = $ini->val('target', 'compress'); + # if any of those isn't set, complain! + if(not defined($name) + or not defined($order) + or not @dirs + or not defined($enable) + or not defined($target) + or not defined($gzip) + or not @media + ) { + $this->logMsg("E", + "Plugin ini file <$config> seems broken!\n" + ); + return; + } + # parse dirs for productvars content: + for(my $i=0; $i <= $#dirs; $i++) { + $dirs[$i] = $this->collect() + ->productData()->_substitute("$dirs[$i]"); + } + $this->name($name); + $this->order($order); + $this->requiredDirs(@dirs); + $this->{m_media} = @media; + if($enable != 0) { + $this->ready(1); + } + $this->{m_compress} = $gzip; + $this->{m_target} = $target; + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - if($this->{m_ready} == 0) { - return 0; - } - my $dirname = $this->{m_handler}->baseurl() - . "/" - . $this->{m_handler}->mediaName(); - my $mult = $this->collect() - ->productData()->getVar("MULTIPLE_MEDIA"); - if( $mult ne "no") { - $dirname .= $this->{m_media}; - } - $dirname .= "/".$this->{m_requireddirs}->[0]; - my $PATDIR; - if(!opendir($PATDIR, "$dirname")) { - $this->logMsg("E", - "PatternsPlugin: cannot read <$dirname>" - ); - $this->logMsg("I", - "Skipping plugin <".$this->name().">" - ); - return 0; - } - my $PAT = FileHandle -> new(); - if (! $PAT -> open(">$dirname/$this->{m_target}")) { - $this->logMsg("E", - "PatternsPlugin: cannot create <$dirname>/patterns!" - ); - $this->logMsg("I", - "Skipping plugin <".$this->name().">" - ); - return 0; - } - my @dirent = readdir($PATDIR); - foreach my $f(@dirent) { - next if $f !~ m{.*\.pat|.*\.pat\.gz}x; - if($f !~ m{.*\.gz$}x and $this->{m_compress} =~ m{yes}i) { - if (system('gzip', '--rsyncable', "$dirname/$f") == 0) { - $f = "$f.gz"; - } + my $this = shift; + if(not ref($this)) { + return; + } + if($this->{m_ready} == 0) { + return 0; + } + my $dirname = $this->{m_handler}->baseurl() + . "/" + . $this->{m_handler}->mediaName(); + my $mult = $this->collect() + ->productData()->getVar("MULTIPLE_MEDIA"); + if( $mult ne "no") { + $dirname .= $this->{m_media}; + } + $dirname .= "/".$this->{m_requireddirs}->[0]; + my $PATDIR; + if(!opendir($PATDIR, "$dirname")) { + $this->logMsg("E", + "PatternsPlugin: cannot read <$dirname>" + ); + $this->logMsg("I", + "Skipping plugin <".$this->name().">" + ); + return 0; + } + my $PAT = FileHandle -> new(); + if (! $PAT -> open(">$dirname/$this->{m_target}")) { + $this->logMsg("E", + "PatternsPlugin: cannot create <$dirname>/patterns!" + ); + $this->logMsg("I", + "Skipping plugin <".$this->name().">" + ); + return 0; + } + my @dirent = readdir($PATDIR); + foreach my $f(@dirent) { + next if $f !~ m{.*\.pat|.*\.pat\.gz}x; + if($f !~ m{.*\.gz$}x and $this->{m_compress} =~ m{yes}i) { + if (system('gzip', '--rsyncable', "$dirname/$f") == 0) { + $f = "$f.gz"; + } + } + print $PAT "$f\n"; } - print $PAT "$f\n"; - } - closedir($PATDIR); - $PAT -> close(); - return 1; + closedir($PATDIR); + $PAT -> close(); + return 1; } 1; diff --git a/distribution/kiwi-instsource-plugins-SLE-12/KIWIBasePlugin.pm b/distribution/kiwi-instsource-plugins-SLE-12/KIWIBasePlugin.pm index 370a7ecff..a980922a2 100644 --- a/distribution/kiwi-instsource-plugins-SLE-12/KIWIBasePlugin.pm +++ b/distribution/kiwi-instsource-plugins-SLE-12/KIWIBasePlugin.pm @@ -25,222 +25,222 @@ use IPC::Open3; use Symbol; sub new { - my $class = shift; - my $this = { - m_handler => undef, - m_name => "KIWIBasePlugin", - m_order => undef, - m_requireddirs=> [], - m_descr => [], - m_requires => [], - m_ready => 0, - m_collect => 0 - }; - bless ($this, $class); - $this->{m_handler} = shift; - if (! ref($this->{m_handler})) { - return; - } - $this->{m_collect} = $this->{m_handler}->collect(); - return $this; + my $class = shift; + my $this = { + m_handler => undef, + m_name => "KIWIBasePlugin", + m_order => undef, + m_requireddirs=> [], + m_descr => [], + m_requires => [], + m_ready => 0, + m_collect => 0 + }; + bless ($this, $class); + $this->{m_handler} = shift; + if (! ref($this->{m_handler})) { + return; + } + $this->{m_collect} = $this->{m_handler}->collect(); + return $this; } sub name { - my $this = shift; - my $name = shift; - if (! ref($this)) { - return; - } - my $oldname = $this->{m_name}; - if($name) { - $this->{m_name} = $name; - } - return $oldname; + my $this = shift; + my $name = shift; + if (! ref($this)) { + return; + } + my $oldname = $this->{m_name}; + if($name) { + $this->{m_name} = $name; + } + return $oldname; } sub order { - my $this = shift; - my $order = shift; - if (! ref($this)) { - return; - } - my $oldorder = $this->{m_order}; - if($order) { - $this->{m_order} = $order; - } - return $oldorder; + my $this = shift; + my $order = shift; + if (! ref($this)) { + return; + } + my $oldorder = $this->{m_order}; + if($order) { + $this->{m_order} = $order; + } + return $oldorder; } sub ready { - my $this = shift; - my $ready = shift; - if (! ref($this)) { - return; - } - my $oldready = $this->{m_ready}; - if($ready) { - $this->{m_ready} = $ready; - } - return $oldready; + my $this = shift; + my $ready = shift; + if (! ref($this)) { + return; + } + my $oldready = $this->{m_ready}; + if($ready) { + $this->{m_ready} = $ready; + } + return $oldready; } sub requiredDirs { - my @params = @_; - my $this = shift @params; - my @dirs = @params; - if (! ref($this)) { - return; - } - my @oldrd = @{$this->{m_requireddirs}}; - foreach my $entry(@params) { - push @{$this->{m_requireddirs}}, $entry; - } - return @oldrd; + my @params = @_; + my $this = shift @params; + my @dirs = @params; + if (! ref($this)) { + return; + } + my @oldrd = @{$this->{m_requireddirs}}; + foreach my $entry(@params) { + push @{$this->{m_requireddirs}}, $entry; + } + return @oldrd; } sub description { - my @params = @_; - my $this = shift @params; - my @descr= @params; - if (! ref($this)) { - return; - } - my @olddesc = $this->{m_descr}; - foreach my $entry(@descr) { - push @{$this->{m_descr}}, $entry; - } - return @olddesc; + my @params = @_; + my $this = shift @params; + my @descr= @params; + if (! ref($this)) { + return; + } + my @olddesc = $this->{m_descr}; + foreach my $entry(@descr) { + push @{$this->{m_descr}}, $entry; + } + return @olddesc; } sub requires { - my @params = @_; - my $this = shift; - my @reqs = @params; - if (! ref($this)) { - return; - } - my @oldreq = $this->{m_requires}; - foreach my $entry(@reqs) { - push @{$this->{m_requires}}, $entry; - } - return @oldreq; + my @params = @_; + my $this = shift; + my @reqs = @params; + if (! ref($this)) { + return; + } + my @oldreq = $this->{m_requires}; + foreach my $entry(@reqs) { + push @{$this->{m_requires}}, $entry; + } + return @oldreq; } sub handler { - my $this = shift; - if (! ref($this)) { - return; - } - return $this->{m_handler}; + my $this = shift; + if (! ref($this)) { + return; + } + return $this->{m_handler}; } sub collect { - my $this = shift; - if (! ref($this)) { - return; - } - return $this->{m_collect}; + my $this = shift; + if (! ref($this)) { + return; + } + return $this->{m_collect}; } sub logMsg { - my $this = shift; - if (! ref($this)) { - return; - } - my $type = shift; - my $msg = shift; - if ((! defined($type)) || (! defined($msg))) { - return; - } - $this->{m_collect}->logMsg($type, $msg); - return $this; + my $this = shift; + if (! ref($this)) { + return; + } + my $type = shift; + my $msg = shift; + if ((! defined($type)) || (! defined($msg))) { + return; + } + $this->{m_collect}->logMsg($type, $msg); + return $this; } sub callCmd { - my $this = shift; - my $cmd = shift; - my $BUFSIZE = 1024; - my @result; - my @errors; - my $result_buf; - my $errors_buf; - my ($CHILDWRITE, $CHILDSTDOUT, $CHILDSTDERR) = map { gensym } 1..3; - my $pid = open3 ( - $CHILDWRITE, $CHILDSTDOUT, $CHILDSTDERR, "$cmd" - ); - my $sel = IO::Select->new(); - $sel->add($CHILDSTDOUT); - $sel->add($CHILDSTDERR); - while($sel->count()) { - foreach my $handle ($sel->can_read()) { - my $bytes_read = ''; - my $chunk_result = sysread($handle, $bytes_read, $BUFSIZE); - if ($handle == $CHILDSTDOUT) { - $result_buf .= $bytes_read; - } else { - $errors_buf .= $bytes_read; - } - if ($chunk_result == 0) { - $sel->remove($handle); - next; - } - } - } - if ($result_buf) { - @result = split (/\n/x,$result_buf); - chomp @result; - } - if ($errors_buf) { - @errors = split (/\n/x,$errors_buf); - chomp @errors; - } - waitpid( $pid, 0 ); - my $status = $? >> 8; - return [$status,\@result,\@errors]; + my $this = shift; + my $cmd = shift; + my $BUFSIZE = 1024; + my @result; + my @errors; + my $result_buf; + my $errors_buf; + my ($CHILDWRITE, $CHILDSTDOUT, $CHILDSTDERR) = map { gensym } 1..3; + my $pid = open3 ( + $CHILDWRITE, $CHILDSTDOUT, $CHILDSTDERR, "$cmd" + ); + my $sel = IO::Select->new(); + $sel->add($CHILDSTDOUT); + $sel->add($CHILDSTDERR); + while($sel->count()) { + foreach my $handle ($sel->can_read()) { + my $bytes_read = ''; + my $chunk_result = sysread($handle, $bytes_read, $BUFSIZE); + if ($handle == $CHILDSTDOUT) { + $result_buf .= $bytes_read; + } else { + $errors_buf .= $bytes_read; + } + if ($chunk_result == 0) { + $sel->remove($handle); + next; + } + } + } + if ($result_buf) { + @result = split (/\n/x,$result_buf); + chomp @result; + } + if ($errors_buf) { + @errors = split (/\n/x,$errors_buf); + chomp @errors; + } + waitpid( $pid, 0 ); + my $status = $? >> 8; + return [$status,\@result,\@errors]; } sub getSubdirLists { - # ... - # method to distinguish debugmedia and ftp media subdirectories. - # --- - my $this = shift; - if (! ref($this)) { - return; - } - my @ret = (); - my $coll = $this->{m_collect}; - my $dbm = $coll->productData()->getOpt("DEBUGMEDIUM"); - my $flavor = $coll->productData()->getVar("FLAVOR"); - my $basesubdirs = $coll->basesubdirs(); - my @paths = values(%{$basesubdirs}); - @paths = grep { $_ =~ /[^0]$/x } @paths; # remove Media0 - my %path = map { $_ => 1 } @paths; - if($flavor =~ m{ftp}i) { - # 1: FTP tree, all subdirs get a separate call. - my @d = sort(keys(%path)); - foreach(@d) { - my @tmp; - push @tmp, $_; - push @ret, \@tmp; - } - } elsif($dbm >= 2) { - # 2: non-ftp tree, may have separate DEBUGMEDIUM specified - my @deb; - my @rest; - foreach my $d(keys(%path)) { - if ($d =~ m{.*$dbm$}x) { - push @deb, $d; - } else { - push @rest, $d; - } - } - push @ret, \@deb; - push @ret, \@rest; - } else { - my @d = keys(%path); - push @ret, \@d; - } - return @ret; + # ... + # method to distinguish debugmedia and ftp media subdirectories. + # --- + my $this = shift; + if (! ref($this)) { + return; + } + my @ret = (); + my $coll = $this->{m_collect}; + my $dbm = $coll->productData()->getOpt("DEBUGMEDIUM"); + my $flavor = $coll->productData()->getVar("FLAVOR"); + my $basesubdirs = $coll->basesubdirs(); + my @paths = values(%{$basesubdirs}); + @paths = grep { $_ =~ /[^0]$/x } @paths; # remove Media0 + my %path = map { $_ => 1 } @paths; + if($flavor =~ m{ftp}i) { + # 1: FTP tree, all subdirs get a separate call. + my @d = sort(keys(%path)); + foreach(@d) { + my @tmp; + push @tmp, $_; + push @ret, \@tmp; + } + } elsif($dbm >= 2) { + # 2: non-ftp tree, may have separate DEBUGMEDIUM specified + my @deb; + my @rest; + foreach my $d(keys(%path)) { + if ($d =~ m{.*$dbm$}x) { + push @deb, $d; + } else { + push @rest, $d; + } + } + push @ret, \@deb; + push @ret, \@rest; + } else { + my @d = keys(%path); + push @ret, \@d; + } + return @ret; } 1; diff --git a/distribution/kiwi-instsource-plugins-SLE-12/KIWIContentPlugin.pm b/distribution/kiwi-instsource-plugins-SLE-12/KIWIContentPlugin.pm index d22b89a5a..3ff88aa5a 100644 --- a/distribution/kiwi-instsource-plugins-SLE-12/KIWIContentPlugin.pm +++ b/distribution/kiwi-instsource-plugins-SLE-12/KIWIContentPlugin.pm @@ -27,152 +27,152 @@ use Data::Dumper; use Config::IniFiles; sub new { - # ... - # Create a new KIWIContentPlugin object - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new ($handler); - bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if(not defined($configpath) or not defined($configfile)) { - $this->logMsg("E", "wrong parameters in plugin initialisation\n"); - return; - } - ## Gather all necessary information from the inifile: - #=== - # Issue: why duplicate code here? Why not put it into the base class? - # Answer: Each plugin may have different options. Some only need a - # target filename, whilst some others may need much more. I don't want - # to specify a complicated framework for the plugin, it shall just be - # a simple straightforward way to get information into the plugin. - # The idea is that the people who decide on the metadata write - # the plugin, and therefore damn well know what it needs and what not. - # I'm definitely not bothering PMs with Yet Another File Specification - #--- - ## plugin content: - #----------------- - #[base] - # name = KIWIEulaPlugin - # order = 3 - # defaultenable = 1 - # - #[target] - # targetfile = content - # targetdir = $PRODUCT_DIR - # media = (list of numbers XOR "all") - # - my $ini = Config::IniFiles -> new( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base', 'name'); # scalar value - my $order = $ini->val('base', 'order'); # scalar value - my $enable = $ini->val('base', 'defaultenable'); # scalar value - my $target = $ini->val('target', 'targetfile'); - my $targetdir = $ini->val('target', 'targetdir'); - my @media = $ini->val('target', 'media'); - # if any of those isn't set, complain! - if(not defined($name) - or not defined($order) - or not defined($enable) - or not defined($target) - or not defined($targetdir) - or not @media - ) { - $this->logMsg("E", "Plugin ini file <$config> seems broken!"); - return; - } - $this->name($name); - $this->order($order); - $targetdir = $this->collect()->productData()->_substitute("$targetdir"); - if($enable != 0) { - $this->ready(1); - } - $this->requiredDirs($targetdir); - $this->{m_target} = $target; - $this->{m_targetdir} = $targetdir; - @{$this->{m_media}} = @media; - return $this; + # ... + # Create a new KIWIContentPlugin object + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new ($handler); + bless ($this, $class); + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if(not defined($configpath) or not defined($configfile)) { + $this->logMsg("E", "wrong parameters in plugin initialisation\n"); + return; + } + ## Gather all necessary information from the inifile: + #=== + # Issue: why duplicate code here? Why not put it into the base class? + # Answer: Each plugin may have different options. Some only need a + # target filename, whilst some others may need much more. I don't want + # to specify a complicated framework for the plugin, it shall just be + # a simple straightforward way to get information into the plugin. + # The idea is that the people who decide on the metadata write + # the plugin, and therefore damn well know what it needs and what not. + # I'm definitely not bothering PMs with Yet Another File Specification + #--- + ## plugin content: + #----------------- + #[base] + # name = KIWIEulaPlugin + # order = 3 + # defaultenable = 1 + # + #[target] + # targetfile = content + # targetdir = $PRODUCT_DIR + # media = (list of numbers XOR "all") + # + my $ini = Config::IniFiles -> new( + -file => "$configpath/$configfile" + ); + my $name = $ini->val('base', 'name'); # scalar value + my $order = $ini->val('base', 'order'); # scalar value + my $enable = $ini->val('base', 'defaultenable'); # scalar value + my $target = $ini->val('target', 'targetfile'); + my $targetdir = $ini->val('target', 'targetdir'); + my @media = $ini->val('target', 'media'); + # if any of those isn't set, complain! + if(not defined($name) + or not defined($order) + or not defined($enable) + or not defined($target) + or not defined($targetdir) + or not @media + ) { + $this->logMsg("E", "Plugin ini file <$config> seems broken!"); + return; + } + $this->name($name); + $this->order($order); + $targetdir = $this->collect()->productData()->_substitute("$targetdir"); + if($enable != 0) { + $this->ready(1); + } + $this->requiredDirs($targetdir); + $this->{m_target} = $target; + $this->{m_targetdir} = $targetdir; + @{$this->{m_media}} = @media; + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - my $retval = 0; - if($this->{m_ready} == 0) { - return $retval; - } - my $descrdir = $this->collect()->productData()->getInfo("DESCRDIR"); - if ((! $descrdir) || ($descrdir eq "/")) { - $this->logMsg("I", - "Empty or (/) descrdir, skipping content file creation" - ); - return $retval; - } - my @targetmedia = $this->collect()->getMediaNumbers(); - my %targets; - if($this->{m_media}->[0] =~ m{all}i) { - %targets = map { $_ => 1 } @targetmedia; - } else { - foreach my $cd(@{$this->{m_media}}) { - if(grep { $cd } @targetmedia) { - $targets{$cd} = 1; - } + my $this = shift; + if(not ref($this)) { + return; } - } - my $info = $this->collect()->productData()->getSet("prodinfo"); - if(!$info) { - $this->logMsg("E", "data set named seems to be broken:"); - $this->logMsg("E", Dumper($info)); - return $retval; - } - foreach my $cd(keys(%targets)) { - $this->logMsg("I", "Creating content file on medium <$cd>:"); - my $dir = $this->collect()->basesubdirs()->{$cd}; - my $contentfile = "$dir/$this->{m_target}"; - my $CONT = FileHandle -> new(); - if (! $CONT -> open(">$contentfile")) { - $this->logMsg("E", "Cannot create <$contentfile> on medium <$cd>"); - next; + my $retval = 0; + if($this->{m_ready} == 0) { + return $retval; + } + my $descrdir = $this->collect()->productData()->getInfo("DESCRDIR"); + if ((! $descrdir) || ($descrdir eq "/")) { + $this->logMsg("I", + "Empty or (/) descrdir, skipping content file creation" + ); + return $retval; } - # compute maxlen: - my $len = 0; - foreach(keys(%{$info})) { - my $l = length($info->{$_}->[0]); - $len = ($l>$len)?$l:$len; + my @targetmedia = $this->collect()->getMediaNumbers(); + my %targets; + if($this->{m_media}->[0] =~ m{all}i) { + %targets = map { $_ => 1 } @targetmedia; + } else { + foreach my $cd(@{$this->{m_media}}) { + if(grep { $cd } @targetmedia) { + $targets{$cd} = 1; + } + } } - $len++; - # ftp media special mode ? - my $coll = $this->{m_collect}; - my $flavor = $coll->productData()->getVar("FLAVOR"); - my $ftpmode = ($flavor =~ m{ftp}i); + my $info = $this->collect()->productData()->getSet("prodinfo"); + if(!$info) { + $this->logMsg("E", "data set named seems to be broken:"); + $this->logMsg("E", Dumper($info)); + return $retval; + } + foreach my $cd(keys(%targets)) { + $this->logMsg("I", "Creating content file on medium <$cd>:"); + my $dir = $this->collect()->basesubdirs()->{$cd}; + my $contentfile = "$dir/$this->{m_target}"; + my $CONT = FileHandle -> new(); + if (! $CONT -> open(">$contentfile")) { + $this->logMsg("E", "Cannot create <$contentfile> on medium <$cd>"); + next; + } + # compute maxlen: + my $len = 0; + foreach(keys(%{$info})) { + my $l = length($info->{$_}->[0]); + $len = ($l>$len)?$l:$len; + } + $len++; + # ftp media special mode ? + my $coll = $this->{m_collect}; + my $flavor = $coll->productData()->getVar("FLAVOR"); + my $ftpmode = ($flavor =~ m{ftp}i); - my %ftpcontentkeys = map {$_ => 1} qw{ - CONTENTSTYLE REPOID DESCRDIR DATADIR VENDOR - }; - foreach my $i(sort { $a <=> $b } keys(%{$info})) { - # ftp medias beside first one should get provide the product - if ( !$ftpmode || $cd eq "1" || $ftpcontentkeys{$info->{$i}->[0]}) { - print $CONT sprintf( - '%-*s %s', $len, $info->{$i}->[0], $info->{$i}->[1] - )."\n"; - } + my %ftpcontentkeys = map {$_ => 1} qw{ + CONTENTSTYLE REPOID DESCRDIR DATADIR VENDOR + }; + foreach my $i(sort { $a <=> $b } keys(%{$info})) { + # ftp medias beside first one should get provide the product + if ( !$ftpmode || $cd eq "1" || $ftpcontentkeys{$info->{$i}->[0]}) { + print $CONT sprintf( + '%-*s %s', $len, $info->{$i}->[0], $info->{$i}->[1] + )."\n"; + } + } + $CONT -> close(); + $this->logMsg( + "I", "Wrote file <$contentfile> for medium <$cd> successfully." + ); + $retval++; } - $CONT -> close(); - $this->logMsg( - "I", "Wrote file <$contentfile> for medium <$cd> successfully." - ); - $retval++; - } - return $retval; + return $retval; } 1; diff --git a/distribution/kiwi-instsource-plugins-SLE-12/KIWIDescrPlugin.pm b/distribution/kiwi-instsource-plugins-SLE-12/KIWIDescrPlugin.pm index ea7b7f64a..ee822c79b 100644 --- a/distribution/kiwi-instsource-plugins-SLE-12/KIWIDescrPlugin.pm +++ b/distribution/kiwi-instsource-plugins-SLE-12/KIWIDescrPlugin.pm @@ -28,346 +28,346 @@ use Data::Dumper; use Cwd 'abs_path'; sub new { - # ... - # Create a new KIWIDescrPlugin object - # creates patterns file - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new($handler); - bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if((! $configpath) || (! $configfile)) { - $this->logMsg("E", - "wrong parameters in plugin initialisation" - ); - return; - } - my $ini = Config::IniFiles -> new( -file => "$configpath/$configfile" ); - my $name = $ini->val('base', 'name'); - my $order = $ini->val('base', 'order'); - my $tool = $ini->val('base', 'tool'); - my $createrepo = $ini->val('base', 'createrepo'); - my $rezip = $ini->val('base', 'rezip'); - my $tdir = $ini->val('base', 'tooldir'); - my $tpack = $ini->val('base', 'toolpack'); - my $enable = $ini->val('base', 'defaultenable'); - my @params = $ini->val('options', 'parameter'); - my $gzip = $ini->val('target', 'compress'); - # if any of those isn't set, complain! - if(not defined($name) - or not defined($order) - or not defined($tool) - or not defined($createrepo) - or not defined($rezip) - or not defined($tdir) - or not defined($tpack) - or not defined($enable) - or not defined($gzip) - or not (@params) - ) { - $this->logMsg("E", - "Plugin ini file <$config> seems broken!" - ); - return; - } - # sanity check for tools' existence: - if(not( -f "$tdir/$tool" and -x "$tdir/$tool")) { - $this->logMsg("E", - "Plugin <$name>: tool <$tdir/$tool> is not executable!" - ); - $this->logMsg("I", - "Check if package <$tpack> is installed." - ); - return; - } - my $params = ""; - foreach my $p(@params) { - $p = $this->collect()->productData()->_substitute("$p"); - $params .= "$p "; - } - # add local kwd files as argument - my $extrafile = abs_path($this->collect()->{m_xml}->{xmlOrigFile}); - $extrafile =~ s/.kiwi$/.kwd/x; - if (-f $extrafile) { - $this->logMsg("W", "Found extra tags file $extrafile."); - $params .= "-T $extrafile "; - } - $this->name($name); - $this->order($order); - $this->{m_tool} = $tool; - $this->{m_tooldir} = $tdir; - $this->{m_toolpack} = $tpack; - $this->{m_createrepo} = $createrepo; - $this->{m_rezip} = $rezip; - $this->{m_params} = $params; - $this->{m_compress} = $gzip; - if($enable != 0) { - $this->ready(1); - } - return $this; + # ... + # Create a new KIWIDescrPlugin object + # creates patterns file + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new($handler); + bless ($this, $class); + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if((! $configpath) || (! $configfile)) { + $this->logMsg("E", + "wrong parameters in plugin initialisation" + ); + return; + } + my $ini = Config::IniFiles -> new( -file => "$configpath/$configfile" ); + my $name = $ini->val('base', 'name'); + my $order = $ini->val('base', 'order'); + my $tool = $ini->val('base', 'tool'); + my $createrepo = $ini->val('base', 'createrepo'); + my $rezip = $ini->val('base', 'rezip'); + my $tdir = $ini->val('base', 'tooldir'); + my $tpack = $ini->val('base', 'toolpack'); + my $enable = $ini->val('base', 'defaultenable'); + my @params = $ini->val('options', 'parameter'); + my $gzip = $ini->val('target', 'compress'); + # if any of those isn't set, complain! + if(not defined($name) + or not defined($order) + or not defined($tool) + or not defined($createrepo) + or not defined($rezip) + or not defined($tdir) + or not defined($tpack) + or not defined($enable) + or not defined($gzip) + or not (@params) + ) { + $this->logMsg("E", + "Plugin ini file <$config> seems broken!" + ); + return; + } + # sanity check for tools' existence: + if(not( -f "$tdir/$tool" and -x "$tdir/$tool")) { + $this->logMsg("E", + "Plugin <$name>: tool <$tdir/$tool> is not executable!" + ); + $this->logMsg("I", + "Check if package <$tpack> is installed." + ); + return; + } + my $params = ""; + foreach my $p(@params) { + $p = $this->collect()->productData()->_substitute("$p"); + $params .= "$p "; + } + # add local kwd files as argument + my $extrafile = abs_path($this->collect()->{m_xml}->{xmlOrigFile}); + $extrafile =~ s/.kiwi$/.kwd/x; + if (-f $extrafile) { + $this->logMsg("W", "Found extra tags file $extrafile."); + $params .= "-T $extrafile "; + } + $this->name($name); + $this->order($order); + $this->{m_tool} = $tool; + $this->{m_tooldir} = $tdir; + $this->{m_toolpack} = $tpack; + $this->{m_createrepo} = $createrepo; + $this->{m_rezip} = $rezip; + $this->{m_params} = $params; + $this->{m_compress} = $gzip; + if($enable != 0) { + $this->ready(1); + } + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - if($this->{m_ready} == 0) { - return 0 - } - my $coll = $this->{m_collect}; - my $basesubdirs = $coll->basesubdirs(); - if(not defined($basesubdirs)) { - ## prevent crash when dereferencing - $this->logMsg("E", - " is undefined! Skipping <$this->name()>" - ); + my $this = shift; + if(not ref($this)) { + return; + } + if($this->{m_ready} == 0) { + return 0 + } + my $coll = $this->{m_collect}; + my $basesubdirs = $coll->basesubdirs(); + if(not defined($basesubdirs)) { + ## prevent crash when dereferencing + $this->logMsg("E", + " is undefined! Skipping <$this->name()>" + ); + return 0; + } + foreach my $dirlist($this->getSubdirLists()) { + my ($s,$m) = $this->executeDir(sort @{$dirlist}); + } return 0; - } - foreach my $dirlist($this->getSubdirLists()) { - my ($s,$m) = $this->executeDir(sort @{$dirlist}); - } - return 0; } sub executeDir { - my @params = @_; - my $this = shift @params; - my @paths = @params; - my $call; - my $status; - my $cmd; - if(!@paths) { - $this->logMsg("W", "Empty path list!"); - return 0; - } - my $coll = $this->{m_collect}; - my $datadir = $coll->productData()->getInfo("DATADIR"); - my $descrdir = $coll->productData()->getInfo("DESCRDIR"); - my $cpeid = $coll->productData()->getInfo("CPEID"); - my $repoid = $coll->productData()->getInfo("REPOID"); - my $createrepomd = $coll->productData()->getVar("CREATE_REPOMD"); - my $targetdir; - my $newtargetdir; - ## this ugly bit creates a parameter string from a list of directories: - # param = -d -d ... - # the order is important. Idea: use map to make hash => -d for - # all subdirs not ending with "0" (those are for metafile unpacking - # only). The result is evaluated in list context be reverse, so - # there's a list looking like " -d ... -d" which is - # reversed again, making the result '-d', '', ..., '-d', ''", - # after the join as string. - # --- - if ($descrdir && $descrdir ne "/") { - my $pathlist = "-d ".join(' -d ', map{$_."/".$datadir}(@paths)); - $this->logMsg("I", - "Calling ".$this->name()." for directories <@paths>:" - ); - $targetdir = $paths[0]."/".$descrdir; - $cmd = "$this->{m_tooldir}/$this->{m_tool} " - . "$pathlist $this->{m_params} -o " - . $paths[0] - . "/" - . $descrdir; - $this->logMsg("I", "Executing command <$cmd>"); - $call = $this -> callCmd($cmd); - $status = $call->[0]; - if($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called <$cmd> exit status <$status> output: $out" - ); - return 0; - } - } - if ( $createrepomd && $createrepomd eq "true" ) { - my $distroname = $coll->productData()->getInfo("DISTRIBUTION")."." - . $coll->productData()->getInfo("VERSION"); - my $result = $this -> createRepositoryMetadata( - \@paths, $repoid, $distroname, $cpeid, $datadir, $targetdir - ); - # return values 0 || 1 indicates an error - if ($result != 2) { - return $result; - } - } - return 1 unless $descrdir; - return 1 unless $targetdir; - # insert translation files - my $trans_dir = '/usr/share/locale/en_US/LC_MESSAGES'; - my $trans_glob = 'package-translations-*.mo'; - foreach my $trans (glob($trans_dir.'/'.$trans_glob)) { - $trans = basename($trans, ".mo"); - $trans =~ s,.*-,,x; - $cmd = "/usr/bin/translate_packages.pl $trans " - . "< $targetdir/packages.en " - . "> $targetdir/packages.$trans"; - $call = $this -> callCmd($cmd); - $status = $call->[0]; - if($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called <$cmd> exit status: <$status> output: $out" - ); - return 1; - } - } - # one more time for english to insert possible EULAs - $cmd = "/usr/bin/translate_packages.pl en " - . "< $targetdir/packages.en " - . "> $targetdir/packages.en.new && " - . "mv $targetdir/packages.en.new $targetdir/packages.en"; - $call = $this -> callCmd($cmd); - $status = $call->[0]; - if ($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called <$cmd> exit status: <$status> output: $out" - ); - return 1; - } - if ((-x "/usr/bin/extract-appdata-icons") && - (-s "$targetdir/appdata.xml") - ) { - $cmd = "/usr/bin/extract-appdata-icons " - . "$targetdir/appdata.xml $targetdir"; - $call = $this -> callCmd($cmd); - $status = $call->[0]; - if($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called <$cmd> exit status: <$status> output: $out" - ); - return 1; + my @params = @_; + my $this = shift @params; + my @paths = @params; + my $call; + my $status; + my $cmd; + if(!@paths) { + $this->logMsg("W", "Empty path list!"); + return 0; } - if($this->{m_compress} =~ m{yes}i) { - system("gzip", "--rsyncable", "$targetdir/appdata.xml"); + my $coll = $this->{m_collect}; + my $datadir = $coll->productData()->getInfo("DATADIR"); + my $descrdir = $coll->productData()->getInfo("DESCRDIR"); + my $cpeid = $coll->productData()->getInfo("CPEID"); + my $repoid = $coll->productData()->getInfo("REPOID"); + my $createrepomd = $coll->productData()->getVar("CREATE_REPOMD"); + my $targetdir; + my $newtargetdir; + ## this ugly bit creates a parameter string from a list of directories: + # param = -d -d ... + # the order is important. Idea: use map to make hash => -d for + # all subdirs not ending with "0" (those are for metafile unpacking + # only). The result is evaluated in list context be reverse, so + # there's a list looking like " -d ... -d" which is + # reversed again, making the result '-d', '', ..., '-d', ''", + # after the join as string. + # --- + if ($descrdir && $descrdir ne "/") { + my $pathlist = "-d ".join(' -d ', map{$_."/".$datadir}(@paths)); + $this->logMsg("I", + "Calling ".$this->name()." for directories <@paths>:" + ); + $targetdir = $paths[0]."/".$descrdir; + $cmd = "$this->{m_tooldir}/$this->{m_tool} " + . "$pathlist $this->{m_params} -o " + . $paths[0] + . "/" + . $descrdir; + $this->logMsg("I", "Executing command <$cmd>"); + $call = $this -> callCmd($cmd); + $status = $call->[0]; + if($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called <$cmd> exit status <$status> output: $out" + ); + return 0; + } } - } - if($this->{m_compress} =~ m{yes}i) { - foreach my $pfile(glob("$targetdir/packages*")) { - if(system("gzip", "--rsyncable", "$pfile") == 0) { - unlink "$targetdir/$pfile"; - } else { - $this->logMsg("W", - "Can't compress file <$targetdir/$pfile>!" + if ( $createrepomd && $createrepomd eq "true" ) { + my $distroname = $coll->productData()->getInfo("DISTRIBUTION")."." + . $coll->productData()->getInfo("VERSION"); + my $result = $this -> createRepositoryMetadata( + \@paths, $repoid, $distroname, $cpeid, $datadir, $targetdir ); - } + # return values 0 || 1 indicates an error + if ($result != 2) { + return $result; + } } - } - return 1; -} - -sub createRepositoryMetadata { - my @params = @_; - my $this = $params[0]; - my $paths = $params[1]; - my $repoid = $params[2]; - my $distroname = $params[3]; - my $cpeid = $params[4]; - my $datadir = $params[5]; - my $targetdir = $params[6]; - my $cmd; - my $call; - my $status; - foreach my $p (@{$paths}) { - $cmd = "$this->{m_createrepo}"; - $cmd .= " --unique-md-filenames"; - $cmd .= " --checksum=sha256"; - $cmd .= " --no-database"; - $cmd .= " --repo=\"$repoid\"" if $repoid; - $cmd .= " --distro=\"$cpeid,$distroname\"" if $cpeid && $distroname; - $cmd .= " $p/$datadir"; - $this->logMsg("I", "Executing command <$cmd>"); - $call = $this -> callCmd($cmd); - $status = $call->[0]; - if($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called <$cmd> exit status: <$status> output: $out" - ); - return 0; + return 1 unless $descrdir; + return 1 unless $targetdir; + # insert translation files + my $trans_dir = '/usr/share/locale/en_US/LC_MESSAGES'; + my $trans_glob = 'package-translations-*.mo'; + foreach my $trans (glob($trans_dir.'/'.$trans_glob)) { + $trans = basename($trans, ".mo"); + $trans =~ s,.*-,,x; + $cmd = "/usr/bin/translate_packages.pl $trans " + . "< $targetdir/packages.en " + . "> $targetdir/packages.$trans"; + $call = $this -> callCmd($cmd); + $status = $call->[0]; + if($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called <$cmd> exit status: <$status> output: $out" + ); + return 1; + } } - $cmd = "$this->{m_rezip} $p/$datadir "; - $this->logMsg("I", "Executing command <$cmd>"); + # one more time for english to insert possible EULAs + $cmd = "/usr/bin/translate_packages.pl en " + . "< $targetdir/packages.en " + . "> $targetdir/packages.en.new && " + . "mv $targetdir/packages.en.new $targetdir/packages.en"; $call = $this -> callCmd($cmd); $status = $call->[0]; - if($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called <$cmd> exit status: <$status> output: $out" - ); - return 0; - } - my $newtargetdir = "$p/$datadir/repodata"; - if ((-x "/usr/bin/extract-appdata-icons") && - (-s "$newtargetdir/appdata.xml") - ) { - $cmd = "/usr/bin/extract-appdata-icons " - . "$newtargetdir/appdata.xml $newtargetdir"; - $call = $this -> callCmd($cmd); - $status = $call->[0]; - if($status) { + if ($status) { my $out = join("\n",@{$call->[1]}); $this->logMsg("E", - "Called $cmd exit status: <$status> output: $out" + "Called <$cmd> exit status: <$status> output: $out" ); return 1; - } - if($this->{m_compress} =~ m{yes}i) { - system("gzip", "--rsyncable", "$newtargetdir/appdata.xml"); - } } if ((-x "/usr/bin/extract-appdata-icons") && - (-s "$targetdir/appdata.xml") + (-s "$targetdir/appdata.xml") ) { - $newtargetdir = "$p/$datadir/repodata"; - system("cp $targetdir/appdata.xml $newtargetdir/appdata.xml"); - $cmd = "/usr/bin/extract-appdata-icons " - . "$newtargetdir/appdata.xml $newtargetdir"; - $call = $this -> callCmd($cmd); - $status = $call->[0]; - if($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called $cmd exit status: <$status> output: $out" - ); - return 1; - } - if($this->{m_compress} =~ m{yes}i) { - system("gzip", "--rsyncable", "$newtargetdir/appdata.xml"); - } + $cmd = "/usr/bin/extract-appdata-icons " + . "$targetdir/appdata.xml $targetdir"; + $call = $this -> callCmd($cmd); + $status = $call->[0]; + if($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called <$cmd> exit status: <$status> output: $out" + ); + return 1; + } + if($this->{m_compress} =~ m{yes}i) { + system("gzip", "--rsyncable", "$targetdir/appdata.xml"); + } } - if ( -f "/usr/bin/add_product_susedata" ) { - my $kwdfile = abs_path( - $this->collect()->{m_xml}->{xmlOrigFile} - ); - $kwdfile =~ s/.kiwi$/.kwd/x; - $cmd = "/usr/bin/add_product_susedata"; - $cmd .= " -u"; # unique filenames - $cmd .= " -k $kwdfile"; - $cmd .= " -e /usr/share/doc/packages/eulas"; - $cmd .= " -d $p/$datadir"; - $this->logMsg("I", "Executing command <$cmd>"); - $call = $this -> callCmd($cmd); - $status = $call->[0]; - if($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called <$cmd> exit status: <$status> output: $out" - ); - return 0; - } + if($this->{m_compress} =~ m{yes}i) { + foreach my $pfile(glob("$targetdir/packages*")) { + if(system("gzip", "--rsyncable", "$pfile") == 0) { + unlink "$targetdir/$pfile"; + } else { + $this->logMsg("W", + "Can't compress file <$targetdir/$pfile>!" + ); + } + } + } + return 1; +} + +sub createRepositoryMetadata { + my @params = @_; + my $this = $params[0]; + my $paths = $params[1]; + my $repoid = $params[2]; + my $distroname = $params[3]; + my $cpeid = $params[4]; + my $datadir = $params[5]; + my $targetdir = $params[6]; + my $cmd; + my $call; + my $status; + foreach my $p (@{$paths}) { + $cmd = "$this->{m_createrepo}"; + $cmd .= " --unique-md-filenames"; + $cmd .= " --checksum=sha256"; + $cmd .= " --no-database"; + $cmd .= " --repo=\"$repoid\"" if $repoid; + $cmd .= " --distro=\"$cpeid,$distroname\"" if $cpeid && $distroname; + $cmd .= " $p/$datadir"; + $this->logMsg("I", "Executing command <$cmd>"); + $call = $this -> callCmd($cmd); + $status = $call->[0]; + if($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called <$cmd> exit status: <$status> output: $out" + ); + return 0; + } + $cmd = "$this->{m_rezip} $p/$datadir "; + $this->logMsg("I", "Executing command <$cmd>"); + $call = $this -> callCmd($cmd); + $status = $call->[0]; + if($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called <$cmd> exit status: <$status> output: $out" + ); + return 0; + } + my $newtargetdir = "$p/$datadir/repodata"; + if ((-x "/usr/bin/extract-appdata-icons") && + (-s "$newtargetdir/appdata.xml") + ) { + $cmd = "/usr/bin/extract-appdata-icons " + . "$newtargetdir/appdata.xml $newtargetdir"; + $call = $this -> callCmd($cmd); + $status = $call->[0]; + if($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called $cmd exit status: <$status> output: $out" + ); + return 1; + } + if($this->{m_compress} =~ m{yes}i) { + system("gzip", "--rsyncable", "$newtargetdir/appdata.xml"); + } + } + if ((-x "/usr/bin/extract-appdata-icons") && + (-s "$targetdir/appdata.xml") + ) { + $newtargetdir = "$p/$datadir/repodata"; + system("cp $targetdir/appdata.xml $newtargetdir/appdata.xml"); + $cmd = "/usr/bin/extract-appdata-icons " + . "$newtargetdir/appdata.xml $newtargetdir"; + $call = $this -> callCmd($cmd); + $status = $call->[0]; + if($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called $cmd exit status: <$status> output: $out" + ); + return 1; + } + if($this->{m_compress} =~ m{yes}i) { + system("gzip", "--rsyncable", "$newtargetdir/appdata.xml"); + } + } + if ( -f "/usr/bin/add_product_susedata" ) { + my $kwdfile = abs_path( + $this->collect()->{m_xml}->{xmlOrigFile} + ); + $kwdfile =~ s/.kiwi$/.kwd/x; + $cmd = "/usr/bin/add_product_susedata"; + $cmd .= " -u"; # unique filenames + $cmd .= " -k $kwdfile"; + $cmd .= " -e /usr/share/doc/packages/eulas"; + $cmd .= " -d $p/$datadir"; + $this->logMsg("I", "Executing command <$cmd>"); + $call = $this -> callCmd($cmd); + $status = $call->[0]; + if($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called <$cmd> exit status: <$status> output: $out" + ); + return 0; + } + } } - } - return 2; + return 2; } 1; diff --git a/distribution/kiwi-instsource-plugins-SLE-12/KIWIFinishEFIPlugin.pm b/distribution/kiwi-instsource-plugins-SLE-12/KIWIFinishEFIPlugin.pm index 4cfc8397f..341caf52c 100644 --- a/distribution/kiwi-instsource-plugins-SLE-12/KIWIFinishEFIPlugin.pm +++ b/distribution/kiwi-instsource-plugins-SLE-12/KIWIFinishEFIPlugin.pm @@ -28,83 +28,83 @@ use File::Find; use File::Basename; sub new { - # ... - # Create a new KIWIFinishEFIPlugin object - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin ->new ($handler); - bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if(not defined($configpath) or not defined($configfile)) { - $this->logMsg("E", - "wrong parameters in plugin initialisation\n" + # ... + # Create a new KIWIFinishEFIPlugin object + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin ->new ($handler); + bless ($this, $class); + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if(not defined($configpath) or not defined($configfile)) { + $this->logMsg("E", + "wrong parameters in plugin initialisation\n" + ); + return; + } + ## plugin content: + #----------------- + #[base] + # name = KIWIEulaPlugin + # order = 3 + # defaultenable = 1 + # + #[target] + # targetfile = content + # targetdir = $PRODUCT_DIR + # media = (list of numbers XOR "all") + # + my $ini= Config::IniFiles -> new( + -file => "$configpath/$configfile" ); - return; - } - ## plugin content: - #----------------- - #[base] - # name = KIWIEulaPlugin - # order = 3 - # defaultenable = 1 - # - #[target] - # targetfile = content - # targetdir = $PRODUCT_DIR - # media = (list of numbers XOR "all") - # - my $ini= Config::IniFiles -> new( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base', 'name'); - my $order = $ini->val('base', 'order'); - my $enable = $ini->val('base', 'defaultenable'); - # if any of those isn't set, complain! - if(not defined($name) - or not defined($order) - or not defined($enable) - ) { - $this->logMsg("E", - "Plugin ini file <$config> seems broken!\n" - ); - return; - } - $this->name($name); - $this->order($order); - if($enable != 0) { - $this->ready(1); - } - return $this; + my $name = $ini->val('base', 'name'); + my $order = $ini->val('base', 'order'); + my $enable = $ini->val('base', 'defaultenable'); + # if any of those isn't set, complain! + if(not defined($name) + or not defined($order) + or not defined($enable) + ) { + $this->logMsg("E", + "Plugin ini file <$config> seems broken!\n" + ); + return; + } + $this->name($name); + $this->order($order); + if($enable != 0) { + $this->ready(1); + } + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - if($this->{m_ready} == 0) { + my $this = shift; + if(not ref($this)) { + return; + } + if($this->{m_ready} == 0) { + return 0; + } + my $cd = 1; + my $type = $this->collect()->{m_xml}->getImageType(); + return 0 unless $type; + my $firmware = $type->getFirmwareType(); + if ($firmware eq "efi" || $firmware eq "uefi") { + my $dir = $this->collect()->basesubdirs()->{$cd}; + my $efi = "$dir/boot/x86_64/efi"; + $this->logMsg("I", "creating $efi"); + $this -> callCmd("dd if=/dev/zero of=$efi bs=1M count=4"); + $this -> callCmd("/usr/sbin/mkdosfs -n 'BOOT' $efi"); + $this -> callCmd("mcopy -Do -s -i $efi $dir/EFI ::"); + } return 0; - } - my $cd = 1; - my $type = $this->collect()->{m_xml}->getImageType(); - return 0 unless $type; - my $firmware = $type->getFirmwareType(); - if ($firmware eq "efi" || $firmware eq "uefi") { - my $dir = $this->collect()->basesubdirs()->{$cd}; - my $efi = "$dir/boot/x86_64/efi"; - $this->logMsg("I", "creating $efi"); - $this -> callCmd("dd if=/dev/zero of=$efi bs=1M count=4"); - $this -> callCmd("/usr/sbin/mkdosfs -n 'BOOT' $efi"); - $this -> callCmd("mcopy -Do -s -i $efi $dir/EFI ::"); - } - return 0; } 1; diff --git a/distribution/kiwi-instsource-plugins-SLE-12/KIWILicensePlugin.pm b/distribution/kiwi-instsource-plugins-SLE-12/KIWILicensePlugin.pm index 6957497f9..81f5afe60 100644 --- a/distribution/kiwi-instsource-plugins-SLE-12/KIWILicensePlugin.pm +++ b/distribution/kiwi-instsource-plugins-SLE-12/KIWILicensePlugin.pm @@ -24,107 +24,107 @@ use warnings; use base "KIWIBasePlugin"; sub new { - my $class = shift; - my $handler = shift; - my $config = shift; - my $this = KIWIBasePlugin -> new ($handler); - bless ($this, $class); - my $ini = Config::IniFiles -> new ( - -file => "$config" - ); - my $name = $ini->val('base', 'name'); - my $order = $ini->val('base', 'order'); - my $enable = $ini->val('base', 'defaultenable'); - if (not defined($name) - or not defined($order) - or not defined($enable) - ) { - $this->logMsg( - "E", "Plugin ini file <$config> seems broken!" + my $class = shift; + my $handler = shift; + my $config = shift; + my $this = KIWIBasePlugin -> new ($handler); + bless ($this, $class); + my $ini = Config::IniFiles -> new ( + -file => "$config" ); - return; - } - $this->name($name); - $this->order($order); - if ($enable != 0) { - $this->ready(1); - } - return $this; + my $name = $ini->val('base', 'name'); + my $order = $ini->val('base', 'order'); + my $enable = $ini->val('base', 'defaultenable'); + if (not defined($name) + or not defined($order) + or not defined($enable) + ) { + $this->logMsg( + "E", "Plugin ini file <$config> seems broken!" + ); + return; + } + $this->name($name); + $this->order($order); + if ($enable != 0) { + $this->ready(1); + } + return $this; } sub execute { - my $this = shift; - my $result; - for my $cd ($this->collect()->getMediaNumbers()) { - next if $cd == 0; - my $name = $this->collect()->{m_basesubdir}->{$cd}; - $name =~ s{.*/(.*)/*$}{$1}x; - my $media_base = $this->collect()->{m_united}."/$name"; - my $media_license_dir = $this->collect()->{m_united} - ."/".$name.".license"; - my $betaFile = $this->collect()->{m_united} - ."/".$name."/README.BETA"; - $this->logMsg( - "I", "Check for licenses on media $media_base" - ); - my $licenseArchive = "$media_base/license.tar.gz"; - if ( -e $licenseArchive ) { - $this->logMsg("I", "Extracting license.tar.gz"); - system("mkdir $media_license_dir"); - $result = $? >> 8; - if ($result != 0) { - $this->logMsg( - "E", "mkdir failed!" - ); - return 1; - } - system("tar xf $licenseArchive -C $media_license_dir"); - $result = $? >> 8; - if ($result != 0) { - $this->logMsg( - "E", "Untar failed!" - ); - return 1; - } - if ( ! -e "$media_license_dir/license.txt" ) { + my $this = shift; + my $result; + for my $cd ($this->collect()->getMediaNumbers()) { + next if $cd == 0; + my $name = $this->collect()->{m_basesubdir}->{$cd}; + $name =~ s{.*/(.*)/*$}{$1}x; + my $media_base = $this->collect()->{m_united}."/$name"; + my $media_license_dir = $this->collect()->{m_united} + ."/".$name.".license"; + my $betaFile = $this->collect()->{m_united} + ."/".$name."/README.BETA"; $this->logMsg( - "E", "No license.txt extracted!" + "I", "Check for licenses on media $media_base" ); - return 1; - } - if ( ! -e "$media_license_dir/directory.yast" ) { - $this->logMsg( - "E", "No directory.yast extracted!" - ); - return 1; - } - # add license information to repomd metadata - if ( -d "$media_base/repodata" ) { - $this->logMsg("I", "Adding license.tar.gz to rpm-md data"); - system("cd $media_base && modifyrepo $licenseArchive repodata"); - $result = $? >> 8; - if ($result != 0) { - $this->logMsg( - "E", "modifyrepo failed!" - ); - return 1; - } - # not needed here anymore - unlink $licenseArchive; - } - if ( -e $betaFile ) { - system("cp $betaFile $media_license_dir"); - $result = $? >> 8; - if ($result != 0) { - $this->logMsg( - "E", "Copying README.BETA failed!" - ); - return 1; + my $licenseArchive = "$media_base/license.tar.gz"; + if ( -e $licenseArchive ) { + $this->logMsg("I", "Extracting license.tar.gz"); + system("mkdir $media_license_dir"); + $result = $? >> 8; + if ($result != 0) { + $this->logMsg( + "E", "mkdir failed!" + ); + return 1; + } + system("tar xf $licenseArchive -C $media_license_dir"); + $result = $? >> 8; + if ($result != 0) { + $this->logMsg( + "E", "Untar failed!" + ); + return 1; + } + if ( ! -e "$media_license_dir/license.txt" ) { + $this->logMsg( + "E", "No license.txt extracted!" + ); + return 1; + } + if ( ! -e "$media_license_dir/directory.yast" ) { + $this->logMsg( + "E", "No directory.yast extracted!" + ); + return 1; + } + # add license information to repomd metadata + if ( -d "$media_base/repodata" ) { + $this->logMsg("I", "Adding license.tar.gz to rpm-md data"); + system("cd $media_base && modifyrepo $licenseArchive repodata"); + $result = $? >> 8; + if ($result != 0) { + $this->logMsg( + "E", "modifyrepo failed!" + ); + return 1; + } + # not needed here anymore + unlink $licenseArchive; + } + if ( -e $betaFile ) { + system("cp $betaFile $media_license_dir"); + $result = $? >> 8; + if ($result != 0) { + $this->logMsg( + "E", "Copying README.BETA failed!" + ); + return 1; + } + } } - } } - } - return 0; + return 0; } 1; diff --git a/distribution/kiwi-instsource-plugins-SLE-12/KIWILiveTreePlugin.pm b/distribution/kiwi-instsource-plugins-SLE-12/KIWILiveTreePlugin.pm index 49a25dc4e..cc726fb5a 100644 --- a/distribution/kiwi-instsource-plugins-SLE-12/KIWILiveTreePlugin.pm +++ b/distribution/kiwi-instsource-plugins-SLE-12/KIWILiveTreePlugin.pm @@ -29,104 +29,104 @@ use File::Basename; use Carp; sub new { - # ... - # Create a new KIWILiveTreePlugin object - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new($handler); - bless ($this, $class); + # ... + # Create a new KIWILiveTreePlugin object + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new($handler); + bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if(not defined($configpath) or not defined($configfile)) { - $this->logMsg("E", - "wrong parameters in plugin initialisation\n" + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if(not defined($configpath) or not defined($configfile)) { + $this->logMsg("E", + "wrong parameters in plugin initialisation\n" + ); + return; + } + ## plugin content: + #----------------- + #[base] + # name = KIWIEulaPlugin + # order = 3 + # defaultenable = 1 + # + #[target] + # targetfile = content + # targetdir = $PRODUCT_DIR + # media = (list of numbers XOR "all") + # + my $ini = Config::IniFiles -> new( + -file => "$configpath/$configfile" ); - return; - } - ## plugin content: - #----------------- - #[base] - # name = KIWIEulaPlugin - # order = 3 - # defaultenable = 1 - # - #[target] - # targetfile = content - # targetdir = $PRODUCT_DIR - # media = (list of numbers XOR "all") - # - my $ini = Config::IniFiles -> new( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base', 'name'); - my $order = $ini->val('base', 'order'); - my $enable = $ini->val('base', 'defaultenable'); - # if any of those isn't set, complain! - if(not defined($name) - or not defined($order) - or not defined($enable) - ) { - $this->logMsg("E", - "Plugin ini file <$config> seems broken!\n" - ); - return; - } - $this->name($name); - $this->order($order); - if($enable != 0) { - $this->ready(1); - } - return $this; + my $name = $ini->val('base', 'name'); + my $order = $ini->val('base', 'order'); + my $enable = $ini->val('base', 'defaultenable'); + # if any of those isn't set, complain! + if(not defined($name) + or not defined($order) + or not defined($enable) + ) { + $this->logMsg("E", + "Plugin ini file <$config> seems broken!\n" + ); + return; + } + $this->name($name); + $this->order($order); + if($enable != 0) { + $this->ready(1); + } + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - if($this->{m_ready} == 0) { - return 0; - } - my $ismini = $this->collect() - ->productData()->getVar("FLAVOR"); - if(not defined($ismini)) { - $this->logMsg("W", "FLAVOR not set?"); - return 0; - } - if($ismini !~ m{livetree}i) { + my $this = shift; + if(not ref($this)) { + return; + } + if($this->{m_ready} == 0) { + return 0; + } + my $ismini = $this->collect() + ->productData()->getVar("FLAVOR"); + if(not defined($ismini)) { + $this->logMsg("W", "FLAVOR not set?"); + return 0; + } + if($ismini !~ m{livetree}i) { + return 0; + } + my $medium = $this->collect() + ->productData()->getVar("MEDIUM_NAME"); + my $cd; + find( + sub { if (m/.iso/x) { $cd = $File::Find::name; } }, + $this->handler()->collect()->basedir() + ); + if (!$cd) { + $this->logMsg("E", "Initial CD not found\n"); + croak "E: fatal"; + } + $this->logMsg("I", "$cd $medium"); + my $dname = dirname($cd); + $this->logMsg("I", "$dname"); + my $nname = "$medium.iso"; + $nname =~ s,-i586-,-i686-,x; + $this->logMsg("I", + "Renaming $cd to $dname/$nname" + ); + if (! rename($cd, "$dname/$nname")) { + $this->logMsg("E", "could not rename $cd"); + croak "E: fatal"; + } return 0; - } - my $medium = $this->collect() - ->productData()->getVar("MEDIUM_NAME"); - my $cd; - find( - sub { if (m/.iso/x) { $cd = $File::Find::name; } }, - $this->handler()->collect()->basedir() - ); - if (!$cd) { - $this->logMsg("E", "Initial CD not found\n"); - croak "E: fatal"; - } - $this->logMsg("I", "$cd $medium"); - my $dname = dirname($cd); - $this->logMsg("I", "$dname"); - my $nname = "$medium.iso"; - $nname =~ s,-i586-,-i686-,x; - $this->logMsg("I", - "Renaming $cd to $dname/$nname" - ); - if (! rename($cd, "$dname/$nname")) { - $this->logMsg("E", "could not rename $cd"); - croak "E: fatal"; - } - return 0; } 1; diff --git a/distribution/kiwi-instsource-plugins-SLE-12/KIWIMiniIsoPlugin.pm b/distribution/kiwi-instsource-plugins-SLE-12/KIWIMiniIsoPlugin.pm index 82d6de925..3bb4a6943 100644 --- a/distribution/kiwi-instsource-plugins-SLE-12/KIWIMiniIsoPlugin.pm +++ b/distribution/kiwi-instsource-plugins-SLE-12/KIWIMiniIsoPlugin.pm @@ -29,245 +29,245 @@ use FileHandle; use Carp; sub new { - # ... - # Create a new KIWIMiniIsoPlugin object - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new($handler); - bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if ((! $configpath) || (! $configfile)) { - $this->logMsg("E", - "wrong parameters in plugin initialisation\n" - ); - return; - } - ## plugin content: - #----------------- - #[base] - # name = KIWIEulaPlugin - # order = 3 - # defaultenable = 1 - # - #[target] - # targetfile = content - # targetdir = $PRODUCT_DIR - # media = (list of numbers XOR "all") - # - my $ini = Config::IniFiles -> new ( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base', 'name'); - my $order = $ini->val('base', 'order'); - my $enable = $ini->val('base', 'defaultenable'); - # if any of those isn't set, complain! - if (not defined($name) - or not defined($order) - or not defined($enable) - ) { - $this->logMsg("E", - "Plugin ini file <$config> seems broken!\n" + # ... + # Create a new KIWIMiniIsoPlugin object + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new($handler); + bless ($this, $class); + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if ((! $configpath) || (! $configfile)) { + $this->logMsg("E", + "wrong parameters in plugin initialisation\n" + ); + return; + } + ## plugin content: + #----------------- + #[base] + # name = KIWIEulaPlugin + # order = 3 + # defaultenable = 1 + # + #[target] + # targetfile = content + # targetdir = $PRODUCT_DIR + # media = (list of numbers XOR "all") + # + my $ini = Config::IniFiles -> new ( + -file => "$configpath/$configfile" ); - return; - } - $this->name($name); - $this->order($order); - if($enable != 0) { - $this->ready(1); - } - return $this; + my $name = $ini->val('base', 'name'); + my $order = $ini->val('base', 'order'); + my $enable = $ini->val('base', 'defaultenable'); + # if any of those isn't set, complain! + if (not defined($name) + or not defined($order) + or not defined($enable) + ) { + $this->logMsg("E", + "Plugin ini file <$config> seems broken!\n" + ); + return; + } + $this->name($name); + $this->order($order); + if($enable != 0) { + $this->ready(1); + } + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - my $retval = 0; - if($this->{m_ready} == 0) { - return $retval; - } - my $repoloc = $this->collect()->productData()->getOpt("REPO_LOCATION"); - my $ismini = $this->collect()->productData()->getVar("FLAVOR"); - if(not defined($ismini)) { - $this->logMsg("W", "FLAVOR not set?"); - return $retval; - } - if ($ismini !~ m{mini}i) { - $this->logMsg("I", - "Nothing to for for media type <$ismini>" + my $this = shift; + if(not ref($this)) { + return; + } + my $retval = 0; + if($this->{m_ready} == 0) { + return $retval; + } + my $repoloc = $this->collect()->productData()->getOpt("REPO_LOCATION"); + my $ismini = $this->collect()->productData()->getVar("FLAVOR"); + if(not defined($ismini)) { + $this->logMsg("W", "FLAVOR not set?"); + return $retval; + } + if ($ismini !~ m{mini}i) { + $this->logMsg("I", + "Nothing to for for media type <$ismini>" + ); + return $retval; + } + my ($srv, $path); + if (not defined($repoloc)) { + $this->logMsg("I", + " is unset, boot protocol will be set to 'slp'!" + ); + } else { + if ($repoloc =~ m{^http://([^/]+)/(.+)}x) { + ($srv, $path) = ($1, $2); + } + if(not defined($srv) or not defined($path)) { + $this->logMsg("W", + "Parsing repo-location=<$repoloc> failed!" + ); + return $retval; + } + } + my @gfxbootfiles; + find( + sub { find_cb($this, '.*/gfxboot\.cfg$', \@gfxbootfiles) }, + $this->handler()->collect()->basedir() ); - return $retval; - } - my ($srv, $path); - if (not defined($repoloc)) { - $this->logMsg("I", - " is unset, boot protocol will be set to 'slp'!" + my @rootfiles; + find( + sub { find_cb($this, '.*/root$', \@rootfiles) }, + $this->handler()->collect()->basedir() ); - } else { - if ($repoloc =~ m{^http://([^/]+)/(.+)}x) { - ($srv, $path) = ($1, $2); + foreach(@rootfiles) { + $this->logMsg("I", "removing file <$_>"); + unlink $_; } - if(not defined($srv) or not defined($path)) { - $this->logMsg("W", - "Parsing repo-location=<$repoloc> failed!" - ); - return $retval; + if (!@gfxbootfiles) { + my $msg = "No gfxboot.cfg file found! " + . "This _MIGHT_ be ok for S/390. " + . "Please verify package(s)"; + $this->logMsg("W", $msg); + return $retval; } - } - my @gfxbootfiles; - find( - sub { find_cb($this, '.*/gfxboot\.cfg$', \@gfxbootfiles) }, - $this->handler()->collect()->basedir() - ); - my @rootfiles; - find( - sub { find_cb($this, '.*/root$', \@rootfiles) }, - $this->handler()->collect()->basedir() - ); - foreach(@rootfiles) { - $this->logMsg("I", "removing file <$_>"); - unlink $_; - } - if (!@gfxbootfiles) { - my $msg = "No gfxboot.cfg file found! " - . "This _MIGHT_ be ok for S/390. " - . "Please verify package(s)"; - $this->logMsg("W", $msg); + $this -> updateEFIGrubConfig($repoloc); + $retval = $this -> updateGraphicsBootConfig ( + \@gfxbootfiles, $repoloc, $srv, $path + ); return $retval; - } - $this -> updateEFIGrubConfig($repoloc); - $retval = $this -> updateGraphicsBootConfig ( - \@gfxbootfiles, $repoloc, $srv, $path - ); - return $retval; } sub updateGraphicsBootConfig { - my $this = shift; - my $gfxbootfiles = shift; - my $repoloc = shift; - my $srv = shift; - my $path = shift; - my $retval = 0; - foreach my $cfg(@{$gfxbootfiles}) { - $this->logMsg("I", "Processing file <$cfg>: "); - my $F = FileHandle -> new(); - if (! $F -> open($cfg)) { - $this->logMsg("E", "Cant open file <$cfg>!"); - next; + my $this = shift; + my $gfxbootfiles = shift; + my $repoloc = shift; + my $srv = shift; + my $path = shift; + my $retval = 0; + foreach my $cfg(@{$gfxbootfiles}) { + $this->logMsg("I", "Processing file <$cfg>: "); + my $F = FileHandle -> new(); + if (! $F -> open($cfg)) { + $this->logMsg("E", "Cant open file <$cfg>!"); + next; + } + my @lines = <$F>; + $F -> close(); + chomp(@lines); + my $install = -1; + my $ihs = -1; + my $ihp = -1; + my $i = -1; + foreach my $line(@lines) { + $i++; + next if $line !~ m{^install}x; + if($line =~ m{^install=.*}x) { + $install = $i; + } + if ($line =~ m{^install.http.server=+}x) { + $ihs = $i; + } + if($line =~ m{^install.http.path=+}x) { + $ihp = $i; + } + } + if(!$repoloc) { + if($install == -1) { + push @lines, "install=slp"; + } else { + $lines[$install] =~ s{^install.*}{install=slp}x; + } + } elsif($srv) { + if($ihs == -1) { + push @lines, "install.http.server=$srv"; + } else { + $lines[$ihs] =~ s{^(install.http.server).*}{$1=$srv}x; + } + if($ihp == -1) { + push @lines, "install.http.path=$path"; + } else { + $lines[$ihp] =~ s{^(install.http.path).*}{$1=$path}x; + } + if($install == -1) { + push @lines, "install=http"; + } else { + $lines[$install] =~ s{^install.*}{install=http}x; + } + } + unlink $cfg; + if (! $F -> open(">$cfg")) { + $this->logMsg("E", "Cant open file for writing <$cfg>!"); + next; + } + foreach(@lines) { + print $F "$_\n"; + } + $F -> close(); + $retval++; } - my @lines = <$F>; - $F -> close(); - chomp(@lines); - my $install = -1; - my $ihs = -1; - my $ihp = -1; - my $i = -1; - foreach my $line(@lines) { - $i++; - next if $line !~ m{^install}x; - if($line =~ m{^install=.*}x) { - $install = $i; - } - if ($line =~ m{^install.http.server=+}x) { - $ihs = $i; - } - if($line =~ m{^install.http.path=+}x) { - $ihp = $i; - } + return $retval; +} + +sub updateEFIGrubConfig { + my $this = shift; + my $repoloc = shift; + my $grubcfg = $this->collect() + ->basesubdirs()->{1} . "/EFI/BOOT/grub.cfg"; + if (! -f $grubcfg ) { + $this->logMsg("I", "no grub.cfg at <$grubcfg>"); + return; } - if(!$repoloc) { - if($install == -1) { - push @lines, "install=slp"; - } else { - $lines[$install] =~ s{^install.*}{install=slp}x; - } - } elsif($srv) { - if($ihs == -1) { - push @lines, "install.http.server=$srv"; - } else { - $lines[$ihs] =~ s{^(install.http.server).*}{$1=$srv}x; - } - if($ihp == -1) { - push @lines, "install.http.path=$path"; - } else { - $lines[$ihp] =~ s{^(install.http.path).*}{$1=$path}x; - } - if($install == -1) { - push @lines, "install=http"; - } else { - $lines[$install] =~ s{^install.*}{install=http}x; - } + $this->logMsg("I", "editing <$grubcfg>"); + my $IN = FileHandle -> new(); + my $OUT = FileHandle -> new(); + if (! $IN -> open($grubcfg)) { + croak "Cant open file for reading $grubcfg: $!"; } - unlink $cfg; - if (! $F -> open(">$cfg")) { - $this->logMsg("E", "Cant open file for writing <$cfg>!"); - next; + if (! $OUT -> open(">$grubcfg.new")) { + croak "Cant open file for writing $grubcfg.new: $!"; } - foreach(@lines) { - print $F "$_\n"; + while(<$IN>) { + my $line = $_; + chomp $line; + $this->logMsg("I", "-$line"); + $line =~ + s,(linuxefi /boot/x86_64/loader/linux),$1 install=$repoloc,x; + $this->logMsg("I", "+$line"); + print $OUT "$line\n"; } - $F -> close(); - $retval++; - } - return $retval; -} - -sub updateEFIGrubConfig { - my $this = shift; - my $repoloc = shift; - my $grubcfg = $this->collect() - ->basesubdirs()->{1} . "/EFI/BOOT/grub.cfg"; - if (! -f $grubcfg ) { - $this->logMsg("I", "no grub.cfg at <$grubcfg>"); - return; - } - $this->logMsg("I", "editing <$grubcfg>"); - my $IN = FileHandle -> new(); - my $OUT = FileHandle -> new(); - if (! $IN -> open($grubcfg)) { - croak "Cant open file for reading $grubcfg: $!"; - } - if (! $OUT -> open(">$grubcfg.new")) { - croak "Cant open file for writing $grubcfg.new: $!"; - } - while(<$IN>) { - my $line = $_; - chomp $line; - $this->logMsg("I", "-$line"); - $line =~ - s,(linuxefi /boot/x86_64/loader/linux),$1 install=$repoloc,x; - $this->logMsg("I", "+$line"); - print $OUT "$line\n"; - } - $OUT -> close(); - $IN -> close(); - $this -> callCmd("diff -u $grubcfg $grubcfg.new"); - rename("$grubcfg.new", $grubcfg); - return $this; + $OUT -> close(); + $IN -> close(); + $this -> callCmd("diff -u $grubcfg $grubcfg.new"); + rename("$grubcfg.new", $grubcfg); + return $this; } sub find_cb { - my $this = shift; - return if not ref($this); + my $this = shift; + return if not ref($this); - my $pat = shift; - my $listref = shift; - if(not defined($listref) or not defined($pat)) { - return; - } - if($File::Find::name =~ m{$pat}x) { - push @{$listref}, $File::Find::name; - } - return $this; + my $pat = shift; + my $listref = shift; + if(not defined($listref) or not defined($pat)) { + return; + } + if($File::Find::name =~ m{$pat}x) { + push @{$listref}, $File::Find::name; + } + return $this; } 1; diff --git a/distribution/kiwi-instsource-plugins-SLE-12/KIWIPromoDVDPlugin.pm b/distribution/kiwi-instsource-plugins-SLE-12/KIWIPromoDVDPlugin.pm index 11873803d..768d304cb 100644 --- a/distribution/kiwi-instsource-plugins-SLE-12/KIWIPromoDVDPlugin.pm +++ b/distribution/kiwi-instsource-plugins-SLE-12/KIWIPromoDVDPlugin.pm @@ -28,94 +28,94 @@ use File::Find; use File::Basename; sub new { - # ... - # Create a new KIWIPromoDVDPlugin object - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new($handler); - bless ($this, $class); + # ... + # Create a new KIWIPromoDVDPlugin object + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new($handler); + bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if ((! $configpath) || (! $configfile)) { - $this->logMsg("E", - "wrong parameters in plugin initialisation\n" + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if ((! $configpath) || (! $configfile)) { + $this->logMsg("E", + "wrong parameters in plugin initialisation\n" + ); + return; + } + ## plugin content: + #----------------- + #[base] + # name = KIWIEulaPlugin + # order = 3 + # defaultenable = 1 + # + #[target] + # targetfile = content + # targetdir = $PRODUCT_DIR + # media = (list of numbers XOR "all") + # + my $ini = Config::IniFiles -> new( + -file => "$configpath/$configfile" ); - return; - } - ## plugin content: - #----------------- - #[base] - # name = KIWIEulaPlugin - # order = 3 - # defaultenable = 1 - # - #[target] - # targetfile = content - # targetdir = $PRODUCT_DIR - # media = (list of numbers XOR "all") - # - my $ini = Config::IniFiles -> new( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base', 'name'); - my $order = $ini->val('base', 'order'); - my $enable = $ini->val('base', 'defaultenable'); - # if any of those isn't set, complain! - if(not defined($name) - or not defined($order) - or not defined($enable) - ) { - $this->logMsg("E", - "Plugin ini file <$config> seems broken!\n" - ); - return; - } - $this->name($name); - $this->order($order); - if($enable != 0) { - $this->ready(1); - } - return $this; + my $name = $ini->val('base', 'name'); + my $order = $ini->val('base', 'order'); + my $enable = $ini->val('base', 'defaultenable'); + # if any of those isn't set, complain! + if(not defined($name) + or not defined($order) + or not defined($enable) + ) { + $this->logMsg("E", + "Plugin ini file <$config> seems broken!\n" + ); + return; + } + $this->name($name); + $this->order($order); + if($enable != 0) { + $this->ready(1); + } + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - if($this->{m_ready} == 0) { - return 0; - } - my $ismini = $this->collect() - ->productData()->getVar("FLAVOR"); - if(not defined($ismini)) { - $this->logMsg("W", "FLAVOR not set?"); - return 0; - } - if ($ismini !~ m{dvd-promo}ix) { + my $this = shift; + if(not ref($this)) { + return; + } + if($this->{m_ready} == 0) { + return 0; + } + my $ismini = $this->collect() + ->productData()->getVar("FLAVOR"); + if(not defined($ismini)) { + $this->logMsg("W", "FLAVOR not set?"); + return 0; + } + if ($ismini !~ m{dvd-promo}ix) { + return 0; + } + my $medium = $this->collect() + ->productData()->getVar("MEDIUM_NAME"); + find( sub { + if (m/initrd.liv/x) { + my $cd = $File::Find::name; + system("mkdir -p boot; echo $medium > boot/mbrid"); + system("echo boot/mbrid | cpio --create --format=newc --quiet | gzip -9 -f >> $cd"); + system("rm boot/mbrid; rmdir boot"); + $this->logMsg("I", "updated $cd"); + } + }, + $this->handler()->collect()->basedir() + ); return 0; - } - my $medium = $this->collect() - ->productData()->getVar("MEDIUM_NAME"); - find( sub { - if (m/initrd.liv/x) { - my $cd = $File::Find::name; - system("mkdir -p boot; echo $medium > boot/mbrid"); - system("echo boot/mbrid | cpio --create --format=newc --quiet | gzip -9 -f >> $cd"); - system("rm boot/mbrid; rmdir boot"); - $this->logMsg("I", "updated $cd"); - } - }, - $this->handler()->collect()->basedir() - ); - return 0; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-11-1/KIWIBasePlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-11-1/KIWIBasePlugin.pm index 370a7ecff..a980922a2 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-11-1/KIWIBasePlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-11-1/KIWIBasePlugin.pm @@ -25,222 +25,222 @@ use IPC::Open3; use Symbol; sub new { - my $class = shift; - my $this = { - m_handler => undef, - m_name => "KIWIBasePlugin", - m_order => undef, - m_requireddirs=> [], - m_descr => [], - m_requires => [], - m_ready => 0, - m_collect => 0 - }; - bless ($this, $class); - $this->{m_handler} = shift; - if (! ref($this->{m_handler})) { - return; - } - $this->{m_collect} = $this->{m_handler}->collect(); - return $this; + my $class = shift; + my $this = { + m_handler => undef, + m_name => "KIWIBasePlugin", + m_order => undef, + m_requireddirs=> [], + m_descr => [], + m_requires => [], + m_ready => 0, + m_collect => 0 + }; + bless ($this, $class); + $this->{m_handler} = shift; + if (! ref($this->{m_handler})) { + return; + } + $this->{m_collect} = $this->{m_handler}->collect(); + return $this; } sub name { - my $this = shift; - my $name = shift; - if (! ref($this)) { - return; - } - my $oldname = $this->{m_name}; - if($name) { - $this->{m_name} = $name; - } - return $oldname; + my $this = shift; + my $name = shift; + if (! ref($this)) { + return; + } + my $oldname = $this->{m_name}; + if($name) { + $this->{m_name} = $name; + } + return $oldname; } sub order { - my $this = shift; - my $order = shift; - if (! ref($this)) { - return; - } - my $oldorder = $this->{m_order}; - if($order) { - $this->{m_order} = $order; - } - return $oldorder; + my $this = shift; + my $order = shift; + if (! ref($this)) { + return; + } + my $oldorder = $this->{m_order}; + if($order) { + $this->{m_order} = $order; + } + return $oldorder; } sub ready { - my $this = shift; - my $ready = shift; - if (! ref($this)) { - return; - } - my $oldready = $this->{m_ready}; - if($ready) { - $this->{m_ready} = $ready; - } - return $oldready; + my $this = shift; + my $ready = shift; + if (! ref($this)) { + return; + } + my $oldready = $this->{m_ready}; + if($ready) { + $this->{m_ready} = $ready; + } + return $oldready; } sub requiredDirs { - my @params = @_; - my $this = shift @params; - my @dirs = @params; - if (! ref($this)) { - return; - } - my @oldrd = @{$this->{m_requireddirs}}; - foreach my $entry(@params) { - push @{$this->{m_requireddirs}}, $entry; - } - return @oldrd; + my @params = @_; + my $this = shift @params; + my @dirs = @params; + if (! ref($this)) { + return; + } + my @oldrd = @{$this->{m_requireddirs}}; + foreach my $entry(@params) { + push @{$this->{m_requireddirs}}, $entry; + } + return @oldrd; } sub description { - my @params = @_; - my $this = shift @params; - my @descr= @params; - if (! ref($this)) { - return; - } - my @olddesc = $this->{m_descr}; - foreach my $entry(@descr) { - push @{$this->{m_descr}}, $entry; - } - return @olddesc; + my @params = @_; + my $this = shift @params; + my @descr= @params; + if (! ref($this)) { + return; + } + my @olddesc = $this->{m_descr}; + foreach my $entry(@descr) { + push @{$this->{m_descr}}, $entry; + } + return @olddesc; } sub requires { - my @params = @_; - my $this = shift; - my @reqs = @params; - if (! ref($this)) { - return; - } - my @oldreq = $this->{m_requires}; - foreach my $entry(@reqs) { - push @{$this->{m_requires}}, $entry; - } - return @oldreq; + my @params = @_; + my $this = shift; + my @reqs = @params; + if (! ref($this)) { + return; + } + my @oldreq = $this->{m_requires}; + foreach my $entry(@reqs) { + push @{$this->{m_requires}}, $entry; + } + return @oldreq; } sub handler { - my $this = shift; - if (! ref($this)) { - return; - } - return $this->{m_handler}; + my $this = shift; + if (! ref($this)) { + return; + } + return $this->{m_handler}; } sub collect { - my $this = shift; - if (! ref($this)) { - return; - } - return $this->{m_collect}; + my $this = shift; + if (! ref($this)) { + return; + } + return $this->{m_collect}; } sub logMsg { - my $this = shift; - if (! ref($this)) { - return; - } - my $type = shift; - my $msg = shift; - if ((! defined($type)) || (! defined($msg))) { - return; - } - $this->{m_collect}->logMsg($type, $msg); - return $this; + my $this = shift; + if (! ref($this)) { + return; + } + my $type = shift; + my $msg = shift; + if ((! defined($type)) || (! defined($msg))) { + return; + } + $this->{m_collect}->logMsg($type, $msg); + return $this; } sub callCmd { - my $this = shift; - my $cmd = shift; - my $BUFSIZE = 1024; - my @result; - my @errors; - my $result_buf; - my $errors_buf; - my ($CHILDWRITE, $CHILDSTDOUT, $CHILDSTDERR) = map { gensym } 1..3; - my $pid = open3 ( - $CHILDWRITE, $CHILDSTDOUT, $CHILDSTDERR, "$cmd" - ); - my $sel = IO::Select->new(); - $sel->add($CHILDSTDOUT); - $sel->add($CHILDSTDERR); - while($sel->count()) { - foreach my $handle ($sel->can_read()) { - my $bytes_read = ''; - my $chunk_result = sysread($handle, $bytes_read, $BUFSIZE); - if ($handle == $CHILDSTDOUT) { - $result_buf .= $bytes_read; - } else { - $errors_buf .= $bytes_read; - } - if ($chunk_result == 0) { - $sel->remove($handle); - next; - } - } - } - if ($result_buf) { - @result = split (/\n/x,$result_buf); - chomp @result; - } - if ($errors_buf) { - @errors = split (/\n/x,$errors_buf); - chomp @errors; - } - waitpid( $pid, 0 ); - my $status = $? >> 8; - return [$status,\@result,\@errors]; + my $this = shift; + my $cmd = shift; + my $BUFSIZE = 1024; + my @result; + my @errors; + my $result_buf; + my $errors_buf; + my ($CHILDWRITE, $CHILDSTDOUT, $CHILDSTDERR) = map { gensym } 1..3; + my $pid = open3 ( + $CHILDWRITE, $CHILDSTDOUT, $CHILDSTDERR, "$cmd" + ); + my $sel = IO::Select->new(); + $sel->add($CHILDSTDOUT); + $sel->add($CHILDSTDERR); + while($sel->count()) { + foreach my $handle ($sel->can_read()) { + my $bytes_read = ''; + my $chunk_result = sysread($handle, $bytes_read, $BUFSIZE); + if ($handle == $CHILDSTDOUT) { + $result_buf .= $bytes_read; + } else { + $errors_buf .= $bytes_read; + } + if ($chunk_result == 0) { + $sel->remove($handle); + next; + } + } + } + if ($result_buf) { + @result = split (/\n/x,$result_buf); + chomp @result; + } + if ($errors_buf) { + @errors = split (/\n/x,$errors_buf); + chomp @errors; + } + waitpid( $pid, 0 ); + my $status = $? >> 8; + return [$status,\@result,\@errors]; } sub getSubdirLists { - # ... - # method to distinguish debugmedia and ftp media subdirectories. - # --- - my $this = shift; - if (! ref($this)) { - return; - } - my @ret = (); - my $coll = $this->{m_collect}; - my $dbm = $coll->productData()->getOpt("DEBUGMEDIUM"); - my $flavor = $coll->productData()->getVar("FLAVOR"); - my $basesubdirs = $coll->basesubdirs(); - my @paths = values(%{$basesubdirs}); - @paths = grep { $_ =~ /[^0]$/x } @paths; # remove Media0 - my %path = map { $_ => 1 } @paths; - if($flavor =~ m{ftp}i) { - # 1: FTP tree, all subdirs get a separate call. - my @d = sort(keys(%path)); - foreach(@d) { - my @tmp; - push @tmp, $_; - push @ret, \@tmp; - } - } elsif($dbm >= 2) { - # 2: non-ftp tree, may have separate DEBUGMEDIUM specified - my @deb; - my @rest; - foreach my $d(keys(%path)) { - if ($d =~ m{.*$dbm$}x) { - push @deb, $d; - } else { - push @rest, $d; - } - } - push @ret, \@deb; - push @ret, \@rest; - } else { - my @d = keys(%path); - push @ret, \@d; - } - return @ret; + # ... + # method to distinguish debugmedia and ftp media subdirectories. + # --- + my $this = shift; + if (! ref($this)) { + return; + } + my @ret = (); + my $coll = $this->{m_collect}; + my $dbm = $coll->productData()->getOpt("DEBUGMEDIUM"); + my $flavor = $coll->productData()->getVar("FLAVOR"); + my $basesubdirs = $coll->basesubdirs(); + my @paths = values(%{$basesubdirs}); + @paths = grep { $_ =~ /[^0]$/x } @paths; # remove Media0 + my %path = map { $_ => 1 } @paths; + if($flavor =~ m{ftp}i) { + # 1: FTP tree, all subdirs get a separate call. + my @d = sort(keys(%path)); + foreach(@d) { + my @tmp; + push @tmp, $_; + push @ret, \@tmp; + } + } elsif($dbm >= 2) { + # 2: non-ftp tree, may have separate DEBUGMEDIUM specified + my @deb; + my @rest; + foreach my $d(keys(%path)) { + if ($d =~ m{.*$dbm$}x) { + push @deb, $d; + } else { + push @rest, $d; + } + } + push @ret, \@deb; + push @ret, \@rest; + } else { + my @d = keys(%path); + push @ret, \@d; + } + return @ret; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-11-1/KIWIContentPlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-11-1/KIWIContentPlugin.pm index d22b89a5a..3ff88aa5a 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-11-1/KIWIContentPlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-11-1/KIWIContentPlugin.pm @@ -27,152 +27,152 @@ use Data::Dumper; use Config::IniFiles; sub new { - # ... - # Create a new KIWIContentPlugin object - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new ($handler); - bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if(not defined($configpath) or not defined($configfile)) { - $this->logMsg("E", "wrong parameters in plugin initialisation\n"); - return; - } - ## Gather all necessary information from the inifile: - #=== - # Issue: why duplicate code here? Why not put it into the base class? - # Answer: Each plugin may have different options. Some only need a - # target filename, whilst some others may need much more. I don't want - # to specify a complicated framework for the plugin, it shall just be - # a simple straightforward way to get information into the plugin. - # The idea is that the people who decide on the metadata write - # the plugin, and therefore damn well know what it needs and what not. - # I'm definitely not bothering PMs with Yet Another File Specification - #--- - ## plugin content: - #----------------- - #[base] - # name = KIWIEulaPlugin - # order = 3 - # defaultenable = 1 - # - #[target] - # targetfile = content - # targetdir = $PRODUCT_DIR - # media = (list of numbers XOR "all") - # - my $ini = Config::IniFiles -> new( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base', 'name'); # scalar value - my $order = $ini->val('base', 'order'); # scalar value - my $enable = $ini->val('base', 'defaultenable'); # scalar value - my $target = $ini->val('target', 'targetfile'); - my $targetdir = $ini->val('target', 'targetdir'); - my @media = $ini->val('target', 'media'); - # if any of those isn't set, complain! - if(not defined($name) - or not defined($order) - or not defined($enable) - or not defined($target) - or not defined($targetdir) - or not @media - ) { - $this->logMsg("E", "Plugin ini file <$config> seems broken!"); - return; - } - $this->name($name); - $this->order($order); - $targetdir = $this->collect()->productData()->_substitute("$targetdir"); - if($enable != 0) { - $this->ready(1); - } - $this->requiredDirs($targetdir); - $this->{m_target} = $target; - $this->{m_targetdir} = $targetdir; - @{$this->{m_media}} = @media; - return $this; + # ... + # Create a new KIWIContentPlugin object + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new ($handler); + bless ($this, $class); + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if(not defined($configpath) or not defined($configfile)) { + $this->logMsg("E", "wrong parameters in plugin initialisation\n"); + return; + } + ## Gather all necessary information from the inifile: + #=== + # Issue: why duplicate code here? Why not put it into the base class? + # Answer: Each plugin may have different options. Some only need a + # target filename, whilst some others may need much more. I don't want + # to specify a complicated framework for the plugin, it shall just be + # a simple straightforward way to get information into the plugin. + # The idea is that the people who decide on the metadata write + # the plugin, and therefore damn well know what it needs and what not. + # I'm definitely not bothering PMs with Yet Another File Specification + #--- + ## plugin content: + #----------------- + #[base] + # name = KIWIEulaPlugin + # order = 3 + # defaultenable = 1 + # + #[target] + # targetfile = content + # targetdir = $PRODUCT_DIR + # media = (list of numbers XOR "all") + # + my $ini = Config::IniFiles -> new( + -file => "$configpath/$configfile" + ); + my $name = $ini->val('base', 'name'); # scalar value + my $order = $ini->val('base', 'order'); # scalar value + my $enable = $ini->val('base', 'defaultenable'); # scalar value + my $target = $ini->val('target', 'targetfile'); + my $targetdir = $ini->val('target', 'targetdir'); + my @media = $ini->val('target', 'media'); + # if any of those isn't set, complain! + if(not defined($name) + or not defined($order) + or not defined($enable) + or not defined($target) + or not defined($targetdir) + or not @media + ) { + $this->logMsg("E", "Plugin ini file <$config> seems broken!"); + return; + } + $this->name($name); + $this->order($order); + $targetdir = $this->collect()->productData()->_substitute("$targetdir"); + if($enable != 0) { + $this->ready(1); + } + $this->requiredDirs($targetdir); + $this->{m_target} = $target; + $this->{m_targetdir} = $targetdir; + @{$this->{m_media}} = @media; + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - my $retval = 0; - if($this->{m_ready} == 0) { - return $retval; - } - my $descrdir = $this->collect()->productData()->getInfo("DESCRDIR"); - if ((! $descrdir) || ($descrdir eq "/")) { - $this->logMsg("I", - "Empty or (/) descrdir, skipping content file creation" - ); - return $retval; - } - my @targetmedia = $this->collect()->getMediaNumbers(); - my %targets; - if($this->{m_media}->[0] =~ m{all}i) { - %targets = map { $_ => 1 } @targetmedia; - } else { - foreach my $cd(@{$this->{m_media}}) { - if(grep { $cd } @targetmedia) { - $targets{$cd} = 1; - } + my $this = shift; + if(not ref($this)) { + return; } - } - my $info = $this->collect()->productData()->getSet("prodinfo"); - if(!$info) { - $this->logMsg("E", "data set named seems to be broken:"); - $this->logMsg("E", Dumper($info)); - return $retval; - } - foreach my $cd(keys(%targets)) { - $this->logMsg("I", "Creating content file on medium <$cd>:"); - my $dir = $this->collect()->basesubdirs()->{$cd}; - my $contentfile = "$dir/$this->{m_target}"; - my $CONT = FileHandle -> new(); - if (! $CONT -> open(">$contentfile")) { - $this->logMsg("E", "Cannot create <$contentfile> on medium <$cd>"); - next; + my $retval = 0; + if($this->{m_ready} == 0) { + return $retval; + } + my $descrdir = $this->collect()->productData()->getInfo("DESCRDIR"); + if ((! $descrdir) || ($descrdir eq "/")) { + $this->logMsg("I", + "Empty or (/) descrdir, skipping content file creation" + ); + return $retval; } - # compute maxlen: - my $len = 0; - foreach(keys(%{$info})) { - my $l = length($info->{$_}->[0]); - $len = ($l>$len)?$l:$len; + my @targetmedia = $this->collect()->getMediaNumbers(); + my %targets; + if($this->{m_media}->[0] =~ m{all}i) { + %targets = map { $_ => 1 } @targetmedia; + } else { + foreach my $cd(@{$this->{m_media}}) { + if(grep { $cd } @targetmedia) { + $targets{$cd} = 1; + } + } } - $len++; - # ftp media special mode ? - my $coll = $this->{m_collect}; - my $flavor = $coll->productData()->getVar("FLAVOR"); - my $ftpmode = ($flavor =~ m{ftp}i); + my $info = $this->collect()->productData()->getSet("prodinfo"); + if(!$info) { + $this->logMsg("E", "data set named seems to be broken:"); + $this->logMsg("E", Dumper($info)); + return $retval; + } + foreach my $cd(keys(%targets)) { + $this->logMsg("I", "Creating content file on medium <$cd>:"); + my $dir = $this->collect()->basesubdirs()->{$cd}; + my $contentfile = "$dir/$this->{m_target}"; + my $CONT = FileHandle -> new(); + if (! $CONT -> open(">$contentfile")) { + $this->logMsg("E", "Cannot create <$contentfile> on medium <$cd>"); + next; + } + # compute maxlen: + my $len = 0; + foreach(keys(%{$info})) { + my $l = length($info->{$_}->[0]); + $len = ($l>$len)?$l:$len; + } + $len++; + # ftp media special mode ? + my $coll = $this->{m_collect}; + my $flavor = $coll->productData()->getVar("FLAVOR"); + my $ftpmode = ($flavor =~ m{ftp}i); - my %ftpcontentkeys = map {$_ => 1} qw{ - CONTENTSTYLE REPOID DESCRDIR DATADIR VENDOR - }; - foreach my $i(sort { $a <=> $b } keys(%{$info})) { - # ftp medias beside first one should get provide the product - if ( !$ftpmode || $cd eq "1" || $ftpcontentkeys{$info->{$i}->[0]}) { - print $CONT sprintf( - '%-*s %s', $len, $info->{$i}->[0], $info->{$i}->[1] - )."\n"; - } + my %ftpcontentkeys = map {$_ => 1} qw{ + CONTENTSTYLE REPOID DESCRDIR DATADIR VENDOR + }; + foreach my $i(sort { $a <=> $b } keys(%{$info})) { + # ftp medias beside first one should get provide the product + if ( !$ftpmode || $cd eq "1" || $ftpcontentkeys{$info->{$i}->[0]}) { + print $CONT sprintf( + '%-*s %s', $len, $info->{$i}->[0], $info->{$i}->[1] + )."\n"; + } + } + $CONT -> close(); + $this->logMsg( + "I", "Wrote file <$contentfile> for medium <$cd> successfully." + ); + $retval++; } - $CONT -> close(); - $this->logMsg( - "I", "Wrote file <$contentfile> for medium <$cd> successfully." - ); - $retval++; - } - return $retval; + return $retval; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-11-1/KIWIDescrPlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-11-1/KIWIDescrPlugin.pm index 7d389a799..5ebbf773b 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-11-1/KIWIDescrPlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-11-1/KIWIDescrPlugin.pm @@ -28,207 +28,207 @@ use Data::Dumper; use Cwd 'abs_path'; sub new { - # ... - # Create a new KIWIDescrPlugin object - # creates patterns file - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new($handler); - bless ($this, $class); + # ... + # Create a new KIWIDescrPlugin object + # creates patterns file + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new($handler); + bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if((! $configpath) || (! $configfile)) { - $this->logMsg("E", - "wrong parameters in plugin initialisation" - ); - return; - } - my $ini = Config::IniFiles -> new( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base' , 'name'); - my $order = $ini->val('base' , 'order'); - my $tool = $ini->val('base' , 'tool'); - my $createrepo = $ini->val('base' , 'createrepo'); - my $rezip = $ini->val('base' , 'rezip'); - my $tdir = $ini->val('base' , 'tooldir'); - my $tpack = $ini->val('base' , 'toolpack'); - my $enable = $ini->val('base' , 'defaultenable'); - my $pdbfiles = $ini->val('options', 'pdbfiles'); - my @params = $ini->val('options', 'parameter'); - my @langs = $ini->val('options', 'language'); - my $gzip = $ini->val('target' , 'compress'); - # if any of those isn't set, complain! - if(not defined($name) - or not defined($order) - or not defined($tool) - or not defined($createrepo) - or not defined($rezip) - or not defined($tdir) - or not defined($tpack) - or not defined($enable) - or not defined($pdbfiles) - or not defined($gzip) - or not (@params) - ) { - $this->logMsg("E", - "Plugin ini file <$config> seems broken!" - ); - return; - } - # sanity check for tools' existence: - if(not( -f "$tdir/$tool" and -x "$tdir/$tool")) { - $this->logMsg("E", - "Plugin <$name>: tool <$tdir/$tool> is not executable!" - ); - $this->logMsg("I", - "Check if package <$tpack> is installed." + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if((! $configpath) || (! $configfile)) { + $this->logMsg("E", + "wrong parameters in plugin initialisation" + ); + return; + } + my $ini = Config::IniFiles -> new( + -file => "$configpath/$configfile" ); - return; - } - my $params = ""; - foreach my $p(@params) { - $p = $this->collect()->productData()->_substitute("$p"); - $params .= "$p "; - } - # add local kwd files as argument - my $extrafile = abs_path($this->collect()->{m_xml}->{xmlOrigFile}); - $extrafile =~ s/.kiwi$/.kwd/x; - if (-f $extrafile) { - $this->logMsg("W", "Found extra tags file $extrafile."); - $params .= "-T $extrafile "; - } - $this->name($name); - $this->order($order); - $this->{m_tool} = $tool; - $this->{m_tooldir} = $tdir; - $this->{m_toolpack} = $tpack; - $this->{m_pdbfiles} = $pdbfiles; - $this->{m_createrepo} = $createrepo; - $this->{m_rezip} = $rezip; - $this->{m_params} = $params; - $this->{m_languages} = join(' ', @langs); - $this->{m_compress} = $gzip; - if($enable != 0) { - $this->ready(1); - } - return $this; + my $name = $ini->val('base' , 'name'); + my $order = $ini->val('base' , 'order'); + my $tool = $ini->val('base' , 'tool'); + my $createrepo = $ini->val('base' , 'createrepo'); + my $rezip = $ini->val('base' , 'rezip'); + my $tdir = $ini->val('base' , 'tooldir'); + my $tpack = $ini->val('base' , 'toolpack'); + my $enable = $ini->val('base' , 'defaultenable'); + my $pdbfiles = $ini->val('options', 'pdbfiles'); + my @params = $ini->val('options', 'parameter'); + my @langs = $ini->val('options', 'language'); + my $gzip = $ini->val('target' , 'compress'); + # if any of those isn't set, complain! + if(not defined($name) + or not defined($order) + or not defined($tool) + or not defined($createrepo) + or not defined($rezip) + or not defined($tdir) + or not defined($tpack) + or not defined($enable) + or not defined($pdbfiles) + or not defined($gzip) + or not (@params) + ) { + $this->logMsg("E", + "Plugin ini file <$config> seems broken!" + ); + return; + } + # sanity check for tools' existence: + if(not( -f "$tdir/$tool" and -x "$tdir/$tool")) { + $this->logMsg("E", + "Plugin <$name>: tool <$tdir/$tool> is not executable!" + ); + $this->logMsg("I", + "Check if package <$tpack> is installed." + ); + return; + } + my $params = ""; + foreach my $p(@params) { + $p = $this->collect()->productData()->_substitute("$p"); + $params .= "$p "; + } + # add local kwd files as argument + my $extrafile = abs_path($this->collect()->{m_xml}->{xmlOrigFile}); + $extrafile =~ s/.kiwi$/.kwd/x; + if (-f $extrafile) { + $this->logMsg("W", "Found extra tags file $extrafile."); + $params .= "-T $extrafile "; + } + $this->name($name); + $this->order($order); + $this->{m_tool} = $tool; + $this->{m_tooldir} = $tdir; + $this->{m_toolpack} = $tpack; + $this->{m_pdbfiles} = $pdbfiles; + $this->{m_createrepo} = $createrepo; + $this->{m_rezip} = $rezip; + $this->{m_params} = $params; + $this->{m_languages} = join(' ', @langs); + $this->{m_compress} = $gzip; + if($enable != 0) { + $this->ready(1); + } + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - my $retval = 0; - # sanity check: - if($this->{m_ready} == 0) { - return $retval; - } - my $coll = $this->{m_collect}; - my $basesubdirs = $coll->basesubdirs(); - if(not defined($basesubdirs)) { - ## prevent crash when dereferencing - $this->logMsg("E", - " is undefined! Skipping <$this->name()>" - ); + my $this = shift; + if(not ref($this)) { + return; + } + my $retval = 0; + # sanity check: + if($this->{m_ready} == 0) { + return $retval; + } + my $coll = $this->{m_collect}; + my $basesubdirs = $coll->basesubdirs(); + if(not defined($basesubdirs)) { + ## prevent crash when dereferencing + $this->logMsg("E", + " is undefined! Skipping <$this->name()>" + ); + return $retval; + } + foreach my $dirlist($this->getSubdirLists()) { + my ($s,$m) = $this->executeDir(sort @{$dirlist}); + } return $retval; - } - foreach my $dirlist($this->getSubdirLists()) { - my ($s,$m) = $this->executeDir(sort @{$dirlist}); - } - return $retval; } sub executeDir { - my @params = @_; - my $this = shift @params; - my @paths = @params; - my $retval = 0; - my $status; - my $call; - if(!@paths) { - $this->logMsg("W", "Empty path list!"); - return $retval; - } - my $coll = $this->{m_collect}; - my $datadir = $coll->productData()->getInfo("DATADIR"); - my $descrdir = $coll->productData()->getInfo("DESCRDIR"); - my $createrepomd = $coll->productData()->getVar("CREATE_REPOMD"); - my $targetdir = $paths[0]."/".$descrdir; - ## this bits creates a parameter string from a list of directories: - # param = -d -d ... - # the order is important. Idea: use map to make hash => -d - # for all subdirs not ending with "0" (those are for metafile - # unpacking only). The result is evaluated in list context be reverse, - # so there's a list looking like " -d ... -d" which is - # reversed again, making the result '-d', '', ..., '-d', ''", - # after the join as string. - # ---- - my $pathlist = "-d ".join(' -d ', map{$_."/".$datadir}(@paths)); - $this->logMsg("I", - "Calling ".$this->name()." for directories <@paths>:" - ); - my $cmd = "$this->{m_tooldir}/$this->{m_tool} " - . "$this->{m_pdbfiles} $pathlist $this->{m_params} " - . "$this->{m_languages} -o " - . $paths[0] - . "/".$descrdir; - $this->logMsg("I", "Executing command <$cmd>"); - $call = $this -> callCmd($cmd); - $status = $call->[0]; - if($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called <$cmd> exit status: <$status> output: $out" - ); - return $retval; - } - if ( $createrepomd eq "true" ) { - foreach my $p (@paths) { - my $cmd_repo = "$this->{m_createrepo} $p/$datadir "; - $this->logMsg("I", "Executing command <$cmd_repo>"); - $call = $this -> callCmd($cmd_repo); - $status = $call->[0]; - if ($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called <$cmd_repo> exit status: <$status> output: $out" - ); + my @params = @_; + my $this = shift @params; + my @paths = @params; + my $retval = 0; + my $status; + my $call; + if(!@paths) { + $this->logMsg("W", "Empty path list!"); return $retval; - } - my $cmd_zipp = "$this->{m_rezip} $p/$datadir "; - $this->logMsg("I", "Executing command <$cmd_zipp>"); - $call = $this -> callCmd($cmd_zipp); - $status = $call->[0]; - if($status) { + } + my $coll = $this->{m_collect}; + my $datadir = $coll->productData()->getInfo("DATADIR"); + my $descrdir = $coll->productData()->getInfo("DESCRDIR"); + my $createrepomd = $coll->productData()->getVar("CREATE_REPOMD"); + my $targetdir = $paths[0]."/".$descrdir; + ## this bits creates a parameter string from a list of directories: + # param = -d -d ... + # the order is important. Idea: use map to make hash => -d + # for all subdirs not ending with "0" (those are for metafile + # unpacking only). The result is evaluated in list context be reverse, + # so there's a list looking like " -d ... -d" which is + # reversed again, making the result '-d', '', ..., '-d', ''", + # after the join as string. + # ---- + my $pathlist = "-d ".join(' -d ', map{$_."/".$datadir}(@paths)); + $this->logMsg("I", + "Calling ".$this->name()." for directories <@paths>:" + ); + my $cmd = "$this->{m_tooldir}/$this->{m_tool} " + . "$this->{m_pdbfiles} $pathlist $this->{m_params} " + . "$this->{m_languages} -o " + . $paths[0] + . "/".$descrdir; + $this->logMsg("I", "Executing command <$cmd>"); + $call = $this -> callCmd($cmd); + $status = $call->[0]; + if($status) { my $out = join("\n",@{$call->[1]}); $this->logMsg("E", - "Called <$cmd_zipp> exit status: <$status> output: $out" + "Called <$cmd> exit status: <$status> output: $out" ); return $retval; - } } - } - if($this->{m_compress} =~ m{yes}i) { - foreach my $pfile(glob("$targetdir/packages*")) { - if(system("gzip", "--rsyncable", "$pfile") == 0) { - unlink "$targetdir/$pfile"; - } else { - $this->logMsg("W", - "Can't compress file <$targetdir/$pfile>!" - ); - } + if ( $createrepomd eq "true" ) { + foreach my $p (@paths) { + my $cmd_repo = "$this->{m_createrepo} $p/$datadir "; + $this->logMsg("I", "Executing command <$cmd_repo>"); + $call = $this -> callCmd($cmd_repo); + $status = $call->[0]; + if ($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called <$cmd_repo> exit status: <$status> output: $out" + ); + return $retval; + } + my $cmd_zipp = "$this->{m_rezip} $p/$datadir "; + $this->logMsg("I", "Executing command <$cmd_zipp>"); + $call = $this -> callCmd($cmd_zipp); + $status = $call->[0]; + if($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called <$cmd_zipp> exit status: <$status> output: $out" + ); + return $retval; + } + } + } + if($this->{m_compress} =~ m{yes}i) { + foreach my $pfile(glob("$targetdir/packages*")) { + if(system("gzip", "--rsyncable", "$pfile") == 0) { + unlink "$targetdir/$pfile"; + } else { + $this->logMsg("W", + "Can't compress file <$targetdir/$pfile>!" + ); + } + } } - } - return 1; + return 1; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-11-1/KIWIEulaPlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-11-1/KIWIEulaPlugin.pm index 5a4d14e7c..01c5b31b9 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-11-1/KIWIEulaPlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-11-1/KIWIEulaPlugin.pm @@ -26,146 +26,146 @@ use Config::IniFiles; use FileHandle; sub new { - # ... - # Create a new KIWIEulaPlugin object - # creates patterns file - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new($handler); - bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if ((! $configpath) || (! $configfile)) { - $this->logMsg("E", - "wrong parameters in plugin initialisation\n" + # ... + # Create a new KIWIEulaPlugin object + # creates patterns file + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new($handler); + bless ($this, $class); + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if ((! $configpath) || (! $configfile)) { + $this->logMsg("E", + "wrong parameters in plugin initialisation\n" + ); + return; + } + ## plugin content: + #----------------- + #[base] + # name = KIWIEulaPlugin + # order = 3 + # src = packages.en[.gz] + # srcdir = $DESCRDIR + # tool = packages2eula.pl + # tooldir = /usr/bin + # toolpack = inst-source-utils + # defaultenable = 1 + # + #[target] + # targetfile = EULA.txt + # targetdir = $PRODUCT_DIR + # + my $ini = Config::IniFiles -> new( + -file => "$configpath/$configfile" ); - return; - } - ## plugin content: - #----------------- - #[base] - # name = KIWIEulaPlugin - # order = 3 - # src = packages.en[.gz] - # srcdir = $DESCRDIR - # tool = packages2eula.pl - # tooldir = /usr/bin - # toolpack = inst-source-utils - # defaultenable = 1 - # - #[target] - # targetfile = EULA.txt - # targetdir = $PRODUCT_DIR - # - my $ini = Config::IniFiles -> new( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base', 'name'); - my $order = $ini->val('base', 'order'); - my $tool = $ini->val('base', 'tool'); - my $tooldir = $ini->val('base', 'tooldir'); - my $toolpack = $ini->val('base', 'toolpack'); - my $enable = $ini->val('base', 'defaultenable'); - my $src = $ini->val('base', 'sourcefile'); - my $srcdir = $ini->val('base', 'sourcedir'); - my $iopt = $ini->val('option', 'in'); - my $oopt = $ini->val('option', 'out'); - my $popt = $ini->val('option', 'packfile'); - my $target = $ini->val('target', 'targetfile'); - my $targetdir= $ini->val('target', 'targetdir'); - # if any of those isn't set, complain! - if(not defined($name) - or not defined($order) - or not defined($tool) - or not defined($tooldir) - or not defined($toolpack) - or not defined($enable) - or not defined($target) - or not defined($targetdir) - or not defined($iopt) - or not defined($oopt) - or not defined($popt) - ) { - $this->logMsg("E", - "Plugin ini file <$config> seems broken!\n" - ); - return; - } - $this->name($name); - $this->order($order); - $targetdir = $this->collect() - ->productData()->_substitute("$targetdir"); - $srcdir = $this->collect() - ->productData()->_substitute("$srcdir"); - $this->{m_target} = $target; - if($enable != 0) { - $this->ready(1); - } - $this->{m_source} = $src; - $this->{m_srcdir} = $srcdir; - $this->{m_tool} = $tool; - $this->{m_toolpath} = $this->collect() - ->productData()->_substitute("$tooldir"); - $this->{m_toolpack} = $toolpack; - $this->{m_iopt} = $iopt; - $this->{m_oopt} = $oopt; - $this->{m_popt} = $popt; - $this->requiredDirs($srcdir, $targetdir); - return $this; + my $name = $ini->val('base', 'name'); + my $order = $ini->val('base', 'order'); + my $tool = $ini->val('base', 'tool'); + my $tooldir = $ini->val('base', 'tooldir'); + my $toolpack = $ini->val('base', 'toolpack'); + my $enable = $ini->val('base', 'defaultenable'); + my $src = $ini->val('base', 'sourcefile'); + my $srcdir = $ini->val('base', 'sourcedir'); + my $iopt = $ini->val('option', 'in'); + my $oopt = $ini->val('option', 'out'); + my $popt = $ini->val('option', 'packfile'); + my $target = $ini->val('target', 'targetfile'); + my $targetdir= $ini->val('target', 'targetdir'); + # if any of those isn't set, complain! + if(not defined($name) + or not defined($order) + or not defined($tool) + or not defined($tooldir) + or not defined($toolpack) + or not defined($enable) + or not defined($target) + or not defined($targetdir) + or not defined($iopt) + or not defined($oopt) + or not defined($popt) + ) { + $this->logMsg("E", + "Plugin ini file <$config> seems broken!\n" + ); + return; + } + $this->name($name); + $this->order($order); + $targetdir = $this->collect() + ->productData()->_substitute("$targetdir"); + $srcdir = $this->collect() + ->productData()->_substitute("$srcdir"); + $this->{m_target} = $target; + if($enable != 0) { + $this->ready(1); + } + $this->{m_source} = $src; + $this->{m_srcdir} = $srcdir; + $this->{m_tool} = $tool; + $this->{m_toolpath} = $this->collect() + ->productData()->_substitute("$tooldir"); + $this->{m_toolpack} = $toolpack; + $this->{m_iopt} = $iopt; + $this->{m_oopt} = $oopt; + $this->{m_popt} = $popt; + $this->requiredDirs($srcdir, $targetdir); + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - my $retval = 0; - if($this->{m_ready} == 0) { - return $retval; - } - my @dirlist = $this->getSubdirLists(); - return unless @dirlist && $dirlist[0] && - ref ($dirlist[0] eq "ARRAY") && $dirlist[0]->[0]; - my $dirname = $dirlist[0]->[0]; - my $srcdir = $dirname."/".$this->{m_requireddirs}->[0]; - my $targetdir = $dirname."/".$this->{m_requireddirs}->[1]; - my $SRCFILE = FileHandle -> new(); - if (! $SRCFILE -> open ("<$srcdir/$this->{m_source}")) { - $this->logMsg("E", - "PatternsPlugin: cannot read <$srcdir/".$this->{m_source}.">" - ); - $this->logMsg("I", "Skipping plugin <".$this->name().">"); + my $this = shift; + if(not ref($this)) { + return; + } + my $retval = 0; + if($this->{m_ready} == 0) { + return $retval; + } + my @dirlist = $this->getSubdirLists(); + return unless @dirlist && $dirlist[0] && + ref ($dirlist[0] eq "ARRAY") && $dirlist[0]->[0]; + my $dirname = $dirlist[0]->[0]; + my $srcdir = $dirname."/".$this->{m_requireddirs}->[0]; + my $targetdir = $dirname."/".$this->{m_requireddirs}->[1]; + my $SRCFILE = FileHandle -> new(); + if (! $SRCFILE -> open ("<$srcdir/$this->{m_source}")) { + $this->logMsg("E", + "PatternsPlugin: cannot read <$srcdir/".$this->{m_source}.">" + ); + $this->logMsg("I", "Skipping plugin <".$this->name().">"); + return $retval; + } + $SRCFILE -> close(); + my $cmd = "$this->{m_toolpath}/$this->{m_tool} " + . "$this->{m_iopt} $targetdir/$this->{m_target} " + . "$this->{m_popt} $srcdir/$this->{m_source} " + . "$this->{m_oopt} $targetdir/$this->{m_target}.new"; + my $call = $this -> callCmd($cmd); + my $status = $call->[0]; + my @data = @{$call->[1]}; + $this->logMsg("I", "output of command $this->{m_tool}:\n"); + foreach my $l(@data) { + $this->logMsg("I", "\t$l\n"); + } + if($status) { + $this->logMsg("I", + "command $this->{m_tool} exited with <$status>\n" + ); + } else { + $this->logMsg("I", + "command $this->{m_tool} exited successfully.\n" + ); + $retval = 1; + } return $retval; - } - $SRCFILE -> close(); - my $cmd = "$this->{m_toolpath}/$this->{m_tool} " - . "$this->{m_iopt} $targetdir/$this->{m_target} " - . "$this->{m_popt} $srcdir/$this->{m_source} " - . "$this->{m_oopt} $targetdir/$this->{m_target}.new"; - my $call = $this -> callCmd($cmd); - my $status = $call->[0]; - my @data = @{$call->[1]}; - $this->logMsg("I", "output of command $this->{m_tool}:\n"); - foreach my $l(@data) { - $this->logMsg("I", "\t$l\n"); - } - if($status) { - $this->logMsg("I", - "command $this->{m_tool} exited with <$status>\n" - ); - } else { - $this->logMsg("I", - "command $this->{m_tool} exited successfully.\n" - ); - $retval = 1; - } - return $retval; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-11-1/KIWIMiniIsoPlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-11-1/KIWIMiniIsoPlugin.pm index 82d6de925..3bb4a6943 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-11-1/KIWIMiniIsoPlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-11-1/KIWIMiniIsoPlugin.pm @@ -29,245 +29,245 @@ use FileHandle; use Carp; sub new { - # ... - # Create a new KIWIMiniIsoPlugin object - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new($handler); - bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if ((! $configpath) || (! $configfile)) { - $this->logMsg("E", - "wrong parameters in plugin initialisation\n" - ); - return; - } - ## plugin content: - #----------------- - #[base] - # name = KIWIEulaPlugin - # order = 3 - # defaultenable = 1 - # - #[target] - # targetfile = content - # targetdir = $PRODUCT_DIR - # media = (list of numbers XOR "all") - # - my $ini = Config::IniFiles -> new ( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base', 'name'); - my $order = $ini->val('base', 'order'); - my $enable = $ini->val('base', 'defaultenable'); - # if any of those isn't set, complain! - if (not defined($name) - or not defined($order) - or not defined($enable) - ) { - $this->logMsg("E", - "Plugin ini file <$config> seems broken!\n" + # ... + # Create a new KIWIMiniIsoPlugin object + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new($handler); + bless ($this, $class); + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if ((! $configpath) || (! $configfile)) { + $this->logMsg("E", + "wrong parameters in plugin initialisation\n" + ); + return; + } + ## plugin content: + #----------------- + #[base] + # name = KIWIEulaPlugin + # order = 3 + # defaultenable = 1 + # + #[target] + # targetfile = content + # targetdir = $PRODUCT_DIR + # media = (list of numbers XOR "all") + # + my $ini = Config::IniFiles -> new ( + -file => "$configpath/$configfile" ); - return; - } - $this->name($name); - $this->order($order); - if($enable != 0) { - $this->ready(1); - } - return $this; + my $name = $ini->val('base', 'name'); + my $order = $ini->val('base', 'order'); + my $enable = $ini->val('base', 'defaultenable'); + # if any of those isn't set, complain! + if (not defined($name) + or not defined($order) + or not defined($enable) + ) { + $this->logMsg("E", + "Plugin ini file <$config> seems broken!\n" + ); + return; + } + $this->name($name); + $this->order($order); + if($enable != 0) { + $this->ready(1); + } + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - my $retval = 0; - if($this->{m_ready} == 0) { - return $retval; - } - my $repoloc = $this->collect()->productData()->getOpt("REPO_LOCATION"); - my $ismini = $this->collect()->productData()->getVar("FLAVOR"); - if(not defined($ismini)) { - $this->logMsg("W", "FLAVOR not set?"); - return $retval; - } - if ($ismini !~ m{mini}i) { - $this->logMsg("I", - "Nothing to for for media type <$ismini>" + my $this = shift; + if(not ref($this)) { + return; + } + my $retval = 0; + if($this->{m_ready} == 0) { + return $retval; + } + my $repoloc = $this->collect()->productData()->getOpt("REPO_LOCATION"); + my $ismini = $this->collect()->productData()->getVar("FLAVOR"); + if(not defined($ismini)) { + $this->logMsg("W", "FLAVOR not set?"); + return $retval; + } + if ($ismini !~ m{mini}i) { + $this->logMsg("I", + "Nothing to for for media type <$ismini>" + ); + return $retval; + } + my ($srv, $path); + if (not defined($repoloc)) { + $this->logMsg("I", + " is unset, boot protocol will be set to 'slp'!" + ); + } else { + if ($repoloc =~ m{^http://([^/]+)/(.+)}x) { + ($srv, $path) = ($1, $2); + } + if(not defined($srv) or not defined($path)) { + $this->logMsg("W", + "Parsing repo-location=<$repoloc> failed!" + ); + return $retval; + } + } + my @gfxbootfiles; + find( + sub { find_cb($this, '.*/gfxboot\.cfg$', \@gfxbootfiles) }, + $this->handler()->collect()->basedir() ); - return $retval; - } - my ($srv, $path); - if (not defined($repoloc)) { - $this->logMsg("I", - " is unset, boot protocol will be set to 'slp'!" + my @rootfiles; + find( + sub { find_cb($this, '.*/root$', \@rootfiles) }, + $this->handler()->collect()->basedir() ); - } else { - if ($repoloc =~ m{^http://([^/]+)/(.+)}x) { - ($srv, $path) = ($1, $2); + foreach(@rootfiles) { + $this->logMsg("I", "removing file <$_>"); + unlink $_; } - if(not defined($srv) or not defined($path)) { - $this->logMsg("W", - "Parsing repo-location=<$repoloc> failed!" - ); - return $retval; + if (!@gfxbootfiles) { + my $msg = "No gfxboot.cfg file found! " + . "This _MIGHT_ be ok for S/390. " + . "Please verify package(s)"; + $this->logMsg("W", $msg); + return $retval; } - } - my @gfxbootfiles; - find( - sub { find_cb($this, '.*/gfxboot\.cfg$', \@gfxbootfiles) }, - $this->handler()->collect()->basedir() - ); - my @rootfiles; - find( - sub { find_cb($this, '.*/root$', \@rootfiles) }, - $this->handler()->collect()->basedir() - ); - foreach(@rootfiles) { - $this->logMsg("I", "removing file <$_>"); - unlink $_; - } - if (!@gfxbootfiles) { - my $msg = "No gfxboot.cfg file found! " - . "This _MIGHT_ be ok for S/390. " - . "Please verify package(s)"; - $this->logMsg("W", $msg); + $this -> updateEFIGrubConfig($repoloc); + $retval = $this -> updateGraphicsBootConfig ( + \@gfxbootfiles, $repoloc, $srv, $path + ); return $retval; - } - $this -> updateEFIGrubConfig($repoloc); - $retval = $this -> updateGraphicsBootConfig ( - \@gfxbootfiles, $repoloc, $srv, $path - ); - return $retval; } sub updateGraphicsBootConfig { - my $this = shift; - my $gfxbootfiles = shift; - my $repoloc = shift; - my $srv = shift; - my $path = shift; - my $retval = 0; - foreach my $cfg(@{$gfxbootfiles}) { - $this->logMsg("I", "Processing file <$cfg>: "); - my $F = FileHandle -> new(); - if (! $F -> open($cfg)) { - $this->logMsg("E", "Cant open file <$cfg>!"); - next; + my $this = shift; + my $gfxbootfiles = shift; + my $repoloc = shift; + my $srv = shift; + my $path = shift; + my $retval = 0; + foreach my $cfg(@{$gfxbootfiles}) { + $this->logMsg("I", "Processing file <$cfg>: "); + my $F = FileHandle -> new(); + if (! $F -> open($cfg)) { + $this->logMsg("E", "Cant open file <$cfg>!"); + next; + } + my @lines = <$F>; + $F -> close(); + chomp(@lines); + my $install = -1; + my $ihs = -1; + my $ihp = -1; + my $i = -1; + foreach my $line(@lines) { + $i++; + next if $line !~ m{^install}x; + if($line =~ m{^install=.*}x) { + $install = $i; + } + if ($line =~ m{^install.http.server=+}x) { + $ihs = $i; + } + if($line =~ m{^install.http.path=+}x) { + $ihp = $i; + } + } + if(!$repoloc) { + if($install == -1) { + push @lines, "install=slp"; + } else { + $lines[$install] =~ s{^install.*}{install=slp}x; + } + } elsif($srv) { + if($ihs == -1) { + push @lines, "install.http.server=$srv"; + } else { + $lines[$ihs] =~ s{^(install.http.server).*}{$1=$srv}x; + } + if($ihp == -1) { + push @lines, "install.http.path=$path"; + } else { + $lines[$ihp] =~ s{^(install.http.path).*}{$1=$path}x; + } + if($install == -1) { + push @lines, "install=http"; + } else { + $lines[$install] =~ s{^install.*}{install=http}x; + } + } + unlink $cfg; + if (! $F -> open(">$cfg")) { + $this->logMsg("E", "Cant open file for writing <$cfg>!"); + next; + } + foreach(@lines) { + print $F "$_\n"; + } + $F -> close(); + $retval++; } - my @lines = <$F>; - $F -> close(); - chomp(@lines); - my $install = -1; - my $ihs = -1; - my $ihp = -1; - my $i = -1; - foreach my $line(@lines) { - $i++; - next if $line !~ m{^install}x; - if($line =~ m{^install=.*}x) { - $install = $i; - } - if ($line =~ m{^install.http.server=+}x) { - $ihs = $i; - } - if($line =~ m{^install.http.path=+}x) { - $ihp = $i; - } + return $retval; +} + +sub updateEFIGrubConfig { + my $this = shift; + my $repoloc = shift; + my $grubcfg = $this->collect() + ->basesubdirs()->{1} . "/EFI/BOOT/grub.cfg"; + if (! -f $grubcfg ) { + $this->logMsg("I", "no grub.cfg at <$grubcfg>"); + return; } - if(!$repoloc) { - if($install == -1) { - push @lines, "install=slp"; - } else { - $lines[$install] =~ s{^install.*}{install=slp}x; - } - } elsif($srv) { - if($ihs == -1) { - push @lines, "install.http.server=$srv"; - } else { - $lines[$ihs] =~ s{^(install.http.server).*}{$1=$srv}x; - } - if($ihp == -1) { - push @lines, "install.http.path=$path"; - } else { - $lines[$ihp] =~ s{^(install.http.path).*}{$1=$path}x; - } - if($install == -1) { - push @lines, "install=http"; - } else { - $lines[$install] =~ s{^install.*}{install=http}x; - } + $this->logMsg("I", "editing <$grubcfg>"); + my $IN = FileHandle -> new(); + my $OUT = FileHandle -> new(); + if (! $IN -> open($grubcfg)) { + croak "Cant open file for reading $grubcfg: $!"; } - unlink $cfg; - if (! $F -> open(">$cfg")) { - $this->logMsg("E", "Cant open file for writing <$cfg>!"); - next; + if (! $OUT -> open(">$grubcfg.new")) { + croak "Cant open file for writing $grubcfg.new: $!"; } - foreach(@lines) { - print $F "$_\n"; + while(<$IN>) { + my $line = $_; + chomp $line; + $this->logMsg("I", "-$line"); + $line =~ + s,(linuxefi /boot/x86_64/loader/linux),$1 install=$repoloc,x; + $this->logMsg("I", "+$line"); + print $OUT "$line\n"; } - $F -> close(); - $retval++; - } - return $retval; -} - -sub updateEFIGrubConfig { - my $this = shift; - my $repoloc = shift; - my $grubcfg = $this->collect() - ->basesubdirs()->{1} . "/EFI/BOOT/grub.cfg"; - if (! -f $grubcfg ) { - $this->logMsg("I", "no grub.cfg at <$grubcfg>"); - return; - } - $this->logMsg("I", "editing <$grubcfg>"); - my $IN = FileHandle -> new(); - my $OUT = FileHandle -> new(); - if (! $IN -> open($grubcfg)) { - croak "Cant open file for reading $grubcfg: $!"; - } - if (! $OUT -> open(">$grubcfg.new")) { - croak "Cant open file for writing $grubcfg.new: $!"; - } - while(<$IN>) { - my $line = $_; - chomp $line; - $this->logMsg("I", "-$line"); - $line =~ - s,(linuxefi /boot/x86_64/loader/linux),$1 install=$repoloc,x; - $this->logMsg("I", "+$line"); - print $OUT "$line\n"; - } - $OUT -> close(); - $IN -> close(); - $this -> callCmd("diff -u $grubcfg $grubcfg.new"); - rename("$grubcfg.new", $grubcfg); - return $this; + $OUT -> close(); + $IN -> close(); + $this -> callCmd("diff -u $grubcfg $grubcfg.new"); + rename("$grubcfg.new", $grubcfg); + return $this; } sub find_cb { - my $this = shift; - return if not ref($this); + my $this = shift; + return if not ref($this); - my $pat = shift; - my $listref = shift; - if(not defined($listref) or not defined($pat)) { - return; - } - if($File::Find::name =~ m{$pat}x) { - push @{$listref}, $File::Find::name; - } - return $this; + my $pat = shift; + my $listref = shift; + if(not defined($listref) or not defined($pat)) { + return; + } + if($File::Find::name =~ m{$pat}x) { + push @{$listref}, $File::Find::name; + } + return $this; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-11-1/KIWIPatternsPlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-11-1/KIWIPatternsPlugin.pm index a4df6924a..01685ef14 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-11-1/KIWIPatternsPlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-11-1/KIWIPatternsPlugin.pm @@ -25,135 +25,135 @@ use base "KIWIBasePlugin"; use Config::IniFiles; sub new { - # ... - # Create a new KIWIPatternsPlugin object - # creates patterns file - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new($handler); - bless ($this, $class); + # ... + # Create a new KIWIPatternsPlugin object + # creates patterns file + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new($handler); + bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if ((! $configpath) || (! $configfile)) { - $this->logMsg("E", - "wrong parameters in plugin initialisation\n" - ); - return; - } - ## plugin content: - #----------------- - #[base] - # name = KIWIPatternsPlugin - # dir = $DATADIR/setup/descr - # order = 1 - # tool = create_package_descr - # tooldir = /usr/bin - # toolpack = inst-source-utils - # defaultenabled = 1 - # media = 1 - # - #[target] - # targetfile = patterns - # compress = yes|no - # - my $ini = Config::IniFiles ->new( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base', 'name'); - my $order = $ini->val('base', 'order'); - my @dirs = $ini->val('base', 'dir'); - my $enable = $ini->val('base', 'defaultenable'); - my @media = $ini->val('base', 'media'); - my $target = $ini->val('target', 'targetfile'); - my $gzip = $ini->val('target', 'compress'); - # if any of those isn't set, complain! - if(not defined($name) - or not defined($order) - or not @dirs - or not defined($enable) - or not defined($target) - or not defined($gzip) - or not @media - ) { - $this->logMsg("E", - "Plugin ini file <$config> seems broken!\n" + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if ((! $configpath) || (! $configfile)) { + $this->logMsg("E", + "wrong parameters in plugin initialisation\n" + ); + return; + } + ## plugin content: + #----------------- + #[base] + # name = KIWIPatternsPlugin + # dir = $DATADIR/setup/descr + # order = 1 + # tool = create_package_descr + # tooldir = /usr/bin + # toolpack = inst-source-utils + # defaultenabled = 1 + # media = 1 + # + #[target] + # targetfile = patterns + # compress = yes|no + # + my $ini = Config::IniFiles ->new( + -file => "$configpath/$configfile" ); - return; - } - # parse dirs for productvars content: - for(my $i=0; $i <= $#dirs; $i++) { - $dirs[$i] = $this->collect() - ->productData()->_substitute("$dirs[$i]"); - } - $this->name($name); - $this->order($order); - $this->requiredDirs(@dirs); - $this->{m_media} = @media; - if($enable != 0) { - $this->ready(1); - } - $this->{m_compress} = $gzip; - $this->{m_target} = $target; - return $this; + my $name = $ini->val('base', 'name'); + my $order = $ini->val('base', 'order'); + my @dirs = $ini->val('base', 'dir'); + my $enable = $ini->val('base', 'defaultenable'); + my @media = $ini->val('base', 'media'); + my $target = $ini->val('target', 'targetfile'); + my $gzip = $ini->val('target', 'compress'); + # if any of those isn't set, complain! + if(not defined($name) + or not defined($order) + or not @dirs + or not defined($enable) + or not defined($target) + or not defined($gzip) + or not @media + ) { + $this->logMsg("E", + "Plugin ini file <$config> seems broken!\n" + ); + return; + } + # parse dirs for productvars content: + for(my $i=0; $i <= $#dirs; $i++) { + $dirs[$i] = $this->collect() + ->productData()->_substitute("$dirs[$i]"); + } + $this->name($name); + $this->order($order); + $this->requiredDirs(@dirs); + $this->{m_media} = @media; + if($enable != 0) { + $this->ready(1); + } + $this->{m_compress} = $gzip; + $this->{m_target} = $target; + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - if($this->{m_ready} == 0) { - return 0; - } - my $dirname = $this->{m_handler}->baseurl() - . "/" - . $this->{m_handler}->mediaName(); - my $mult = $this->collect() - ->productData()->getVar("MULTIPLE_MEDIA"); - if( $mult ne "no") { - $dirname .= $this->{m_media}; - } - $dirname .= "/".$this->{m_requireddirs}->[0]; - my $PATDIR; - if(!opendir($PATDIR, "$dirname")) { - $this->logMsg("E", - "PatternsPlugin: cannot read <$dirname>" - ); - $this->logMsg("I", - "Skipping plugin <".$this->name().">" - ); - return 0; - } - my $PAT = FileHandle -> new(); - if (! $PAT -> open(">$dirname/$this->{m_target}")) { - $this->logMsg("E", - "PatternsPlugin: cannot create <$dirname>/patterns!" - ); - $this->logMsg("I", - "Skipping plugin <".$this->name().">" - ); - return 0; - } - my @dirent = readdir($PATDIR); - foreach my $f(@dirent) { - next if $f !~ m{.*\.pat|.*\.pat\.gz}x; - if($f !~ m{.*\.gz$}x and $this->{m_compress} =~ m{yes}i) { - if (system('gzip', '--rsyncable', "$dirname/$f") == 0) { - $f = "$f.gz"; - } + my $this = shift; + if(not ref($this)) { + return; + } + if($this->{m_ready} == 0) { + return 0; + } + my $dirname = $this->{m_handler}->baseurl() + . "/" + . $this->{m_handler}->mediaName(); + my $mult = $this->collect() + ->productData()->getVar("MULTIPLE_MEDIA"); + if( $mult ne "no") { + $dirname .= $this->{m_media}; + } + $dirname .= "/".$this->{m_requireddirs}->[0]; + my $PATDIR; + if(!opendir($PATDIR, "$dirname")) { + $this->logMsg("E", + "PatternsPlugin: cannot read <$dirname>" + ); + $this->logMsg("I", + "Skipping plugin <".$this->name().">" + ); + return 0; + } + my $PAT = FileHandle -> new(); + if (! $PAT -> open(">$dirname/$this->{m_target}")) { + $this->logMsg("E", + "PatternsPlugin: cannot create <$dirname>/patterns!" + ); + $this->logMsg("I", + "Skipping plugin <".$this->name().">" + ); + return 0; + } + my @dirent = readdir($PATDIR); + foreach my $f(@dirent) { + next if $f !~ m{.*\.pat|.*\.pat\.gz}x; + if($f !~ m{.*\.gz$}x and $this->{m_compress} =~ m{yes}i) { + if (system('gzip', '--rsyncable', "$dirname/$f") == 0) { + $f = "$f.gz"; + } + } + print $PAT "$f\n"; } - print $PAT "$f\n"; - } - closedir($PATDIR); - $PAT -> close(); - return 1; + closedir($PATDIR); + $PAT -> close(); + return 1; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-11-2/KIWIBasePlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-11-2/KIWIBasePlugin.pm index 370a7ecff..a980922a2 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-11-2/KIWIBasePlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-11-2/KIWIBasePlugin.pm @@ -25,222 +25,222 @@ use IPC::Open3; use Symbol; sub new { - my $class = shift; - my $this = { - m_handler => undef, - m_name => "KIWIBasePlugin", - m_order => undef, - m_requireddirs=> [], - m_descr => [], - m_requires => [], - m_ready => 0, - m_collect => 0 - }; - bless ($this, $class); - $this->{m_handler} = shift; - if (! ref($this->{m_handler})) { - return; - } - $this->{m_collect} = $this->{m_handler}->collect(); - return $this; + my $class = shift; + my $this = { + m_handler => undef, + m_name => "KIWIBasePlugin", + m_order => undef, + m_requireddirs=> [], + m_descr => [], + m_requires => [], + m_ready => 0, + m_collect => 0 + }; + bless ($this, $class); + $this->{m_handler} = shift; + if (! ref($this->{m_handler})) { + return; + } + $this->{m_collect} = $this->{m_handler}->collect(); + return $this; } sub name { - my $this = shift; - my $name = shift; - if (! ref($this)) { - return; - } - my $oldname = $this->{m_name}; - if($name) { - $this->{m_name} = $name; - } - return $oldname; + my $this = shift; + my $name = shift; + if (! ref($this)) { + return; + } + my $oldname = $this->{m_name}; + if($name) { + $this->{m_name} = $name; + } + return $oldname; } sub order { - my $this = shift; - my $order = shift; - if (! ref($this)) { - return; - } - my $oldorder = $this->{m_order}; - if($order) { - $this->{m_order} = $order; - } - return $oldorder; + my $this = shift; + my $order = shift; + if (! ref($this)) { + return; + } + my $oldorder = $this->{m_order}; + if($order) { + $this->{m_order} = $order; + } + return $oldorder; } sub ready { - my $this = shift; - my $ready = shift; - if (! ref($this)) { - return; - } - my $oldready = $this->{m_ready}; - if($ready) { - $this->{m_ready} = $ready; - } - return $oldready; + my $this = shift; + my $ready = shift; + if (! ref($this)) { + return; + } + my $oldready = $this->{m_ready}; + if($ready) { + $this->{m_ready} = $ready; + } + return $oldready; } sub requiredDirs { - my @params = @_; - my $this = shift @params; - my @dirs = @params; - if (! ref($this)) { - return; - } - my @oldrd = @{$this->{m_requireddirs}}; - foreach my $entry(@params) { - push @{$this->{m_requireddirs}}, $entry; - } - return @oldrd; + my @params = @_; + my $this = shift @params; + my @dirs = @params; + if (! ref($this)) { + return; + } + my @oldrd = @{$this->{m_requireddirs}}; + foreach my $entry(@params) { + push @{$this->{m_requireddirs}}, $entry; + } + return @oldrd; } sub description { - my @params = @_; - my $this = shift @params; - my @descr= @params; - if (! ref($this)) { - return; - } - my @olddesc = $this->{m_descr}; - foreach my $entry(@descr) { - push @{$this->{m_descr}}, $entry; - } - return @olddesc; + my @params = @_; + my $this = shift @params; + my @descr= @params; + if (! ref($this)) { + return; + } + my @olddesc = $this->{m_descr}; + foreach my $entry(@descr) { + push @{$this->{m_descr}}, $entry; + } + return @olddesc; } sub requires { - my @params = @_; - my $this = shift; - my @reqs = @params; - if (! ref($this)) { - return; - } - my @oldreq = $this->{m_requires}; - foreach my $entry(@reqs) { - push @{$this->{m_requires}}, $entry; - } - return @oldreq; + my @params = @_; + my $this = shift; + my @reqs = @params; + if (! ref($this)) { + return; + } + my @oldreq = $this->{m_requires}; + foreach my $entry(@reqs) { + push @{$this->{m_requires}}, $entry; + } + return @oldreq; } sub handler { - my $this = shift; - if (! ref($this)) { - return; - } - return $this->{m_handler}; + my $this = shift; + if (! ref($this)) { + return; + } + return $this->{m_handler}; } sub collect { - my $this = shift; - if (! ref($this)) { - return; - } - return $this->{m_collect}; + my $this = shift; + if (! ref($this)) { + return; + } + return $this->{m_collect}; } sub logMsg { - my $this = shift; - if (! ref($this)) { - return; - } - my $type = shift; - my $msg = shift; - if ((! defined($type)) || (! defined($msg))) { - return; - } - $this->{m_collect}->logMsg($type, $msg); - return $this; + my $this = shift; + if (! ref($this)) { + return; + } + my $type = shift; + my $msg = shift; + if ((! defined($type)) || (! defined($msg))) { + return; + } + $this->{m_collect}->logMsg($type, $msg); + return $this; } sub callCmd { - my $this = shift; - my $cmd = shift; - my $BUFSIZE = 1024; - my @result; - my @errors; - my $result_buf; - my $errors_buf; - my ($CHILDWRITE, $CHILDSTDOUT, $CHILDSTDERR) = map { gensym } 1..3; - my $pid = open3 ( - $CHILDWRITE, $CHILDSTDOUT, $CHILDSTDERR, "$cmd" - ); - my $sel = IO::Select->new(); - $sel->add($CHILDSTDOUT); - $sel->add($CHILDSTDERR); - while($sel->count()) { - foreach my $handle ($sel->can_read()) { - my $bytes_read = ''; - my $chunk_result = sysread($handle, $bytes_read, $BUFSIZE); - if ($handle == $CHILDSTDOUT) { - $result_buf .= $bytes_read; - } else { - $errors_buf .= $bytes_read; - } - if ($chunk_result == 0) { - $sel->remove($handle); - next; - } - } - } - if ($result_buf) { - @result = split (/\n/x,$result_buf); - chomp @result; - } - if ($errors_buf) { - @errors = split (/\n/x,$errors_buf); - chomp @errors; - } - waitpid( $pid, 0 ); - my $status = $? >> 8; - return [$status,\@result,\@errors]; + my $this = shift; + my $cmd = shift; + my $BUFSIZE = 1024; + my @result; + my @errors; + my $result_buf; + my $errors_buf; + my ($CHILDWRITE, $CHILDSTDOUT, $CHILDSTDERR) = map { gensym } 1..3; + my $pid = open3 ( + $CHILDWRITE, $CHILDSTDOUT, $CHILDSTDERR, "$cmd" + ); + my $sel = IO::Select->new(); + $sel->add($CHILDSTDOUT); + $sel->add($CHILDSTDERR); + while($sel->count()) { + foreach my $handle ($sel->can_read()) { + my $bytes_read = ''; + my $chunk_result = sysread($handle, $bytes_read, $BUFSIZE); + if ($handle == $CHILDSTDOUT) { + $result_buf .= $bytes_read; + } else { + $errors_buf .= $bytes_read; + } + if ($chunk_result == 0) { + $sel->remove($handle); + next; + } + } + } + if ($result_buf) { + @result = split (/\n/x,$result_buf); + chomp @result; + } + if ($errors_buf) { + @errors = split (/\n/x,$errors_buf); + chomp @errors; + } + waitpid( $pid, 0 ); + my $status = $? >> 8; + return [$status,\@result,\@errors]; } sub getSubdirLists { - # ... - # method to distinguish debugmedia and ftp media subdirectories. - # --- - my $this = shift; - if (! ref($this)) { - return; - } - my @ret = (); - my $coll = $this->{m_collect}; - my $dbm = $coll->productData()->getOpt("DEBUGMEDIUM"); - my $flavor = $coll->productData()->getVar("FLAVOR"); - my $basesubdirs = $coll->basesubdirs(); - my @paths = values(%{$basesubdirs}); - @paths = grep { $_ =~ /[^0]$/x } @paths; # remove Media0 - my %path = map { $_ => 1 } @paths; - if($flavor =~ m{ftp}i) { - # 1: FTP tree, all subdirs get a separate call. - my @d = sort(keys(%path)); - foreach(@d) { - my @tmp; - push @tmp, $_; - push @ret, \@tmp; - } - } elsif($dbm >= 2) { - # 2: non-ftp tree, may have separate DEBUGMEDIUM specified - my @deb; - my @rest; - foreach my $d(keys(%path)) { - if ($d =~ m{.*$dbm$}x) { - push @deb, $d; - } else { - push @rest, $d; - } - } - push @ret, \@deb; - push @ret, \@rest; - } else { - my @d = keys(%path); - push @ret, \@d; - } - return @ret; + # ... + # method to distinguish debugmedia and ftp media subdirectories. + # --- + my $this = shift; + if (! ref($this)) { + return; + } + my @ret = (); + my $coll = $this->{m_collect}; + my $dbm = $coll->productData()->getOpt("DEBUGMEDIUM"); + my $flavor = $coll->productData()->getVar("FLAVOR"); + my $basesubdirs = $coll->basesubdirs(); + my @paths = values(%{$basesubdirs}); + @paths = grep { $_ =~ /[^0]$/x } @paths; # remove Media0 + my %path = map { $_ => 1 } @paths; + if($flavor =~ m{ftp}i) { + # 1: FTP tree, all subdirs get a separate call. + my @d = sort(keys(%path)); + foreach(@d) { + my @tmp; + push @tmp, $_; + push @ret, \@tmp; + } + } elsif($dbm >= 2) { + # 2: non-ftp tree, may have separate DEBUGMEDIUM specified + my @deb; + my @rest; + foreach my $d(keys(%path)) { + if ($d =~ m{.*$dbm$}x) { + push @deb, $d; + } else { + push @rest, $d; + } + } + push @ret, \@deb; + push @ret, \@rest; + } else { + my @d = keys(%path); + push @ret, \@d; + } + return @ret; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-11-2/KIWIContentPlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-11-2/KIWIContentPlugin.pm index d22b89a5a..3ff88aa5a 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-11-2/KIWIContentPlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-11-2/KIWIContentPlugin.pm @@ -27,152 +27,152 @@ use Data::Dumper; use Config::IniFiles; sub new { - # ... - # Create a new KIWIContentPlugin object - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new ($handler); - bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if(not defined($configpath) or not defined($configfile)) { - $this->logMsg("E", "wrong parameters in plugin initialisation\n"); - return; - } - ## Gather all necessary information from the inifile: - #=== - # Issue: why duplicate code here? Why not put it into the base class? - # Answer: Each plugin may have different options. Some only need a - # target filename, whilst some others may need much more. I don't want - # to specify a complicated framework for the plugin, it shall just be - # a simple straightforward way to get information into the plugin. - # The idea is that the people who decide on the metadata write - # the plugin, and therefore damn well know what it needs and what not. - # I'm definitely not bothering PMs with Yet Another File Specification - #--- - ## plugin content: - #----------------- - #[base] - # name = KIWIEulaPlugin - # order = 3 - # defaultenable = 1 - # - #[target] - # targetfile = content - # targetdir = $PRODUCT_DIR - # media = (list of numbers XOR "all") - # - my $ini = Config::IniFiles -> new( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base', 'name'); # scalar value - my $order = $ini->val('base', 'order'); # scalar value - my $enable = $ini->val('base', 'defaultenable'); # scalar value - my $target = $ini->val('target', 'targetfile'); - my $targetdir = $ini->val('target', 'targetdir'); - my @media = $ini->val('target', 'media'); - # if any of those isn't set, complain! - if(not defined($name) - or not defined($order) - or not defined($enable) - or not defined($target) - or not defined($targetdir) - or not @media - ) { - $this->logMsg("E", "Plugin ini file <$config> seems broken!"); - return; - } - $this->name($name); - $this->order($order); - $targetdir = $this->collect()->productData()->_substitute("$targetdir"); - if($enable != 0) { - $this->ready(1); - } - $this->requiredDirs($targetdir); - $this->{m_target} = $target; - $this->{m_targetdir} = $targetdir; - @{$this->{m_media}} = @media; - return $this; + # ... + # Create a new KIWIContentPlugin object + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new ($handler); + bless ($this, $class); + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if(not defined($configpath) or not defined($configfile)) { + $this->logMsg("E", "wrong parameters in plugin initialisation\n"); + return; + } + ## Gather all necessary information from the inifile: + #=== + # Issue: why duplicate code here? Why not put it into the base class? + # Answer: Each plugin may have different options. Some only need a + # target filename, whilst some others may need much more. I don't want + # to specify a complicated framework for the plugin, it shall just be + # a simple straightforward way to get information into the plugin. + # The idea is that the people who decide on the metadata write + # the plugin, and therefore damn well know what it needs and what not. + # I'm definitely not bothering PMs with Yet Another File Specification + #--- + ## plugin content: + #----------------- + #[base] + # name = KIWIEulaPlugin + # order = 3 + # defaultenable = 1 + # + #[target] + # targetfile = content + # targetdir = $PRODUCT_DIR + # media = (list of numbers XOR "all") + # + my $ini = Config::IniFiles -> new( + -file => "$configpath/$configfile" + ); + my $name = $ini->val('base', 'name'); # scalar value + my $order = $ini->val('base', 'order'); # scalar value + my $enable = $ini->val('base', 'defaultenable'); # scalar value + my $target = $ini->val('target', 'targetfile'); + my $targetdir = $ini->val('target', 'targetdir'); + my @media = $ini->val('target', 'media'); + # if any of those isn't set, complain! + if(not defined($name) + or not defined($order) + or not defined($enable) + or not defined($target) + or not defined($targetdir) + or not @media + ) { + $this->logMsg("E", "Plugin ini file <$config> seems broken!"); + return; + } + $this->name($name); + $this->order($order); + $targetdir = $this->collect()->productData()->_substitute("$targetdir"); + if($enable != 0) { + $this->ready(1); + } + $this->requiredDirs($targetdir); + $this->{m_target} = $target; + $this->{m_targetdir} = $targetdir; + @{$this->{m_media}} = @media; + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - my $retval = 0; - if($this->{m_ready} == 0) { - return $retval; - } - my $descrdir = $this->collect()->productData()->getInfo("DESCRDIR"); - if ((! $descrdir) || ($descrdir eq "/")) { - $this->logMsg("I", - "Empty or (/) descrdir, skipping content file creation" - ); - return $retval; - } - my @targetmedia = $this->collect()->getMediaNumbers(); - my %targets; - if($this->{m_media}->[0] =~ m{all}i) { - %targets = map { $_ => 1 } @targetmedia; - } else { - foreach my $cd(@{$this->{m_media}}) { - if(grep { $cd } @targetmedia) { - $targets{$cd} = 1; - } + my $this = shift; + if(not ref($this)) { + return; } - } - my $info = $this->collect()->productData()->getSet("prodinfo"); - if(!$info) { - $this->logMsg("E", "data set named seems to be broken:"); - $this->logMsg("E", Dumper($info)); - return $retval; - } - foreach my $cd(keys(%targets)) { - $this->logMsg("I", "Creating content file on medium <$cd>:"); - my $dir = $this->collect()->basesubdirs()->{$cd}; - my $contentfile = "$dir/$this->{m_target}"; - my $CONT = FileHandle -> new(); - if (! $CONT -> open(">$contentfile")) { - $this->logMsg("E", "Cannot create <$contentfile> on medium <$cd>"); - next; + my $retval = 0; + if($this->{m_ready} == 0) { + return $retval; + } + my $descrdir = $this->collect()->productData()->getInfo("DESCRDIR"); + if ((! $descrdir) || ($descrdir eq "/")) { + $this->logMsg("I", + "Empty or (/) descrdir, skipping content file creation" + ); + return $retval; } - # compute maxlen: - my $len = 0; - foreach(keys(%{$info})) { - my $l = length($info->{$_}->[0]); - $len = ($l>$len)?$l:$len; + my @targetmedia = $this->collect()->getMediaNumbers(); + my %targets; + if($this->{m_media}->[0] =~ m{all}i) { + %targets = map { $_ => 1 } @targetmedia; + } else { + foreach my $cd(@{$this->{m_media}}) { + if(grep { $cd } @targetmedia) { + $targets{$cd} = 1; + } + } } - $len++; - # ftp media special mode ? - my $coll = $this->{m_collect}; - my $flavor = $coll->productData()->getVar("FLAVOR"); - my $ftpmode = ($flavor =~ m{ftp}i); + my $info = $this->collect()->productData()->getSet("prodinfo"); + if(!$info) { + $this->logMsg("E", "data set named seems to be broken:"); + $this->logMsg("E", Dumper($info)); + return $retval; + } + foreach my $cd(keys(%targets)) { + $this->logMsg("I", "Creating content file on medium <$cd>:"); + my $dir = $this->collect()->basesubdirs()->{$cd}; + my $contentfile = "$dir/$this->{m_target}"; + my $CONT = FileHandle -> new(); + if (! $CONT -> open(">$contentfile")) { + $this->logMsg("E", "Cannot create <$contentfile> on medium <$cd>"); + next; + } + # compute maxlen: + my $len = 0; + foreach(keys(%{$info})) { + my $l = length($info->{$_}->[0]); + $len = ($l>$len)?$l:$len; + } + $len++; + # ftp media special mode ? + my $coll = $this->{m_collect}; + my $flavor = $coll->productData()->getVar("FLAVOR"); + my $ftpmode = ($flavor =~ m{ftp}i); - my %ftpcontentkeys = map {$_ => 1} qw{ - CONTENTSTYLE REPOID DESCRDIR DATADIR VENDOR - }; - foreach my $i(sort { $a <=> $b } keys(%{$info})) { - # ftp medias beside first one should get provide the product - if ( !$ftpmode || $cd eq "1" || $ftpcontentkeys{$info->{$i}->[0]}) { - print $CONT sprintf( - '%-*s %s', $len, $info->{$i}->[0], $info->{$i}->[1] - )."\n"; - } + my %ftpcontentkeys = map {$_ => 1} qw{ + CONTENTSTYLE REPOID DESCRDIR DATADIR VENDOR + }; + foreach my $i(sort { $a <=> $b } keys(%{$info})) { + # ftp medias beside first one should get provide the product + if ( !$ftpmode || $cd eq "1" || $ftpcontentkeys{$info->{$i}->[0]}) { + print $CONT sprintf( + '%-*s %s', $len, $info->{$i}->[0], $info->{$i}->[1] + )."\n"; + } + } + $CONT -> close(); + $this->logMsg( + "I", "Wrote file <$contentfile> for medium <$cd> successfully." + ); + $retval++; } - $CONT -> close(); - $this->logMsg( - "I", "Wrote file <$contentfile> for medium <$cd> successfully." - ); - $retval++; - } - return $retval; + return $retval; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-11-2/KIWIDescrPlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-11-2/KIWIDescrPlugin.pm index 7d389a799..5ebbf773b 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-11-2/KIWIDescrPlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-11-2/KIWIDescrPlugin.pm @@ -28,207 +28,207 @@ use Data::Dumper; use Cwd 'abs_path'; sub new { - # ... - # Create a new KIWIDescrPlugin object - # creates patterns file - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new($handler); - bless ($this, $class); + # ... + # Create a new KIWIDescrPlugin object + # creates patterns file + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new($handler); + bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if((! $configpath) || (! $configfile)) { - $this->logMsg("E", - "wrong parameters in plugin initialisation" - ); - return; - } - my $ini = Config::IniFiles -> new( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base' , 'name'); - my $order = $ini->val('base' , 'order'); - my $tool = $ini->val('base' , 'tool'); - my $createrepo = $ini->val('base' , 'createrepo'); - my $rezip = $ini->val('base' , 'rezip'); - my $tdir = $ini->val('base' , 'tooldir'); - my $tpack = $ini->val('base' , 'toolpack'); - my $enable = $ini->val('base' , 'defaultenable'); - my $pdbfiles = $ini->val('options', 'pdbfiles'); - my @params = $ini->val('options', 'parameter'); - my @langs = $ini->val('options', 'language'); - my $gzip = $ini->val('target' , 'compress'); - # if any of those isn't set, complain! - if(not defined($name) - or not defined($order) - or not defined($tool) - or not defined($createrepo) - or not defined($rezip) - or not defined($tdir) - or not defined($tpack) - or not defined($enable) - or not defined($pdbfiles) - or not defined($gzip) - or not (@params) - ) { - $this->logMsg("E", - "Plugin ini file <$config> seems broken!" - ); - return; - } - # sanity check for tools' existence: - if(not( -f "$tdir/$tool" and -x "$tdir/$tool")) { - $this->logMsg("E", - "Plugin <$name>: tool <$tdir/$tool> is not executable!" - ); - $this->logMsg("I", - "Check if package <$tpack> is installed." + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if((! $configpath) || (! $configfile)) { + $this->logMsg("E", + "wrong parameters in plugin initialisation" + ); + return; + } + my $ini = Config::IniFiles -> new( + -file => "$configpath/$configfile" ); - return; - } - my $params = ""; - foreach my $p(@params) { - $p = $this->collect()->productData()->_substitute("$p"); - $params .= "$p "; - } - # add local kwd files as argument - my $extrafile = abs_path($this->collect()->{m_xml}->{xmlOrigFile}); - $extrafile =~ s/.kiwi$/.kwd/x; - if (-f $extrafile) { - $this->logMsg("W", "Found extra tags file $extrafile."); - $params .= "-T $extrafile "; - } - $this->name($name); - $this->order($order); - $this->{m_tool} = $tool; - $this->{m_tooldir} = $tdir; - $this->{m_toolpack} = $tpack; - $this->{m_pdbfiles} = $pdbfiles; - $this->{m_createrepo} = $createrepo; - $this->{m_rezip} = $rezip; - $this->{m_params} = $params; - $this->{m_languages} = join(' ', @langs); - $this->{m_compress} = $gzip; - if($enable != 0) { - $this->ready(1); - } - return $this; + my $name = $ini->val('base' , 'name'); + my $order = $ini->val('base' , 'order'); + my $tool = $ini->val('base' , 'tool'); + my $createrepo = $ini->val('base' , 'createrepo'); + my $rezip = $ini->val('base' , 'rezip'); + my $tdir = $ini->val('base' , 'tooldir'); + my $tpack = $ini->val('base' , 'toolpack'); + my $enable = $ini->val('base' , 'defaultenable'); + my $pdbfiles = $ini->val('options', 'pdbfiles'); + my @params = $ini->val('options', 'parameter'); + my @langs = $ini->val('options', 'language'); + my $gzip = $ini->val('target' , 'compress'); + # if any of those isn't set, complain! + if(not defined($name) + or not defined($order) + or not defined($tool) + or not defined($createrepo) + or not defined($rezip) + or not defined($tdir) + or not defined($tpack) + or not defined($enable) + or not defined($pdbfiles) + or not defined($gzip) + or not (@params) + ) { + $this->logMsg("E", + "Plugin ini file <$config> seems broken!" + ); + return; + } + # sanity check for tools' existence: + if(not( -f "$tdir/$tool" and -x "$tdir/$tool")) { + $this->logMsg("E", + "Plugin <$name>: tool <$tdir/$tool> is not executable!" + ); + $this->logMsg("I", + "Check if package <$tpack> is installed." + ); + return; + } + my $params = ""; + foreach my $p(@params) { + $p = $this->collect()->productData()->_substitute("$p"); + $params .= "$p "; + } + # add local kwd files as argument + my $extrafile = abs_path($this->collect()->{m_xml}->{xmlOrigFile}); + $extrafile =~ s/.kiwi$/.kwd/x; + if (-f $extrafile) { + $this->logMsg("W", "Found extra tags file $extrafile."); + $params .= "-T $extrafile "; + } + $this->name($name); + $this->order($order); + $this->{m_tool} = $tool; + $this->{m_tooldir} = $tdir; + $this->{m_toolpack} = $tpack; + $this->{m_pdbfiles} = $pdbfiles; + $this->{m_createrepo} = $createrepo; + $this->{m_rezip} = $rezip; + $this->{m_params} = $params; + $this->{m_languages} = join(' ', @langs); + $this->{m_compress} = $gzip; + if($enable != 0) { + $this->ready(1); + } + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - my $retval = 0; - # sanity check: - if($this->{m_ready} == 0) { - return $retval; - } - my $coll = $this->{m_collect}; - my $basesubdirs = $coll->basesubdirs(); - if(not defined($basesubdirs)) { - ## prevent crash when dereferencing - $this->logMsg("E", - " is undefined! Skipping <$this->name()>" - ); + my $this = shift; + if(not ref($this)) { + return; + } + my $retval = 0; + # sanity check: + if($this->{m_ready} == 0) { + return $retval; + } + my $coll = $this->{m_collect}; + my $basesubdirs = $coll->basesubdirs(); + if(not defined($basesubdirs)) { + ## prevent crash when dereferencing + $this->logMsg("E", + " is undefined! Skipping <$this->name()>" + ); + return $retval; + } + foreach my $dirlist($this->getSubdirLists()) { + my ($s,$m) = $this->executeDir(sort @{$dirlist}); + } return $retval; - } - foreach my $dirlist($this->getSubdirLists()) { - my ($s,$m) = $this->executeDir(sort @{$dirlist}); - } - return $retval; } sub executeDir { - my @params = @_; - my $this = shift @params; - my @paths = @params; - my $retval = 0; - my $status; - my $call; - if(!@paths) { - $this->logMsg("W", "Empty path list!"); - return $retval; - } - my $coll = $this->{m_collect}; - my $datadir = $coll->productData()->getInfo("DATADIR"); - my $descrdir = $coll->productData()->getInfo("DESCRDIR"); - my $createrepomd = $coll->productData()->getVar("CREATE_REPOMD"); - my $targetdir = $paths[0]."/".$descrdir; - ## this bits creates a parameter string from a list of directories: - # param = -d -d ... - # the order is important. Idea: use map to make hash => -d - # for all subdirs not ending with "0" (those are for metafile - # unpacking only). The result is evaluated in list context be reverse, - # so there's a list looking like " -d ... -d" which is - # reversed again, making the result '-d', '', ..., '-d', ''", - # after the join as string. - # ---- - my $pathlist = "-d ".join(' -d ', map{$_."/".$datadir}(@paths)); - $this->logMsg("I", - "Calling ".$this->name()." for directories <@paths>:" - ); - my $cmd = "$this->{m_tooldir}/$this->{m_tool} " - . "$this->{m_pdbfiles} $pathlist $this->{m_params} " - . "$this->{m_languages} -o " - . $paths[0] - . "/".$descrdir; - $this->logMsg("I", "Executing command <$cmd>"); - $call = $this -> callCmd($cmd); - $status = $call->[0]; - if($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called <$cmd> exit status: <$status> output: $out" - ); - return $retval; - } - if ( $createrepomd eq "true" ) { - foreach my $p (@paths) { - my $cmd_repo = "$this->{m_createrepo} $p/$datadir "; - $this->logMsg("I", "Executing command <$cmd_repo>"); - $call = $this -> callCmd($cmd_repo); - $status = $call->[0]; - if ($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called <$cmd_repo> exit status: <$status> output: $out" - ); + my @params = @_; + my $this = shift @params; + my @paths = @params; + my $retval = 0; + my $status; + my $call; + if(!@paths) { + $this->logMsg("W", "Empty path list!"); return $retval; - } - my $cmd_zipp = "$this->{m_rezip} $p/$datadir "; - $this->logMsg("I", "Executing command <$cmd_zipp>"); - $call = $this -> callCmd($cmd_zipp); - $status = $call->[0]; - if($status) { + } + my $coll = $this->{m_collect}; + my $datadir = $coll->productData()->getInfo("DATADIR"); + my $descrdir = $coll->productData()->getInfo("DESCRDIR"); + my $createrepomd = $coll->productData()->getVar("CREATE_REPOMD"); + my $targetdir = $paths[0]."/".$descrdir; + ## this bits creates a parameter string from a list of directories: + # param = -d -d ... + # the order is important. Idea: use map to make hash => -d + # for all subdirs not ending with "0" (those are for metafile + # unpacking only). The result is evaluated in list context be reverse, + # so there's a list looking like " -d ... -d" which is + # reversed again, making the result '-d', '', ..., '-d', ''", + # after the join as string. + # ---- + my $pathlist = "-d ".join(' -d ', map{$_."/".$datadir}(@paths)); + $this->logMsg("I", + "Calling ".$this->name()." for directories <@paths>:" + ); + my $cmd = "$this->{m_tooldir}/$this->{m_tool} " + . "$this->{m_pdbfiles} $pathlist $this->{m_params} " + . "$this->{m_languages} -o " + . $paths[0] + . "/".$descrdir; + $this->logMsg("I", "Executing command <$cmd>"); + $call = $this -> callCmd($cmd); + $status = $call->[0]; + if($status) { my $out = join("\n",@{$call->[1]}); $this->logMsg("E", - "Called <$cmd_zipp> exit status: <$status> output: $out" + "Called <$cmd> exit status: <$status> output: $out" ); return $retval; - } } - } - if($this->{m_compress} =~ m{yes}i) { - foreach my $pfile(glob("$targetdir/packages*")) { - if(system("gzip", "--rsyncable", "$pfile") == 0) { - unlink "$targetdir/$pfile"; - } else { - $this->logMsg("W", - "Can't compress file <$targetdir/$pfile>!" - ); - } + if ( $createrepomd eq "true" ) { + foreach my $p (@paths) { + my $cmd_repo = "$this->{m_createrepo} $p/$datadir "; + $this->logMsg("I", "Executing command <$cmd_repo>"); + $call = $this -> callCmd($cmd_repo); + $status = $call->[0]; + if ($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called <$cmd_repo> exit status: <$status> output: $out" + ); + return $retval; + } + my $cmd_zipp = "$this->{m_rezip} $p/$datadir "; + $this->logMsg("I", "Executing command <$cmd_zipp>"); + $call = $this -> callCmd($cmd_zipp); + $status = $call->[0]; + if($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called <$cmd_zipp> exit status: <$status> output: $out" + ); + return $retval; + } + } + } + if($this->{m_compress} =~ m{yes}i) { + foreach my $pfile(glob("$targetdir/packages*")) { + if(system("gzip", "--rsyncable", "$pfile") == 0) { + unlink "$targetdir/$pfile"; + } else { + $this->logMsg("W", + "Can't compress file <$targetdir/$pfile>!" + ); + } + } } - } - return 1; + return 1; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-11-2/KIWILiveTreePlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-11-2/KIWILiveTreePlugin.pm index 49a25dc4e..cc726fb5a 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-11-2/KIWILiveTreePlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-11-2/KIWILiveTreePlugin.pm @@ -29,104 +29,104 @@ use File::Basename; use Carp; sub new { - # ... - # Create a new KIWILiveTreePlugin object - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new($handler); - bless ($this, $class); + # ... + # Create a new KIWILiveTreePlugin object + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new($handler); + bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if(not defined($configpath) or not defined($configfile)) { - $this->logMsg("E", - "wrong parameters in plugin initialisation\n" + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if(not defined($configpath) or not defined($configfile)) { + $this->logMsg("E", + "wrong parameters in plugin initialisation\n" + ); + return; + } + ## plugin content: + #----------------- + #[base] + # name = KIWIEulaPlugin + # order = 3 + # defaultenable = 1 + # + #[target] + # targetfile = content + # targetdir = $PRODUCT_DIR + # media = (list of numbers XOR "all") + # + my $ini = Config::IniFiles -> new( + -file => "$configpath/$configfile" ); - return; - } - ## plugin content: - #----------------- - #[base] - # name = KIWIEulaPlugin - # order = 3 - # defaultenable = 1 - # - #[target] - # targetfile = content - # targetdir = $PRODUCT_DIR - # media = (list of numbers XOR "all") - # - my $ini = Config::IniFiles -> new( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base', 'name'); - my $order = $ini->val('base', 'order'); - my $enable = $ini->val('base', 'defaultenable'); - # if any of those isn't set, complain! - if(not defined($name) - or not defined($order) - or not defined($enable) - ) { - $this->logMsg("E", - "Plugin ini file <$config> seems broken!\n" - ); - return; - } - $this->name($name); - $this->order($order); - if($enable != 0) { - $this->ready(1); - } - return $this; + my $name = $ini->val('base', 'name'); + my $order = $ini->val('base', 'order'); + my $enable = $ini->val('base', 'defaultenable'); + # if any of those isn't set, complain! + if(not defined($name) + or not defined($order) + or not defined($enable) + ) { + $this->logMsg("E", + "Plugin ini file <$config> seems broken!\n" + ); + return; + } + $this->name($name); + $this->order($order); + if($enable != 0) { + $this->ready(1); + } + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - if($this->{m_ready} == 0) { - return 0; - } - my $ismini = $this->collect() - ->productData()->getVar("FLAVOR"); - if(not defined($ismini)) { - $this->logMsg("W", "FLAVOR not set?"); - return 0; - } - if($ismini !~ m{livetree}i) { + my $this = shift; + if(not ref($this)) { + return; + } + if($this->{m_ready} == 0) { + return 0; + } + my $ismini = $this->collect() + ->productData()->getVar("FLAVOR"); + if(not defined($ismini)) { + $this->logMsg("W", "FLAVOR not set?"); + return 0; + } + if($ismini !~ m{livetree}i) { + return 0; + } + my $medium = $this->collect() + ->productData()->getVar("MEDIUM_NAME"); + my $cd; + find( + sub { if (m/.iso/x) { $cd = $File::Find::name; } }, + $this->handler()->collect()->basedir() + ); + if (!$cd) { + $this->logMsg("E", "Initial CD not found\n"); + croak "E: fatal"; + } + $this->logMsg("I", "$cd $medium"); + my $dname = dirname($cd); + $this->logMsg("I", "$dname"); + my $nname = "$medium.iso"; + $nname =~ s,-i586-,-i686-,x; + $this->logMsg("I", + "Renaming $cd to $dname/$nname" + ); + if (! rename($cd, "$dname/$nname")) { + $this->logMsg("E", "could not rename $cd"); + croak "E: fatal"; + } return 0; - } - my $medium = $this->collect() - ->productData()->getVar("MEDIUM_NAME"); - my $cd; - find( - sub { if (m/.iso/x) { $cd = $File::Find::name; } }, - $this->handler()->collect()->basedir() - ); - if (!$cd) { - $this->logMsg("E", "Initial CD not found\n"); - croak "E: fatal"; - } - $this->logMsg("I", "$cd $medium"); - my $dname = dirname($cd); - $this->logMsg("I", "$dname"); - my $nname = "$medium.iso"; - $nname =~ s,-i586-,-i686-,x; - $this->logMsg("I", - "Renaming $cd to $dname/$nname" - ); - if (! rename($cd, "$dname/$nname")) { - $this->logMsg("E", "could not rename $cd"); - croak "E: fatal"; - } - return 0; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-11-2/KIWIMiniIsoPlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-11-2/KIWIMiniIsoPlugin.pm index 82d6de925..3bb4a6943 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-11-2/KIWIMiniIsoPlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-11-2/KIWIMiniIsoPlugin.pm @@ -29,245 +29,245 @@ use FileHandle; use Carp; sub new { - # ... - # Create a new KIWIMiniIsoPlugin object - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new($handler); - bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if ((! $configpath) || (! $configfile)) { - $this->logMsg("E", - "wrong parameters in plugin initialisation\n" - ); - return; - } - ## plugin content: - #----------------- - #[base] - # name = KIWIEulaPlugin - # order = 3 - # defaultenable = 1 - # - #[target] - # targetfile = content - # targetdir = $PRODUCT_DIR - # media = (list of numbers XOR "all") - # - my $ini = Config::IniFiles -> new ( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base', 'name'); - my $order = $ini->val('base', 'order'); - my $enable = $ini->val('base', 'defaultenable'); - # if any of those isn't set, complain! - if (not defined($name) - or not defined($order) - or not defined($enable) - ) { - $this->logMsg("E", - "Plugin ini file <$config> seems broken!\n" + # ... + # Create a new KIWIMiniIsoPlugin object + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new($handler); + bless ($this, $class); + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if ((! $configpath) || (! $configfile)) { + $this->logMsg("E", + "wrong parameters in plugin initialisation\n" + ); + return; + } + ## plugin content: + #----------------- + #[base] + # name = KIWIEulaPlugin + # order = 3 + # defaultenable = 1 + # + #[target] + # targetfile = content + # targetdir = $PRODUCT_DIR + # media = (list of numbers XOR "all") + # + my $ini = Config::IniFiles -> new ( + -file => "$configpath/$configfile" ); - return; - } - $this->name($name); - $this->order($order); - if($enable != 0) { - $this->ready(1); - } - return $this; + my $name = $ini->val('base', 'name'); + my $order = $ini->val('base', 'order'); + my $enable = $ini->val('base', 'defaultenable'); + # if any of those isn't set, complain! + if (not defined($name) + or not defined($order) + or not defined($enable) + ) { + $this->logMsg("E", + "Plugin ini file <$config> seems broken!\n" + ); + return; + } + $this->name($name); + $this->order($order); + if($enable != 0) { + $this->ready(1); + } + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - my $retval = 0; - if($this->{m_ready} == 0) { - return $retval; - } - my $repoloc = $this->collect()->productData()->getOpt("REPO_LOCATION"); - my $ismini = $this->collect()->productData()->getVar("FLAVOR"); - if(not defined($ismini)) { - $this->logMsg("W", "FLAVOR not set?"); - return $retval; - } - if ($ismini !~ m{mini}i) { - $this->logMsg("I", - "Nothing to for for media type <$ismini>" + my $this = shift; + if(not ref($this)) { + return; + } + my $retval = 0; + if($this->{m_ready} == 0) { + return $retval; + } + my $repoloc = $this->collect()->productData()->getOpt("REPO_LOCATION"); + my $ismini = $this->collect()->productData()->getVar("FLAVOR"); + if(not defined($ismini)) { + $this->logMsg("W", "FLAVOR not set?"); + return $retval; + } + if ($ismini !~ m{mini}i) { + $this->logMsg("I", + "Nothing to for for media type <$ismini>" + ); + return $retval; + } + my ($srv, $path); + if (not defined($repoloc)) { + $this->logMsg("I", + " is unset, boot protocol will be set to 'slp'!" + ); + } else { + if ($repoloc =~ m{^http://([^/]+)/(.+)}x) { + ($srv, $path) = ($1, $2); + } + if(not defined($srv) or not defined($path)) { + $this->logMsg("W", + "Parsing repo-location=<$repoloc> failed!" + ); + return $retval; + } + } + my @gfxbootfiles; + find( + sub { find_cb($this, '.*/gfxboot\.cfg$', \@gfxbootfiles) }, + $this->handler()->collect()->basedir() ); - return $retval; - } - my ($srv, $path); - if (not defined($repoloc)) { - $this->logMsg("I", - " is unset, boot protocol will be set to 'slp'!" + my @rootfiles; + find( + sub { find_cb($this, '.*/root$', \@rootfiles) }, + $this->handler()->collect()->basedir() ); - } else { - if ($repoloc =~ m{^http://([^/]+)/(.+)}x) { - ($srv, $path) = ($1, $2); + foreach(@rootfiles) { + $this->logMsg("I", "removing file <$_>"); + unlink $_; } - if(not defined($srv) or not defined($path)) { - $this->logMsg("W", - "Parsing repo-location=<$repoloc> failed!" - ); - return $retval; + if (!@gfxbootfiles) { + my $msg = "No gfxboot.cfg file found! " + . "This _MIGHT_ be ok for S/390. " + . "Please verify package(s)"; + $this->logMsg("W", $msg); + return $retval; } - } - my @gfxbootfiles; - find( - sub { find_cb($this, '.*/gfxboot\.cfg$', \@gfxbootfiles) }, - $this->handler()->collect()->basedir() - ); - my @rootfiles; - find( - sub { find_cb($this, '.*/root$', \@rootfiles) }, - $this->handler()->collect()->basedir() - ); - foreach(@rootfiles) { - $this->logMsg("I", "removing file <$_>"); - unlink $_; - } - if (!@gfxbootfiles) { - my $msg = "No gfxboot.cfg file found! " - . "This _MIGHT_ be ok for S/390. " - . "Please verify package(s)"; - $this->logMsg("W", $msg); + $this -> updateEFIGrubConfig($repoloc); + $retval = $this -> updateGraphicsBootConfig ( + \@gfxbootfiles, $repoloc, $srv, $path + ); return $retval; - } - $this -> updateEFIGrubConfig($repoloc); - $retval = $this -> updateGraphicsBootConfig ( - \@gfxbootfiles, $repoloc, $srv, $path - ); - return $retval; } sub updateGraphicsBootConfig { - my $this = shift; - my $gfxbootfiles = shift; - my $repoloc = shift; - my $srv = shift; - my $path = shift; - my $retval = 0; - foreach my $cfg(@{$gfxbootfiles}) { - $this->logMsg("I", "Processing file <$cfg>: "); - my $F = FileHandle -> new(); - if (! $F -> open($cfg)) { - $this->logMsg("E", "Cant open file <$cfg>!"); - next; + my $this = shift; + my $gfxbootfiles = shift; + my $repoloc = shift; + my $srv = shift; + my $path = shift; + my $retval = 0; + foreach my $cfg(@{$gfxbootfiles}) { + $this->logMsg("I", "Processing file <$cfg>: "); + my $F = FileHandle -> new(); + if (! $F -> open($cfg)) { + $this->logMsg("E", "Cant open file <$cfg>!"); + next; + } + my @lines = <$F>; + $F -> close(); + chomp(@lines); + my $install = -1; + my $ihs = -1; + my $ihp = -1; + my $i = -1; + foreach my $line(@lines) { + $i++; + next if $line !~ m{^install}x; + if($line =~ m{^install=.*}x) { + $install = $i; + } + if ($line =~ m{^install.http.server=+}x) { + $ihs = $i; + } + if($line =~ m{^install.http.path=+}x) { + $ihp = $i; + } + } + if(!$repoloc) { + if($install == -1) { + push @lines, "install=slp"; + } else { + $lines[$install] =~ s{^install.*}{install=slp}x; + } + } elsif($srv) { + if($ihs == -1) { + push @lines, "install.http.server=$srv"; + } else { + $lines[$ihs] =~ s{^(install.http.server).*}{$1=$srv}x; + } + if($ihp == -1) { + push @lines, "install.http.path=$path"; + } else { + $lines[$ihp] =~ s{^(install.http.path).*}{$1=$path}x; + } + if($install == -1) { + push @lines, "install=http"; + } else { + $lines[$install] =~ s{^install.*}{install=http}x; + } + } + unlink $cfg; + if (! $F -> open(">$cfg")) { + $this->logMsg("E", "Cant open file for writing <$cfg>!"); + next; + } + foreach(@lines) { + print $F "$_\n"; + } + $F -> close(); + $retval++; } - my @lines = <$F>; - $F -> close(); - chomp(@lines); - my $install = -1; - my $ihs = -1; - my $ihp = -1; - my $i = -1; - foreach my $line(@lines) { - $i++; - next if $line !~ m{^install}x; - if($line =~ m{^install=.*}x) { - $install = $i; - } - if ($line =~ m{^install.http.server=+}x) { - $ihs = $i; - } - if($line =~ m{^install.http.path=+}x) { - $ihp = $i; - } + return $retval; +} + +sub updateEFIGrubConfig { + my $this = shift; + my $repoloc = shift; + my $grubcfg = $this->collect() + ->basesubdirs()->{1} . "/EFI/BOOT/grub.cfg"; + if (! -f $grubcfg ) { + $this->logMsg("I", "no grub.cfg at <$grubcfg>"); + return; } - if(!$repoloc) { - if($install == -1) { - push @lines, "install=slp"; - } else { - $lines[$install] =~ s{^install.*}{install=slp}x; - } - } elsif($srv) { - if($ihs == -1) { - push @lines, "install.http.server=$srv"; - } else { - $lines[$ihs] =~ s{^(install.http.server).*}{$1=$srv}x; - } - if($ihp == -1) { - push @lines, "install.http.path=$path"; - } else { - $lines[$ihp] =~ s{^(install.http.path).*}{$1=$path}x; - } - if($install == -1) { - push @lines, "install=http"; - } else { - $lines[$install] =~ s{^install.*}{install=http}x; - } + $this->logMsg("I", "editing <$grubcfg>"); + my $IN = FileHandle -> new(); + my $OUT = FileHandle -> new(); + if (! $IN -> open($grubcfg)) { + croak "Cant open file for reading $grubcfg: $!"; } - unlink $cfg; - if (! $F -> open(">$cfg")) { - $this->logMsg("E", "Cant open file for writing <$cfg>!"); - next; + if (! $OUT -> open(">$grubcfg.new")) { + croak "Cant open file for writing $grubcfg.new: $!"; } - foreach(@lines) { - print $F "$_\n"; + while(<$IN>) { + my $line = $_; + chomp $line; + $this->logMsg("I", "-$line"); + $line =~ + s,(linuxefi /boot/x86_64/loader/linux),$1 install=$repoloc,x; + $this->logMsg("I", "+$line"); + print $OUT "$line\n"; } - $F -> close(); - $retval++; - } - return $retval; -} - -sub updateEFIGrubConfig { - my $this = shift; - my $repoloc = shift; - my $grubcfg = $this->collect() - ->basesubdirs()->{1} . "/EFI/BOOT/grub.cfg"; - if (! -f $grubcfg ) { - $this->logMsg("I", "no grub.cfg at <$grubcfg>"); - return; - } - $this->logMsg("I", "editing <$grubcfg>"); - my $IN = FileHandle -> new(); - my $OUT = FileHandle -> new(); - if (! $IN -> open($grubcfg)) { - croak "Cant open file for reading $grubcfg: $!"; - } - if (! $OUT -> open(">$grubcfg.new")) { - croak "Cant open file for writing $grubcfg.new: $!"; - } - while(<$IN>) { - my $line = $_; - chomp $line; - $this->logMsg("I", "-$line"); - $line =~ - s,(linuxefi /boot/x86_64/loader/linux),$1 install=$repoloc,x; - $this->logMsg("I", "+$line"); - print $OUT "$line\n"; - } - $OUT -> close(); - $IN -> close(); - $this -> callCmd("diff -u $grubcfg $grubcfg.new"); - rename("$grubcfg.new", $grubcfg); - return $this; + $OUT -> close(); + $IN -> close(); + $this -> callCmd("diff -u $grubcfg $grubcfg.new"); + rename("$grubcfg.new", $grubcfg); + return $this; } sub find_cb { - my $this = shift; - return if not ref($this); + my $this = shift; + return if not ref($this); - my $pat = shift; - my $listref = shift; - if(not defined($listref) or not defined($pat)) { - return; - } - if($File::Find::name =~ m{$pat}x) { - push @{$listref}, $File::Find::name; - } - return $this; + my $pat = shift; + my $listref = shift; + if(not defined($listref) or not defined($pat)) { + return; + } + if($File::Find::name =~ m{$pat}x) { + push @{$listref}, $File::Find::name; + } + return $this; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-11-2/KIWIPatternsPlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-11-2/KIWIPatternsPlugin.pm index a4df6924a..01685ef14 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-11-2/KIWIPatternsPlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-11-2/KIWIPatternsPlugin.pm @@ -25,135 +25,135 @@ use base "KIWIBasePlugin"; use Config::IniFiles; sub new { - # ... - # Create a new KIWIPatternsPlugin object - # creates patterns file - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new($handler); - bless ($this, $class); + # ... + # Create a new KIWIPatternsPlugin object + # creates patterns file + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new($handler); + bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if ((! $configpath) || (! $configfile)) { - $this->logMsg("E", - "wrong parameters in plugin initialisation\n" - ); - return; - } - ## plugin content: - #----------------- - #[base] - # name = KIWIPatternsPlugin - # dir = $DATADIR/setup/descr - # order = 1 - # tool = create_package_descr - # tooldir = /usr/bin - # toolpack = inst-source-utils - # defaultenabled = 1 - # media = 1 - # - #[target] - # targetfile = patterns - # compress = yes|no - # - my $ini = Config::IniFiles ->new( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base', 'name'); - my $order = $ini->val('base', 'order'); - my @dirs = $ini->val('base', 'dir'); - my $enable = $ini->val('base', 'defaultenable'); - my @media = $ini->val('base', 'media'); - my $target = $ini->val('target', 'targetfile'); - my $gzip = $ini->val('target', 'compress'); - # if any of those isn't set, complain! - if(not defined($name) - or not defined($order) - or not @dirs - or not defined($enable) - or not defined($target) - or not defined($gzip) - or not @media - ) { - $this->logMsg("E", - "Plugin ini file <$config> seems broken!\n" + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if ((! $configpath) || (! $configfile)) { + $this->logMsg("E", + "wrong parameters in plugin initialisation\n" + ); + return; + } + ## plugin content: + #----------------- + #[base] + # name = KIWIPatternsPlugin + # dir = $DATADIR/setup/descr + # order = 1 + # tool = create_package_descr + # tooldir = /usr/bin + # toolpack = inst-source-utils + # defaultenabled = 1 + # media = 1 + # + #[target] + # targetfile = patterns + # compress = yes|no + # + my $ini = Config::IniFiles ->new( + -file => "$configpath/$configfile" ); - return; - } - # parse dirs for productvars content: - for(my $i=0; $i <= $#dirs; $i++) { - $dirs[$i] = $this->collect() - ->productData()->_substitute("$dirs[$i]"); - } - $this->name($name); - $this->order($order); - $this->requiredDirs(@dirs); - $this->{m_media} = @media; - if($enable != 0) { - $this->ready(1); - } - $this->{m_compress} = $gzip; - $this->{m_target} = $target; - return $this; + my $name = $ini->val('base', 'name'); + my $order = $ini->val('base', 'order'); + my @dirs = $ini->val('base', 'dir'); + my $enable = $ini->val('base', 'defaultenable'); + my @media = $ini->val('base', 'media'); + my $target = $ini->val('target', 'targetfile'); + my $gzip = $ini->val('target', 'compress'); + # if any of those isn't set, complain! + if(not defined($name) + or not defined($order) + or not @dirs + or not defined($enable) + or not defined($target) + or not defined($gzip) + or not @media + ) { + $this->logMsg("E", + "Plugin ini file <$config> seems broken!\n" + ); + return; + } + # parse dirs for productvars content: + for(my $i=0; $i <= $#dirs; $i++) { + $dirs[$i] = $this->collect() + ->productData()->_substitute("$dirs[$i]"); + } + $this->name($name); + $this->order($order); + $this->requiredDirs(@dirs); + $this->{m_media} = @media; + if($enable != 0) { + $this->ready(1); + } + $this->{m_compress} = $gzip; + $this->{m_target} = $target; + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - if($this->{m_ready} == 0) { - return 0; - } - my $dirname = $this->{m_handler}->baseurl() - . "/" - . $this->{m_handler}->mediaName(); - my $mult = $this->collect() - ->productData()->getVar("MULTIPLE_MEDIA"); - if( $mult ne "no") { - $dirname .= $this->{m_media}; - } - $dirname .= "/".$this->{m_requireddirs}->[0]; - my $PATDIR; - if(!opendir($PATDIR, "$dirname")) { - $this->logMsg("E", - "PatternsPlugin: cannot read <$dirname>" - ); - $this->logMsg("I", - "Skipping plugin <".$this->name().">" - ); - return 0; - } - my $PAT = FileHandle -> new(); - if (! $PAT -> open(">$dirname/$this->{m_target}")) { - $this->logMsg("E", - "PatternsPlugin: cannot create <$dirname>/patterns!" - ); - $this->logMsg("I", - "Skipping plugin <".$this->name().">" - ); - return 0; - } - my @dirent = readdir($PATDIR); - foreach my $f(@dirent) { - next if $f !~ m{.*\.pat|.*\.pat\.gz}x; - if($f !~ m{.*\.gz$}x and $this->{m_compress} =~ m{yes}i) { - if (system('gzip', '--rsyncable', "$dirname/$f") == 0) { - $f = "$f.gz"; - } + my $this = shift; + if(not ref($this)) { + return; + } + if($this->{m_ready} == 0) { + return 0; + } + my $dirname = $this->{m_handler}->baseurl() + . "/" + . $this->{m_handler}->mediaName(); + my $mult = $this->collect() + ->productData()->getVar("MULTIPLE_MEDIA"); + if( $mult ne "no") { + $dirname .= $this->{m_media}; + } + $dirname .= "/".$this->{m_requireddirs}->[0]; + my $PATDIR; + if(!opendir($PATDIR, "$dirname")) { + $this->logMsg("E", + "PatternsPlugin: cannot read <$dirname>" + ); + $this->logMsg("I", + "Skipping plugin <".$this->name().">" + ); + return 0; + } + my $PAT = FileHandle -> new(); + if (! $PAT -> open(">$dirname/$this->{m_target}")) { + $this->logMsg("E", + "PatternsPlugin: cannot create <$dirname>/patterns!" + ); + $this->logMsg("I", + "Skipping plugin <".$this->name().">" + ); + return 0; + } + my @dirent = readdir($PATDIR); + foreach my $f(@dirent) { + next if $f !~ m{.*\.pat|.*\.pat\.gz}x; + if($f !~ m{.*\.gz$}x and $this->{m_compress} =~ m{yes}i) { + if (system('gzip', '--rsyncable', "$dirname/$f") == 0) { + $f = "$f.gz"; + } + } + print $PAT "$f\n"; } - print $PAT "$f\n"; - } - closedir($PATDIR); - $PAT -> close(); - return 1; + closedir($PATDIR); + $PAT -> close(); + return 1; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-11-3/KIWIBasePlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-11-3/KIWIBasePlugin.pm index 370a7ecff..a980922a2 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-11-3/KIWIBasePlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-11-3/KIWIBasePlugin.pm @@ -25,222 +25,222 @@ use IPC::Open3; use Symbol; sub new { - my $class = shift; - my $this = { - m_handler => undef, - m_name => "KIWIBasePlugin", - m_order => undef, - m_requireddirs=> [], - m_descr => [], - m_requires => [], - m_ready => 0, - m_collect => 0 - }; - bless ($this, $class); - $this->{m_handler} = shift; - if (! ref($this->{m_handler})) { - return; - } - $this->{m_collect} = $this->{m_handler}->collect(); - return $this; + my $class = shift; + my $this = { + m_handler => undef, + m_name => "KIWIBasePlugin", + m_order => undef, + m_requireddirs=> [], + m_descr => [], + m_requires => [], + m_ready => 0, + m_collect => 0 + }; + bless ($this, $class); + $this->{m_handler} = shift; + if (! ref($this->{m_handler})) { + return; + } + $this->{m_collect} = $this->{m_handler}->collect(); + return $this; } sub name { - my $this = shift; - my $name = shift; - if (! ref($this)) { - return; - } - my $oldname = $this->{m_name}; - if($name) { - $this->{m_name} = $name; - } - return $oldname; + my $this = shift; + my $name = shift; + if (! ref($this)) { + return; + } + my $oldname = $this->{m_name}; + if($name) { + $this->{m_name} = $name; + } + return $oldname; } sub order { - my $this = shift; - my $order = shift; - if (! ref($this)) { - return; - } - my $oldorder = $this->{m_order}; - if($order) { - $this->{m_order} = $order; - } - return $oldorder; + my $this = shift; + my $order = shift; + if (! ref($this)) { + return; + } + my $oldorder = $this->{m_order}; + if($order) { + $this->{m_order} = $order; + } + return $oldorder; } sub ready { - my $this = shift; - my $ready = shift; - if (! ref($this)) { - return; - } - my $oldready = $this->{m_ready}; - if($ready) { - $this->{m_ready} = $ready; - } - return $oldready; + my $this = shift; + my $ready = shift; + if (! ref($this)) { + return; + } + my $oldready = $this->{m_ready}; + if($ready) { + $this->{m_ready} = $ready; + } + return $oldready; } sub requiredDirs { - my @params = @_; - my $this = shift @params; - my @dirs = @params; - if (! ref($this)) { - return; - } - my @oldrd = @{$this->{m_requireddirs}}; - foreach my $entry(@params) { - push @{$this->{m_requireddirs}}, $entry; - } - return @oldrd; + my @params = @_; + my $this = shift @params; + my @dirs = @params; + if (! ref($this)) { + return; + } + my @oldrd = @{$this->{m_requireddirs}}; + foreach my $entry(@params) { + push @{$this->{m_requireddirs}}, $entry; + } + return @oldrd; } sub description { - my @params = @_; - my $this = shift @params; - my @descr= @params; - if (! ref($this)) { - return; - } - my @olddesc = $this->{m_descr}; - foreach my $entry(@descr) { - push @{$this->{m_descr}}, $entry; - } - return @olddesc; + my @params = @_; + my $this = shift @params; + my @descr= @params; + if (! ref($this)) { + return; + } + my @olddesc = $this->{m_descr}; + foreach my $entry(@descr) { + push @{$this->{m_descr}}, $entry; + } + return @olddesc; } sub requires { - my @params = @_; - my $this = shift; - my @reqs = @params; - if (! ref($this)) { - return; - } - my @oldreq = $this->{m_requires}; - foreach my $entry(@reqs) { - push @{$this->{m_requires}}, $entry; - } - return @oldreq; + my @params = @_; + my $this = shift; + my @reqs = @params; + if (! ref($this)) { + return; + } + my @oldreq = $this->{m_requires}; + foreach my $entry(@reqs) { + push @{$this->{m_requires}}, $entry; + } + return @oldreq; } sub handler { - my $this = shift; - if (! ref($this)) { - return; - } - return $this->{m_handler}; + my $this = shift; + if (! ref($this)) { + return; + } + return $this->{m_handler}; } sub collect { - my $this = shift; - if (! ref($this)) { - return; - } - return $this->{m_collect}; + my $this = shift; + if (! ref($this)) { + return; + } + return $this->{m_collect}; } sub logMsg { - my $this = shift; - if (! ref($this)) { - return; - } - my $type = shift; - my $msg = shift; - if ((! defined($type)) || (! defined($msg))) { - return; - } - $this->{m_collect}->logMsg($type, $msg); - return $this; + my $this = shift; + if (! ref($this)) { + return; + } + my $type = shift; + my $msg = shift; + if ((! defined($type)) || (! defined($msg))) { + return; + } + $this->{m_collect}->logMsg($type, $msg); + return $this; } sub callCmd { - my $this = shift; - my $cmd = shift; - my $BUFSIZE = 1024; - my @result; - my @errors; - my $result_buf; - my $errors_buf; - my ($CHILDWRITE, $CHILDSTDOUT, $CHILDSTDERR) = map { gensym } 1..3; - my $pid = open3 ( - $CHILDWRITE, $CHILDSTDOUT, $CHILDSTDERR, "$cmd" - ); - my $sel = IO::Select->new(); - $sel->add($CHILDSTDOUT); - $sel->add($CHILDSTDERR); - while($sel->count()) { - foreach my $handle ($sel->can_read()) { - my $bytes_read = ''; - my $chunk_result = sysread($handle, $bytes_read, $BUFSIZE); - if ($handle == $CHILDSTDOUT) { - $result_buf .= $bytes_read; - } else { - $errors_buf .= $bytes_read; - } - if ($chunk_result == 0) { - $sel->remove($handle); - next; - } - } - } - if ($result_buf) { - @result = split (/\n/x,$result_buf); - chomp @result; - } - if ($errors_buf) { - @errors = split (/\n/x,$errors_buf); - chomp @errors; - } - waitpid( $pid, 0 ); - my $status = $? >> 8; - return [$status,\@result,\@errors]; + my $this = shift; + my $cmd = shift; + my $BUFSIZE = 1024; + my @result; + my @errors; + my $result_buf; + my $errors_buf; + my ($CHILDWRITE, $CHILDSTDOUT, $CHILDSTDERR) = map { gensym } 1..3; + my $pid = open3 ( + $CHILDWRITE, $CHILDSTDOUT, $CHILDSTDERR, "$cmd" + ); + my $sel = IO::Select->new(); + $sel->add($CHILDSTDOUT); + $sel->add($CHILDSTDERR); + while($sel->count()) { + foreach my $handle ($sel->can_read()) { + my $bytes_read = ''; + my $chunk_result = sysread($handle, $bytes_read, $BUFSIZE); + if ($handle == $CHILDSTDOUT) { + $result_buf .= $bytes_read; + } else { + $errors_buf .= $bytes_read; + } + if ($chunk_result == 0) { + $sel->remove($handle); + next; + } + } + } + if ($result_buf) { + @result = split (/\n/x,$result_buf); + chomp @result; + } + if ($errors_buf) { + @errors = split (/\n/x,$errors_buf); + chomp @errors; + } + waitpid( $pid, 0 ); + my $status = $? >> 8; + return [$status,\@result,\@errors]; } sub getSubdirLists { - # ... - # method to distinguish debugmedia and ftp media subdirectories. - # --- - my $this = shift; - if (! ref($this)) { - return; - } - my @ret = (); - my $coll = $this->{m_collect}; - my $dbm = $coll->productData()->getOpt("DEBUGMEDIUM"); - my $flavor = $coll->productData()->getVar("FLAVOR"); - my $basesubdirs = $coll->basesubdirs(); - my @paths = values(%{$basesubdirs}); - @paths = grep { $_ =~ /[^0]$/x } @paths; # remove Media0 - my %path = map { $_ => 1 } @paths; - if($flavor =~ m{ftp}i) { - # 1: FTP tree, all subdirs get a separate call. - my @d = sort(keys(%path)); - foreach(@d) { - my @tmp; - push @tmp, $_; - push @ret, \@tmp; - } - } elsif($dbm >= 2) { - # 2: non-ftp tree, may have separate DEBUGMEDIUM specified - my @deb; - my @rest; - foreach my $d(keys(%path)) { - if ($d =~ m{.*$dbm$}x) { - push @deb, $d; - } else { - push @rest, $d; - } - } - push @ret, \@deb; - push @ret, \@rest; - } else { - my @d = keys(%path); - push @ret, \@d; - } - return @ret; + # ... + # method to distinguish debugmedia and ftp media subdirectories. + # --- + my $this = shift; + if (! ref($this)) { + return; + } + my @ret = (); + my $coll = $this->{m_collect}; + my $dbm = $coll->productData()->getOpt("DEBUGMEDIUM"); + my $flavor = $coll->productData()->getVar("FLAVOR"); + my $basesubdirs = $coll->basesubdirs(); + my @paths = values(%{$basesubdirs}); + @paths = grep { $_ =~ /[^0]$/x } @paths; # remove Media0 + my %path = map { $_ => 1 } @paths; + if($flavor =~ m{ftp}i) { + # 1: FTP tree, all subdirs get a separate call. + my @d = sort(keys(%path)); + foreach(@d) { + my @tmp; + push @tmp, $_; + push @ret, \@tmp; + } + } elsif($dbm >= 2) { + # 2: non-ftp tree, may have separate DEBUGMEDIUM specified + my @deb; + my @rest; + foreach my $d(keys(%path)) { + if ($d =~ m{.*$dbm$}x) { + push @deb, $d; + } else { + push @rest, $d; + } + } + push @ret, \@deb; + push @ret, \@rest; + } else { + my @d = keys(%path); + push @ret, \@d; + } + return @ret; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-11-3/KIWIContentPlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-11-3/KIWIContentPlugin.pm index d22b89a5a..3ff88aa5a 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-11-3/KIWIContentPlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-11-3/KIWIContentPlugin.pm @@ -27,152 +27,152 @@ use Data::Dumper; use Config::IniFiles; sub new { - # ... - # Create a new KIWIContentPlugin object - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new ($handler); - bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if(not defined($configpath) or not defined($configfile)) { - $this->logMsg("E", "wrong parameters in plugin initialisation\n"); - return; - } - ## Gather all necessary information from the inifile: - #=== - # Issue: why duplicate code here? Why not put it into the base class? - # Answer: Each plugin may have different options. Some only need a - # target filename, whilst some others may need much more. I don't want - # to specify a complicated framework for the plugin, it shall just be - # a simple straightforward way to get information into the plugin. - # The idea is that the people who decide on the metadata write - # the plugin, and therefore damn well know what it needs and what not. - # I'm definitely not bothering PMs with Yet Another File Specification - #--- - ## plugin content: - #----------------- - #[base] - # name = KIWIEulaPlugin - # order = 3 - # defaultenable = 1 - # - #[target] - # targetfile = content - # targetdir = $PRODUCT_DIR - # media = (list of numbers XOR "all") - # - my $ini = Config::IniFiles -> new( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base', 'name'); # scalar value - my $order = $ini->val('base', 'order'); # scalar value - my $enable = $ini->val('base', 'defaultenable'); # scalar value - my $target = $ini->val('target', 'targetfile'); - my $targetdir = $ini->val('target', 'targetdir'); - my @media = $ini->val('target', 'media'); - # if any of those isn't set, complain! - if(not defined($name) - or not defined($order) - or not defined($enable) - or not defined($target) - or not defined($targetdir) - or not @media - ) { - $this->logMsg("E", "Plugin ini file <$config> seems broken!"); - return; - } - $this->name($name); - $this->order($order); - $targetdir = $this->collect()->productData()->_substitute("$targetdir"); - if($enable != 0) { - $this->ready(1); - } - $this->requiredDirs($targetdir); - $this->{m_target} = $target; - $this->{m_targetdir} = $targetdir; - @{$this->{m_media}} = @media; - return $this; + # ... + # Create a new KIWIContentPlugin object + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new ($handler); + bless ($this, $class); + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if(not defined($configpath) or not defined($configfile)) { + $this->logMsg("E", "wrong parameters in plugin initialisation\n"); + return; + } + ## Gather all necessary information from the inifile: + #=== + # Issue: why duplicate code here? Why not put it into the base class? + # Answer: Each plugin may have different options. Some only need a + # target filename, whilst some others may need much more. I don't want + # to specify a complicated framework for the plugin, it shall just be + # a simple straightforward way to get information into the plugin. + # The idea is that the people who decide on the metadata write + # the plugin, and therefore damn well know what it needs and what not. + # I'm definitely not bothering PMs with Yet Another File Specification + #--- + ## plugin content: + #----------------- + #[base] + # name = KIWIEulaPlugin + # order = 3 + # defaultenable = 1 + # + #[target] + # targetfile = content + # targetdir = $PRODUCT_DIR + # media = (list of numbers XOR "all") + # + my $ini = Config::IniFiles -> new( + -file => "$configpath/$configfile" + ); + my $name = $ini->val('base', 'name'); # scalar value + my $order = $ini->val('base', 'order'); # scalar value + my $enable = $ini->val('base', 'defaultenable'); # scalar value + my $target = $ini->val('target', 'targetfile'); + my $targetdir = $ini->val('target', 'targetdir'); + my @media = $ini->val('target', 'media'); + # if any of those isn't set, complain! + if(not defined($name) + or not defined($order) + or not defined($enable) + or not defined($target) + or not defined($targetdir) + or not @media + ) { + $this->logMsg("E", "Plugin ini file <$config> seems broken!"); + return; + } + $this->name($name); + $this->order($order); + $targetdir = $this->collect()->productData()->_substitute("$targetdir"); + if($enable != 0) { + $this->ready(1); + } + $this->requiredDirs($targetdir); + $this->{m_target} = $target; + $this->{m_targetdir} = $targetdir; + @{$this->{m_media}} = @media; + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - my $retval = 0; - if($this->{m_ready} == 0) { - return $retval; - } - my $descrdir = $this->collect()->productData()->getInfo("DESCRDIR"); - if ((! $descrdir) || ($descrdir eq "/")) { - $this->logMsg("I", - "Empty or (/) descrdir, skipping content file creation" - ); - return $retval; - } - my @targetmedia = $this->collect()->getMediaNumbers(); - my %targets; - if($this->{m_media}->[0] =~ m{all}i) { - %targets = map { $_ => 1 } @targetmedia; - } else { - foreach my $cd(@{$this->{m_media}}) { - if(grep { $cd } @targetmedia) { - $targets{$cd} = 1; - } + my $this = shift; + if(not ref($this)) { + return; } - } - my $info = $this->collect()->productData()->getSet("prodinfo"); - if(!$info) { - $this->logMsg("E", "data set named seems to be broken:"); - $this->logMsg("E", Dumper($info)); - return $retval; - } - foreach my $cd(keys(%targets)) { - $this->logMsg("I", "Creating content file on medium <$cd>:"); - my $dir = $this->collect()->basesubdirs()->{$cd}; - my $contentfile = "$dir/$this->{m_target}"; - my $CONT = FileHandle -> new(); - if (! $CONT -> open(">$contentfile")) { - $this->logMsg("E", "Cannot create <$contentfile> on medium <$cd>"); - next; + my $retval = 0; + if($this->{m_ready} == 0) { + return $retval; + } + my $descrdir = $this->collect()->productData()->getInfo("DESCRDIR"); + if ((! $descrdir) || ($descrdir eq "/")) { + $this->logMsg("I", + "Empty or (/) descrdir, skipping content file creation" + ); + return $retval; } - # compute maxlen: - my $len = 0; - foreach(keys(%{$info})) { - my $l = length($info->{$_}->[0]); - $len = ($l>$len)?$l:$len; + my @targetmedia = $this->collect()->getMediaNumbers(); + my %targets; + if($this->{m_media}->[0] =~ m{all}i) { + %targets = map { $_ => 1 } @targetmedia; + } else { + foreach my $cd(@{$this->{m_media}}) { + if(grep { $cd } @targetmedia) { + $targets{$cd} = 1; + } + } } - $len++; - # ftp media special mode ? - my $coll = $this->{m_collect}; - my $flavor = $coll->productData()->getVar("FLAVOR"); - my $ftpmode = ($flavor =~ m{ftp}i); + my $info = $this->collect()->productData()->getSet("prodinfo"); + if(!$info) { + $this->logMsg("E", "data set named seems to be broken:"); + $this->logMsg("E", Dumper($info)); + return $retval; + } + foreach my $cd(keys(%targets)) { + $this->logMsg("I", "Creating content file on medium <$cd>:"); + my $dir = $this->collect()->basesubdirs()->{$cd}; + my $contentfile = "$dir/$this->{m_target}"; + my $CONT = FileHandle -> new(); + if (! $CONT -> open(">$contentfile")) { + $this->logMsg("E", "Cannot create <$contentfile> on medium <$cd>"); + next; + } + # compute maxlen: + my $len = 0; + foreach(keys(%{$info})) { + my $l = length($info->{$_}->[0]); + $len = ($l>$len)?$l:$len; + } + $len++; + # ftp media special mode ? + my $coll = $this->{m_collect}; + my $flavor = $coll->productData()->getVar("FLAVOR"); + my $ftpmode = ($flavor =~ m{ftp}i); - my %ftpcontentkeys = map {$_ => 1} qw{ - CONTENTSTYLE REPOID DESCRDIR DATADIR VENDOR - }; - foreach my $i(sort { $a <=> $b } keys(%{$info})) { - # ftp medias beside first one should get provide the product - if ( !$ftpmode || $cd eq "1" || $ftpcontentkeys{$info->{$i}->[0]}) { - print $CONT sprintf( - '%-*s %s', $len, $info->{$i}->[0], $info->{$i}->[1] - )."\n"; - } + my %ftpcontentkeys = map {$_ => 1} qw{ + CONTENTSTYLE REPOID DESCRDIR DATADIR VENDOR + }; + foreach my $i(sort { $a <=> $b } keys(%{$info})) { + # ftp medias beside first one should get provide the product + if ( !$ftpmode || $cd eq "1" || $ftpcontentkeys{$info->{$i}->[0]}) { + print $CONT sprintf( + '%-*s %s', $len, $info->{$i}->[0], $info->{$i}->[1] + )."\n"; + } + } + $CONT -> close(); + $this->logMsg( + "I", "Wrote file <$contentfile> for medium <$cd> successfully." + ); + $retval++; } - $CONT -> close(); - $this->logMsg( - "I", "Wrote file <$contentfile> for medium <$cd> successfully." - ); - $retval++; - } - return $retval; + return $retval; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-11-3/KIWIDescrPlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-11-3/KIWIDescrPlugin.pm index 7d389a799..5ebbf773b 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-11-3/KIWIDescrPlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-11-3/KIWIDescrPlugin.pm @@ -28,207 +28,207 @@ use Data::Dumper; use Cwd 'abs_path'; sub new { - # ... - # Create a new KIWIDescrPlugin object - # creates patterns file - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new($handler); - bless ($this, $class); + # ... + # Create a new KIWIDescrPlugin object + # creates patterns file + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new($handler); + bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if((! $configpath) || (! $configfile)) { - $this->logMsg("E", - "wrong parameters in plugin initialisation" - ); - return; - } - my $ini = Config::IniFiles -> new( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base' , 'name'); - my $order = $ini->val('base' , 'order'); - my $tool = $ini->val('base' , 'tool'); - my $createrepo = $ini->val('base' , 'createrepo'); - my $rezip = $ini->val('base' , 'rezip'); - my $tdir = $ini->val('base' , 'tooldir'); - my $tpack = $ini->val('base' , 'toolpack'); - my $enable = $ini->val('base' , 'defaultenable'); - my $pdbfiles = $ini->val('options', 'pdbfiles'); - my @params = $ini->val('options', 'parameter'); - my @langs = $ini->val('options', 'language'); - my $gzip = $ini->val('target' , 'compress'); - # if any of those isn't set, complain! - if(not defined($name) - or not defined($order) - or not defined($tool) - or not defined($createrepo) - or not defined($rezip) - or not defined($tdir) - or not defined($tpack) - or not defined($enable) - or not defined($pdbfiles) - or not defined($gzip) - or not (@params) - ) { - $this->logMsg("E", - "Plugin ini file <$config> seems broken!" - ); - return; - } - # sanity check for tools' existence: - if(not( -f "$tdir/$tool" and -x "$tdir/$tool")) { - $this->logMsg("E", - "Plugin <$name>: tool <$tdir/$tool> is not executable!" - ); - $this->logMsg("I", - "Check if package <$tpack> is installed." + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if((! $configpath) || (! $configfile)) { + $this->logMsg("E", + "wrong parameters in plugin initialisation" + ); + return; + } + my $ini = Config::IniFiles -> new( + -file => "$configpath/$configfile" ); - return; - } - my $params = ""; - foreach my $p(@params) { - $p = $this->collect()->productData()->_substitute("$p"); - $params .= "$p "; - } - # add local kwd files as argument - my $extrafile = abs_path($this->collect()->{m_xml}->{xmlOrigFile}); - $extrafile =~ s/.kiwi$/.kwd/x; - if (-f $extrafile) { - $this->logMsg("W", "Found extra tags file $extrafile."); - $params .= "-T $extrafile "; - } - $this->name($name); - $this->order($order); - $this->{m_tool} = $tool; - $this->{m_tooldir} = $tdir; - $this->{m_toolpack} = $tpack; - $this->{m_pdbfiles} = $pdbfiles; - $this->{m_createrepo} = $createrepo; - $this->{m_rezip} = $rezip; - $this->{m_params} = $params; - $this->{m_languages} = join(' ', @langs); - $this->{m_compress} = $gzip; - if($enable != 0) { - $this->ready(1); - } - return $this; + my $name = $ini->val('base' , 'name'); + my $order = $ini->val('base' , 'order'); + my $tool = $ini->val('base' , 'tool'); + my $createrepo = $ini->val('base' , 'createrepo'); + my $rezip = $ini->val('base' , 'rezip'); + my $tdir = $ini->val('base' , 'tooldir'); + my $tpack = $ini->val('base' , 'toolpack'); + my $enable = $ini->val('base' , 'defaultenable'); + my $pdbfiles = $ini->val('options', 'pdbfiles'); + my @params = $ini->val('options', 'parameter'); + my @langs = $ini->val('options', 'language'); + my $gzip = $ini->val('target' , 'compress'); + # if any of those isn't set, complain! + if(not defined($name) + or not defined($order) + or not defined($tool) + or not defined($createrepo) + or not defined($rezip) + or not defined($tdir) + or not defined($tpack) + or not defined($enable) + or not defined($pdbfiles) + or not defined($gzip) + or not (@params) + ) { + $this->logMsg("E", + "Plugin ini file <$config> seems broken!" + ); + return; + } + # sanity check for tools' existence: + if(not( -f "$tdir/$tool" and -x "$tdir/$tool")) { + $this->logMsg("E", + "Plugin <$name>: tool <$tdir/$tool> is not executable!" + ); + $this->logMsg("I", + "Check if package <$tpack> is installed." + ); + return; + } + my $params = ""; + foreach my $p(@params) { + $p = $this->collect()->productData()->_substitute("$p"); + $params .= "$p "; + } + # add local kwd files as argument + my $extrafile = abs_path($this->collect()->{m_xml}->{xmlOrigFile}); + $extrafile =~ s/.kiwi$/.kwd/x; + if (-f $extrafile) { + $this->logMsg("W", "Found extra tags file $extrafile."); + $params .= "-T $extrafile "; + } + $this->name($name); + $this->order($order); + $this->{m_tool} = $tool; + $this->{m_tooldir} = $tdir; + $this->{m_toolpack} = $tpack; + $this->{m_pdbfiles} = $pdbfiles; + $this->{m_createrepo} = $createrepo; + $this->{m_rezip} = $rezip; + $this->{m_params} = $params; + $this->{m_languages} = join(' ', @langs); + $this->{m_compress} = $gzip; + if($enable != 0) { + $this->ready(1); + } + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - my $retval = 0; - # sanity check: - if($this->{m_ready} == 0) { - return $retval; - } - my $coll = $this->{m_collect}; - my $basesubdirs = $coll->basesubdirs(); - if(not defined($basesubdirs)) { - ## prevent crash when dereferencing - $this->logMsg("E", - " is undefined! Skipping <$this->name()>" - ); + my $this = shift; + if(not ref($this)) { + return; + } + my $retval = 0; + # sanity check: + if($this->{m_ready} == 0) { + return $retval; + } + my $coll = $this->{m_collect}; + my $basesubdirs = $coll->basesubdirs(); + if(not defined($basesubdirs)) { + ## prevent crash when dereferencing + $this->logMsg("E", + " is undefined! Skipping <$this->name()>" + ); + return $retval; + } + foreach my $dirlist($this->getSubdirLists()) { + my ($s,$m) = $this->executeDir(sort @{$dirlist}); + } return $retval; - } - foreach my $dirlist($this->getSubdirLists()) { - my ($s,$m) = $this->executeDir(sort @{$dirlist}); - } - return $retval; } sub executeDir { - my @params = @_; - my $this = shift @params; - my @paths = @params; - my $retval = 0; - my $status; - my $call; - if(!@paths) { - $this->logMsg("W", "Empty path list!"); - return $retval; - } - my $coll = $this->{m_collect}; - my $datadir = $coll->productData()->getInfo("DATADIR"); - my $descrdir = $coll->productData()->getInfo("DESCRDIR"); - my $createrepomd = $coll->productData()->getVar("CREATE_REPOMD"); - my $targetdir = $paths[0]."/".$descrdir; - ## this bits creates a parameter string from a list of directories: - # param = -d -d ... - # the order is important. Idea: use map to make hash => -d - # for all subdirs not ending with "0" (those are for metafile - # unpacking only). The result is evaluated in list context be reverse, - # so there's a list looking like " -d ... -d" which is - # reversed again, making the result '-d', '', ..., '-d', ''", - # after the join as string. - # ---- - my $pathlist = "-d ".join(' -d ', map{$_."/".$datadir}(@paths)); - $this->logMsg("I", - "Calling ".$this->name()." for directories <@paths>:" - ); - my $cmd = "$this->{m_tooldir}/$this->{m_tool} " - . "$this->{m_pdbfiles} $pathlist $this->{m_params} " - . "$this->{m_languages} -o " - . $paths[0] - . "/".$descrdir; - $this->logMsg("I", "Executing command <$cmd>"); - $call = $this -> callCmd($cmd); - $status = $call->[0]; - if($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called <$cmd> exit status: <$status> output: $out" - ); - return $retval; - } - if ( $createrepomd eq "true" ) { - foreach my $p (@paths) { - my $cmd_repo = "$this->{m_createrepo} $p/$datadir "; - $this->logMsg("I", "Executing command <$cmd_repo>"); - $call = $this -> callCmd($cmd_repo); - $status = $call->[0]; - if ($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called <$cmd_repo> exit status: <$status> output: $out" - ); + my @params = @_; + my $this = shift @params; + my @paths = @params; + my $retval = 0; + my $status; + my $call; + if(!@paths) { + $this->logMsg("W", "Empty path list!"); return $retval; - } - my $cmd_zipp = "$this->{m_rezip} $p/$datadir "; - $this->logMsg("I", "Executing command <$cmd_zipp>"); - $call = $this -> callCmd($cmd_zipp); - $status = $call->[0]; - if($status) { + } + my $coll = $this->{m_collect}; + my $datadir = $coll->productData()->getInfo("DATADIR"); + my $descrdir = $coll->productData()->getInfo("DESCRDIR"); + my $createrepomd = $coll->productData()->getVar("CREATE_REPOMD"); + my $targetdir = $paths[0]."/".$descrdir; + ## this bits creates a parameter string from a list of directories: + # param = -d -d ... + # the order is important. Idea: use map to make hash => -d + # for all subdirs not ending with "0" (those are for metafile + # unpacking only). The result is evaluated in list context be reverse, + # so there's a list looking like " -d ... -d" which is + # reversed again, making the result '-d', '', ..., '-d', ''", + # after the join as string. + # ---- + my $pathlist = "-d ".join(' -d ', map{$_."/".$datadir}(@paths)); + $this->logMsg("I", + "Calling ".$this->name()." for directories <@paths>:" + ); + my $cmd = "$this->{m_tooldir}/$this->{m_tool} " + . "$this->{m_pdbfiles} $pathlist $this->{m_params} " + . "$this->{m_languages} -o " + . $paths[0] + . "/".$descrdir; + $this->logMsg("I", "Executing command <$cmd>"); + $call = $this -> callCmd($cmd); + $status = $call->[0]; + if($status) { my $out = join("\n",@{$call->[1]}); $this->logMsg("E", - "Called <$cmd_zipp> exit status: <$status> output: $out" + "Called <$cmd> exit status: <$status> output: $out" ); return $retval; - } } - } - if($this->{m_compress} =~ m{yes}i) { - foreach my $pfile(glob("$targetdir/packages*")) { - if(system("gzip", "--rsyncable", "$pfile") == 0) { - unlink "$targetdir/$pfile"; - } else { - $this->logMsg("W", - "Can't compress file <$targetdir/$pfile>!" - ); - } + if ( $createrepomd eq "true" ) { + foreach my $p (@paths) { + my $cmd_repo = "$this->{m_createrepo} $p/$datadir "; + $this->logMsg("I", "Executing command <$cmd_repo>"); + $call = $this -> callCmd($cmd_repo); + $status = $call->[0]; + if ($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called <$cmd_repo> exit status: <$status> output: $out" + ); + return $retval; + } + my $cmd_zipp = "$this->{m_rezip} $p/$datadir "; + $this->logMsg("I", "Executing command <$cmd_zipp>"); + $call = $this -> callCmd($cmd_zipp); + $status = $call->[0]; + if($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called <$cmd_zipp> exit status: <$status> output: $out" + ); + return $retval; + } + } + } + if($this->{m_compress} =~ m{yes}i) { + foreach my $pfile(glob("$targetdir/packages*")) { + if(system("gzip", "--rsyncable", "$pfile") == 0) { + unlink "$targetdir/$pfile"; + } else { + $this->logMsg("W", + "Can't compress file <$targetdir/$pfile>!" + ); + } + } } - } - return 1; + return 1; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-11-3/KIWILiveTreePlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-11-3/KIWILiveTreePlugin.pm index 49a25dc4e..cc726fb5a 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-11-3/KIWILiveTreePlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-11-3/KIWILiveTreePlugin.pm @@ -29,104 +29,104 @@ use File::Basename; use Carp; sub new { - # ... - # Create a new KIWILiveTreePlugin object - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new($handler); - bless ($this, $class); + # ... + # Create a new KIWILiveTreePlugin object + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new($handler); + bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if(not defined($configpath) or not defined($configfile)) { - $this->logMsg("E", - "wrong parameters in plugin initialisation\n" + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if(not defined($configpath) or not defined($configfile)) { + $this->logMsg("E", + "wrong parameters in plugin initialisation\n" + ); + return; + } + ## plugin content: + #----------------- + #[base] + # name = KIWIEulaPlugin + # order = 3 + # defaultenable = 1 + # + #[target] + # targetfile = content + # targetdir = $PRODUCT_DIR + # media = (list of numbers XOR "all") + # + my $ini = Config::IniFiles -> new( + -file => "$configpath/$configfile" ); - return; - } - ## plugin content: - #----------------- - #[base] - # name = KIWIEulaPlugin - # order = 3 - # defaultenable = 1 - # - #[target] - # targetfile = content - # targetdir = $PRODUCT_DIR - # media = (list of numbers XOR "all") - # - my $ini = Config::IniFiles -> new( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base', 'name'); - my $order = $ini->val('base', 'order'); - my $enable = $ini->val('base', 'defaultenable'); - # if any of those isn't set, complain! - if(not defined($name) - or not defined($order) - or not defined($enable) - ) { - $this->logMsg("E", - "Plugin ini file <$config> seems broken!\n" - ); - return; - } - $this->name($name); - $this->order($order); - if($enable != 0) { - $this->ready(1); - } - return $this; + my $name = $ini->val('base', 'name'); + my $order = $ini->val('base', 'order'); + my $enable = $ini->val('base', 'defaultenable'); + # if any of those isn't set, complain! + if(not defined($name) + or not defined($order) + or not defined($enable) + ) { + $this->logMsg("E", + "Plugin ini file <$config> seems broken!\n" + ); + return; + } + $this->name($name); + $this->order($order); + if($enable != 0) { + $this->ready(1); + } + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - if($this->{m_ready} == 0) { - return 0; - } - my $ismini = $this->collect() - ->productData()->getVar("FLAVOR"); - if(not defined($ismini)) { - $this->logMsg("W", "FLAVOR not set?"); - return 0; - } - if($ismini !~ m{livetree}i) { + my $this = shift; + if(not ref($this)) { + return; + } + if($this->{m_ready} == 0) { + return 0; + } + my $ismini = $this->collect() + ->productData()->getVar("FLAVOR"); + if(not defined($ismini)) { + $this->logMsg("W", "FLAVOR not set?"); + return 0; + } + if($ismini !~ m{livetree}i) { + return 0; + } + my $medium = $this->collect() + ->productData()->getVar("MEDIUM_NAME"); + my $cd; + find( + sub { if (m/.iso/x) { $cd = $File::Find::name; } }, + $this->handler()->collect()->basedir() + ); + if (!$cd) { + $this->logMsg("E", "Initial CD not found\n"); + croak "E: fatal"; + } + $this->logMsg("I", "$cd $medium"); + my $dname = dirname($cd); + $this->logMsg("I", "$dname"); + my $nname = "$medium.iso"; + $nname =~ s,-i586-,-i686-,x; + $this->logMsg("I", + "Renaming $cd to $dname/$nname" + ); + if (! rename($cd, "$dname/$nname")) { + $this->logMsg("E", "could not rename $cd"); + croak "E: fatal"; + } return 0; - } - my $medium = $this->collect() - ->productData()->getVar("MEDIUM_NAME"); - my $cd; - find( - sub { if (m/.iso/x) { $cd = $File::Find::name; } }, - $this->handler()->collect()->basedir() - ); - if (!$cd) { - $this->logMsg("E", "Initial CD not found\n"); - croak "E: fatal"; - } - $this->logMsg("I", "$cd $medium"); - my $dname = dirname($cd); - $this->logMsg("I", "$dname"); - my $nname = "$medium.iso"; - $nname =~ s,-i586-,-i686-,x; - $this->logMsg("I", - "Renaming $cd to $dname/$nname" - ); - if (! rename($cd, "$dname/$nname")) { - $this->logMsg("E", "could not rename $cd"); - croak "E: fatal"; - } - return 0; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-11-3/KIWIMiniIsoPlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-11-3/KIWIMiniIsoPlugin.pm index 82d6de925..3bb4a6943 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-11-3/KIWIMiniIsoPlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-11-3/KIWIMiniIsoPlugin.pm @@ -29,245 +29,245 @@ use FileHandle; use Carp; sub new { - # ... - # Create a new KIWIMiniIsoPlugin object - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new($handler); - bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if ((! $configpath) || (! $configfile)) { - $this->logMsg("E", - "wrong parameters in plugin initialisation\n" - ); - return; - } - ## plugin content: - #----------------- - #[base] - # name = KIWIEulaPlugin - # order = 3 - # defaultenable = 1 - # - #[target] - # targetfile = content - # targetdir = $PRODUCT_DIR - # media = (list of numbers XOR "all") - # - my $ini = Config::IniFiles -> new ( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base', 'name'); - my $order = $ini->val('base', 'order'); - my $enable = $ini->val('base', 'defaultenable'); - # if any of those isn't set, complain! - if (not defined($name) - or not defined($order) - or not defined($enable) - ) { - $this->logMsg("E", - "Plugin ini file <$config> seems broken!\n" + # ... + # Create a new KIWIMiniIsoPlugin object + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new($handler); + bless ($this, $class); + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if ((! $configpath) || (! $configfile)) { + $this->logMsg("E", + "wrong parameters in plugin initialisation\n" + ); + return; + } + ## plugin content: + #----------------- + #[base] + # name = KIWIEulaPlugin + # order = 3 + # defaultenable = 1 + # + #[target] + # targetfile = content + # targetdir = $PRODUCT_DIR + # media = (list of numbers XOR "all") + # + my $ini = Config::IniFiles -> new ( + -file => "$configpath/$configfile" ); - return; - } - $this->name($name); - $this->order($order); - if($enable != 0) { - $this->ready(1); - } - return $this; + my $name = $ini->val('base', 'name'); + my $order = $ini->val('base', 'order'); + my $enable = $ini->val('base', 'defaultenable'); + # if any of those isn't set, complain! + if (not defined($name) + or not defined($order) + or not defined($enable) + ) { + $this->logMsg("E", + "Plugin ini file <$config> seems broken!\n" + ); + return; + } + $this->name($name); + $this->order($order); + if($enable != 0) { + $this->ready(1); + } + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - my $retval = 0; - if($this->{m_ready} == 0) { - return $retval; - } - my $repoloc = $this->collect()->productData()->getOpt("REPO_LOCATION"); - my $ismini = $this->collect()->productData()->getVar("FLAVOR"); - if(not defined($ismini)) { - $this->logMsg("W", "FLAVOR not set?"); - return $retval; - } - if ($ismini !~ m{mini}i) { - $this->logMsg("I", - "Nothing to for for media type <$ismini>" + my $this = shift; + if(not ref($this)) { + return; + } + my $retval = 0; + if($this->{m_ready} == 0) { + return $retval; + } + my $repoloc = $this->collect()->productData()->getOpt("REPO_LOCATION"); + my $ismini = $this->collect()->productData()->getVar("FLAVOR"); + if(not defined($ismini)) { + $this->logMsg("W", "FLAVOR not set?"); + return $retval; + } + if ($ismini !~ m{mini}i) { + $this->logMsg("I", + "Nothing to for for media type <$ismini>" + ); + return $retval; + } + my ($srv, $path); + if (not defined($repoloc)) { + $this->logMsg("I", + " is unset, boot protocol will be set to 'slp'!" + ); + } else { + if ($repoloc =~ m{^http://([^/]+)/(.+)}x) { + ($srv, $path) = ($1, $2); + } + if(not defined($srv) or not defined($path)) { + $this->logMsg("W", + "Parsing repo-location=<$repoloc> failed!" + ); + return $retval; + } + } + my @gfxbootfiles; + find( + sub { find_cb($this, '.*/gfxboot\.cfg$', \@gfxbootfiles) }, + $this->handler()->collect()->basedir() ); - return $retval; - } - my ($srv, $path); - if (not defined($repoloc)) { - $this->logMsg("I", - " is unset, boot protocol will be set to 'slp'!" + my @rootfiles; + find( + sub { find_cb($this, '.*/root$', \@rootfiles) }, + $this->handler()->collect()->basedir() ); - } else { - if ($repoloc =~ m{^http://([^/]+)/(.+)}x) { - ($srv, $path) = ($1, $2); + foreach(@rootfiles) { + $this->logMsg("I", "removing file <$_>"); + unlink $_; } - if(not defined($srv) or not defined($path)) { - $this->logMsg("W", - "Parsing repo-location=<$repoloc> failed!" - ); - return $retval; + if (!@gfxbootfiles) { + my $msg = "No gfxboot.cfg file found! " + . "This _MIGHT_ be ok for S/390. " + . "Please verify package(s)"; + $this->logMsg("W", $msg); + return $retval; } - } - my @gfxbootfiles; - find( - sub { find_cb($this, '.*/gfxboot\.cfg$', \@gfxbootfiles) }, - $this->handler()->collect()->basedir() - ); - my @rootfiles; - find( - sub { find_cb($this, '.*/root$', \@rootfiles) }, - $this->handler()->collect()->basedir() - ); - foreach(@rootfiles) { - $this->logMsg("I", "removing file <$_>"); - unlink $_; - } - if (!@gfxbootfiles) { - my $msg = "No gfxboot.cfg file found! " - . "This _MIGHT_ be ok for S/390. " - . "Please verify package(s)"; - $this->logMsg("W", $msg); + $this -> updateEFIGrubConfig($repoloc); + $retval = $this -> updateGraphicsBootConfig ( + \@gfxbootfiles, $repoloc, $srv, $path + ); return $retval; - } - $this -> updateEFIGrubConfig($repoloc); - $retval = $this -> updateGraphicsBootConfig ( - \@gfxbootfiles, $repoloc, $srv, $path - ); - return $retval; } sub updateGraphicsBootConfig { - my $this = shift; - my $gfxbootfiles = shift; - my $repoloc = shift; - my $srv = shift; - my $path = shift; - my $retval = 0; - foreach my $cfg(@{$gfxbootfiles}) { - $this->logMsg("I", "Processing file <$cfg>: "); - my $F = FileHandle -> new(); - if (! $F -> open($cfg)) { - $this->logMsg("E", "Cant open file <$cfg>!"); - next; + my $this = shift; + my $gfxbootfiles = shift; + my $repoloc = shift; + my $srv = shift; + my $path = shift; + my $retval = 0; + foreach my $cfg(@{$gfxbootfiles}) { + $this->logMsg("I", "Processing file <$cfg>: "); + my $F = FileHandle -> new(); + if (! $F -> open($cfg)) { + $this->logMsg("E", "Cant open file <$cfg>!"); + next; + } + my @lines = <$F>; + $F -> close(); + chomp(@lines); + my $install = -1; + my $ihs = -1; + my $ihp = -1; + my $i = -1; + foreach my $line(@lines) { + $i++; + next if $line !~ m{^install}x; + if($line =~ m{^install=.*}x) { + $install = $i; + } + if ($line =~ m{^install.http.server=+}x) { + $ihs = $i; + } + if($line =~ m{^install.http.path=+}x) { + $ihp = $i; + } + } + if(!$repoloc) { + if($install == -1) { + push @lines, "install=slp"; + } else { + $lines[$install] =~ s{^install.*}{install=slp}x; + } + } elsif($srv) { + if($ihs == -1) { + push @lines, "install.http.server=$srv"; + } else { + $lines[$ihs] =~ s{^(install.http.server).*}{$1=$srv}x; + } + if($ihp == -1) { + push @lines, "install.http.path=$path"; + } else { + $lines[$ihp] =~ s{^(install.http.path).*}{$1=$path}x; + } + if($install == -1) { + push @lines, "install=http"; + } else { + $lines[$install] =~ s{^install.*}{install=http}x; + } + } + unlink $cfg; + if (! $F -> open(">$cfg")) { + $this->logMsg("E", "Cant open file for writing <$cfg>!"); + next; + } + foreach(@lines) { + print $F "$_\n"; + } + $F -> close(); + $retval++; } - my @lines = <$F>; - $F -> close(); - chomp(@lines); - my $install = -1; - my $ihs = -1; - my $ihp = -1; - my $i = -1; - foreach my $line(@lines) { - $i++; - next if $line !~ m{^install}x; - if($line =~ m{^install=.*}x) { - $install = $i; - } - if ($line =~ m{^install.http.server=+}x) { - $ihs = $i; - } - if($line =~ m{^install.http.path=+}x) { - $ihp = $i; - } + return $retval; +} + +sub updateEFIGrubConfig { + my $this = shift; + my $repoloc = shift; + my $grubcfg = $this->collect() + ->basesubdirs()->{1} . "/EFI/BOOT/grub.cfg"; + if (! -f $grubcfg ) { + $this->logMsg("I", "no grub.cfg at <$grubcfg>"); + return; } - if(!$repoloc) { - if($install == -1) { - push @lines, "install=slp"; - } else { - $lines[$install] =~ s{^install.*}{install=slp}x; - } - } elsif($srv) { - if($ihs == -1) { - push @lines, "install.http.server=$srv"; - } else { - $lines[$ihs] =~ s{^(install.http.server).*}{$1=$srv}x; - } - if($ihp == -1) { - push @lines, "install.http.path=$path"; - } else { - $lines[$ihp] =~ s{^(install.http.path).*}{$1=$path}x; - } - if($install == -1) { - push @lines, "install=http"; - } else { - $lines[$install] =~ s{^install.*}{install=http}x; - } + $this->logMsg("I", "editing <$grubcfg>"); + my $IN = FileHandle -> new(); + my $OUT = FileHandle -> new(); + if (! $IN -> open($grubcfg)) { + croak "Cant open file for reading $grubcfg: $!"; } - unlink $cfg; - if (! $F -> open(">$cfg")) { - $this->logMsg("E", "Cant open file for writing <$cfg>!"); - next; + if (! $OUT -> open(">$grubcfg.new")) { + croak "Cant open file for writing $grubcfg.new: $!"; } - foreach(@lines) { - print $F "$_\n"; + while(<$IN>) { + my $line = $_; + chomp $line; + $this->logMsg("I", "-$line"); + $line =~ + s,(linuxefi /boot/x86_64/loader/linux),$1 install=$repoloc,x; + $this->logMsg("I", "+$line"); + print $OUT "$line\n"; } - $F -> close(); - $retval++; - } - return $retval; -} - -sub updateEFIGrubConfig { - my $this = shift; - my $repoloc = shift; - my $grubcfg = $this->collect() - ->basesubdirs()->{1} . "/EFI/BOOT/grub.cfg"; - if (! -f $grubcfg ) { - $this->logMsg("I", "no grub.cfg at <$grubcfg>"); - return; - } - $this->logMsg("I", "editing <$grubcfg>"); - my $IN = FileHandle -> new(); - my $OUT = FileHandle -> new(); - if (! $IN -> open($grubcfg)) { - croak "Cant open file for reading $grubcfg: $!"; - } - if (! $OUT -> open(">$grubcfg.new")) { - croak "Cant open file for writing $grubcfg.new: $!"; - } - while(<$IN>) { - my $line = $_; - chomp $line; - $this->logMsg("I", "-$line"); - $line =~ - s,(linuxefi /boot/x86_64/loader/linux),$1 install=$repoloc,x; - $this->logMsg("I", "+$line"); - print $OUT "$line\n"; - } - $OUT -> close(); - $IN -> close(); - $this -> callCmd("diff -u $grubcfg $grubcfg.new"); - rename("$grubcfg.new", $grubcfg); - return $this; + $OUT -> close(); + $IN -> close(); + $this -> callCmd("diff -u $grubcfg $grubcfg.new"); + rename("$grubcfg.new", $grubcfg); + return $this; } sub find_cb { - my $this = shift; - return if not ref($this); + my $this = shift; + return if not ref($this); - my $pat = shift; - my $listref = shift; - if(not defined($listref) or not defined($pat)) { - return; - } - if($File::Find::name =~ m{$pat}x) { - push @{$listref}, $File::Find::name; - } - return $this; + my $pat = shift; + my $listref = shift; + if(not defined($listref) or not defined($pat)) { + return; + } + if($File::Find::name =~ m{$pat}x) { + push @{$listref}, $File::Find::name; + } + return $this; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-11-3/KIWIPatternsPlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-11-3/KIWIPatternsPlugin.pm index a4df6924a..01685ef14 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-11-3/KIWIPatternsPlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-11-3/KIWIPatternsPlugin.pm @@ -25,135 +25,135 @@ use base "KIWIBasePlugin"; use Config::IniFiles; sub new { - # ... - # Create a new KIWIPatternsPlugin object - # creates patterns file - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new($handler); - bless ($this, $class); + # ... + # Create a new KIWIPatternsPlugin object + # creates patterns file + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new($handler); + bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if ((! $configpath) || (! $configfile)) { - $this->logMsg("E", - "wrong parameters in plugin initialisation\n" - ); - return; - } - ## plugin content: - #----------------- - #[base] - # name = KIWIPatternsPlugin - # dir = $DATADIR/setup/descr - # order = 1 - # tool = create_package_descr - # tooldir = /usr/bin - # toolpack = inst-source-utils - # defaultenabled = 1 - # media = 1 - # - #[target] - # targetfile = patterns - # compress = yes|no - # - my $ini = Config::IniFiles ->new( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base', 'name'); - my $order = $ini->val('base', 'order'); - my @dirs = $ini->val('base', 'dir'); - my $enable = $ini->val('base', 'defaultenable'); - my @media = $ini->val('base', 'media'); - my $target = $ini->val('target', 'targetfile'); - my $gzip = $ini->val('target', 'compress'); - # if any of those isn't set, complain! - if(not defined($name) - or not defined($order) - or not @dirs - or not defined($enable) - or not defined($target) - or not defined($gzip) - or not @media - ) { - $this->logMsg("E", - "Plugin ini file <$config> seems broken!\n" + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if ((! $configpath) || (! $configfile)) { + $this->logMsg("E", + "wrong parameters in plugin initialisation\n" + ); + return; + } + ## plugin content: + #----------------- + #[base] + # name = KIWIPatternsPlugin + # dir = $DATADIR/setup/descr + # order = 1 + # tool = create_package_descr + # tooldir = /usr/bin + # toolpack = inst-source-utils + # defaultenabled = 1 + # media = 1 + # + #[target] + # targetfile = patterns + # compress = yes|no + # + my $ini = Config::IniFiles ->new( + -file => "$configpath/$configfile" ); - return; - } - # parse dirs for productvars content: - for(my $i=0; $i <= $#dirs; $i++) { - $dirs[$i] = $this->collect() - ->productData()->_substitute("$dirs[$i]"); - } - $this->name($name); - $this->order($order); - $this->requiredDirs(@dirs); - $this->{m_media} = @media; - if($enable != 0) { - $this->ready(1); - } - $this->{m_compress} = $gzip; - $this->{m_target} = $target; - return $this; + my $name = $ini->val('base', 'name'); + my $order = $ini->val('base', 'order'); + my @dirs = $ini->val('base', 'dir'); + my $enable = $ini->val('base', 'defaultenable'); + my @media = $ini->val('base', 'media'); + my $target = $ini->val('target', 'targetfile'); + my $gzip = $ini->val('target', 'compress'); + # if any of those isn't set, complain! + if(not defined($name) + or not defined($order) + or not @dirs + or not defined($enable) + or not defined($target) + or not defined($gzip) + or not @media + ) { + $this->logMsg("E", + "Plugin ini file <$config> seems broken!\n" + ); + return; + } + # parse dirs for productvars content: + for(my $i=0; $i <= $#dirs; $i++) { + $dirs[$i] = $this->collect() + ->productData()->_substitute("$dirs[$i]"); + } + $this->name($name); + $this->order($order); + $this->requiredDirs(@dirs); + $this->{m_media} = @media; + if($enable != 0) { + $this->ready(1); + } + $this->{m_compress} = $gzip; + $this->{m_target} = $target; + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - if($this->{m_ready} == 0) { - return 0; - } - my $dirname = $this->{m_handler}->baseurl() - . "/" - . $this->{m_handler}->mediaName(); - my $mult = $this->collect() - ->productData()->getVar("MULTIPLE_MEDIA"); - if( $mult ne "no") { - $dirname .= $this->{m_media}; - } - $dirname .= "/".$this->{m_requireddirs}->[0]; - my $PATDIR; - if(!opendir($PATDIR, "$dirname")) { - $this->logMsg("E", - "PatternsPlugin: cannot read <$dirname>" - ); - $this->logMsg("I", - "Skipping plugin <".$this->name().">" - ); - return 0; - } - my $PAT = FileHandle -> new(); - if (! $PAT -> open(">$dirname/$this->{m_target}")) { - $this->logMsg("E", - "PatternsPlugin: cannot create <$dirname>/patterns!" - ); - $this->logMsg("I", - "Skipping plugin <".$this->name().">" - ); - return 0; - } - my @dirent = readdir($PATDIR); - foreach my $f(@dirent) { - next if $f !~ m{.*\.pat|.*\.pat\.gz}x; - if($f !~ m{.*\.gz$}x and $this->{m_compress} =~ m{yes}i) { - if (system('gzip', '--rsyncable', "$dirname/$f") == 0) { - $f = "$f.gz"; - } + my $this = shift; + if(not ref($this)) { + return; + } + if($this->{m_ready} == 0) { + return 0; + } + my $dirname = $this->{m_handler}->baseurl() + . "/" + . $this->{m_handler}->mediaName(); + my $mult = $this->collect() + ->productData()->getVar("MULTIPLE_MEDIA"); + if( $mult ne "no") { + $dirname .= $this->{m_media}; + } + $dirname .= "/".$this->{m_requireddirs}->[0]; + my $PATDIR; + if(!opendir($PATDIR, "$dirname")) { + $this->logMsg("E", + "PatternsPlugin: cannot read <$dirname>" + ); + $this->logMsg("I", + "Skipping plugin <".$this->name().">" + ); + return 0; + } + my $PAT = FileHandle -> new(); + if (! $PAT -> open(">$dirname/$this->{m_target}")) { + $this->logMsg("E", + "PatternsPlugin: cannot create <$dirname>/patterns!" + ); + $this->logMsg("I", + "Skipping plugin <".$this->name().">" + ); + return 0; + } + my @dirent = readdir($PATDIR); + foreach my $f(@dirent) { + next if $f !~ m{.*\.pat|.*\.pat\.gz}x; + if($f !~ m{.*\.gz$}x and $this->{m_compress} =~ m{yes}i) { + if (system('gzip', '--rsyncable', "$dirname/$f") == 0) { + $f = "$f.gz"; + } + } + print $PAT "$f\n"; } - print $PAT "$f\n"; - } - closedir($PATDIR); - $PAT -> close(); - return 1; + closedir($PATDIR); + $PAT -> close(); + return 1; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWIBasePlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWIBasePlugin.pm index 370a7ecff..a980922a2 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWIBasePlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWIBasePlugin.pm @@ -25,222 +25,222 @@ use IPC::Open3; use Symbol; sub new { - my $class = shift; - my $this = { - m_handler => undef, - m_name => "KIWIBasePlugin", - m_order => undef, - m_requireddirs=> [], - m_descr => [], - m_requires => [], - m_ready => 0, - m_collect => 0 - }; - bless ($this, $class); - $this->{m_handler} = shift; - if (! ref($this->{m_handler})) { - return; - } - $this->{m_collect} = $this->{m_handler}->collect(); - return $this; + my $class = shift; + my $this = { + m_handler => undef, + m_name => "KIWIBasePlugin", + m_order => undef, + m_requireddirs=> [], + m_descr => [], + m_requires => [], + m_ready => 0, + m_collect => 0 + }; + bless ($this, $class); + $this->{m_handler} = shift; + if (! ref($this->{m_handler})) { + return; + } + $this->{m_collect} = $this->{m_handler}->collect(); + return $this; } sub name { - my $this = shift; - my $name = shift; - if (! ref($this)) { - return; - } - my $oldname = $this->{m_name}; - if($name) { - $this->{m_name} = $name; - } - return $oldname; + my $this = shift; + my $name = shift; + if (! ref($this)) { + return; + } + my $oldname = $this->{m_name}; + if($name) { + $this->{m_name} = $name; + } + return $oldname; } sub order { - my $this = shift; - my $order = shift; - if (! ref($this)) { - return; - } - my $oldorder = $this->{m_order}; - if($order) { - $this->{m_order} = $order; - } - return $oldorder; + my $this = shift; + my $order = shift; + if (! ref($this)) { + return; + } + my $oldorder = $this->{m_order}; + if($order) { + $this->{m_order} = $order; + } + return $oldorder; } sub ready { - my $this = shift; - my $ready = shift; - if (! ref($this)) { - return; - } - my $oldready = $this->{m_ready}; - if($ready) { - $this->{m_ready} = $ready; - } - return $oldready; + my $this = shift; + my $ready = shift; + if (! ref($this)) { + return; + } + my $oldready = $this->{m_ready}; + if($ready) { + $this->{m_ready} = $ready; + } + return $oldready; } sub requiredDirs { - my @params = @_; - my $this = shift @params; - my @dirs = @params; - if (! ref($this)) { - return; - } - my @oldrd = @{$this->{m_requireddirs}}; - foreach my $entry(@params) { - push @{$this->{m_requireddirs}}, $entry; - } - return @oldrd; + my @params = @_; + my $this = shift @params; + my @dirs = @params; + if (! ref($this)) { + return; + } + my @oldrd = @{$this->{m_requireddirs}}; + foreach my $entry(@params) { + push @{$this->{m_requireddirs}}, $entry; + } + return @oldrd; } sub description { - my @params = @_; - my $this = shift @params; - my @descr= @params; - if (! ref($this)) { - return; - } - my @olddesc = $this->{m_descr}; - foreach my $entry(@descr) { - push @{$this->{m_descr}}, $entry; - } - return @olddesc; + my @params = @_; + my $this = shift @params; + my @descr= @params; + if (! ref($this)) { + return; + } + my @olddesc = $this->{m_descr}; + foreach my $entry(@descr) { + push @{$this->{m_descr}}, $entry; + } + return @olddesc; } sub requires { - my @params = @_; - my $this = shift; - my @reqs = @params; - if (! ref($this)) { - return; - } - my @oldreq = $this->{m_requires}; - foreach my $entry(@reqs) { - push @{$this->{m_requires}}, $entry; - } - return @oldreq; + my @params = @_; + my $this = shift; + my @reqs = @params; + if (! ref($this)) { + return; + } + my @oldreq = $this->{m_requires}; + foreach my $entry(@reqs) { + push @{$this->{m_requires}}, $entry; + } + return @oldreq; } sub handler { - my $this = shift; - if (! ref($this)) { - return; - } - return $this->{m_handler}; + my $this = shift; + if (! ref($this)) { + return; + } + return $this->{m_handler}; } sub collect { - my $this = shift; - if (! ref($this)) { - return; - } - return $this->{m_collect}; + my $this = shift; + if (! ref($this)) { + return; + } + return $this->{m_collect}; } sub logMsg { - my $this = shift; - if (! ref($this)) { - return; - } - my $type = shift; - my $msg = shift; - if ((! defined($type)) || (! defined($msg))) { - return; - } - $this->{m_collect}->logMsg($type, $msg); - return $this; + my $this = shift; + if (! ref($this)) { + return; + } + my $type = shift; + my $msg = shift; + if ((! defined($type)) || (! defined($msg))) { + return; + } + $this->{m_collect}->logMsg($type, $msg); + return $this; } sub callCmd { - my $this = shift; - my $cmd = shift; - my $BUFSIZE = 1024; - my @result; - my @errors; - my $result_buf; - my $errors_buf; - my ($CHILDWRITE, $CHILDSTDOUT, $CHILDSTDERR) = map { gensym } 1..3; - my $pid = open3 ( - $CHILDWRITE, $CHILDSTDOUT, $CHILDSTDERR, "$cmd" - ); - my $sel = IO::Select->new(); - $sel->add($CHILDSTDOUT); - $sel->add($CHILDSTDERR); - while($sel->count()) { - foreach my $handle ($sel->can_read()) { - my $bytes_read = ''; - my $chunk_result = sysread($handle, $bytes_read, $BUFSIZE); - if ($handle == $CHILDSTDOUT) { - $result_buf .= $bytes_read; - } else { - $errors_buf .= $bytes_read; - } - if ($chunk_result == 0) { - $sel->remove($handle); - next; - } - } - } - if ($result_buf) { - @result = split (/\n/x,$result_buf); - chomp @result; - } - if ($errors_buf) { - @errors = split (/\n/x,$errors_buf); - chomp @errors; - } - waitpid( $pid, 0 ); - my $status = $? >> 8; - return [$status,\@result,\@errors]; + my $this = shift; + my $cmd = shift; + my $BUFSIZE = 1024; + my @result; + my @errors; + my $result_buf; + my $errors_buf; + my ($CHILDWRITE, $CHILDSTDOUT, $CHILDSTDERR) = map { gensym } 1..3; + my $pid = open3 ( + $CHILDWRITE, $CHILDSTDOUT, $CHILDSTDERR, "$cmd" + ); + my $sel = IO::Select->new(); + $sel->add($CHILDSTDOUT); + $sel->add($CHILDSTDERR); + while($sel->count()) { + foreach my $handle ($sel->can_read()) { + my $bytes_read = ''; + my $chunk_result = sysread($handle, $bytes_read, $BUFSIZE); + if ($handle == $CHILDSTDOUT) { + $result_buf .= $bytes_read; + } else { + $errors_buf .= $bytes_read; + } + if ($chunk_result == 0) { + $sel->remove($handle); + next; + } + } + } + if ($result_buf) { + @result = split (/\n/x,$result_buf); + chomp @result; + } + if ($errors_buf) { + @errors = split (/\n/x,$errors_buf); + chomp @errors; + } + waitpid( $pid, 0 ); + my $status = $? >> 8; + return [$status,\@result,\@errors]; } sub getSubdirLists { - # ... - # method to distinguish debugmedia and ftp media subdirectories. - # --- - my $this = shift; - if (! ref($this)) { - return; - } - my @ret = (); - my $coll = $this->{m_collect}; - my $dbm = $coll->productData()->getOpt("DEBUGMEDIUM"); - my $flavor = $coll->productData()->getVar("FLAVOR"); - my $basesubdirs = $coll->basesubdirs(); - my @paths = values(%{$basesubdirs}); - @paths = grep { $_ =~ /[^0]$/x } @paths; # remove Media0 - my %path = map { $_ => 1 } @paths; - if($flavor =~ m{ftp}i) { - # 1: FTP tree, all subdirs get a separate call. - my @d = sort(keys(%path)); - foreach(@d) { - my @tmp; - push @tmp, $_; - push @ret, \@tmp; - } - } elsif($dbm >= 2) { - # 2: non-ftp tree, may have separate DEBUGMEDIUM specified - my @deb; - my @rest; - foreach my $d(keys(%path)) { - if ($d =~ m{.*$dbm$}x) { - push @deb, $d; - } else { - push @rest, $d; - } - } - push @ret, \@deb; - push @ret, \@rest; - } else { - my @d = keys(%path); - push @ret, \@d; - } - return @ret; + # ... + # method to distinguish debugmedia and ftp media subdirectories. + # --- + my $this = shift; + if (! ref($this)) { + return; + } + my @ret = (); + my $coll = $this->{m_collect}; + my $dbm = $coll->productData()->getOpt("DEBUGMEDIUM"); + my $flavor = $coll->productData()->getVar("FLAVOR"); + my $basesubdirs = $coll->basesubdirs(); + my @paths = values(%{$basesubdirs}); + @paths = grep { $_ =~ /[^0]$/x } @paths; # remove Media0 + my %path = map { $_ => 1 } @paths; + if($flavor =~ m{ftp}i) { + # 1: FTP tree, all subdirs get a separate call. + my @d = sort(keys(%path)); + foreach(@d) { + my @tmp; + push @tmp, $_; + push @ret, \@tmp; + } + } elsif($dbm >= 2) { + # 2: non-ftp tree, may have separate DEBUGMEDIUM specified + my @deb; + my @rest; + foreach my $d(keys(%path)) { + if ($d =~ m{.*$dbm$}x) { + push @deb, $d; + } else { + push @rest, $d; + } + } + push @ret, \@deb; + push @ret, \@rest; + } else { + my @d = keys(%path); + push @ret, \@d; + } + return @ret; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWIContentPlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWIContentPlugin.pm index d22b89a5a..3ff88aa5a 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWIContentPlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWIContentPlugin.pm @@ -27,152 +27,152 @@ use Data::Dumper; use Config::IniFiles; sub new { - # ... - # Create a new KIWIContentPlugin object - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new ($handler); - bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if(not defined($configpath) or not defined($configfile)) { - $this->logMsg("E", "wrong parameters in plugin initialisation\n"); - return; - } - ## Gather all necessary information from the inifile: - #=== - # Issue: why duplicate code here? Why not put it into the base class? - # Answer: Each plugin may have different options. Some only need a - # target filename, whilst some others may need much more. I don't want - # to specify a complicated framework for the plugin, it shall just be - # a simple straightforward way to get information into the plugin. - # The idea is that the people who decide on the metadata write - # the plugin, and therefore damn well know what it needs and what not. - # I'm definitely not bothering PMs with Yet Another File Specification - #--- - ## plugin content: - #----------------- - #[base] - # name = KIWIEulaPlugin - # order = 3 - # defaultenable = 1 - # - #[target] - # targetfile = content - # targetdir = $PRODUCT_DIR - # media = (list of numbers XOR "all") - # - my $ini = Config::IniFiles -> new( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base', 'name'); # scalar value - my $order = $ini->val('base', 'order'); # scalar value - my $enable = $ini->val('base', 'defaultenable'); # scalar value - my $target = $ini->val('target', 'targetfile'); - my $targetdir = $ini->val('target', 'targetdir'); - my @media = $ini->val('target', 'media'); - # if any of those isn't set, complain! - if(not defined($name) - or not defined($order) - or not defined($enable) - or not defined($target) - or not defined($targetdir) - or not @media - ) { - $this->logMsg("E", "Plugin ini file <$config> seems broken!"); - return; - } - $this->name($name); - $this->order($order); - $targetdir = $this->collect()->productData()->_substitute("$targetdir"); - if($enable != 0) { - $this->ready(1); - } - $this->requiredDirs($targetdir); - $this->{m_target} = $target; - $this->{m_targetdir} = $targetdir; - @{$this->{m_media}} = @media; - return $this; + # ... + # Create a new KIWIContentPlugin object + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new ($handler); + bless ($this, $class); + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if(not defined($configpath) or not defined($configfile)) { + $this->logMsg("E", "wrong parameters in plugin initialisation\n"); + return; + } + ## Gather all necessary information from the inifile: + #=== + # Issue: why duplicate code here? Why not put it into the base class? + # Answer: Each plugin may have different options. Some only need a + # target filename, whilst some others may need much more. I don't want + # to specify a complicated framework for the plugin, it shall just be + # a simple straightforward way to get information into the plugin. + # The idea is that the people who decide on the metadata write + # the plugin, and therefore damn well know what it needs and what not. + # I'm definitely not bothering PMs with Yet Another File Specification + #--- + ## plugin content: + #----------------- + #[base] + # name = KIWIEulaPlugin + # order = 3 + # defaultenable = 1 + # + #[target] + # targetfile = content + # targetdir = $PRODUCT_DIR + # media = (list of numbers XOR "all") + # + my $ini = Config::IniFiles -> new( + -file => "$configpath/$configfile" + ); + my $name = $ini->val('base', 'name'); # scalar value + my $order = $ini->val('base', 'order'); # scalar value + my $enable = $ini->val('base', 'defaultenable'); # scalar value + my $target = $ini->val('target', 'targetfile'); + my $targetdir = $ini->val('target', 'targetdir'); + my @media = $ini->val('target', 'media'); + # if any of those isn't set, complain! + if(not defined($name) + or not defined($order) + or not defined($enable) + or not defined($target) + or not defined($targetdir) + or not @media + ) { + $this->logMsg("E", "Plugin ini file <$config> seems broken!"); + return; + } + $this->name($name); + $this->order($order); + $targetdir = $this->collect()->productData()->_substitute("$targetdir"); + if($enable != 0) { + $this->ready(1); + } + $this->requiredDirs($targetdir); + $this->{m_target} = $target; + $this->{m_targetdir} = $targetdir; + @{$this->{m_media}} = @media; + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - my $retval = 0; - if($this->{m_ready} == 0) { - return $retval; - } - my $descrdir = $this->collect()->productData()->getInfo("DESCRDIR"); - if ((! $descrdir) || ($descrdir eq "/")) { - $this->logMsg("I", - "Empty or (/) descrdir, skipping content file creation" - ); - return $retval; - } - my @targetmedia = $this->collect()->getMediaNumbers(); - my %targets; - if($this->{m_media}->[0] =~ m{all}i) { - %targets = map { $_ => 1 } @targetmedia; - } else { - foreach my $cd(@{$this->{m_media}}) { - if(grep { $cd } @targetmedia) { - $targets{$cd} = 1; - } + my $this = shift; + if(not ref($this)) { + return; } - } - my $info = $this->collect()->productData()->getSet("prodinfo"); - if(!$info) { - $this->logMsg("E", "data set named seems to be broken:"); - $this->logMsg("E", Dumper($info)); - return $retval; - } - foreach my $cd(keys(%targets)) { - $this->logMsg("I", "Creating content file on medium <$cd>:"); - my $dir = $this->collect()->basesubdirs()->{$cd}; - my $contentfile = "$dir/$this->{m_target}"; - my $CONT = FileHandle -> new(); - if (! $CONT -> open(">$contentfile")) { - $this->logMsg("E", "Cannot create <$contentfile> on medium <$cd>"); - next; + my $retval = 0; + if($this->{m_ready} == 0) { + return $retval; + } + my $descrdir = $this->collect()->productData()->getInfo("DESCRDIR"); + if ((! $descrdir) || ($descrdir eq "/")) { + $this->logMsg("I", + "Empty or (/) descrdir, skipping content file creation" + ); + return $retval; } - # compute maxlen: - my $len = 0; - foreach(keys(%{$info})) { - my $l = length($info->{$_}->[0]); - $len = ($l>$len)?$l:$len; + my @targetmedia = $this->collect()->getMediaNumbers(); + my %targets; + if($this->{m_media}->[0] =~ m{all}i) { + %targets = map { $_ => 1 } @targetmedia; + } else { + foreach my $cd(@{$this->{m_media}}) { + if(grep { $cd } @targetmedia) { + $targets{$cd} = 1; + } + } } - $len++; - # ftp media special mode ? - my $coll = $this->{m_collect}; - my $flavor = $coll->productData()->getVar("FLAVOR"); - my $ftpmode = ($flavor =~ m{ftp}i); + my $info = $this->collect()->productData()->getSet("prodinfo"); + if(!$info) { + $this->logMsg("E", "data set named seems to be broken:"); + $this->logMsg("E", Dumper($info)); + return $retval; + } + foreach my $cd(keys(%targets)) { + $this->logMsg("I", "Creating content file on medium <$cd>:"); + my $dir = $this->collect()->basesubdirs()->{$cd}; + my $contentfile = "$dir/$this->{m_target}"; + my $CONT = FileHandle -> new(); + if (! $CONT -> open(">$contentfile")) { + $this->logMsg("E", "Cannot create <$contentfile> on medium <$cd>"); + next; + } + # compute maxlen: + my $len = 0; + foreach(keys(%{$info})) { + my $l = length($info->{$_}->[0]); + $len = ($l>$len)?$l:$len; + } + $len++; + # ftp media special mode ? + my $coll = $this->{m_collect}; + my $flavor = $coll->productData()->getVar("FLAVOR"); + my $ftpmode = ($flavor =~ m{ftp}i); - my %ftpcontentkeys = map {$_ => 1} qw{ - CONTENTSTYLE REPOID DESCRDIR DATADIR VENDOR - }; - foreach my $i(sort { $a <=> $b } keys(%{$info})) { - # ftp medias beside first one should get provide the product - if ( !$ftpmode || $cd eq "1" || $ftpcontentkeys{$info->{$i}->[0]}) { - print $CONT sprintf( - '%-*s %s', $len, $info->{$i}->[0], $info->{$i}->[1] - )."\n"; - } + my %ftpcontentkeys = map {$_ => 1} qw{ + CONTENTSTYLE REPOID DESCRDIR DATADIR VENDOR + }; + foreach my $i(sort { $a <=> $b } keys(%{$info})) { + # ftp medias beside first one should get provide the product + if ( !$ftpmode || $cd eq "1" || $ftpcontentkeys{$info->{$i}->[0]}) { + print $CONT sprintf( + '%-*s %s', $len, $info->{$i}->[0], $info->{$i}->[1] + )."\n"; + } + } + $CONT -> close(); + $this->logMsg( + "I", "Wrote file <$contentfile> for medium <$cd> successfully." + ); + $retval++; } - $CONT -> close(); - $this->logMsg( - "I", "Wrote file <$contentfile> for medium <$cd> successfully." - ); - $retval++; - } - return $retval; + return $retval; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWIDescrPlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWIDescrPlugin.pm index c1910e53d..6bcbc6f36 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWIDescrPlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWIDescrPlugin.pm @@ -28,346 +28,346 @@ use Data::Dumper; use Cwd 'abs_path'; sub new { - # ... - # Create a new KIWIDescrPlugin object - # creates patterns file - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new($handler); - bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if((! $configpath) || (! $configfile)) { - $this->logMsg("E", - "wrong parameters in plugin initialisation" - ); - return; - } - my $ini = Config::IniFiles -> new( -file => "$configpath/$configfile" ); - my $name = $ini->val('base', 'name'); - my $order = $ini->val('base', 'order'); - my $tool = $ini->val('base', 'tool'); - my $createrepo = $ini->val('base', 'createrepo'); - my $rezip = $ini->val('base', 'rezip'); - my $tdir = $ini->val('base', 'tooldir'); - my $tpack = $ini->val('base', 'toolpack'); - my $enable = $ini->val('base', 'defaultenable'); - my @params = $ini->val('options', 'parameter'); - my $gzip = $ini->val('target', 'compress'); - # if any of those isn't set, complain! - if(not defined($name) - or not defined($order) - or not defined($tool) - or not defined($createrepo) - or not defined($rezip) - or not defined($tdir) - or not defined($tpack) - or not defined($enable) - or not defined($gzip) - or not (@params) - ) { - $this->logMsg("E", - "Plugin ini file <$config> seems broken!" - ); - return; - } - # sanity check for tools' existence: - if(not( -f "$tdir/$tool" and -x "$tdir/$tool")) { - $this->logMsg("E", - "Plugin <$name>: tool <$tdir/$tool> is not executable!" - ); - $this->logMsg("I", - "Check if package <$tpack> is installed." - ); - return; - } - my $params = ""; - foreach my $p(@params) { - $p = $this->collect()->productData()->_substitute("$p"); - $params .= "$p "; - } - # add local kwd files as argument - my $extrafile = abs_path($this->collect()->{m_xml}->{xmlOrigFile}); - $extrafile =~ s/.kiwi$/.kwd/x; - if (-f $extrafile) { - $this->logMsg("W", "Found extra tags file $extrafile."); - $params .= "-T $extrafile "; - } - $this->name($name); - $this->order($order); - $this->{m_tool} = $tool; - $this->{m_tooldir} = $tdir; - $this->{m_toolpack} = $tpack; - $this->{m_createrepo} = $createrepo; - $this->{m_rezip} = $rezip; - $this->{m_params} = $params; - $this->{m_compress} = $gzip; - if($enable != 0) { - $this->ready(1); - } - return $this; + # ... + # Create a new KIWIDescrPlugin object + # creates patterns file + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new($handler); + bless ($this, $class); + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if((! $configpath) || (! $configfile)) { + $this->logMsg("E", + "wrong parameters in plugin initialisation" + ); + return; + } + my $ini = Config::IniFiles -> new( -file => "$configpath/$configfile" ); + my $name = $ini->val('base', 'name'); + my $order = $ini->val('base', 'order'); + my $tool = $ini->val('base', 'tool'); + my $createrepo = $ini->val('base', 'createrepo'); + my $rezip = $ini->val('base', 'rezip'); + my $tdir = $ini->val('base', 'tooldir'); + my $tpack = $ini->val('base', 'toolpack'); + my $enable = $ini->val('base', 'defaultenable'); + my @params = $ini->val('options', 'parameter'); + my $gzip = $ini->val('target', 'compress'); + # if any of those isn't set, complain! + if(not defined($name) + or not defined($order) + or not defined($tool) + or not defined($createrepo) + or not defined($rezip) + or not defined($tdir) + or not defined($tpack) + or not defined($enable) + or not defined($gzip) + or not (@params) + ) { + $this->logMsg("E", + "Plugin ini file <$config> seems broken!" + ); + return; + } + # sanity check for tools' existence: + if(not( -f "$tdir/$tool" and -x "$tdir/$tool")) { + $this->logMsg("E", + "Plugin <$name>: tool <$tdir/$tool> is not executable!" + ); + $this->logMsg("I", + "Check if package <$tpack> is installed." + ); + return; + } + my $params = ""; + foreach my $p(@params) { + $p = $this->collect()->productData()->_substitute("$p"); + $params .= "$p "; + } + # add local kwd files as argument + my $extrafile = abs_path($this->collect()->{m_xml}->{xmlOrigFile}); + $extrafile =~ s/.kiwi$/.kwd/x; + if (-f $extrafile) { + $this->logMsg("W", "Found extra tags file $extrafile."); + $params .= "-T $extrafile "; + } + $this->name($name); + $this->order($order); + $this->{m_tool} = $tool; + $this->{m_tooldir} = $tdir; + $this->{m_toolpack} = $tpack; + $this->{m_createrepo} = $createrepo; + $this->{m_rezip} = $rezip; + $this->{m_params} = $params; + $this->{m_compress} = $gzip; + if($enable != 0) { + $this->ready(1); + } + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - if($this->{m_ready} == 0) { - return 0 - } - my $coll = $this->{m_collect}; - my $basesubdirs = $coll->basesubdirs(); - if(not defined($basesubdirs)) { - ## prevent crash when dereferencing - $this->logMsg("E", - " is undefined! Skipping <$this->name()>" - ); + my $this = shift; + if(not ref($this)) { + return; + } + if($this->{m_ready} == 0) { + return 0 + } + my $coll = $this->{m_collect}; + my $basesubdirs = $coll->basesubdirs(); + if(not defined($basesubdirs)) { + ## prevent crash when dereferencing + $this->logMsg("E", + " is undefined! Skipping <$this->name()>" + ); + return 0; + } + foreach my $dirlist($this->getSubdirLists()) { + my ($s,$m) = $this->executeDir(sort @{$dirlist}); + } return 0; - } - foreach my $dirlist($this->getSubdirLists()) { - my ($s,$m) = $this->executeDir(sort @{$dirlist}); - } - return 0; } sub executeDir { - my @params = @_; - my $this = shift @params; - my @paths = @params; - my $call; - my $status; - my $cmd; - if(!@paths) { - $this->logMsg("W", "Empty path list!"); - return 0; - } - my $coll = $this->{m_collect}; - my $datadir = $coll->productData()->getInfo("DATADIR"); - my $descrdir = $coll->productData()->getInfo("DESCRDIR"); - my $cpeid = $coll->productData()->getInfo("CPEID"); - my $repoid = $coll->productData()->getInfo("REPOID"); - my $distroname = $coll->productData()->getInfo("DISTRIBUTION")."." - . $coll->productData()->getInfo("VERSION"); - my $createrepomd = $coll->productData()->getVar("CREATE_REPOMD"); - my $targetdir; - my $newtargetdir; - ## this ugly bit creates a parameter string from a list of directories: - # param = -d -d ... - # the order is important. Idea: use map to make hash => -d for - # all subdirs not ending with "0" (those are for metafile unpacking - # only). The result is evaluated in list context be reverse, so - # there's a list looking like " -d ... -d" which is - # reversed again, making the result '-d', '', ..., '-d', ''", - # after the join as string. - # --- - if ($descrdir && $descrdir ne "/") { - my $pathlist = "-d ".join(' -d ', map{$_."/".$datadir}(@paths)); - $this->logMsg("I", - "Calling ".$this->name()." for directories <@paths>:" - ); - $targetdir = $paths[0]."/".$descrdir; - $cmd = "$this->{m_tooldir}/$this->{m_tool} " - . "$pathlist $this->{m_params} -o " - . $paths[0] - . "/" - . $descrdir; - $this->logMsg("I", "Executing command <$cmd>"); - $call = $this -> callCmd($cmd); - $status = $call->[0]; - if($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called <$cmd> exit status <$status> output: $out" - ); - return 0; - } - } - if ( $createrepomd eq "true" ) { - my $result = $this -> createRepositoryMetadata( - \@paths, $repoid, $distroname, $cpeid, $datadir, $targetdir - ); - # return values 0 || 1 indicates an error - if ($result != 2) { - return $result; - } - } - return 1 unless $descrdir; - return 1 unless $targetdir; - # insert translation files - my $trans_dir = '/usr/share/locale/en_US/LC_MESSAGES'; - my $trans_glob = 'package-translations-*.mo'; - foreach my $trans (glob($trans_dir.'/'.$trans_glob)) { - $trans = basename($trans, ".mo"); - $trans =~ s,.*-,,x; - $cmd = "/usr/bin/translate_packages.pl $trans " - . "< $targetdir/packages.en " - . "> $targetdir/packages.$trans"; - $call = $this -> callCmd($cmd); - $status = $call->[0]; - if($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called <$cmd> exit status: <$status> output: $out" - ); - return 1; - } - } - # one more time for english to insert possible EULAs - $cmd = "/usr/bin/translate_packages.pl en " - . "< $targetdir/packages.en " - . "> $targetdir/packages.en.new && " - . "mv $targetdir/packages.en.new $targetdir/packages.en"; - $call = $this -> callCmd($cmd); - $status = $call->[0]; - if ($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called <$cmd> exit status: <$status> output: $out" - ); - return 1; - } - if ((-x "/usr/bin/extract-appdata-icons") && - (-s "$targetdir/appdata.xml") - ) { - $cmd = "/usr/bin/extract-appdata-icons " - . "$targetdir/appdata.xml $targetdir"; - $call = $this -> callCmd($cmd); - $status = $call->[0]; - if($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called <$cmd> exit status: <$status> output: $out" - ); - return 1; + my @params = @_; + my $this = shift @params; + my @paths = @params; + my $call; + my $status; + my $cmd; + if(!@paths) { + $this->logMsg("W", "Empty path list!"); + return 0; } - if($this->{m_compress} =~ m{yes}i) { - system("gzip", "--rsyncable", "$targetdir/appdata.xml"); + my $coll = $this->{m_collect}; + my $datadir = $coll->productData()->getInfo("DATADIR"); + my $descrdir = $coll->productData()->getInfo("DESCRDIR"); + my $cpeid = $coll->productData()->getInfo("CPEID"); + my $repoid = $coll->productData()->getInfo("REPOID"); + my $distroname = $coll->productData()->getInfo("DISTRIBUTION")."." + . $coll->productData()->getInfo("VERSION"); + my $createrepomd = $coll->productData()->getVar("CREATE_REPOMD"); + my $targetdir; + my $newtargetdir; + ## this ugly bit creates a parameter string from a list of directories: + # param = -d -d ... + # the order is important. Idea: use map to make hash => -d for + # all subdirs not ending with "0" (those are for metafile unpacking + # only). The result is evaluated in list context be reverse, so + # there's a list looking like " -d ... -d" which is + # reversed again, making the result '-d', '', ..., '-d', ''", + # after the join as string. + # --- + if ($descrdir && $descrdir ne "/") { + my $pathlist = "-d ".join(' -d ', map{$_."/".$datadir}(@paths)); + $this->logMsg("I", + "Calling ".$this->name()." for directories <@paths>:" + ); + $targetdir = $paths[0]."/".$descrdir; + $cmd = "$this->{m_tooldir}/$this->{m_tool} " + . "$pathlist $this->{m_params} -o " + . $paths[0] + . "/" + . $descrdir; + $this->logMsg("I", "Executing command <$cmd>"); + $call = $this -> callCmd($cmd); + $status = $call->[0]; + if($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called <$cmd> exit status <$status> output: $out" + ); + return 0; + } } - } - if($this->{m_compress} =~ m{yes}i) { - foreach my $pfile(glob("$targetdir/packages*")) { - if(system("gzip", "--rsyncable", "$pfile") == 0) { - unlink "$targetdir/$pfile"; - } else { - $this->logMsg("W", - "Can't compress file <$targetdir/$pfile>!" + if ( $createrepomd eq "true" ) { + my $result = $this -> createRepositoryMetadata( + \@paths, $repoid, $distroname, $cpeid, $datadir, $targetdir ); - } + # return values 0 || 1 indicates an error + if ($result != 2) { + return $result; + } } - } - return 1; -} - -sub createRepositoryMetadata { - my @params = @_; - my $this = $params[0]; - my $paths = $params[1]; - my $repoid = $params[2]; - my $distroname = $params[3]; - my $cpeid = $params[4]; - my $datadir = $params[5]; - my $targetdir = $params[6]; - my $cmd; - my $call; - my $status; - foreach my $p (@{$paths}) { - $cmd = "$this->{m_createrepo}"; - $cmd .= " --unique-md-filenames"; - $cmd .= " --checksum=sha256"; - $cmd .= " --no-database"; - $cmd .= " --repo=\"$repoid\"" if $repoid; - $cmd .= " --distro=\"$cpeid,$distroname\"" if $cpeid && $distroname; - $cmd .= " $p/$datadir"; - $this->logMsg("I", "Executing command <$cmd>"); - $call = $this -> callCmd($cmd); - $status = $call->[0]; - if($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called <$cmd> exit status: <$status> output: $out" - ); - return 0; + return 1 unless $descrdir; + return 1 unless $targetdir; + # insert translation files + my $trans_dir = '/usr/share/locale/en_US/LC_MESSAGES'; + my $trans_glob = 'package-translations-*.mo'; + foreach my $trans (glob($trans_dir.'/'.$trans_glob)) { + $trans = basename($trans, ".mo"); + $trans =~ s,.*-,,x; + $cmd = "/usr/bin/translate_packages.pl $trans " + . "< $targetdir/packages.en " + . "> $targetdir/packages.$trans"; + $call = $this -> callCmd($cmd); + $status = $call->[0]; + if($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called <$cmd> exit status: <$status> output: $out" + ); + return 1; + } } - $cmd = "$this->{m_rezip} $p/$datadir "; - $this->logMsg("I", "Executing command <$cmd>"); + # one more time for english to insert possible EULAs + $cmd = "/usr/bin/translate_packages.pl en " + . "< $targetdir/packages.en " + . "> $targetdir/packages.en.new && " + . "mv $targetdir/packages.en.new $targetdir/packages.en"; $call = $this -> callCmd($cmd); $status = $call->[0]; - if($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called <$cmd> exit status: <$status> output: $out" - ); - return 0; - } - my $newtargetdir = "$p/$datadir/repodata"; - if ((-x "/usr/bin/extract-appdata-icons") && - (-s "$newtargetdir/appdata.xml") - ) { - $cmd = "/usr/bin/extract-appdata-icons " - . "$newtargetdir/appdata.xml $newtargetdir"; - $call = $this -> callCmd($cmd); - $status = $call->[0]; - if($status) { + if ($status) { my $out = join("\n",@{$call->[1]}); $this->logMsg("E", - "Called $cmd exit status: <$status> output: $out" + "Called <$cmd> exit status: <$status> output: $out" ); return 1; - } - if($this->{m_compress} =~ m{yes}i) { - system("gzip", "--rsyncable", "$newtargetdir/appdata.xml"); - } } if ((-x "/usr/bin/extract-appdata-icons") && - (-s "$targetdir/appdata.xml") + (-s "$targetdir/appdata.xml") ) { - $newtargetdir = "$p/$datadir/repodata"; - system("cp $targetdir/appdata.xml $newtargetdir/appdata.xml"); - $cmd = "/usr/bin/extract-appdata-icons " - . "$newtargetdir/appdata.xml $newtargetdir"; - $call = $this -> callCmd($cmd); - $status = $call->[0]; - if($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called $cmd exit status: <$status> output: $out" - ); - return 1; - } - if($this->{m_compress} =~ m{yes}i) { - system("gzip", "--rsyncable", "$newtargetdir/appdata.xml"); - } + $cmd = "/usr/bin/extract-appdata-icons " + . "$targetdir/appdata.xml $targetdir"; + $call = $this -> callCmd($cmd); + $status = $call->[0]; + if($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called <$cmd> exit status: <$status> output: $out" + ); + return 1; + } + if($this->{m_compress} =~ m{yes}i) { + system("gzip", "--rsyncable", "$targetdir/appdata.xml"); + } } - if ( -f "/usr/bin/add_product_susedata" ) { - my $kwdfile = abs_path( - $this->collect()->{m_xml}->{xmlOrigFile} - ); - $kwdfile =~ s/.kiwi$/.kwd/x; - $cmd = "/usr/bin/add_product_susedata"; - $cmd .= " -u"; # unique filenames - $cmd .= " -k $kwdfile"; - $cmd .= " -e /usr/share/doc/packages/eulas"; - $cmd .= " -d $p/$datadir"; - $this->logMsg("I", "Executing command <$cmd>"); - $call = $this -> callCmd($cmd); - $status = $call->[0]; - if($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called <$cmd> exit status: <$status> output: $out" - ); - return 0; - } + if($this->{m_compress} =~ m{yes}i) { + foreach my $pfile(glob("$targetdir/packages*")) { + if(system("gzip", "--rsyncable", "$pfile") == 0) { + unlink "$targetdir/$pfile"; + } else { + $this->logMsg("W", + "Can't compress file <$targetdir/$pfile>!" + ); + } + } + } + return 1; +} + +sub createRepositoryMetadata { + my @params = @_; + my $this = $params[0]; + my $paths = $params[1]; + my $repoid = $params[2]; + my $distroname = $params[3]; + my $cpeid = $params[4]; + my $datadir = $params[5]; + my $targetdir = $params[6]; + my $cmd; + my $call; + my $status; + foreach my $p (@{$paths}) { + $cmd = "$this->{m_createrepo}"; + $cmd .= " --unique-md-filenames"; + $cmd .= " --checksum=sha256"; + $cmd .= " --no-database"; + $cmd .= " --repo=\"$repoid\"" if $repoid; + $cmd .= " --distro=\"$cpeid,$distroname\"" if $cpeid && $distroname; + $cmd .= " $p/$datadir"; + $this->logMsg("I", "Executing command <$cmd>"); + $call = $this -> callCmd($cmd); + $status = $call->[0]; + if($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called <$cmd> exit status: <$status> output: $out" + ); + return 0; + } + $cmd = "$this->{m_rezip} $p/$datadir "; + $this->logMsg("I", "Executing command <$cmd>"); + $call = $this -> callCmd($cmd); + $status = $call->[0]; + if($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called <$cmd> exit status: <$status> output: $out" + ); + return 0; + } + my $newtargetdir = "$p/$datadir/repodata"; + if ((-x "/usr/bin/extract-appdata-icons") && + (-s "$newtargetdir/appdata.xml") + ) { + $cmd = "/usr/bin/extract-appdata-icons " + . "$newtargetdir/appdata.xml $newtargetdir"; + $call = $this -> callCmd($cmd); + $status = $call->[0]; + if($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called $cmd exit status: <$status> output: $out" + ); + return 1; + } + if($this->{m_compress} =~ m{yes}i) { + system("gzip", "--rsyncable", "$newtargetdir/appdata.xml"); + } + } + if ((-x "/usr/bin/extract-appdata-icons") && + (-s "$targetdir/appdata.xml") + ) { + $newtargetdir = "$p/$datadir/repodata"; + system("cp $targetdir/appdata.xml $newtargetdir/appdata.xml"); + $cmd = "/usr/bin/extract-appdata-icons " + . "$newtargetdir/appdata.xml $newtargetdir"; + $call = $this -> callCmd($cmd); + $status = $call->[0]; + if($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called $cmd exit status: <$status> output: $out" + ); + return 1; + } + if($this->{m_compress} =~ m{yes}i) { + system("gzip", "--rsyncable", "$newtargetdir/appdata.xml"); + } + } + if ( -f "/usr/bin/add_product_susedata" ) { + my $kwdfile = abs_path( + $this->collect()->{m_xml}->{xmlOrigFile} + ); + $kwdfile =~ s/.kiwi$/.kwd/x; + $cmd = "/usr/bin/add_product_susedata"; + $cmd .= " -u"; # unique filenames + $cmd .= " -k $kwdfile"; + $cmd .= " -e /usr/share/doc/packages/eulas"; + $cmd .= " -d $p/$datadir"; + $this->logMsg("I", "Executing command <$cmd>"); + $call = $this -> callCmd($cmd); + $status = $call->[0]; + if($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called <$cmd> exit status: <$status> output: $out" + ); + return 0; + } + } } - } - return 2; + return 2; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWIFinishEFIPlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWIFinishEFIPlugin.pm index 4cfc8397f..341caf52c 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWIFinishEFIPlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWIFinishEFIPlugin.pm @@ -28,83 +28,83 @@ use File::Find; use File::Basename; sub new { - # ... - # Create a new KIWIFinishEFIPlugin object - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin ->new ($handler); - bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if(not defined($configpath) or not defined($configfile)) { - $this->logMsg("E", - "wrong parameters in plugin initialisation\n" + # ... + # Create a new KIWIFinishEFIPlugin object + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin ->new ($handler); + bless ($this, $class); + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if(not defined($configpath) or not defined($configfile)) { + $this->logMsg("E", + "wrong parameters in plugin initialisation\n" + ); + return; + } + ## plugin content: + #----------------- + #[base] + # name = KIWIEulaPlugin + # order = 3 + # defaultenable = 1 + # + #[target] + # targetfile = content + # targetdir = $PRODUCT_DIR + # media = (list of numbers XOR "all") + # + my $ini= Config::IniFiles -> new( + -file => "$configpath/$configfile" ); - return; - } - ## plugin content: - #----------------- - #[base] - # name = KIWIEulaPlugin - # order = 3 - # defaultenable = 1 - # - #[target] - # targetfile = content - # targetdir = $PRODUCT_DIR - # media = (list of numbers XOR "all") - # - my $ini= Config::IniFiles -> new( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base', 'name'); - my $order = $ini->val('base', 'order'); - my $enable = $ini->val('base', 'defaultenable'); - # if any of those isn't set, complain! - if(not defined($name) - or not defined($order) - or not defined($enable) - ) { - $this->logMsg("E", - "Plugin ini file <$config> seems broken!\n" - ); - return; - } - $this->name($name); - $this->order($order); - if($enable != 0) { - $this->ready(1); - } - return $this; + my $name = $ini->val('base', 'name'); + my $order = $ini->val('base', 'order'); + my $enable = $ini->val('base', 'defaultenable'); + # if any of those isn't set, complain! + if(not defined($name) + or not defined($order) + or not defined($enable) + ) { + $this->logMsg("E", + "Plugin ini file <$config> seems broken!\n" + ); + return; + } + $this->name($name); + $this->order($order); + if($enable != 0) { + $this->ready(1); + } + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - if($this->{m_ready} == 0) { + my $this = shift; + if(not ref($this)) { + return; + } + if($this->{m_ready} == 0) { + return 0; + } + my $cd = 1; + my $type = $this->collect()->{m_xml}->getImageType(); + return 0 unless $type; + my $firmware = $type->getFirmwareType(); + if ($firmware eq "efi" || $firmware eq "uefi") { + my $dir = $this->collect()->basesubdirs()->{$cd}; + my $efi = "$dir/boot/x86_64/efi"; + $this->logMsg("I", "creating $efi"); + $this -> callCmd("dd if=/dev/zero of=$efi bs=1M count=4"); + $this -> callCmd("/usr/sbin/mkdosfs -n 'BOOT' $efi"); + $this -> callCmd("mcopy -Do -s -i $efi $dir/EFI ::"); + } return 0; - } - my $cd = 1; - my $type = $this->collect()->{m_xml}->getImageType(); - return 0 unless $type; - my $firmware = $type->getFirmwareType(); - if ($firmware eq "efi" || $firmware eq "uefi") { - my $dir = $this->collect()->basesubdirs()->{$cd}; - my $efi = "$dir/boot/x86_64/efi"; - $this->logMsg("I", "creating $efi"); - $this -> callCmd("dd if=/dev/zero of=$efi bs=1M count=4"); - $this -> callCmd("/usr/sbin/mkdosfs -n 'BOOT' $efi"); - $this -> callCmd("mcopy -Do -s -i $efi $dir/EFI ::"); - } - return 0; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWILiveTreePlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWILiveTreePlugin.pm index 49a25dc4e..cc726fb5a 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWILiveTreePlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWILiveTreePlugin.pm @@ -29,104 +29,104 @@ use File::Basename; use Carp; sub new { - # ... - # Create a new KIWILiveTreePlugin object - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new($handler); - bless ($this, $class); + # ... + # Create a new KIWILiveTreePlugin object + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new($handler); + bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if(not defined($configpath) or not defined($configfile)) { - $this->logMsg("E", - "wrong parameters in plugin initialisation\n" + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if(not defined($configpath) or not defined($configfile)) { + $this->logMsg("E", + "wrong parameters in plugin initialisation\n" + ); + return; + } + ## plugin content: + #----------------- + #[base] + # name = KIWIEulaPlugin + # order = 3 + # defaultenable = 1 + # + #[target] + # targetfile = content + # targetdir = $PRODUCT_DIR + # media = (list of numbers XOR "all") + # + my $ini = Config::IniFiles -> new( + -file => "$configpath/$configfile" ); - return; - } - ## plugin content: - #----------------- - #[base] - # name = KIWIEulaPlugin - # order = 3 - # defaultenable = 1 - # - #[target] - # targetfile = content - # targetdir = $PRODUCT_DIR - # media = (list of numbers XOR "all") - # - my $ini = Config::IniFiles -> new( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base', 'name'); - my $order = $ini->val('base', 'order'); - my $enable = $ini->val('base', 'defaultenable'); - # if any of those isn't set, complain! - if(not defined($name) - or not defined($order) - or not defined($enable) - ) { - $this->logMsg("E", - "Plugin ini file <$config> seems broken!\n" - ); - return; - } - $this->name($name); - $this->order($order); - if($enable != 0) { - $this->ready(1); - } - return $this; + my $name = $ini->val('base', 'name'); + my $order = $ini->val('base', 'order'); + my $enable = $ini->val('base', 'defaultenable'); + # if any of those isn't set, complain! + if(not defined($name) + or not defined($order) + or not defined($enable) + ) { + $this->logMsg("E", + "Plugin ini file <$config> seems broken!\n" + ); + return; + } + $this->name($name); + $this->order($order); + if($enable != 0) { + $this->ready(1); + } + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - if($this->{m_ready} == 0) { - return 0; - } - my $ismini = $this->collect() - ->productData()->getVar("FLAVOR"); - if(not defined($ismini)) { - $this->logMsg("W", "FLAVOR not set?"); - return 0; - } - if($ismini !~ m{livetree}i) { + my $this = shift; + if(not ref($this)) { + return; + } + if($this->{m_ready} == 0) { + return 0; + } + my $ismini = $this->collect() + ->productData()->getVar("FLAVOR"); + if(not defined($ismini)) { + $this->logMsg("W", "FLAVOR not set?"); + return 0; + } + if($ismini !~ m{livetree}i) { + return 0; + } + my $medium = $this->collect() + ->productData()->getVar("MEDIUM_NAME"); + my $cd; + find( + sub { if (m/.iso/x) { $cd = $File::Find::name; } }, + $this->handler()->collect()->basedir() + ); + if (!$cd) { + $this->logMsg("E", "Initial CD not found\n"); + croak "E: fatal"; + } + $this->logMsg("I", "$cd $medium"); + my $dname = dirname($cd); + $this->logMsg("I", "$dname"); + my $nname = "$medium.iso"; + $nname =~ s,-i586-,-i686-,x; + $this->logMsg("I", + "Renaming $cd to $dname/$nname" + ); + if (! rename($cd, "$dname/$nname")) { + $this->logMsg("E", "could not rename $cd"); + croak "E: fatal"; + } return 0; - } - my $medium = $this->collect() - ->productData()->getVar("MEDIUM_NAME"); - my $cd; - find( - sub { if (m/.iso/x) { $cd = $File::Find::name; } }, - $this->handler()->collect()->basedir() - ); - if (!$cd) { - $this->logMsg("E", "Initial CD not found\n"); - croak "E: fatal"; - } - $this->logMsg("I", "$cd $medium"); - my $dname = dirname($cd); - $this->logMsg("I", "$dname"); - my $nname = "$medium.iso"; - $nname =~ s,-i586-,-i686-,x; - $this->logMsg("I", - "Renaming $cd to $dname/$nname" - ); - if (! rename($cd, "$dname/$nname")) { - $this->logMsg("E", "could not rename $cd"); - croak "E: fatal"; - } - return 0; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWIMiniIsoPlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWIMiniIsoPlugin.pm index 82d6de925..3bb4a6943 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWIMiniIsoPlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWIMiniIsoPlugin.pm @@ -29,245 +29,245 @@ use FileHandle; use Carp; sub new { - # ... - # Create a new KIWIMiniIsoPlugin object - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new($handler); - bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if ((! $configpath) || (! $configfile)) { - $this->logMsg("E", - "wrong parameters in plugin initialisation\n" - ); - return; - } - ## plugin content: - #----------------- - #[base] - # name = KIWIEulaPlugin - # order = 3 - # defaultenable = 1 - # - #[target] - # targetfile = content - # targetdir = $PRODUCT_DIR - # media = (list of numbers XOR "all") - # - my $ini = Config::IniFiles -> new ( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base', 'name'); - my $order = $ini->val('base', 'order'); - my $enable = $ini->val('base', 'defaultenable'); - # if any of those isn't set, complain! - if (not defined($name) - or not defined($order) - or not defined($enable) - ) { - $this->logMsg("E", - "Plugin ini file <$config> seems broken!\n" + # ... + # Create a new KIWIMiniIsoPlugin object + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new($handler); + bless ($this, $class); + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if ((! $configpath) || (! $configfile)) { + $this->logMsg("E", + "wrong parameters in plugin initialisation\n" + ); + return; + } + ## plugin content: + #----------------- + #[base] + # name = KIWIEulaPlugin + # order = 3 + # defaultenable = 1 + # + #[target] + # targetfile = content + # targetdir = $PRODUCT_DIR + # media = (list of numbers XOR "all") + # + my $ini = Config::IniFiles -> new ( + -file => "$configpath/$configfile" ); - return; - } - $this->name($name); - $this->order($order); - if($enable != 0) { - $this->ready(1); - } - return $this; + my $name = $ini->val('base', 'name'); + my $order = $ini->val('base', 'order'); + my $enable = $ini->val('base', 'defaultenable'); + # if any of those isn't set, complain! + if (not defined($name) + or not defined($order) + or not defined($enable) + ) { + $this->logMsg("E", + "Plugin ini file <$config> seems broken!\n" + ); + return; + } + $this->name($name); + $this->order($order); + if($enable != 0) { + $this->ready(1); + } + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - my $retval = 0; - if($this->{m_ready} == 0) { - return $retval; - } - my $repoloc = $this->collect()->productData()->getOpt("REPO_LOCATION"); - my $ismini = $this->collect()->productData()->getVar("FLAVOR"); - if(not defined($ismini)) { - $this->logMsg("W", "FLAVOR not set?"); - return $retval; - } - if ($ismini !~ m{mini}i) { - $this->logMsg("I", - "Nothing to for for media type <$ismini>" + my $this = shift; + if(not ref($this)) { + return; + } + my $retval = 0; + if($this->{m_ready} == 0) { + return $retval; + } + my $repoloc = $this->collect()->productData()->getOpt("REPO_LOCATION"); + my $ismini = $this->collect()->productData()->getVar("FLAVOR"); + if(not defined($ismini)) { + $this->logMsg("W", "FLAVOR not set?"); + return $retval; + } + if ($ismini !~ m{mini}i) { + $this->logMsg("I", + "Nothing to for for media type <$ismini>" + ); + return $retval; + } + my ($srv, $path); + if (not defined($repoloc)) { + $this->logMsg("I", + " is unset, boot protocol will be set to 'slp'!" + ); + } else { + if ($repoloc =~ m{^http://([^/]+)/(.+)}x) { + ($srv, $path) = ($1, $2); + } + if(not defined($srv) or not defined($path)) { + $this->logMsg("W", + "Parsing repo-location=<$repoloc> failed!" + ); + return $retval; + } + } + my @gfxbootfiles; + find( + sub { find_cb($this, '.*/gfxboot\.cfg$', \@gfxbootfiles) }, + $this->handler()->collect()->basedir() ); - return $retval; - } - my ($srv, $path); - if (not defined($repoloc)) { - $this->logMsg("I", - " is unset, boot protocol will be set to 'slp'!" + my @rootfiles; + find( + sub { find_cb($this, '.*/root$', \@rootfiles) }, + $this->handler()->collect()->basedir() ); - } else { - if ($repoloc =~ m{^http://([^/]+)/(.+)}x) { - ($srv, $path) = ($1, $2); + foreach(@rootfiles) { + $this->logMsg("I", "removing file <$_>"); + unlink $_; } - if(not defined($srv) or not defined($path)) { - $this->logMsg("W", - "Parsing repo-location=<$repoloc> failed!" - ); - return $retval; + if (!@gfxbootfiles) { + my $msg = "No gfxboot.cfg file found! " + . "This _MIGHT_ be ok for S/390. " + . "Please verify package(s)"; + $this->logMsg("W", $msg); + return $retval; } - } - my @gfxbootfiles; - find( - sub { find_cb($this, '.*/gfxboot\.cfg$', \@gfxbootfiles) }, - $this->handler()->collect()->basedir() - ); - my @rootfiles; - find( - sub { find_cb($this, '.*/root$', \@rootfiles) }, - $this->handler()->collect()->basedir() - ); - foreach(@rootfiles) { - $this->logMsg("I", "removing file <$_>"); - unlink $_; - } - if (!@gfxbootfiles) { - my $msg = "No gfxboot.cfg file found! " - . "This _MIGHT_ be ok for S/390. " - . "Please verify package(s)"; - $this->logMsg("W", $msg); + $this -> updateEFIGrubConfig($repoloc); + $retval = $this -> updateGraphicsBootConfig ( + \@gfxbootfiles, $repoloc, $srv, $path + ); return $retval; - } - $this -> updateEFIGrubConfig($repoloc); - $retval = $this -> updateGraphicsBootConfig ( - \@gfxbootfiles, $repoloc, $srv, $path - ); - return $retval; } sub updateGraphicsBootConfig { - my $this = shift; - my $gfxbootfiles = shift; - my $repoloc = shift; - my $srv = shift; - my $path = shift; - my $retval = 0; - foreach my $cfg(@{$gfxbootfiles}) { - $this->logMsg("I", "Processing file <$cfg>: "); - my $F = FileHandle -> new(); - if (! $F -> open($cfg)) { - $this->logMsg("E", "Cant open file <$cfg>!"); - next; + my $this = shift; + my $gfxbootfiles = shift; + my $repoloc = shift; + my $srv = shift; + my $path = shift; + my $retval = 0; + foreach my $cfg(@{$gfxbootfiles}) { + $this->logMsg("I", "Processing file <$cfg>: "); + my $F = FileHandle -> new(); + if (! $F -> open($cfg)) { + $this->logMsg("E", "Cant open file <$cfg>!"); + next; + } + my @lines = <$F>; + $F -> close(); + chomp(@lines); + my $install = -1; + my $ihs = -1; + my $ihp = -1; + my $i = -1; + foreach my $line(@lines) { + $i++; + next if $line !~ m{^install}x; + if($line =~ m{^install=.*}x) { + $install = $i; + } + if ($line =~ m{^install.http.server=+}x) { + $ihs = $i; + } + if($line =~ m{^install.http.path=+}x) { + $ihp = $i; + } + } + if(!$repoloc) { + if($install == -1) { + push @lines, "install=slp"; + } else { + $lines[$install] =~ s{^install.*}{install=slp}x; + } + } elsif($srv) { + if($ihs == -1) { + push @lines, "install.http.server=$srv"; + } else { + $lines[$ihs] =~ s{^(install.http.server).*}{$1=$srv}x; + } + if($ihp == -1) { + push @lines, "install.http.path=$path"; + } else { + $lines[$ihp] =~ s{^(install.http.path).*}{$1=$path}x; + } + if($install == -1) { + push @lines, "install=http"; + } else { + $lines[$install] =~ s{^install.*}{install=http}x; + } + } + unlink $cfg; + if (! $F -> open(">$cfg")) { + $this->logMsg("E", "Cant open file for writing <$cfg>!"); + next; + } + foreach(@lines) { + print $F "$_\n"; + } + $F -> close(); + $retval++; } - my @lines = <$F>; - $F -> close(); - chomp(@lines); - my $install = -1; - my $ihs = -1; - my $ihp = -1; - my $i = -1; - foreach my $line(@lines) { - $i++; - next if $line !~ m{^install}x; - if($line =~ m{^install=.*}x) { - $install = $i; - } - if ($line =~ m{^install.http.server=+}x) { - $ihs = $i; - } - if($line =~ m{^install.http.path=+}x) { - $ihp = $i; - } + return $retval; +} + +sub updateEFIGrubConfig { + my $this = shift; + my $repoloc = shift; + my $grubcfg = $this->collect() + ->basesubdirs()->{1} . "/EFI/BOOT/grub.cfg"; + if (! -f $grubcfg ) { + $this->logMsg("I", "no grub.cfg at <$grubcfg>"); + return; } - if(!$repoloc) { - if($install == -1) { - push @lines, "install=slp"; - } else { - $lines[$install] =~ s{^install.*}{install=slp}x; - } - } elsif($srv) { - if($ihs == -1) { - push @lines, "install.http.server=$srv"; - } else { - $lines[$ihs] =~ s{^(install.http.server).*}{$1=$srv}x; - } - if($ihp == -1) { - push @lines, "install.http.path=$path"; - } else { - $lines[$ihp] =~ s{^(install.http.path).*}{$1=$path}x; - } - if($install == -1) { - push @lines, "install=http"; - } else { - $lines[$install] =~ s{^install.*}{install=http}x; - } + $this->logMsg("I", "editing <$grubcfg>"); + my $IN = FileHandle -> new(); + my $OUT = FileHandle -> new(); + if (! $IN -> open($grubcfg)) { + croak "Cant open file for reading $grubcfg: $!"; } - unlink $cfg; - if (! $F -> open(">$cfg")) { - $this->logMsg("E", "Cant open file for writing <$cfg>!"); - next; + if (! $OUT -> open(">$grubcfg.new")) { + croak "Cant open file for writing $grubcfg.new: $!"; } - foreach(@lines) { - print $F "$_\n"; + while(<$IN>) { + my $line = $_; + chomp $line; + $this->logMsg("I", "-$line"); + $line =~ + s,(linuxefi /boot/x86_64/loader/linux),$1 install=$repoloc,x; + $this->logMsg("I", "+$line"); + print $OUT "$line\n"; } - $F -> close(); - $retval++; - } - return $retval; -} - -sub updateEFIGrubConfig { - my $this = shift; - my $repoloc = shift; - my $grubcfg = $this->collect() - ->basesubdirs()->{1} . "/EFI/BOOT/grub.cfg"; - if (! -f $grubcfg ) { - $this->logMsg("I", "no grub.cfg at <$grubcfg>"); - return; - } - $this->logMsg("I", "editing <$grubcfg>"); - my $IN = FileHandle -> new(); - my $OUT = FileHandle -> new(); - if (! $IN -> open($grubcfg)) { - croak "Cant open file for reading $grubcfg: $!"; - } - if (! $OUT -> open(">$grubcfg.new")) { - croak "Cant open file for writing $grubcfg.new: $!"; - } - while(<$IN>) { - my $line = $_; - chomp $line; - $this->logMsg("I", "-$line"); - $line =~ - s,(linuxefi /boot/x86_64/loader/linux),$1 install=$repoloc,x; - $this->logMsg("I", "+$line"); - print $OUT "$line\n"; - } - $OUT -> close(); - $IN -> close(); - $this -> callCmd("diff -u $grubcfg $grubcfg.new"); - rename("$grubcfg.new", $grubcfg); - return $this; + $OUT -> close(); + $IN -> close(); + $this -> callCmd("diff -u $grubcfg $grubcfg.new"); + rename("$grubcfg.new", $grubcfg); + return $this; } sub find_cb { - my $this = shift; - return if not ref($this); + my $this = shift; + return if not ref($this); - my $pat = shift; - my $listref = shift; - if(not defined($listref) or not defined($pat)) { - return; - } - if($File::Find::name =~ m{$pat}x) { - push @{$listref}, $File::Find::name; - } - return $this; + my $pat = shift; + my $listref = shift; + if(not defined($listref) or not defined($pat)) { + return; + } + if($File::Find::name =~ m{$pat}x) { + push @{$listref}, $File::Find::name; + } + return $this; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWIPatternsPlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWIPatternsPlugin.pm index a4df6924a..01685ef14 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWIPatternsPlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWIPatternsPlugin.pm @@ -25,135 +25,135 @@ use base "KIWIBasePlugin"; use Config::IniFiles; sub new { - # ... - # Create a new KIWIPatternsPlugin object - # creates patterns file - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new($handler); - bless ($this, $class); + # ... + # Create a new KIWIPatternsPlugin object + # creates patterns file + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new($handler); + bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if ((! $configpath) || (! $configfile)) { - $this->logMsg("E", - "wrong parameters in plugin initialisation\n" - ); - return; - } - ## plugin content: - #----------------- - #[base] - # name = KIWIPatternsPlugin - # dir = $DATADIR/setup/descr - # order = 1 - # tool = create_package_descr - # tooldir = /usr/bin - # toolpack = inst-source-utils - # defaultenabled = 1 - # media = 1 - # - #[target] - # targetfile = patterns - # compress = yes|no - # - my $ini = Config::IniFiles ->new( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base', 'name'); - my $order = $ini->val('base', 'order'); - my @dirs = $ini->val('base', 'dir'); - my $enable = $ini->val('base', 'defaultenable'); - my @media = $ini->val('base', 'media'); - my $target = $ini->val('target', 'targetfile'); - my $gzip = $ini->val('target', 'compress'); - # if any of those isn't set, complain! - if(not defined($name) - or not defined($order) - or not @dirs - or not defined($enable) - or not defined($target) - or not defined($gzip) - or not @media - ) { - $this->logMsg("E", - "Plugin ini file <$config> seems broken!\n" + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if ((! $configpath) || (! $configfile)) { + $this->logMsg("E", + "wrong parameters in plugin initialisation\n" + ); + return; + } + ## plugin content: + #----------------- + #[base] + # name = KIWIPatternsPlugin + # dir = $DATADIR/setup/descr + # order = 1 + # tool = create_package_descr + # tooldir = /usr/bin + # toolpack = inst-source-utils + # defaultenabled = 1 + # media = 1 + # + #[target] + # targetfile = patterns + # compress = yes|no + # + my $ini = Config::IniFiles ->new( + -file => "$configpath/$configfile" ); - return; - } - # parse dirs for productvars content: - for(my $i=0; $i <= $#dirs; $i++) { - $dirs[$i] = $this->collect() - ->productData()->_substitute("$dirs[$i]"); - } - $this->name($name); - $this->order($order); - $this->requiredDirs(@dirs); - $this->{m_media} = @media; - if($enable != 0) { - $this->ready(1); - } - $this->{m_compress} = $gzip; - $this->{m_target} = $target; - return $this; + my $name = $ini->val('base', 'name'); + my $order = $ini->val('base', 'order'); + my @dirs = $ini->val('base', 'dir'); + my $enable = $ini->val('base', 'defaultenable'); + my @media = $ini->val('base', 'media'); + my $target = $ini->val('target', 'targetfile'); + my $gzip = $ini->val('target', 'compress'); + # if any of those isn't set, complain! + if(not defined($name) + or not defined($order) + or not @dirs + or not defined($enable) + or not defined($target) + or not defined($gzip) + or not @media + ) { + $this->logMsg("E", + "Plugin ini file <$config> seems broken!\n" + ); + return; + } + # parse dirs for productvars content: + for(my $i=0; $i <= $#dirs; $i++) { + $dirs[$i] = $this->collect() + ->productData()->_substitute("$dirs[$i]"); + } + $this->name($name); + $this->order($order); + $this->requiredDirs(@dirs); + $this->{m_media} = @media; + if($enable != 0) { + $this->ready(1); + } + $this->{m_compress} = $gzip; + $this->{m_target} = $target; + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - if($this->{m_ready} == 0) { - return 0; - } - my $dirname = $this->{m_handler}->baseurl() - . "/" - . $this->{m_handler}->mediaName(); - my $mult = $this->collect() - ->productData()->getVar("MULTIPLE_MEDIA"); - if( $mult ne "no") { - $dirname .= $this->{m_media}; - } - $dirname .= "/".$this->{m_requireddirs}->[0]; - my $PATDIR; - if(!opendir($PATDIR, "$dirname")) { - $this->logMsg("E", - "PatternsPlugin: cannot read <$dirname>" - ); - $this->logMsg("I", - "Skipping plugin <".$this->name().">" - ); - return 0; - } - my $PAT = FileHandle -> new(); - if (! $PAT -> open(">$dirname/$this->{m_target}")) { - $this->logMsg("E", - "PatternsPlugin: cannot create <$dirname>/patterns!" - ); - $this->logMsg("I", - "Skipping plugin <".$this->name().">" - ); - return 0; - } - my @dirent = readdir($PATDIR); - foreach my $f(@dirent) { - next if $f !~ m{.*\.pat|.*\.pat\.gz}x; - if($f !~ m{.*\.gz$}x and $this->{m_compress} =~ m{yes}i) { - if (system('gzip', '--rsyncable', "$dirname/$f") == 0) { - $f = "$f.gz"; - } + my $this = shift; + if(not ref($this)) { + return; + } + if($this->{m_ready} == 0) { + return 0; + } + my $dirname = $this->{m_handler}->baseurl() + . "/" + . $this->{m_handler}->mediaName(); + my $mult = $this->collect() + ->productData()->getVar("MULTIPLE_MEDIA"); + if( $mult ne "no") { + $dirname .= $this->{m_media}; + } + $dirname .= "/".$this->{m_requireddirs}->[0]; + my $PATDIR; + if(!opendir($PATDIR, "$dirname")) { + $this->logMsg("E", + "PatternsPlugin: cannot read <$dirname>" + ); + $this->logMsg("I", + "Skipping plugin <".$this->name().">" + ); + return 0; + } + my $PAT = FileHandle -> new(); + if (! $PAT -> open(">$dirname/$this->{m_target}")) { + $this->logMsg("E", + "PatternsPlugin: cannot create <$dirname>/patterns!" + ); + $this->logMsg("I", + "Skipping plugin <".$this->name().">" + ); + return 0; + } + my @dirent = readdir($PATDIR); + foreach my $f(@dirent) { + next if $f !~ m{.*\.pat|.*\.pat\.gz}x; + if($f !~ m{.*\.gz$}x and $this->{m_compress} =~ m{yes}i) { + if (system('gzip', '--rsyncable', "$dirname/$f") == 0) { + $f = "$f.gz"; + } + } + print $PAT "$f\n"; } - print $PAT "$f\n"; - } - closedir($PATDIR); - $PAT -> close(); - return 1; + closedir($PATDIR); + $PAT -> close(); + return 1; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWIPromoDVDPlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWIPromoDVDPlugin.pm index 11873803d..768d304cb 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWIPromoDVDPlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-12-1/KIWIPromoDVDPlugin.pm @@ -28,94 +28,94 @@ use File::Find; use File::Basename; sub new { - # ... - # Create a new KIWIPromoDVDPlugin object - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new($handler); - bless ($this, $class); + # ... + # Create a new KIWIPromoDVDPlugin object + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new($handler); + bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if ((! $configpath) || (! $configfile)) { - $this->logMsg("E", - "wrong parameters in plugin initialisation\n" + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if ((! $configpath) || (! $configfile)) { + $this->logMsg("E", + "wrong parameters in plugin initialisation\n" + ); + return; + } + ## plugin content: + #----------------- + #[base] + # name = KIWIEulaPlugin + # order = 3 + # defaultenable = 1 + # + #[target] + # targetfile = content + # targetdir = $PRODUCT_DIR + # media = (list of numbers XOR "all") + # + my $ini = Config::IniFiles -> new( + -file => "$configpath/$configfile" ); - return; - } - ## plugin content: - #----------------- - #[base] - # name = KIWIEulaPlugin - # order = 3 - # defaultenable = 1 - # - #[target] - # targetfile = content - # targetdir = $PRODUCT_DIR - # media = (list of numbers XOR "all") - # - my $ini = Config::IniFiles -> new( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base', 'name'); - my $order = $ini->val('base', 'order'); - my $enable = $ini->val('base', 'defaultenable'); - # if any of those isn't set, complain! - if(not defined($name) - or not defined($order) - or not defined($enable) - ) { - $this->logMsg("E", - "Plugin ini file <$config> seems broken!\n" - ); - return; - } - $this->name($name); - $this->order($order); - if($enable != 0) { - $this->ready(1); - } - return $this; + my $name = $ini->val('base', 'name'); + my $order = $ini->val('base', 'order'); + my $enable = $ini->val('base', 'defaultenable'); + # if any of those isn't set, complain! + if(not defined($name) + or not defined($order) + or not defined($enable) + ) { + $this->logMsg("E", + "Plugin ini file <$config> seems broken!\n" + ); + return; + } + $this->name($name); + $this->order($order); + if($enable != 0) { + $this->ready(1); + } + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - if($this->{m_ready} == 0) { - return 0; - } - my $ismini = $this->collect() - ->productData()->getVar("FLAVOR"); - if(not defined($ismini)) { - $this->logMsg("W", "FLAVOR not set?"); - return 0; - } - if ($ismini !~ m{dvd-promo}ix) { + my $this = shift; + if(not ref($this)) { + return; + } + if($this->{m_ready} == 0) { + return 0; + } + my $ismini = $this->collect() + ->productData()->getVar("FLAVOR"); + if(not defined($ismini)) { + $this->logMsg("W", "FLAVOR not set?"); + return 0; + } + if ($ismini !~ m{dvd-promo}ix) { + return 0; + } + my $medium = $this->collect() + ->productData()->getVar("MEDIUM_NAME"); + find( sub { + if (m/initrd.liv/x) { + my $cd = $File::Find::name; + system("mkdir -p boot; echo $medium > boot/mbrid"); + system("echo boot/mbrid | cpio --create --format=newc --quiet | gzip -9 -f >> $cd"); + system("rm boot/mbrid; rmdir boot"); + $this->logMsg("I", "updated $cd"); + } + }, + $this->handler()->collect()->basedir() + ); return 0; - } - my $medium = $this->collect() - ->productData()->getVar("MEDIUM_NAME"); - find( sub { - if (m/initrd.liv/x) { - my $cd = $File::Find::name; - system("mkdir -p boot; echo $medium > boot/mbrid"); - system("echo boot/mbrid | cpio --create --format=newc --quiet | gzip -9 -f >> $cd"); - system("rm boot/mbrid; rmdir boot"); - $this->logMsg("I", "updated $cd"); - } - }, - $this->handler()->collect()->basedir() - ); - return 0; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-13-2/KIWIBasePlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-13-2/KIWIBasePlugin.pm index 370a7ecff..a980922a2 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-13-2/KIWIBasePlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-13-2/KIWIBasePlugin.pm @@ -25,222 +25,222 @@ use IPC::Open3; use Symbol; sub new { - my $class = shift; - my $this = { - m_handler => undef, - m_name => "KIWIBasePlugin", - m_order => undef, - m_requireddirs=> [], - m_descr => [], - m_requires => [], - m_ready => 0, - m_collect => 0 - }; - bless ($this, $class); - $this->{m_handler} = shift; - if (! ref($this->{m_handler})) { - return; - } - $this->{m_collect} = $this->{m_handler}->collect(); - return $this; + my $class = shift; + my $this = { + m_handler => undef, + m_name => "KIWIBasePlugin", + m_order => undef, + m_requireddirs=> [], + m_descr => [], + m_requires => [], + m_ready => 0, + m_collect => 0 + }; + bless ($this, $class); + $this->{m_handler} = shift; + if (! ref($this->{m_handler})) { + return; + } + $this->{m_collect} = $this->{m_handler}->collect(); + return $this; } sub name { - my $this = shift; - my $name = shift; - if (! ref($this)) { - return; - } - my $oldname = $this->{m_name}; - if($name) { - $this->{m_name} = $name; - } - return $oldname; + my $this = shift; + my $name = shift; + if (! ref($this)) { + return; + } + my $oldname = $this->{m_name}; + if($name) { + $this->{m_name} = $name; + } + return $oldname; } sub order { - my $this = shift; - my $order = shift; - if (! ref($this)) { - return; - } - my $oldorder = $this->{m_order}; - if($order) { - $this->{m_order} = $order; - } - return $oldorder; + my $this = shift; + my $order = shift; + if (! ref($this)) { + return; + } + my $oldorder = $this->{m_order}; + if($order) { + $this->{m_order} = $order; + } + return $oldorder; } sub ready { - my $this = shift; - my $ready = shift; - if (! ref($this)) { - return; - } - my $oldready = $this->{m_ready}; - if($ready) { - $this->{m_ready} = $ready; - } - return $oldready; + my $this = shift; + my $ready = shift; + if (! ref($this)) { + return; + } + my $oldready = $this->{m_ready}; + if($ready) { + $this->{m_ready} = $ready; + } + return $oldready; } sub requiredDirs { - my @params = @_; - my $this = shift @params; - my @dirs = @params; - if (! ref($this)) { - return; - } - my @oldrd = @{$this->{m_requireddirs}}; - foreach my $entry(@params) { - push @{$this->{m_requireddirs}}, $entry; - } - return @oldrd; + my @params = @_; + my $this = shift @params; + my @dirs = @params; + if (! ref($this)) { + return; + } + my @oldrd = @{$this->{m_requireddirs}}; + foreach my $entry(@params) { + push @{$this->{m_requireddirs}}, $entry; + } + return @oldrd; } sub description { - my @params = @_; - my $this = shift @params; - my @descr= @params; - if (! ref($this)) { - return; - } - my @olddesc = $this->{m_descr}; - foreach my $entry(@descr) { - push @{$this->{m_descr}}, $entry; - } - return @olddesc; + my @params = @_; + my $this = shift @params; + my @descr= @params; + if (! ref($this)) { + return; + } + my @olddesc = $this->{m_descr}; + foreach my $entry(@descr) { + push @{$this->{m_descr}}, $entry; + } + return @olddesc; } sub requires { - my @params = @_; - my $this = shift; - my @reqs = @params; - if (! ref($this)) { - return; - } - my @oldreq = $this->{m_requires}; - foreach my $entry(@reqs) { - push @{$this->{m_requires}}, $entry; - } - return @oldreq; + my @params = @_; + my $this = shift; + my @reqs = @params; + if (! ref($this)) { + return; + } + my @oldreq = $this->{m_requires}; + foreach my $entry(@reqs) { + push @{$this->{m_requires}}, $entry; + } + return @oldreq; } sub handler { - my $this = shift; - if (! ref($this)) { - return; - } - return $this->{m_handler}; + my $this = shift; + if (! ref($this)) { + return; + } + return $this->{m_handler}; } sub collect { - my $this = shift; - if (! ref($this)) { - return; - } - return $this->{m_collect}; + my $this = shift; + if (! ref($this)) { + return; + } + return $this->{m_collect}; } sub logMsg { - my $this = shift; - if (! ref($this)) { - return; - } - my $type = shift; - my $msg = shift; - if ((! defined($type)) || (! defined($msg))) { - return; - } - $this->{m_collect}->logMsg($type, $msg); - return $this; + my $this = shift; + if (! ref($this)) { + return; + } + my $type = shift; + my $msg = shift; + if ((! defined($type)) || (! defined($msg))) { + return; + } + $this->{m_collect}->logMsg($type, $msg); + return $this; } sub callCmd { - my $this = shift; - my $cmd = shift; - my $BUFSIZE = 1024; - my @result; - my @errors; - my $result_buf; - my $errors_buf; - my ($CHILDWRITE, $CHILDSTDOUT, $CHILDSTDERR) = map { gensym } 1..3; - my $pid = open3 ( - $CHILDWRITE, $CHILDSTDOUT, $CHILDSTDERR, "$cmd" - ); - my $sel = IO::Select->new(); - $sel->add($CHILDSTDOUT); - $sel->add($CHILDSTDERR); - while($sel->count()) { - foreach my $handle ($sel->can_read()) { - my $bytes_read = ''; - my $chunk_result = sysread($handle, $bytes_read, $BUFSIZE); - if ($handle == $CHILDSTDOUT) { - $result_buf .= $bytes_read; - } else { - $errors_buf .= $bytes_read; - } - if ($chunk_result == 0) { - $sel->remove($handle); - next; - } - } - } - if ($result_buf) { - @result = split (/\n/x,$result_buf); - chomp @result; - } - if ($errors_buf) { - @errors = split (/\n/x,$errors_buf); - chomp @errors; - } - waitpid( $pid, 0 ); - my $status = $? >> 8; - return [$status,\@result,\@errors]; + my $this = shift; + my $cmd = shift; + my $BUFSIZE = 1024; + my @result; + my @errors; + my $result_buf; + my $errors_buf; + my ($CHILDWRITE, $CHILDSTDOUT, $CHILDSTDERR) = map { gensym } 1..3; + my $pid = open3 ( + $CHILDWRITE, $CHILDSTDOUT, $CHILDSTDERR, "$cmd" + ); + my $sel = IO::Select->new(); + $sel->add($CHILDSTDOUT); + $sel->add($CHILDSTDERR); + while($sel->count()) { + foreach my $handle ($sel->can_read()) { + my $bytes_read = ''; + my $chunk_result = sysread($handle, $bytes_read, $BUFSIZE); + if ($handle == $CHILDSTDOUT) { + $result_buf .= $bytes_read; + } else { + $errors_buf .= $bytes_read; + } + if ($chunk_result == 0) { + $sel->remove($handle); + next; + } + } + } + if ($result_buf) { + @result = split (/\n/x,$result_buf); + chomp @result; + } + if ($errors_buf) { + @errors = split (/\n/x,$errors_buf); + chomp @errors; + } + waitpid( $pid, 0 ); + my $status = $? >> 8; + return [$status,\@result,\@errors]; } sub getSubdirLists { - # ... - # method to distinguish debugmedia and ftp media subdirectories. - # --- - my $this = shift; - if (! ref($this)) { - return; - } - my @ret = (); - my $coll = $this->{m_collect}; - my $dbm = $coll->productData()->getOpt("DEBUGMEDIUM"); - my $flavor = $coll->productData()->getVar("FLAVOR"); - my $basesubdirs = $coll->basesubdirs(); - my @paths = values(%{$basesubdirs}); - @paths = grep { $_ =~ /[^0]$/x } @paths; # remove Media0 - my %path = map { $_ => 1 } @paths; - if($flavor =~ m{ftp}i) { - # 1: FTP tree, all subdirs get a separate call. - my @d = sort(keys(%path)); - foreach(@d) { - my @tmp; - push @tmp, $_; - push @ret, \@tmp; - } - } elsif($dbm >= 2) { - # 2: non-ftp tree, may have separate DEBUGMEDIUM specified - my @deb; - my @rest; - foreach my $d(keys(%path)) { - if ($d =~ m{.*$dbm$}x) { - push @deb, $d; - } else { - push @rest, $d; - } - } - push @ret, \@deb; - push @ret, \@rest; - } else { - my @d = keys(%path); - push @ret, \@d; - } - return @ret; + # ... + # method to distinguish debugmedia and ftp media subdirectories. + # --- + my $this = shift; + if (! ref($this)) { + return; + } + my @ret = (); + my $coll = $this->{m_collect}; + my $dbm = $coll->productData()->getOpt("DEBUGMEDIUM"); + my $flavor = $coll->productData()->getVar("FLAVOR"); + my $basesubdirs = $coll->basesubdirs(); + my @paths = values(%{$basesubdirs}); + @paths = grep { $_ =~ /[^0]$/x } @paths; # remove Media0 + my %path = map { $_ => 1 } @paths; + if($flavor =~ m{ftp}i) { + # 1: FTP tree, all subdirs get a separate call. + my @d = sort(keys(%path)); + foreach(@d) { + my @tmp; + push @tmp, $_; + push @ret, \@tmp; + } + } elsif($dbm >= 2) { + # 2: non-ftp tree, may have separate DEBUGMEDIUM specified + my @deb; + my @rest; + foreach my $d(keys(%path)) { + if ($d =~ m{.*$dbm$}x) { + push @deb, $d; + } else { + push @rest, $d; + } + } + push @ret, \@deb; + push @ret, \@rest; + } else { + my @d = keys(%path); + push @ret, \@d; + } + return @ret; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-13-2/KIWIContentPlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-13-2/KIWIContentPlugin.pm index d22b89a5a..3ff88aa5a 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-13-2/KIWIContentPlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-13-2/KIWIContentPlugin.pm @@ -27,152 +27,152 @@ use Data::Dumper; use Config::IniFiles; sub new { - # ... - # Create a new KIWIContentPlugin object - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new ($handler); - bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if(not defined($configpath) or not defined($configfile)) { - $this->logMsg("E", "wrong parameters in plugin initialisation\n"); - return; - } - ## Gather all necessary information from the inifile: - #=== - # Issue: why duplicate code here? Why not put it into the base class? - # Answer: Each plugin may have different options. Some only need a - # target filename, whilst some others may need much more. I don't want - # to specify a complicated framework for the plugin, it shall just be - # a simple straightforward way to get information into the plugin. - # The idea is that the people who decide on the metadata write - # the plugin, and therefore damn well know what it needs and what not. - # I'm definitely not bothering PMs with Yet Another File Specification - #--- - ## plugin content: - #----------------- - #[base] - # name = KIWIEulaPlugin - # order = 3 - # defaultenable = 1 - # - #[target] - # targetfile = content - # targetdir = $PRODUCT_DIR - # media = (list of numbers XOR "all") - # - my $ini = Config::IniFiles -> new( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base', 'name'); # scalar value - my $order = $ini->val('base', 'order'); # scalar value - my $enable = $ini->val('base', 'defaultenable'); # scalar value - my $target = $ini->val('target', 'targetfile'); - my $targetdir = $ini->val('target', 'targetdir'); - my @media = $ini->val('target', 'media'); - # if any of those isn't set, complain! - if(not defined($name) - or not defined($order) - or not defined($enable) - or not defined($target) - or not defined($targetdir) - or not @media - ) { - $this->logMsg("E", "Plugin ini file <$config> seems broken!"); - return; - } - $this->name($name); - $this->order($order); - $targetdir = $this->collect()->productData()->_substitute("$targetdir"); - if($enable != 0) { - $this->ready(1); - } - $this->requiredDirs($targetdir); - $this->{m_target} = $target; - $this->{m_targetdir} = $targetdir; - @{$this->{m_media}} = @media; - return $this; + # ... + # Create a new KIWIContentPlugin object + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new ($handler); + bless ($this, $class); + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if(not defined($configpath) or not defined($configfile)) { + $this->logMsg("E", "wrong parameters in plugin initialisation\n"); + return; + } + ## Gather all necessary information from the inifile: + #=== + # Issue: why duplicate code here? Why not put it into the base class? + # Answer: Each plugin may have different options. Some only need a + # target filename, whilst some others may need much more. I don't want + # to specify a complicated framework for the plugin, it shall just be + # a simple straightforward way to get information into the plugin. + # The idea is that the people who decide on the metadata write + # the plugin, and therefore damn well know what it needs and what not. + # I'm definitely not bothering PMs with Yet Another File Specification + #--- + ## plugin content: + #----------------- + #[base] + # name = KIWIEulaPlugin + # order = 3 + # defaultenable = 1 + # + #[target] + # targetfile = content + # targetdir = $PRODUCT_DIR + # media = (list of numbers XOR "all") + # + my $ini = Config::IniFiles -> new( + -file => "$configpath/$configfile" + ); + my $name = $ini->val('base', 'name'); # scalar value + my $order = $ini->val('base', 'order'); # scalar value + my $enable = $ini->val('base', 'defaultenable'); # scalar value + my $target = $ini->val('target', 'targetfile'); + my $targetdir = $ini->val('target', 'targetdir'); + my @media = $ini->val('target', 'media'); + # if any of those isn't set, complain! + if(not defined($name) + or not defined($order) + or not defined($enable) + or not defined($target) + or not defined($targetdir) + or not @media + ) { + $this->logMsg("E", "Plugin ini file <$config> seems broken!"); + return; + } + $this->name($name); + $this->order($order); + $targetdir = $this->collect()->productData()->_substitute("$targetdir"); + if($enable != 0) { + $this->ready(1); + } + $this->requiredDirs($targetdir); + $this->{m_target} = $target; + $this->{m_targetdir} = $targetdir; + @{$this->{m_media}} = @media; + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - my $retval = 0; - if($this->{m_ready} == 0) { - return $retval; - } - my $descrdir = $this->collect()->productData()->getInfo("DESCRDIR"); - if ((! $descrdir) || ($descrdir eq "/")) { - $this->logMsg("I", - "Empty or (/) descrdir, skipping content file creation" - ); - return $retval; - } - my @targetmedia = $this->collect()->getMediaNumbers(); - my %targets; - if($this->{m_media}->[0] =~ m{all}i) { - %targets = map { $_ => 1 } @targetmedia; - } else { - foreach my $cd(@{$this->{m_media}}) { - if(grep { $cd } @targetmedia) { - $targets{$cd} = 1; - } + my $this = shift; + if(not ref($this)) { + return; } - } - my $info = $this->collect()->productData()->getSet("prodinfo"); - if(!$info) { - $this->logMsg("E", "data set named seems to be broken:"); - $this->logMsg("E", Dumper($info)); - return $retval; - } - foreach my $cd(keys(%targets)) { - $this->logMsg("I", "Creating content file on medium <$cd>:"); - my $dir = $this->collect()->basesubdirs()->{$cd}; - my $contentfile = "$dir/$this->{m_target}"; - my $CONT = FileHandle -> new(); - if (! $CONT -> open(">$contentfile")) { - $this->logMsg("E", "Cannot create <$contentfile> on medium <$cd>"); - next; + my $retval = 0; + if($this->{m_ready} == 0) { + return $retval; + } + my $descrdir = $this->collect()->productData()->getInfo("DESCRDIR"); + if ((! $descrdir) || ($descrdir eq "/")) { + $this->logMsg("I", + "Empty or (/) descrdir, skipping content file creation" + ); + return $retval; } - # compute maxlen: - my $len = 0; - foreach(keys(%{$info})) { - my $l = length($info->{$_}->[0]); - $len = ($l>$len)?$l:$len; + my @targetmedia = $this->collect()->getMediaNumbers(); + my %targets; + if($this->{m_media}->[0] =~ m{all}i) { + %targets = map { $_ => 1 } @targetmedia; + } else { + foreach my $cd(@{$this->{m_media}}) { + if(grep { $cd } @targetmedia) { + $targets{$cd} = 1; + } + } } - $len++; - # ftp media special mode ? - my $coll = $this->{m_collect}; - my $flavor = $coll->productData()->getVar("FLAVOR"); - my $ftpmode = ($flavor =~ m{ftp}i); + my $info = $this->collect()->productData()->getSet("prodinfo"); + if(!$info) { + $this->logMsg("E", "data set named seems to be broken:"); + $this->logMsg("E", Dumper($info)); + return $retval; + } + foreach my $cd(keys(%targets)) { + $this->logMsg("I", "Creating content file on medium <$cd>:"); + my $dir = $this->collect()->basesubdirs()->{$cd}; + my $contentfile = "$dir/$this->{m_target}"; + my $CONT = FileHandle -> new(); + if (! $CONT -> open(">$contentfile")) { + $this->logMsg("E", "Cannot create <$contentfile> on medium <$cd>"); + next; + } + # compute maxlen: + my $len = 0; + foreach(keys(%{$info})) { + my $l = length($info->{$_}->[0]); + $len = ($l>$len)?$l:$len; + } + $len++; + # ftp media special mode ? + my $coll = $this->{m_collect}; + my $flavor = $coll->productData()->getVar("FLAVOR"); + my $ftpmode = ($flavor =~ m{ftp}i); - my %ftpcontentkeys = map {$_ => 1} qw{ - CONTENTSTYLE REPOID DESCRDIR DATADIR VENDOR - }; - foreach my $i(sort { $a <=> $b } keys(%{$info})) { - # ftp medias beside first one should get provide the product - if ( !$ftpmode || $cd eq "1" || $ftpcontentkeys{$info->{$i}->[0]}) { - print $CONT sprintf( - '%-*s %s', $len, $info->{$i}->[0], $info->{$i}->[1] - )."\n"; - } + my %ftpcontentkeys = map {$_ => 1} qw{ + CONTENTSTYLE REPOID DESCRDIR DATADIR VENDOR + }; + foreach my $i(sort { $a <=> $b } keys(%{$info})) { + # ftp medias beside first one should get provide the product + if ( !$ftpmode || $cd eq "1" || $ftpcontentkeys{$info->{$i}->[0]}) { + print $CONT sprintf( + '%-*s %s', $len, $info->{$i}->[0], $info->{$i}->[1] + )."\n"; + } + } + $CONT -> close(); + $this->logMsg( + "I", "Wrote file <$contentfile> for medium <$cd> successfully." + ); + $retval++; } - $CONT -> close(); - $this->logMsg( - "I", "Wrote file <$contentfile> for medium <$cd> successfully." - ); - $retval++; - } - return $retval; + return $retval; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-13-2/KIWIDescrPlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-13-2/KIWIDescrPlugin.pm index ea7b7f64a..ee822c79b 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-13-2/KIWIDescrPlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-13-2/KIWIDescrPlugin.pm @@ -28,346 +28,346 @@ use Data::Dumper; use Cwd 'abs_path'; sub new { - # ... - # Create a new KIWIDescrPlugin object - # creates patterns file - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new($handler); - bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if((! $configpath) || (! $configfile)) { - $this->logMsg("E", - "wrong parameters in plugin initialisation" - ); - return; - } - my $ini = Config::IniFiles -> new( -file => "$configpath/$configfile" ); - my $name = $ini->val('base', 'name'); - my $order = $ini->val('base', 'order'); - my $tool = $ini->val('base', 'tool'); - my $createrepo = $ini->val('base', 'createrepo'); - my $rezip = $ini->val('base', 'rezip'); - my $tdir = $ini->val('base', 'tooldir'); - my $tpack = $ini->val('base', 'toolpack'); - my $enable = $ini->val('base', 'defaultenable'); - my @params = $ini->val('options', 'parameter'); - my $gzip = $ini->val('target', 'compress'); - # if any of those isn't set, complain! - if(not defined($name) - or not defined($order) - or not defined($tool) - or not defined($createrepo) - or not defined($rezip) - or not defined($tdir) - or not defined($tpack) - or not defined($enable) - or not defined($gzip) - or not (@params) - ) { - $this->logMsg("E", - "Plugin ini file <$config> seems broken!" - ); - return; - } - # sanity check for tools' existence: - if(not( -f "$tdir/$tool" and -x "$tdir/$tool")) { - $this->logMsg("E", - "Plugin <$name>: tool <$tdir/$tool> is not executable!" - ); - $this->logMsg("I", - "Check if package <$tpack> is installed." - ); - return; - } - my $params = ""; - foreach my $p(@params) { - $p = $this->collect()->productData()->_substitute("$p"); - $params .= "$p "; - } - # add local kwd files as argument - my $extrafile = abs_path($this->collect()->{m_xml}->{xmlOrigFile}); - $extrafile =~ s/.kiwi$/.kwd/x; - if (-f $extrafile) { - $this->logMsg("W", "Found extra tags file $extrafile."); - $params .= "-T $extrafile "; - } - $this->name($name); - $this->order($order); - $this->{m_tool} = $tool; - $this->{m_tooldir} = $tdir; - $this->{m_toolpack} = $tpack; - $this->{m_createrepo} = $createrepo; - $this->{m_rezip} = $rezip; - $this->{m_params} = $params; - $this->{m_compress} = $gzip; - if($enable != 0) { - $this->ready(1); - } - return $this; + # ... + # Create a new KIWIDescrPlugin object + # creates patterns file + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new($handler); + bless ($this, $class); + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if((! $configpath) || (! $configfile)) { + $this->logMsg("E", + "wrong parameters in plugin initialisation" + ); + return; + } + my $ini = Config::IniFiles -> new( -file => "$configpath/$configfile" ); + my $name = $ini->val('base', 'name'); + my $order = $ini->val('base', 'order'); + my $tool = $ini->val('base', 'tool'); + my $createrepo = $ini->val('base', 'createrepo'); + my $rezip = $ini->val('base', 'rezip'); + my $tdir = $ini->val('base', 'tooldir'); + my $tpack = $ini->val('base', 'toolpack'); + my $enable = $ini->val('base', 'defaultenable'); + my @params = $ini->val('options', 'parameter'); + my $gzip = $ini->val('target', 'compress'); + # if any of those isn't set, complain! + if(not defined($name) + or not defined($order) + or not defined($tool) + or not defined($createrepo) + or not defined($rezip) + or not defined($tdir) + or not defined($tpack) + or not defined($enable) + or not defined($gzip) + or not (@params) + ) { + $this->logMsg("E", + "Plugin ini file <$config> seems broken!" + ); + return; + } + # sanity check for tools' existence: + if(not( -f "$tdir/$tool" and -x "$tdir/$tool")) { + $this->logMsg("E", + "Plugin <$name>: tool <$tdir/$tool> is not executable!" + ); + $this->logMsg("I", + "Check if package <$tpack> is installed." + ); + return; + } + my $params = ""; + foreach my $p(@params) { + $p = $this->collect()->productData()->_substitute("$p"); + $params .= "$p "; + } + # add local kwd files as argument + my $extrafile = abs_path($this->collect()->{m_xml}->{xmlOrigFile}); + $extrafile =~ s/.kiwi$/.kwd/x; + if (-f $extrafile) { + $this->logMsg("W", "Found extra tags file $extrafile."); + $params .= "-T $extrafile "; + } + $this->name($name); + $this->order($order); + $this->{m_tool} = $tool; + $this->{m_tooldir} = $tdir; + $this->{m_toolpack} = $tpack; + $this->{m_createrepo} = $createrepo; + $this->{m_rezip} = $rezip; + $this->{m_params} = $params; + $this->{m_compress} = $gzip; + if($enable != 0) { + $this->ready(1); + } + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - if($this->{m_ready} == 0) { - return 0 - } - my $coll = $this->{m_collect}; - my $basesubdirs = $coll->basesubdirs(); - if(not defined($basesubdirs)) { - ## prevent crash when dereferencing - $this->logMsg("E", - " is undefined! Skipping <$this->name()>" - ); + my $this = shift; + if(not ref($this)) { + return; + } + if($this->{m_ready} == 0) { + return 0 + } + my $coll = $this->{m_collect}; + my $basesubdirs = $coll->basesubdirs(); + if(not defined($basesubdirs)) { + ## prevent crash when dereferencing + $this->logMsg("E", + " is undefined! Skipping <$this->name()>" + ); + return 0; + } + foreach my $dirlist($this->getSubdirLists()) { + my ($s,$m) = $this->executeDir(sort @{$dirlist}); + } return 0; - } - foreach my $dirlist($this->getSubdirLists()) { - my ($s,$m) = $this->executeDir(sort @{$dirlist}); - } - return 0; } sub executeDir { - my @params = @_; - my $this = shift @params; - my @paths = @params; - my $call; - my $status; - my $cmd; - if(!@paths) { - $this->logMsg("W", "Empty path list!"); - return 0; - } - my $coll = $this->{m_collect}; - my $datadir = $coll->productData()->getInfo("DATADIR"); - my $descrdir = $coll->productData()->getInfo("DESCRDIR"); - my $cpeid = $coll->productData()->getInfo("CPEID"); - my $repoid = $coll->productData()->getInfo("REPOID"); - my $createrepomd = $coll->productData()->getVar("CREATE_REPOMD"); - my $targetdir; - my $newtargetdir; - ## this ugly bit creates a parameter string from a list of directories: - # param = -d -d ... - # the order is important. Idea: use map to make hash => -d for - # all subdirs not ending with "0" (those are for metafile unpacking - # only). The result is evaluated in list context be reverse, so - # there's a list looking like " -d ... -d" which is - # reversed again, making the result '-d', '', ..., '-d', ''", - # after the join as string. - # --- - if ($descrdir && $descrdir ne "/") { - my $pathlist = "-d ".join(' -d ', map{$_."/".$datadir}(@paths)); - $this->logMsg("I", - "Calling ".$this->name()." for directories <@paths>:" - ); - $targetdir = $paths[0]."/".$descrdir; - $cmd = "$this->{m_tooldir}/$this->{m_tool} " - . "$pathlist $this->{m_params} -o " - . $paths[0] - . "/" - . $descrdir; - $this->logMsg("I", "Executing command <$cmd>"); - $call = $this -> callCmd($cmd); - $status = $call->[0]; - if($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called <$cmd> exit status <$status> output: $out" - ); - return 0; - } - } - if ( $createrepomd && $createrepomd eq "true" ) { - my $distroname = $coll->productData()->getInfo("DISTRIBUTION")."." - . $coll->productData()->getInfo("VERSION"); - my $result = $this -> createRepositoryMetadata( - \@paths, $repoid, $distroname, $cpeid, $datadir, $targetdir - ); - # return values 0 || 1 indicates an error - if ($result != 2) { - return $result; - } - } - return 1 unless $descrdir; - return 1 unless $targetdir; - # insert translation files - my $trans_dir = '/usr/share/locale/en_US/LC_MESSAGES'; - my $trans_glob = 'package-translations-*.mo'; - foreach my $trans (glob($trans_dir.'/'.$trans_glob)) { - $trans = basename($trans, ".mo"); - $trans =~ s,.*-,,x; - $cmd = "/usr/bin/translate_packages.pl $trans " - . "< $targetdir/packages.en " - . "> $targetdir/packages.$trans"; - $call = $this -> callCmd($cmd); - $status = $call->[0]; - if($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called <$cmd> exit status: <$status> output: $out" - ); - return 1; - } - } - # one more time for english to insert possible EULAs - $cmd = "/usr/bin/translate_packages.pl en " - . "< $targetdir/packages.en " - . "> $targetdir/packages.en.new && " - . "mv $targetdir/packages.en.new $targetdir/packages.en"; - $call = $this -> callCmd($cmd); - $status = $call->[0]; - if ($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called <$cmd> exit status: <$status> output: $out" - ); - return 1; - } - if ((-x "/usr/bin/extract-appdata-icons") && - (-s "$targetdir/appdata.xml") - ) { - $cmd = "/usr/bin/extract-appdata-icons " - . "$targetdir/appdata.xml $targetdir"; - $call = $this -> callCmd($cmd); - $status = $call->[0]; - if($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called <$cmd> exit status: <$status> output: $out" - ); - return 1; + my @params = @_; + my $this = shift @params; + my @paths = @params; + my $call; + my $status; + my $cmd; + if(!@paths) { + $this->logMsg("W", "Empty path list!"); + return 0; } - if($this->{m_compress} =~ m{yes}i) { - system("gzip", "--rsyncable", "$targetdir/appdata.xml"); + my $coll = $this->{m_collect}; + my $datadir = $coll->productData()->getInfo("DATADIR"); + my $descrdir = $coll->productData()->getInfo("DESCRDIR"); + my $cpeid = $coll->productData()->getInfo("CPEID"); + my $repoid = $coll->productData()->getInfo("REPOID"); + my $createrepomd = $coll->productData()->getVar("CREATE_REPOMD"); + my $targetdir; + my $newtargetdir; + ## this ugly bit creates a parameter string from a list of directories: + # param = -d -d ... + # the order is important. Idea: use map to make hash => -d for + # all subdirs not ending with "0" (those are for metafile unpacking + # only). The result is evaluated in list context be reverse, so + # there's a list looking like " -d ... -d" which is + # reversed again, making the result '-d', '', ..., '-d', ''", + # after the join as string. + # --- + if ($descrdir && $descrdir ne "/") { + my $pathlist = "-d ".join(' -d ', map{$_."/".$datadir}(@paths)); + $this->logMsg("I", + "Calling ".$this->name()." for directories <@paths>:" + ); + $targetdir = $paths[0]."/".$descrdir; + $cmd = "$this->{m_tooldir}/$this->{m_tool} " + . "$pathlist $this->{m_params} -o " + . $paths[0] + . "/" + . $descrdir; + $this->logMsg("I", "Executing command <$cmd>"); + $call = $this -> callCmd($cmd); + $status = $call->[0]; + if($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called <$cmd> exit status <$status> output: $out" + ); + return 0; + } } - } - if($this->{m_compress} =~ m{yes}i) { - foreach my $pfile(glob("$targetdir/packages*")) { - if(system("gzip", "--rsyncable", "$pfile") == 0) { - unlink "$targetdir/$pfile"; - } else { - $this->logMsg("W", - "Can't compress file <$targetdir/$pfile>!" + if ( $createrepomd && $createrepomd eq "true" ) { + my $distroname = $coll->productData()->getInfo("DISTRIBUTION")."." + . $coll->productData()->getInfo("VERSION"); + my $result = $this -> createRepositoryMetadata( + \@paths, $repoid, $distroname, $cpeid, $datadir, $targetdir ); - } + # return values 0 || 1 indicates an error + if ($result != 2) { + return $result; + } } - } - return 1; -} - -sub createRepositoryMetadata { - my @params = @_; - my $this = $params[0]; - my $paths = $params[1]; - my $repoid = $params[2]; - my $distroname = $params[3]; - my $cpeid = $params[4]; - my $datadir = $params[5]; - my $targetdir = $params[6]; - my $cmd; - my $call; - my $status; - foreach my $p (@{$paths}) { - $cmd = "$this->{m_createrepo}"; - $cmd .= " --unique-md-filenames"; - $cmd .= " --checksum=sha256"; - $cmd .= " --no-database"; - $cmd .= " --repo=\"$repoid\"" if $repoid; - $cmd .= " --distro=\"$cpeid,$distroname\"" if $cpeid && $distroname; - $cmd .= " $p/$datadir"; - $this->logMsg("I", "Executing command <$cmd>"); - $call = $this -> callCmd($cmd); - $status = $call->[0]; - if($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called <$cmd> exit status: <$status> output: $out" - ); - return 0; + return 1 unless $descrdir; + return 1 unless $targetdir; + # insert translation files + my $trans_dir = '/usr/share/locale/en_US/LC_MESSAGES'; + my $trans_glob = 'package-translations-*.mo'; + foreach my $trans (glob($trans_dir.'/'.$trans_glob)) { + $trans = basename($trans, ".mo"); + $trans =~ s,.*-,,x; + $cmd = "/usr/bin/translate_packages.pl $trans " + . "< $targetdir/packages.en " + . "> $targetdir/packages.$trans"; + $call = $this -> callCmd($cmd); + $status = $call->[0]; + if($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called <$cmd> exit status: <$status> output: $out" + ); + return 1; + } } - $cmd = "$this->{m_rezip} $p/$datadir "; - $this->logMsg("I", "Executing command <$cmd>"); + # one more time for english to insert possible EULAs + $cmd = "/usr/bin/translate_packages.pl en " + . "< $targetdir/packages.en " + . "> $targetdir/packages.en.new && " + . "mv $targetdir/packages.en.new $targetdir/packages.en"; $call = $this -> callCmd($cmd); $status = $call->[0]; - if($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called <$cmd> exit status: <$status> output: $out" - ); - return 0; - } - my $newtargetdir = "$p/$datadir/repodata"; - if ((-x "/usr/bin/extract-appdata-icons") && - (-s "$newtargetdir/appdata.xml") - ) { - $cmd = "/usr/bin/extract-appdata-icons " - . "$newtargetdir/appdata.xml $newtargetdir"; - $call = $this -> callCmd($cmd); - $status = $call->[0]; - if($status) { + if ($status) { my $out = join("\n",@{$call->[1]}); $this->logMsg("E", - "Called $cmd exit status: <$status> output: $out" + "Called <$cmd> exit status: <$status> output: $out" ); return 1; - } - if($this->{m_compress} =~ m{yes}i) { - system("gzip", "--rsyncable", "$newtargetdir/appdata.xml"); - } } if ((-x "/usr/bin/extract-appdata-icons") && - (-s "$targetdir/appdata.xml") + (-s "$targetdir/appdata.xml") ) { - $newtargetdir = "$p/$datadir/repodata"; - system("cp $targetdir/appdata.xml $newtargetdir/appdata.xml"); - $cmd = "/usr/bin/extract-appdata-icons " - . "$newtargetdir/appdata.xml $newtargetdir"; - $call = $this -> callCmd($cmd); - $status = $call->[0]; - if($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called $cmd exit status: <$status> output: $out" - ); - return 1; - } - if($this->{m_compress} =~ m{yes}i) { - system("gzip", "--rsyncable", "$newtargetdir/appdata.xml"); - } + $cmd = "/usr/bin/extract-appdata-icons " + . "$targetdir/appdata.xml $targetdir"; + $call = $this -> callCmd($cmd); + $status = $call->[0]; + if($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called <$cmd> exit status: <$status> output: $out" + ); + return 1; + } + if($this->{m_compress} =~ m{yes}i) { + system("gzip", "--rsyncable", "$targetdir/appdata.xml"); + } } - if ( -f "/usr/bin/add_product_susedata" ) { - my $kwdfile = abs_path( - $this->collect()->{m_xml}->{xmlOrigFile} - ); - $kwdfile =~ s/.kiwi$/.kwd/x; - $cmd = "/usr/bin/add_product_susedata"; - $cmd .= " -u"; # unique filenames - $cmd .= " -k $kwdfile"; - $cmd .= " -e /usr/share/doc/packages/eulas"; - $cmd .= " -d $p/$datadir"; - $this->logMsg("I", "Executing command <$cmd>"); - $call = $this -> callCmd($cmd); - $status = $call->[0]; - if($status) { - my $out = join("\n",@{$call->[1]}); - $this->logMsg("E", - "Called <$cmd> exit status: <$status> output: $out" - ); - return 0; - } + if($this->{m_compress} =~ m{yes}i) { + foreach my $pfile(glob("$targetdir/packages*")) { + if(system("gzip", "--rsyncable", "$pfile") == 0) { + unlink "$targetdir/$pfile"; + } else { + $this->logMsg("W", + "Can't compress file <$targetdir/$pfile>!" + ); + } + } + } + return 1; +} + +sub createRepositoryMetadata { + my @params = @_; + my $this = $params[0]; + my $paths = $params[1]; + my $repoid = $params[2]; + my $distroname = $params[3]; + my $cpeid = $params[4]; + my $datadir = $params[5]; + my $targetdir = $params[6]; + my $cmd; + my $call; + my $status; + foreach my $p (@{$paths}) { + $cmd = "$this->{m_createrepo}"; + $cmd .= " --unique-md-filenames"; + $cmd .= " --checksum=sha256"; + $cmd .= " --no-database"; + $cmd .= " --repo=\"$repoid\"" if $repoid; + $cmd .= " --distro=\"$cpeid,$distroname\"" if $cpeid && $distroname; + $cmd .= " $p/$datadir"; + $this->logMsg("I", "Executing command <$cmd>"); + $call = $this -> callCmd($cmd); + $status = $call->[0]; + if($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called <$cmd> exit status: <$status> output: $out" + ); + return 0; + } + $cmd = "$this->{m_rezip} $p/$datadir "; + $this->logMsg("I", "Executing command <$cmd>"); + $call = $this -> callCmd($cmd); + $status = $call->[0]; + if($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called <$cmd> exit status: <$status> output: $out" + ); + return 0; + } + my $newtargetdir = "$p/$datadir/repodata"; + if ((-x "/usr/bin/extract-appdata-icons") && + (-s "$newtargetdir/appdata.xml") + ) { + $cmd = "/usr/bin/extract-appdata-icons " + . "$newtargetdir/appdata.xml $newtargetdir"; + $call = $this -> callCmd($cmd); + $status = $call->[0]; + if($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called $cmd exit status: <$status> output: $out" + ); + return 1; + } + if($this->{m_compress} =~ m{yes}i) { + system("gzip", "--rsyncable", "$newtargetdir/appdata.xml"); + } + } + if ((-x "/usr/bin/extract-appdata-icons") && + (-s "$targetdir/appdata.xml") + ) { + $newtargetdir = "$p/$datadir/repodata"; + system("cp $targetdir/appdata.xml $newtargetdir/appdata.xml"); + $cmd = "/usr/bin/extract-appdata-icons " + . "$newtargetdir/appdata.xml $newtargetdir"; + $call = $this -> callCmd($cmd); + $status = $call->[0]; + if($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called $cmd exit status: <$status> output: $out" + ); + return 1; + } + if($this->{m_compress} =~ m{yes}i) { + system("gzip", "--rsyncable", "$newtargetdir/appdata.xml"); + } + } + if ( -f "/usr/bin/add_product_susedata" ) { + my $kwdfile = abs_path( + $this->collect()->{m_xml}->{xmlOrigFile} + ); + $kwdfile =~ s/.kiwi$/.kwd/x; + $cmd = "/usr/bin/add_product_susedata"; + $cmd .= " -u"; # unique filenames + $cmd .= " -k $kwdfile"; + $cmd .= " -e /usr/share/doc/packages/eulas"; + $cmd .= " -d $p/$datadir"; + $this->logMsg("I", "Executing command <$cmd>"); + $call = $this -> callCmd($cmd); + $status = $call->[0]; + if($status) { + my $out = join("\n",@{$call->[1]}); + $this->logMsg("E", + "Called <$cmd> exit status: <$status> output: $out" + ); + return 0; + } + } } - } - return 2; + return 2; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-13-2/KIWIEulaPlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-13-2/KIWIEulaPlugin.pm index 5a4d14e7c..01c5b31b9 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-13-2/KIWIEulaPlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-13-2/KIWIEulaPlugin.pm @@ -26,146 +26,146 @@ use Config::IniFiles; use FileHandle; sub new { - # ... - # Create a new KIWIEulaPlugin object - # creates patterns file - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new($handler); - bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if ((! $configpath) || (! $configfile)) { - $this->logMsg("E", - "wrong parameters in plugin initialisation\n" + # ... + # Create a new KIWIEulaPlugin object + # creates patterns file + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new($handler); + bless ($this, $class); + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if ((! $configpath) || (! $configfile)) { + $this->logMsg("E", + "wrong parameters in plugin initialisation\n" + ); + return; + } + ## plugin content: + #----------------- + #[base] + # name = KIWIEulaPlugin + # order = 3 + # src = packages.en[.gz] + # srcdir = $DESCRDIR + # tool = packages2eula.pl + # tooldir = /usr/bin + # toolpack = inst-source-utils + # defaultenable = 1 + # + #[target] + # targetfile = EULA.txt + # targetdir = $PRODUCT_DIR + # + my $ini = Config::IniFiles -> new( + -file => "$configpath/$configfile" ); - return; - } - ## plugin content: - #----------------- - #[base] - # name = KIWIEulaPlugin - # order = 3 - # src = packages.en[.gz] - # srcdir = $DESCRDIR - # tool = packages2eula.pl - # tooldir = /usr/bin - # toolpack = inst-source-utils - # defaultenable = 1 - # - #[target] - # targetfile = EULA.txt - # targetdir = $PRODUCT_DIR - # - my $ini = Config::IniFiles -> new( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base', 'name'); - my $order = $ini->val('base', 'order'); - my $tool = $ini->val('base', 'tool'); - my $tooldir = $ini->val('base', 'tooldir'); - my $toolpack = $ini->val('base', 'toolpack'); - my $enable = $ini->val('base', 'defaultenable'); - my $src = $ini->val('base', 'sourcefile'); - my $srcdir = $ini->val('base', 'sourcedir'); - my $iopt = $ini->val('option', 'in'); - my $oopt = $ini->val('option', 'out'); - my $popt = $ini->val('option', 'packfile'); - my $target = $ini->val('target', 'targetfile'); - my $targetdir= $ini->val('target', 'targetdir'); - # if any of those isn't set, complain! - if(not defined($name) - or not defined($order) - or not defined($tool) - or not defined($tooldir) - or not defined($toolpack) - or not defined($enable) - or not defined($target) - or not defined($targetdir) - or not defined($iopt) - or not defined($oopt) - or not defined($popt) - ) { - $this->logMsg("E", - "Plugin ini file <$config> seems broken!\n" - ); - return; - } - $this->name($name); - $this->order($order); - $targetdir = $this->collect() - ->productData()->_substitute("$targetdir"); - $srcdir = $this->collect() - ->productData()->_substitute("$srcdir"); - $this->{m_target} = $target; - if($enable != 0) { - $this->ready(1); - } - $this->{m_source} = $src; - $this->{m_srcdir} = $srcdir; - $this->{m_tool} = $tool; - $this->{m_toolpath} = $this->collect() - ->productData()->_substitute("$tooldir"); - $this->{m_toolpack} = $toolpack; - $this->{m_iopt} = $iopt; - $this->{m_oopt} = $oopt; - $this->{m_popt} = $popt; - $this->requiredDirs($srcdir, $targetdir); - return $this; + my $name = $ini->val('base', 'name'); + my $order = $ini->val('base', 'order'); + my $tool = $ini->val('base', 'tool'); + my $tooldir = $ini->val('base', 'tooldir'); + my $toolpack = $ini->val('base', 'toolpack'); + my $enable = $ini->val('base', 'defaultenable'); + my $src = $ini->val('base', 'sourcefile'); + my $srcdir = $ini->val('base', 'sourcedir'); + my $iopt = $ini->val('option', 'in'); + my $oopt = $ini->val('option', 'out'); + my $popt = $ini->val('option', 'packfile'); + my $target = $ini->val('target', 'targetfile'); + my $targetdir= $ini->val('target', 'targetdir'); + # if any of those isn't set, complain! + if(not defined($name) + or not defined($order) + or not defined($tool) + or not defined($tooldir) + or not defined($toolpack) + or not defined($enable) + or not defined($target) + or not defined($targetdir) + or not defined($iopt) + or not defined($oopt) + or not defined($popt) + ) { + $this->logMsg("E", + "Plugin ini file <$config> seems broken!\n" + ); + return; + } + $this->name($name); + $this->order($order); + $targetdir = $this->collect() + ->productData()->_substitute("$targetdir"); + $srcdir = $this->collect() + ->productData()->_substitute("$srcdir"); + $this->{m_target} = $target; + if($enable != 0) { + $this->ready(1); + } + $this->{m_source} = $src; + $this->{m_srcdir} = $srcdir; + $this->{m_tool} = $tool; + $this->{m_toolpath} = $this->collect() + ->productData()->_substitute("$tooldir"); + $this->{m_toolpack} = $toolpack; + $this->{m_iopt} = $iopt; + $this->{m_oopt} = $oopt; + $this->{m_popt} = $popt; + $this->requiredDirs($srcdir, $targetdir); + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - my $retval = 0; - if($this->{m_ready} == 0) { - return $retval; - } - my @dirlist = $this->getSubdirLists(); - return unless @dirlist && $dirlist[0] && - ref ($dirlist[0] eq "ARRAY") && $dirlist[0]->[0]; - my $dirname = $dirlist[0]->[0]; - my $srcdir = $dirname."/".$this->{m_requireddirs}->[0]; - my $targetdir = $dirname."/".$this->{m_requireddirs}->[1]; - my $SRCFILE = FileHandle -> new(); - if (! $SRCFILE -> open ("<$srcdir/$this->{m_source}")) { - $this->logMsg("E", - "PatternsPlugin: cannot read <$srcdir/".$this->{m_source}.">" - ); - $this->logMsg("I", "Skipping plugin <".$this->name().">"); + my $this = shift; + if(not ref($this)) { + return; + } + my $retval = 0; + if($this->{m_ready} == 0) { + return $retval; + } + my @dirlist = $this->getSubdirLists(); + return unless @dirlist && $dirlist[0] && + ref ($dirlist[0] eq "ARRAY") && $dirlist[0]->[0]; + my $dirname = $dirlist[0]->[0]; + my $srcdir = $dirname."/".$this->{m_requireddirs}->[0]; + my $targetdir = $dirname."/".$this->{m_requireddirs}->[1]; + my $SRCFILE = FileHandle -> new(); + if (! $SRCFILE -> open ("<$srcdir/$this->{m_source}")) { + $this->logMsg("E", + "PatternsPlugin: cannot read <$srcdir/".$this->{m_source}.">" + ); + $this->logMsg("I", "Skipping plugin <".$this->name().">"); + return $retval; + } + $SRCFILE -> close(); + my $cmd = "$this->{m_toolpath}/$this->{m_tool} " + . "$this->{m_iopt} $targetdir/$this->{m_target} " + . "$this->{m_popt} $srcdir/$this->{m_source} " + . "$this->{m_oopt} $targetdir/$this->{m_target}.new"; + my $call = $this -> callCmd($cmd); + my $status = $call->[0]; + my @data = @{$call->[1]}; + $this->logMsg("I", "output of command $this->{m_tool}:\n"); + foreach my $l(@data) { + $this->logMsg("I", "\t$l\n"); + } + if($status) { + $this->logMsg("I", + "command $this->{m_tool} exited with <$status>\n" + ); + } else { + $this->logMsg("I", + "command $this->{m_tool} exited successfully.\n" + ); + $retval = 1; + } return $retval; - } - $SRCFILE -> close(); - my $cmd = "$this->{m_toolpath}/$this->{m_tool} " - . "$this->{m_iopt} $targetdir/$this->{m_target} " - . "$this->{m_popt} $srcdir/$this->{m_source} " - . "$this->{m_oopt} $targetdir/$this->{m_target}.new"; - my $call = $this -> callCmd($cmd); - my $status = $call->[0]; - my @data = @{$call->[1]}; - $this->logMsg("I", "output of command $this->{m_tool}:\n"); - foreach my $l(@data) { - $this->logMsg("I", "\t$l\n"); - } - if($status) { - $this->logMsg("I", - "command $this->{m_tool} exited with <$status>\n" - ); - } else { - $this->logMsg("I", - "command $this->{m_tool} exited successfully.\n" - ); - $retval = 1; - } - return $retval; } 1; diff --git a/distribution/kiwi-instsource-plugins-openSUSE-13-2/KIWIMiniIsoPlugin.pm b/distribution/kiwi-instsource-plugins-openSUSE-13-2/KIWIMiniIsoPlugin.pm index 82d6de925..3bb4a6943 100644 --- a/distribution/kiwi-instsource-plugins-openSUSE-13-2/KIWIMiniIsoPlugin.pm +++ b/distribution/kiwi-instsource-plugins-openSUSE-13-2/KIWIMiniIsoPlugin.pm @@ -29,245 +29,245 @@ use FileHandle; use Carp; sub new { - # ... - # Create a new KIWIMiniIsoPlugin object - # --- - my $class = shift; - my $handler = shift; - my $config = shift; - my $configpath; - my $configfile; - my $this = KIWIBasePlugin -> new($handler); - bless ($this, $class); - if ($config =~ m{(.*)/([^/]+)$}x) { - $configpath = $1; - $configfile = $2; - } - if ((! $configpath) || (! $configfile)) { - $this->logMsg("E", - "wrong parameters in plugin initialisation\n" - ); - return; - } - ## plugin content: - #----------------- - #[base] - # name = KIWIEulaPlugin - # order = 3 - # defaultenable = 1 - # - #[target] - # targetfile = content - # targetdir = $PRODUCT_DIR - # media = (list of numbers XOR "all") - # - my $ini = Config::IniFiles -> new ( - -file => "$configpath/$configfile" - ); - my $name = $ini->val('base', 'name'); - my $order = $ini->val('base', 'order'); - my $enable = $ini->val('base', 'defaultenable'); - # if any of those isn't set, complain! - if (not defined($name) - or not defined($order) - or not defined($enable) - ) { - $this->logMsg("E", - "Plugin ini file <$config> seems broken!\n" + # ... + # Create a new KIWIMiniIsoPlugin object + # --- + my $class = shift; + my $handler = shift; + my $config = shift; + my $configpath; + my $configfile; + my $this = KIWIBasePlugin -> new($handler); + bless ($this, $class); + if ($config =~ m{(.*)/([^/]+)$}x) { + $configpath = $1; + $configfile = $2; + } + if ((! $configpath) || (! $configfile)) { + $this->logMsg("E", + "wrong parameters in plugin initialisation\n" + ); + return; + } + ## plugin content: + #----------------- + #[base] + # name = KIWIEulaPlugin + # order = 3 + # defaultenable = 1 + # + #[target] + # targetfile = content + # targetdir = $PRODUCT_DIR + # media = (list of numbers XOR "all") + # + my $ini = Config::IniFiles -> new ( + -file => "$configpath/$configfile" ); - return; - } - $this->name($name); - $this->order($order); - if($enable != 0) { - $this->ready(1); - } - return $this; + my $name = $ini->val('base', 'name'); + my $order = $ini->val('base', 'order'); + my $enable = $ini->val('base', 'defaultenable'); + # if any of those isn't set, complain! + if (not defined($name) + or not defined($order) + or not defined($enable) + ) { + $this->logMsg("E", + "Plugin ini file <$config> seems broken!\n" + ); + return; + } + $this->name($name); + $this->order($order); + if($enable != 0) { + $this->ready(1); + } + return $this; } sub execute { - my $this = shift; - if(not ref($this)) { - return; - } - my $retval = 0; - if($this->{m_ready} == 0) { - return $retval; - } - my $repoloc = $this->collect()->productData()->getOpt("REPO_LOCATION"); - my $ismini = $this->collect()->productData()->getVar("FLAVOR"); - if(not defined($ismini)) { - $this->logMsg("W", "FLAVOR not set?"); - return $retval; - } - if ($ismini !~ m{mini}i) { - $this->logMsg("I", - "Nothing to for for media type <$ismini>" + my $this = shift; + if(not ref($this)) { + return; + } + my $retval = 0; + if($this->{m_ready} == 0) { + return $retval; + } + my $repoloc = $this->collect()->productData()->getOpt("REPO_LOCATION"); + my $ismini = $this->collect()->productData()->getVar("FLAVOR"); + if(not defined($ismini)) { + $this->logMsg("W", "FLAVOR not set?"); + return $retval; + } + if ($ismini !~ m{mini}i) { + $this->logMsg("I", + "Nothing to for for media type <$ismini>" + ); + return $retval; + } + my ($srv, $path); + if (not defined($repoloc)) { + $this->logMsg("I", + " is unset, boot protocol will be set to 'slp'!" + ); + } else { + if ($repoloc =~ m{^http://([^/]+)/(.+)}x) { + ($srv, $path) = ($1, $2); + } + if(not defined($srv) or not defined($path)) { + $this->logMsg("W", + "Parsing repo-location=<$repoloc> failed!" + ); + return $retval; + } + } + my @gfxbootfiles; + find( + sub { find_cb($this, '.*/gfxboot\.cfg$', \@gfxbootfiles) }, + $this->handler()->collect()->basedir() ); - return $retval; - } - my ($srv, $path); - if (not defined($repoloc)) { - $this->logMsg("I", - " is unset, boot protocol will be set to 'slp'!" + my @rootfiles; + find( + sub { find_cb($this, '.*/root$', \@rootfiles) }, + $this->handler()->collect()->basedir() ); - } else { - if ($repoloc =~ m{^http://([^/]+)/(.+)}x) { - ($srv, $path) = ($1, $2); + foreach(@rootfiles) { + $this->logMsg("I", "removing file <$_>"); + unlink $_; } - if(not defined($srv) or not defined($path)) { - $this->logMsg("W", - "Parsing repo-location=<$repoloc> failed!" - ); - return $retval; + if (!@gfxbootfiles) { + my $msg = "No gfxboot.cfg file found! " + . "This _MIGHT_ be ok for S/390. " + . "Please verify package(s)"; + $this->logMsg("W", $msg); + return $retval; } - } - my @gfxbootfiles; - find( - sub { find_cb($this, '.*/gfxboot\.cfg$', \@gfxbootfiles) }, - $this->handler()->collect()->basedir() - ); - my @rootfiles; - find( - sub { find_cb($this, '.*/root$', \@rootfiles) }, - $this->handler()->collect()->basedir() - ); - foreach(@rootfiles) { - $this->logMsg("I", "removing file <$_>"); - unlink $_; - } - if (!@gfxbootfiles) { - my $msg = "No gfxboot.cfg file found! " - . "This _MIGHT_ be ok for S/390. " - . "Please verify package(s)"; - $this->logMsg("W", $msg); + $this -> updateEFIGrubConfig($repoloc); + $retval = $this -> updateGraphicsBootConfig ( + \@gfxbootfiles, $repoloc, $srv, $path + ); return $retval; - } - $this -> updateEFIGrubConfig($repoloc); - $retval = $this -> updateGraphicsBootConfig ( - \@gfxbootfiles, $repoloc, $srv, $path - ); - return $retval; } sub updateGraphicsBootConfig { - my $this = shift; - my $gfxbootfiles = shift; - my $repoloc = shift; - my $srv = shift; - my $path = shift; - my $retval = 0; - foreach my $cfg(@{$gfxbootfiles}) { - $this->logMsg("I", "Processing file <$cfg>: "); - my $F = FileHandle -> new(); - if (! $F -> open($cfg)) { - $this->logMsg("E", "Cant open file <$cfg>!"); - next; + my $this = shift; + my $gfxbootfiles = shift; + my $repoloc = shift; + my $srv = shift; + my $path = shift; + my $retval = 0; + foreach my $cfg(@{$gfxbootfiles}) { + $this->logMsg("I", "Processing file <$cfg>: "); + my $F = FileHandle -> new(); + if (! $F -> open($cfg)) { + $this->logMsg("E", "Cant open file <$cfg>!"); + next; + } + my @lines = <$F>; + $F -> close(); + chomp(@lines); + my $install = -1; + my $ihs = -1; + my $ihp = -1; + my $i = -1; + foreach my $line(@lines) { + $i++; + next if $line !~ m{^install}x; + if($line =~ m{^install=.*}x) { + $install = $i; + } + if ($line =~ m{^install.http.server=+}x) { + $ihs = $i; + } + if($line =~ m{^install.http.path=+}x) { + $ihp = $i; + } + } + if(!$repoloc) { + if($install == -1) { + push @lines, "install=slp"; + } else { + $lines[$install] =~ s{^install.*}{install=slp}x; + } + } elsif($srv) { + if($ihs == -1) { + push @lines, "install.http.server=$srv"; + } else { + $lines[$ihs] =~ s{^(install.http.server).*}{$1=$srv}x; + } + if($ihp == -1) { + push @lines, "install.http.path=$path"; + } else { + $lines[$ihp] =~ s{^(install.http.path).*}{$1=$path}x; + } + if($install == -1) { + push @lines, "install=http"; + } else { + $lines[$install] =~ s{^install.*}{install=http}x; + } + } + unlink $cfg; + if (! $F -> open(">$cfg")) { + $this->logMsg("E", "Cant open file for writing <$cfg>!"); + next; + } + foreach(@lines) { + print $F "$_\n"; + } + $F -> close(); + $retval++; } - my @lines = <$F>; - $F -> close(); - chomp(@lines); - my $install = -1; - my $ihs = -1; - my $ihp = -1; - my $i = -1; - foreach my $line(@lines) { - $i++; - next if $line !~ m{^install}x; - if($line =~ m{^install=.*}x) { - $install = $i; - } - if ($line =~ m{^install.http.server=+}x) { - $ihs = $i; - } - if($line =~ m{^install.http.path=+}x) { - $ihp = $i; - } + return $retval; +} + +sub updateEFIGrubConfig { + my $this = shift; + my $repoloc = shift; + my $grubcfg = $this->collect() + ->basesubdirs()->{1} . "/EFI/BOOT/grub.cfg"; + if (! -f $grubcfg ) { + $this->logMsg("I", "no grub.cfg at <$grubcfg>"); + return; } - if(!$repoloc) { - if($install == -1) { - push @lines, "install=slp"; - } else { - $lines[$install] =~ s{^install.*}{install=slp}x; - } - } elsif($srv) { - if($ihs == -1) { - push @lines, "install.http.server=$srv"; - } else { - $lines[$ihs] =~ s{^(install.http.server).*}{$1=$srv}x; - } - if($ihp == -1) { - push @lines, "install.http.path=$path"; - } else { - $lines[$ihp] =~ s{^(install.http.path).*}{$1=$path}x; - } - if($install == -1) { - push @lines, "install=http"; - } else { - $lines[$install] =~ s{^install.*}{install=http}x; - } + $this->logMsg("I", "editing <$grubcfg>"); + my $IN = FileHandle -> new(); + my $OUT = FileHandle -> new(); + if (! $IN -> open($grubcfg)) { + croak "Cant open file for reading $grubcfg: $!"; } - unlink $cfg; - if (! $F -> open(">$cfg")) { - $this->logMsg("E", "Cant open file for writing <$cfg>!"); - next; + if (! $OUT -> open(">$grubcfg.new")) { + croak "Cant open file for writing $grubcfg.new: $!"; } - foreach(@lines) { - print $F "$_\n"; + while(<$IN>) { + my $line = $_; + chomp $line; + $this->logMsg("I", "-$line"); + $line =~ + s,(linuxefi /boot/x86_64/loader/linux),$1 install=$repoloc,x; + $this->logMsg("I", "+$line"); + print $OUT "$line\n"; } - $F -> close(); - $retval++; - } - return $retval; -} - -sub updateEFIGrubConfig { - my $this = shift; - my $repoloc = shift; - my $grubcfg = $this->collect() - ->basesubdirs()->{1} . "/EFI/BOOT/grub.cfg"; - if (! -f $grubcfg ) { - $this->logMsg("I", "no grub.cfg at <$grubcfg>"); - return; - } - $this->logMsg("I", "editing <$grubcfg>"); - my $IN = FileHandle -> new(); - my $OUT = FileHandle -> new(); - if (! $IN -> open($grubcfg)) { - croak "Cant open file for reading $grubcfg: $!"; - } - if (! $OUT -> open(">$grubcfg.new")) { - croak "Cant open file for writing $grubcfg.new: $!"; - } - while(<$IN>) { - my $line = $_; - chomp $line; - $this->logMsg("I", "-$line"); - $line =~ - s,(linuxefi /boot/x86_64/loader/linux),$1 install=$repoloc,x; - $this->logMsg("I", "+$line"); - print $OUT "$line\n"; - } - $OUT -> close(); - $IN -> close(); - $this -> callCmd("diff -u $grubcfg $grubcfg.new"); - rename("$grubcfg.new", $grubcfg); - return $this; + $OUT -> close(); + $IN -> close(); + $this -> callCmd("diff -u $grubcfg $grubcfg.new"); + rename("$grubcfg.new", $grubcfg); + return $this; } sub find_cb { - my $this = shift; - return if not ref($this); + my $this = shift; + return if not ref($this); - my $pat = shift; - my $listref = shift; - if(not defined($listref) or not defined($pat)) { - return; - } - if($File::Find::name =~ m{$pat}x) { - push @{$listref}, $File::Find::name; - } - return $this; + my $pat = shift; + my $listref = shift; + if(not defined($listref) or not defined($pat)) { + return; + } + if($File::Find::name =~ m{$pat}x) { + push @{$listref}, $File::Find::name; + } + return $this; } 1; diff --git a/doc/devdoc/genDevDoc b/doc/devdoc/genDevDoc index 3da38c523..1250b7fa3 100755 --- a/doc/devdoc/genDevDoc +++ b/doc/devdoc/genDevDoc @@ -46,643 +46,643 @@ my %unresolvable; # addMethodInfo #------------------------------------------ sub addMethodInfo { - # ... - # Extract the method name and it's documentation delineated by - # # ... and # ---. - # --- - my $modName = shift; - my $content = shift; - my $lineNo = 0; - my $collectDoc; - my $defOnLine; - my $docEnd; - my $inMethodContext; - my $methodDoc = q{}; - my $methName; - my $nothingCollected; - my %classInfo; - #print "DBG: working for: $modName\n"; - for my $ln (@{$content}) { - $lineNo += 1; - if ($ln =~ /^sub\s/mx) { - my ($keyword, $name, $curly) = split /\s/mx, $ln; - #print "\tDBG found sub: $name\n"; - if (! $curly) { - chomp $name; - } - $methName = $name; - if (! ($methName =~ /^new$|^instance$/mx)) { - #print "\t\tDBG: not new or instance\n"; - if ($kiwiMethodNames{$methName}) { - $duplicteName{$methName} = 1; - $kiwiMethodNames{$methName} = 1; - } else { - #print "\t\tDBG: add to method hash '$methName'\n"; - $kiwiMethodNames{$methName} = $modName; + # ... + # Extract the method name and it's documentation delineated by + # # ... and # ---. + # --- + my $modName = shift; + my $content = shift; + my $lineNo = 0; + my $collectDoc; + my $defOnLine; + my $docEnd; + my $inMethodContext; + my $methodDoc = q{}; + my $methName; + my $nothingCollected; + my %classInfo; + #print "DBG: working for: $modName\n"; + for my $ln (@{$content}) { + $lineNo += 1; + if ($ln =~ /^sub\s/mx) { + my ($keyword, $name, $curly) = split /\s/mx, $ln; + #print "\tDBG found sub: $name\n"; + if (! $curly) { + chomp $name; + } + $methName = $name; + if (! ($methName =~ /^new$|^instance$/mx)) { + #print "\t\tDBG: not new or instance\n"; + if ($kiwiMethodNames{$methName}) { + $duplicteName{$methName} = 1; + $kiwiMethodNames{$methName} = 1; + } else { + #print "\t\tDBG: add to method hash '$methName'\n"; + $kiwiMethodNames{$methName} = $modName; + } + } + # Potential 1 line method + if ($ln =~ /}/msx) { + #print "\t\tDBG potential one liner\n"; + $ln =~ s/\s//gmx; + my $curlyCnt = 0; + my $tok = PPI::Tokenizer->new(\$ln); + while ( my $t = $tok->get_token() ) { + if ($t eq '{') { + $curlyCnt += 1; + } + if ($t eq '}') { + $curlyCnt -= 1; + } + } + if ($curlyCnt == 0) { + my $access; + if ($methName =~ /^_|^__/mx) { + $access = 'private'; + } else { + $access = 'public'; + } + $classInfo{$access}{$methName}{description} = 'Missing'; + $classInfo{$access}{$methName}{definedOn} = $lineNo; + next; + } + } + $inMethodContext = 1; + $nothingCollected = 1; + $defOnLine = $lineNo; + $docEnd = 0; + next; } - } - # Potential 1 line method - if ($ln =~ /}/msx) { - #print "\t\tDBG potential one liner\n"; - $ln =~ s/\s//gmx; - my $curlyCnt = 0; - my $tok = PPI::Tokenizer->new(\$ln); - while ( my $t = $tok->get_token() ) { - if ($t eq '{') { - $curlyCnt += 1; - } - if ($t eq '}') { - $curlyCnt -= 1; - } - } - if ($curlyCnt == 0) { - my $access; - if ($methName =~ /^_|^__/mx) { + my $access; + if ($methName && $methName =~ /^_|^__/mx) { $access = 'private'; - } else { + } else { $access = 'public'; - } - $classInfo{$access}{$methName}{description} = 'Missing'; - $classInfo{$access}{$methName}{definedOn} = $lineNo; - next; } - } - $inMethodContext = 1; - $nothingCollected = 1; - $defOnLine = $lineNo; - $docEnd = 0; - next; - } - my $access; - if ($methName && $methName =~ /^_|^__/mx) { - $access = 'private'; - } else { - $access = 'public'; - } - if ($inMethodContext && !$docEnd && $ln =~ /\#\s\.\.\./mx) { - #print "\t\tDBG: collect begin; skip line\n"; - $collectDoc = 1; - next; - } - if ($collectDoc && $ln =~ /\#\s---/mx) { - #print "\t\tDBG: collect end\n"; - $classInfo{$access}{$methName}{description} = $methodDoc; - $classInfo{$access}{$methName}{definedOn} = $defOnLine; - $collectDoc = 0; - $docEnd = 1; - $methodDoc = q{}; - $methName = q{}; - } - if ($collectDoc) { - #print "\t\tDBG: collect: $ln\n"; - $nothingCollected = 0; - $ln =~ s/\#//mx; - $ln =~ s/\t//mx; - $methodDoc .= $ln; - } - if ($inMethodContext && $nothingCollected && $ln =~ /^}/mx) { - #print "\t\tDBG: method end no doc: $methName\n"; - $classInfo{$access}{$methName}{description} = 'Missing'; - $classInfo{$access}{$methName}{definedOn} = $defOnLine; - $nothingCollected = 1; - $inMethodContext = 0; + if ($inMethodContext && !$docEnd && $ln =~ /\#\s\.\.\./mx) { + #print "\t\tDBG: collect begin; skip line\n"; + $collectDoc = 1; + next; + } + if ($collectDoc && $ln =~ /\#\s---/mx) { + #print "\t\tDBG: collect end\n"; + $classInfo{$access}{$methName}{description} = $methodDoc; + $classInfo{$access}{$methName}{definedOn} = $defOnLine; + $collectDoc = 0; + $docEnd = 1; + $methodDoc = q{}; + $methName = q{}; + } + if ($collectDoc) { + #print "\t\tDBG: collect: $ln\n"; + $nothingCollected = 0; + $ln =~ s/\#//mx; + $ln =~ s/\t//mx; + $methodDoc .= $ln; + } + if ($inMethodContext && $nothingCollected && $ln =~ /^}/mx) { + #print "\t\tDBG: method end no doc: $methName\n"; + $classInfo{$access}{$methName}{description} = 'Missing'; + $classInfo{$access}{$methName}{definedOn} = $defOnLine; + $nothingCollected = 1; + $inMethodContext = 0; + } } - } - $infoTree{$modName} = \%classInfo; - return; + $infoTree{$modName} = \%classInfo; + return; } #========================================== # addCtorCrossReferences #------------------------------------------ sub addCtorCrossReferences { - # ... - # Add cross refernces to call origins for new() and instance() calls - # --- - my $modName = shift; - my $content = shift; - my $lineNo = 0; - my $methName; + # ... + # Add cross refernces to call origins for new() and instance() calls + # --- + my $modName = shift; + my $content = shift; + my $lineNo = 0; + my $methName; LINE: - for my $ln (@{$content}) { - $lineNo += 1; - if ($ln =~ /^sub\s/mx) { - my ($keyword, $name, $curly) = split /\s/mx, $ln; - $methName = $name; - next LINE; - } - if ($ln =~ /\snew\s|>new|\snew|instance/mx && $ln =~ /KIWI/) { - $ln =~ s/\s//gmx; - my $tok = PPI::Tokenizer->new(\$ln); - my $kObj; - while ( my $t = $tok->get_token() ) { - if ($t =~ /^\#/msx) { - next LINE; + for my $ln (@{$content}) { + $lineNo += 1; + if ($ln =~ /^sub\s/mx) { + my ($keyword, $name, $curly) = split /\s/mx, $ln; + $methName = $name; + next LINE; } - if ($t =~ /^KIWI/mx) { - $kObj = $t; + if ($ln =~ /\snew\s|>new|\snew|instance/mx && $ln =~ /KIWI/) { + $ln =~ s/\s//gmx; + my $tok = PPI::Tokenizer->new(\$ln); + my $kObj; + while ( my $t = $tok->get_token() ) { + if ($t =~ /^\#/msx) { + next LINE; + } + if ($t =~ /^KIWI/mx) { + $kObj = $t; + } + } + if (! $kObj) { + next LINE; + } + my $origin = $modName . ':' . $methName . ':' . $lineNo; + if ($ln =~ /new/) { + if ($infoTree{$kObj}{public}{new}{called}) { + push @{$infoTree{$kObj} + ->{public} + ->{new} + ->{called}}, $origin; + } else { + my @orig = ($origin); + $infoTree{$kObj}{public}{new}{called} = \@orig; + } + } else { + if ($infoTree{$kObj}{public}{instance}) { + if ($infoTree{$kObj}{public}{instance}{called}) { + push @{$infoTree{$kObj} + ->{public} + ->{instance} + ->{called}}, , $origin; + } else { + my @orig = ($origin); + $infoTree{$kObj} + ->{public} + ->{instance} + ->{called} = \@orig; + } + } else { + my @orig = ($origin); + my %callRef = ( called => \@orig); + $infoTree{$kObj}{public}{instance} = \%callRef; + } + } } - } - if (! $kObj) { - next LINE; - } - my $origin = $modName . ':' . $methName . ':' . $lineNo; - if ($ln =~ /new/) { - if ($infoTree{$kObj}{public}{new}{called}) { - push @{$infoTree{$kObj} - ->{public} - ->{new} - ->{called}}, $origin; - } else { - my @orig = ($origin); - $infoTree{$kObj}{public}{new}{called} = \@orig; - } - } else { - if ($infoTree{$kObj}{public}{instance}) { - if ($infoTree{$kObj}{public}{instance}{called}) { - push @{$infoTree{$kObj} - ->{public} - ->{instance} - ->{called}}, , $origin; - } else { - my @orig = ($origin); - $infoTree{$kObj} - ->{public} - ->{instance} - ->{called} = \@orig; - } - } else { - my @orig = ($origin); - my %callRef = ( called => \@orig); - $infoTree{$kObj}{public}{instance} = \%callRef; - } - } } - } - return; + return; } #========================================== # addMethodCallCrossReferences #------------------------------------------ sub addMethodCallCrossReferences { - # ... - # Generate cross references for all kiwi methods - # --- - my $modName = shift; - my $content = shift; - my $lineNo = 0; - my $methName; - my $nextMethName; + # ... + # Generate cross references for all kiwi methods + # --- + my $modName = shift; + my $content = shift; + my $lineNo = 0; + my $methName; + my $nextMethName; LINE: - for my $ln (@{$content}) { - $lineNo += 1; - my $cln = $ln; - $cln =~ s/\s//gmx; - my $tok = PPI::Tokenizer->new(\$cln); - while ( my $t = $tok->get_token() ) { - if ($t =~ /^\#/mx) { - next LINE; - } - if ($t =~ /^sub$/mx) { - $nextMethName = 1; - } - if ($nextMethName) { - $methName = $t; - $nextMethName = 0; - next LINE; - } - if ($kiwiMethodNames{$t}) { - if ($duplicteName{$t}) { - __disambiguateCall($content, $t, $modName, $lineNo); - } else { - __addLineCrossRef($t, $modName, $lineNo); + for my $ln (@{$content}) { + $lineNo += 1; + my $cln = $ln; + $cln =~ s/\s//gmx; + my $tok = PPI::Tokenizer->new(\$cln); + while ( my $t = $tok->get_token() ) { + if ($t =~ /^\#/mx) { + next LINE; + } + if ($t =~ /^sub$/mx) { + $nextMethName = 1; + } + if ($nextMethName) { + $methName = $t; + $nextMethName = 0; + next LINE; + } + if ($kiwiMethodNames{$t}) { + if ($duplicteName{$t}) { + __disambiguateCall($content, $t, $modName, $lineNo); + } else { + __addLineCrossRef($t, $modName, $lineNo); + } + } } - } } - } - return; + return; } #========================================== # generateDependencyData #------------------------------------------ sub generateDependencyData { - # ... - # Create dependency entries for each module. - # --- - my $modName = shift; - my $content = shift; - my @dependencies; - for my $ln (@{$content}) { - $ln =~ s/\s//gmx; - my $tok = PPI::Tokenizer->new(\$ln); - my @tokens = @{$tok->all_tokens()}; - if ($tokens[0] && $tokens[0] =~ /^use|^require/mx) { - for my $token (@tokens) { - if ($token =~ /.*(KIWI\w+).*/mx) { - push @dependencies, $1; + # ... + # Create dependency entries for each module. + # --- + my $modName = shift; + my $content = shift; + my @dependencies; + for my $ln (@{$content}) { + $ln =~ s/\s//gmx; + my $tok = PPI::Tokenizer->new(\$ln); + my @tokens = @{$tok->all_tokens()}; + if ($tokens[0] && $tokens[0] =~ /^use|^require/mx) { + for my $token (@tokens) { + if ($token =~ /.*(KIWI\w+).*/mx) { + push @dependencies, $1; + } + } } - } } - } - $dependencyMap{$modName} = \@dependencies; - return; + $dependencyMap{$modName} = \@dependencies; + return; } #========================================== # generateDependencyGraph #------------------------------------------ sub generateDependencyGraph { - # ... - # Create a DAG from the dependency data - # --- - if (! -d 'devDocs') { - mkdir 'devDocs'; - } - my $graph = gv::graph('KIWI Module Dependencies'); - gv::setv($graph, 'concentrate', 'true'); - my %nodeIDmap; - # Add all the nodes - for my $modName (keys %dependencyMap) { - my $handleID = gv::node($graph, $modName); - $nodeIDmap{$modName} = $handleID; - } - # Add the edges - for my $modName (keys %dependencyMap) { - my @dependencies = @{$dependencyMap{$modName}}; - my $headNd = $nodeIDmap{$modName}; - for my $depMod (@dependencies) { - my $edge = gv::edge($nodeIDmap{$depMod}, $headNd); - gv::setv($edge, 'arrowhead', 'open'); - gv::setv($edge, 'arrowsize', '2'); + # ... + # Create a DAG from the dependency data + # --- + if (! -d 'devDocs') { + mkdir 'devDocs'; + } + my $graph = gv::graph('KIWI Module Dependencies'); + gv::setv($graph, 'concentrate', 'true'); + my %nodeIDmap; + # Add all the nodes + for my $modName (keys %dependencyMap) { + my $handleID = gv::node($graph, $modName); + $nodeIDmap{$modName} = $handleID; } - } - gv::layout($graph, 'dot'); - gv::render($graph, 'svg', 'images/moduleDAG.svg'); - return; + # Add the edges + for my $modName (keys %dependencyMap) { + my @dependencies = @{$dependencyMap{$modName}}; + my $headNd = $nodeIDmap{$modName}; + for my $depMod (@dependencies) { + my $edge = gv::edge($nodeIDmap{$depMod}, $headNd); + gv::setv($edge, 'arrowhead', 'open'); + gv::setv($edge, 'arrowsize', '2'); + } + } + gv::layout($graph, 'dot'); + gv::render($graph, 'svg', 'images/moduleDAG.svg'); + return; } #========================================== # generateGraphPage #------------------------------------------ sub generateGraphPage { - # ... - # Generate HTML to show the dependency graph - # --- - if (! -d 'images') { - mkdir 'devDocs'; - } - my $page = '' . "\n" - . '' . "\n" - . '' . "\n" - . '' . "\n" - . 'KIWI Module Dependencies' . "\n" - . '' . "\n" - . '' . "\n" - . '

KIWI Module Dependencies

' . "\n" - . '

' . "\n" - . ''; - my $status = open( my $PAGE, '>', 'devDocs/graph.html'); - if (! $status) { - croak('Could not open devDocs/graph.html'); - } - print $PAGE $page; - close $PAGE; - return; + # ... + # Generate HTML to show the dependency graph + # --- + if (! -d 'images') { + mkdir 'devDocs'; + } + my $page = '' . "\n" + . '' . "\n" + . '' . "\n" + . '' . "\n" + . 'KIWI Module Dependencies' . "\n" + . '' . "\n" + . '' . "\n" + . '

KIWI Module Dependencies

' . "\n" + . '

' . "\n" + . ''; + my $status = open( my $PAGE, '>', 'devDocs/graph.html'); + if (! $status) { + croak('Could not open devDocs/graph.html'); + } + print $PAGE $page; + close $PAGE; + return; } #========================================== # generateIndexPage #------------------------------------------ sub generateIndexPage { - # ... - # Generate HTML pages for the information in the tree. - # --- - if (! -d 'devDocs') { - mkdir 'devDocs'; - } - my $index = '' . "\n" - . '' . "\n" - . '' . "\n" - . '' . "\n" - . 'KIWI Module Index' . "\n" - . '' . "\n" - . '' . "\n" - . '

KIWI Module Index

' . "\n" - . '

' . "\n" - . '


' . "\n" - . 'Dependency Graph' . "\n" - . '
' . "\n" - . '
    ' . "\n"; - my @modules = keys %infoTree; - @modules = sort @modules; - for my $mod (@modules) { - $index .= '
  • ' . $mod . '
  • '; - $index .= "\n"; - } - $index .= '
' . "\n" - . '
' . "\n" - . '

Unresolvable call information

' . "\n" - . '

' . "\n" - . '

    ' . "\n"; - my @methods = keys %unresolvable; - @methods = sort @methods; - for my $meth (@methods) { - $index .= '
  • ' . $meth . '
  • ' . "\n" - . '
      ' . "\n"; - for my $msg (@{$unresolvable{$meth}}) { - $index .= '
    • ' . $msg . '
    • ' . "\n"; + # ... + # Generate HTML pages for the information in the tree. + # --- + if (! -d 'devDocs') { + mkdir 'devDocs'; + } + my $index = '' . "\n" + . '' . "\n" + . '' . "\n" + . '' . "\n" + . 'KIWI Module Index' . "\n" + . '' . "\n" + . '' . "\n" + . '

      KIWI Module Index

      ' . "\n" + . '

      ' . "\n" + . '


      ' . "\n" + . 'Dependency Graph' . "\n" + . '
      ' . "\n" + . '
        ' . "\n"; + my @modules = keys %infoTree; + @modules = sort @modules; + for my $mod (@modules) { + $index .= '
      • ' . $mod . '
      • '; + $index .= "\n"; + } + $index .= '
      ' . "\n" + . '
      ' . "\n" + . '

      Unresolvable call information

      ' . "\n" + . '

      ' . "\n" + . '

        ' . "\n"; + my @methods = keys %unresolvable; + @methods = sort @methods; + for my $meth (@methods) { + $index .= '
      • ' . $meth . '
      • ' . "\n" + . '
          ' . "\n"; + for my $msg (@{$unresolvable{$meth}}) { + $index .= '
        • ' . $msg . '
        • ' . "\n"; + } + $index .= '
        ' . "\n"; } $index .= '
      ' . "\n"; - } - $index .= '
    ' . "\n"; - my $status = open( my $INDEX, '>', 'devDocs/index.html'); - if (! $status) { - croak('Could not open devDocs/index.html'); - } - print $INDEX $index; - close $INDEX; - return; + my $status = open( my $INDEX, '>', 'devDocs/index.html'); + if (! $status) { + croak('Could not open devDocs/index.html'); + } + print $INDEX $index; + close $INDEX; + return; } #========================================== # generateModulePages #------------------------------------------ sub generateModulePages { - # ... - # Generate a page for each module - # --- - for my $mod (keys %infoTree) { - my $page = '' . "\n" - . '' . "\n" - . '' . "\n" - . '' . "\n" - . '' . $mod . ' Info' . "\n" - . '' . "\n" - . '' . "\n" - . '

    ' . $mod . ' Info

    ' . "\n" - . '

    ' . "\n" - . '


    ' . "\n" - . '' . "\n" - . '

    Public methods

    ' . "\n" - . '

    ' . "\n" - . '

      ' . "\n"; - my @methodsPub = keys %{$infoTree{$mod}{public}}; - @methodsPub = sort @methodsPub; - for my $meth (@methodsPub) { - $page .= '
    • ' . $meth . '
    • ' - . "\n"; - } - $page .= '
    ' . "\n"; - my @methodsPriv; - if ($infoTree{$mod}{private}) { - @methodsPriv = keys %{$infoTree{$mod}{private}}; - @methodsPriv = sort @methodsPriv; - $page .= '

    Private methods

    ' . "\n" - . '

    ' . "\n" - . '

      ' . "\n"; - for my $meth (@methodsPriv) { - $page .= '
    • ' . $meth . '
    • ' - . "\n"; - } - $page .= '
    ' . "\n"; - } - $page .= '
    ' . "\n"; - my %accessData = ( - public => \@methodsPub, - private => \@methodsPriv - ); - for my $access (keys %accessData) { - for my $meth (@{$accessData{$access}}) { - $page .= '

    ' . $meth . '

    ' - . "\n" - . '

    ' . "\n"; - my $doc = $infoTree{$mod}{$access}{$meth}{description}; - if (! $doc) { - $doc = 'Missing documentation'; + # ... + # Generate a page for each module + # --- + for my $mod (keys %infoTree) { + my $page = '' . "\n" + . '' . "\n" + . '' . "\n" + . '' . "\n" + . '' . $mod . ' Info' . "\n" + . '' . "\n" + . '' . "\n" + . '

    ' . $mod . ' Info

    ' . "\n" + . '

    ' . "\n" + . '


    ' . "\n" + . '' . "\n" + . '

    Public methods

    ' . "\n" + . '

    ' . "\n" + . '

      ' . "\n"; + my @methodsPub = keys %{$infoTree{$mod}{public}}; + @methodsPub = sort @methodsPub; + for my $meth (@methodsPub) { + $page .= '
    • ' . $meth . '
    • ' + . "\n"; } - $page .= $doc - . '

      ' . "\n" - . 'Defined on line: '; - my $lineNo = $infoTree{$mod}{$access}{$meth}{definedOn}; - if (! $lineNo) { - $lineNo = 'Unknown'; + $page .= '

    ' . "\n"; + my @methodsPriv; + if ($infoTree{$mod}{private}) { + @methodsPriv = keys %{$infoTree{$mod}{private}}; + @methodsPriv = sort @methodsPriv; + $page .= '

    Private methods

    ' . "\n" + . '

    ' . "\n" + . '

      ' . "\n"; + for my $meth (@methodsPriv) { + $page .= '
    • ' . $meth . '
    • ' + . "\n"; + } + $page .= '
    ' . "\n"; } - $page .= $lineNo . "\n"; - if ($infoTree{$mod}{$access}{$meth}{called}) { - my @calls = @{$infoTree{$mod}{$access}{$meth}{called}}; - $page .= '

    ' . "\n" - . 'Called in' . "\n" - . '

      ' . "\n"; - for my $call (@calls) { - my ($name, $methName, $lineNum) = split /:/msx, $call; - $page .= '
    • ' . $name - . ' : ' . $lineNum . '
    • '; - } - $page .= '
    ' . "\n"; + $page .= '
    ' . "\n"; + my %accessData = ( + public => \@methodsPub, + private => \@methodsPriv + ); + for my $access (keys %accessData) { + for my $meth (@{$accessData{$access}}) { + $page .= '

    ' . $meth . '

    ' + . "\n" + . '

    ' . "\n"; + my $doc = $infoTree{$mod}{$access}{$meth}{description}; + if (! $doc) { + $doc = 'Missing documentation'; + } + $page .= $doc + . '

    ' . "\n" + . 'Defined on line: '; + my $lineNo = $infoTree{$mod}{$access}{$meth}{definedOn}; + if (! $lineNo) { + $lineNo = 'Unknown'; + } + $page .= $lineNo . "\n"; + if ($infoTree{$mod}{$access}{$meth}{called}) { + my @calls = @{$infoTree{$mod}{$access}{$meth}{called}}; + $page .= '

    ' . "\n" + . 'Called in' . "\n" + . '

      ' . "\n"; + for my $call (@calls) { + my ($name, $methName, $lineNum) = split /:/msx, $call; + $page .= '
    • ' . $name + . ' : ' . $lineNum . '
    • '; + } + $page .= '
    ' . "\n"; + } + } } - } - } - my $status = open( my $PAGE, '>', "devDocs/$mod.html"); - if (! $status) { - croak("Could not open devDocs/$mod.html"); + my $status = open( my $PAGE, '>', "devDocs/$mod.html"); + if (! $status) { + croak("Could not open devDocs/$mod.html"); + } + print $PAGE $page; + close $PAGE; } - print $PAGE $page; - close $PAGE; - } - return; + return; } #========================================== # __addLineCrossRef #------------------------------------------ sub __addLineCrossRef { - # ... - # Add a cross reference to given line number for the given called - # kiwi method. - # --- - my $kiwiMethodName = shift; - my $moduleName = shift; - my $lineNo = shift; - my $useObj = shift; - if ($duplicteName{$kiwiMethodName} && ! $useObj) { - print "Cannot disambiguate '$kiwiMethodName', use __disambiguateCall " - . "method to add cross ref for this method.\n"; - return; - } - my $kObj; - if ($useObj) { - $kObj = $useObj; - } else { - $kObj = $kiwiMethodNames{$kiwiMethodName}; - } - if (! $kObj) { - print "No entry for kiwi method $kiwiMethodName\n"; - return; - } - my $origin = $moduleName . ':' . $kiwiMethodName . ':' . $lineNo; - if (! $infoTree{$kObj}) { - print "Could not add cross reference for '$kObj', called from " - . "$origin; no entry.\n"; - return; - } - my $access; - if ($kiwiMethodName =~ /^_|^__/mx) { - $access = 'private'; - } else { - $access = 'public'; - } - if (! $infoTree{$kObj}{$access}{$kiwiMethodName}) { - my $msg = "Could not add cross reference for '$kiwiMethodName' on " - . "'$kObj', called from $origin; no entry.\n"; - if ($unresolvable{$kiwiMethodName}) { - push @{$unresolvable{$kiwiMethodName}}, $msg; + # ... + # Add a cross reference to given line number for the given called + # kiwi method. + # --- + my $kiwiMethodName = shift; + my $moduleName = shift; + my $lineNo = shift; + my $useObj = shift; + if ($duplicteName{$kiwiMethodName} && ! $useObj) { + print "Cannot disambiguate '$kiwiMethodName', use __disambiguateCall " + . "method to add cross ref for this method.\n"; + return; + } + my $kObj; + if ($useObj) { + $kObj = $useObj; } else { - my @msgs = ($msg); - $unresolvable{$kiwiMethodName} = \@msgs + $kObj = $kiwiMethodNames{$kiwiMethodName}; + } + if (! $kObj) { + print "No entry for kiwi method $kiwiMethodName\n"; + return; + } + my $origin = $moduleName . ':' . $kiwiMethodName . ':' . $lineNo; + if (! $infoTree{$kObj}) { + print "Could not add cross reference for '$kObj', called from " + . "$origin; no entry.\n"; + return; + } + my $access; + if ($kiwiMethodName =~ /^_|^__/mx) { + $access = 'private'; + } else { + $access = 'public'; + } + if (! $infoTree{$kObj}{$access}{$kiwiMethodName}) { + my $msg = "Could not add cross reference for '$kiwiMethodName' on " + . "'$kObj', called from $origin; no entry.\n"; + if ($unresolvable{$kiwiMethodName}) { + push @{$unresolvable{$kiwiMethodName}}, $msg; + } else { + my @msgs = ($msg); + $unresolvable{$kiwiMethodName} = \@msgs + } + return; + } + if ($infoTree{$kObj}{$access}{$kiwiMethodName}{called}) { + push @{$infoTree{$kObj}{$access}{$kiwiMethodName}{called}}, $origin; + } else { + my @orig = ($origin); + $infoTree{$kObj}{$access}{$kiwiMethodName}{called} = \@orig; } return; - } - if ($infoTree{$kObj}{$access}{$kiwiMethodName}{called}) { - push @{$infoTree{$kObj}{$access}{$kiwiMethodName}{called}}, $origin; - } else { - my @orig = ($origin); - $infoTree{$kObj}{$access}{$kiwiMethodName}{called} = \@orig; - } - return; } #========================================== # __disambiguateCall #------------------------------------------ sub __disambiguateCall { - # ... - # Figure out on which object the method was called. - # --- - my $content = shift; - my $kiwiMethodName = shift; - my $modName = shift; - my $lineNo = shift; - my %perlSpecial = ( - BEGIN => 1, - DESTROY => 1 - ); - if ($perlSpecial{$kiwiMethodName}) { - return; - } - #print "DBG: Need to disambiguate $kiwiMethodName : in: $modName\n"; - my @source = @{$content}; - my $ambigCallLn = $source[$lineNo-1]; - $ambigCallLn =~ s/\s//gmx; - my $tok = PPI::Tokenizer->new(\$ambigCallLn); - my @tokens = @{$tok->all_tokens()}; - my $methIdx = first { $tokens[$_] eq $kiwiMethodName } 0..$#tokens; - my $callerVar = $tokens[$methIdx-2]; - my $tgtObj; - if ($callerVar =~ /^\$/mx) { - if ($callerVar eq '$this') { - #print "\t\tDBG: trivial case for: $kiwiMethodName\n"; - $tgtObj = $modName; - } else { - $tgtObj = __getKClassName($content, $callerVar, $lineNo); - if (! $tgtObj || $tgtObj eq '0') { - my $msg = "Cannot disambiguate call to: $kiwiMethodName in " - . "$modName at $lineNo\n"; - if ($unresolvable{$kiwiMethodName}) { - push @{$unresolvable{$kiwiMethodName}}, $msg; + # ... + # Figure out on which object the method was called. + # --- + my $content = shift; + my $kiwiMethodName = shift; + my $modName = shift; + my $lineNo = shift; + my %perlSpecial = ( + BEGIN => 1, + DESTROY => 1 + ); + if ($perlSpecial{$kiwiMethodName}) { + return; + } + #print "DBG: Need to disambiguate $kiwiMethodName : in: $modName\n"; + my @source = @{$content}; + my $ambigCallLn = $source[$lineNo-1]; + $ambigCallLn =~ s/\s//gmx; + my $tok = PPI::Tokenizer->new(\$ambigCallLn); + my @tokens = @{$tok->all_tokens()}; + my $methIdx = first { $tokens[$_] eq $kiwiMethodName } 0..$#tokens; + my $callerVar = $tokens[$methIdx-2]; + my $tgtObj; + if ($callerVar =~ /^\$/mx) { + if ($callerVar eq '$this') { + #print "\t\tDBG: trivial case for: $kiwiMethodName\n"; + $tgtObj = $modName; } else { - my @msgs = ($msg); - $unresolvable{$kiwiMethodName} = \@msgs + $tgtObj = __getKClassName($content, $callerVar, $lineNo); + if (! $tgtObj || $tgtObj eq '0') { + my $msg = "Cannot disambiguate call to: $kiwiMethodName in " + . "$modName at $lineNo\n"; + if ($unresolvable{$kiwiMethodName}) { + push @{$unresolvable{$kiwiMethodName}}, $msg; + } else { + my @msgs = ($msg); + $unresolvable{$kiwiMethodName} = \@msgs + } + return; + } } + __addLineCrossRef($kiwiMethodName, $modName, $lineNo, $tgtObj); return; - } } - __addLineCrossRef($kiwiMethodName, $modName, $lineNo, $tgtObj); return; - } - return; } #========================================== # __getKClassName #------------------------------------------ sub __getKClassName { - # ... - # Find a KIWI class name that maps to the given variable used to a - # method. - # --- - my $content = shift; - my $objRef = shift; - my $lineNo = shift; - return if ! $objRef; - my @source = @{$content}; - my $search = quotemeta $objRef; - #print "\t\t\tDBG: work backwards from: $lineNo: looking for: '$objRef'\n"; - while ($lineNo > 0) { - $lineNo -= 1; - my $ln = $source[$lineNo]; - #print "\t\t\tDBG: working for: $ln\n"; - if ($ln =~ /$search\s*=/mx) { - #print "\t\t\tDBG: found assignment\n"; - my $useNextAsRval; - my $rval; - $ln =~ s/\s//gmx; - my $tok = PPI::Tokenizer->new(\$ln); - while ( my $t = $tok->get_token() ) { - if ($useNextAsRval) { - $rval = $t; - #print "\t\t\tDBG: found rval: $rval : objRef: $objRef\n"; - $useNextAsRval = 0; - } - if ($t eq '=') { - $useNextAsRval = 1; + # ... + # Find a KIWI class name that maps to the given variable used to a + # method. + # --- + my $content = shift; + my $objRef = shift; + my $lineNo = shift; + return if ! $objRef; + my @source = @{$content}; + my $search = quotemeta $objRef; + #print "\t\t\tDBG: work backwards from: $lineNo: looking for: '$objRef'\n"; + while ($lineNo > 0) { + $lineNo -= 1; + my $ln = $source[$lineNo]; + #print "\t\t\tDBG: working for: $ln\n"; + if ($ln =~ /$search\s*=/mx) { + #print "\t\t\tDBG: found assignment\n"; + my $useNextAsRval; + my $rval; + $ln =~ s/\s//gmx; + my $tok = PPI::Tokenizer->new(\$ln); + while ( my $t = $tok->get_token() ) { + if ($useNextAsRval) { + $rval = $t; + #print "\t\t\tDBG: found rval: $rval : objRef: $objRef\n"; + $useNextAsRval = 0; + } + if ($t eq '=') { + $useNextAsRval = 1; + } + } + if (($rval) && ($rval =~ /KIWI/)) { + return $rval; + } elsif (($rval) && ($rval eq 'shift')) { + return '0'; + } else { + return __getKClassName($content, $rval, $lineNo); + } } - } - if (($rval) && ($rval =~ /KIWI/)) { - return $rval; - } elsif (($rval) && ($rval eq 'shift')) { - return '0'; - } else { - return __getKClassName($content, $rval, $lineNo); - } } - } - return; + return; } #========================================== # processFiles #------------------------------------------ sub processFiles { - # ... - # Process all the modules - # --- - my @procOrder = ( - \&addMethodInfo, - \&addCtorCrossReferences, - \&addMethodCallCrossReferences, - \&generateDependencyData - ); - for my $func (@procOrder) { - for my $flpath (@allModules) { - my ($vol, $dir, $fname) = File::Spec->splitpath( $flpath ); - my ($name, $ext) = split /\./msx, $fname; - my @lines = read_file($flpath); - &{$func}($name, \@lines); + # ... + # Process all the modules + # --- + my @procOrder = ( + \&addMethodInfo, + \&addCtorCrossReferences, + \&addMethodCallCrossReferences, + \&generateDependencyData + ); + for my $func (@procOrder) { + for my $flpath (@allModules) { + my ($vol, $dir, $fname) = File::Spec->splitpath( $flpath ); + my ($name, $ext) = split /\./msx, $fname; + my @lines = read_file($flpath); + &{$func}($name, \@lines); + } } - } - return; + return; } processFiles(); diff --git a/doc/devdoc/susesync b/doc/devdoc/susesync index 3487504d5..6574c0dca 100755 --- a/doc/devdoc/susesync +++ b/doc/devdoc/susesync @@ -1,2 +1,2 @@ rsync -rlvt devDocs/* \ - community.opensuse.org:doc.opensuse.org/htdocs/projects/kiwi/devdoc + community.opensuse.org:doc.opensuse.org/htdocs/projects/kiwi/devdoc diff --git a/doc/docbook/etc/fop.xml b/doc/docbook/etc/fop.xml index 6d95a3ab9..58c58f85e 100644 --- a/doc/docbook/etc/fop.xml +++ b/doc/docbook/etc/fop.xml @@ -1,33 +1,33 @@ - - true + + true - - true + + true - - ./ + + ./ - - ./ + + ./ - - 72 - - 72 + + 72 + + 72 - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + diff --git a/doc/docbook/kiwi-doc-appendix.xml b/doc/docbook/kiwi-doc-appendix.xml index 7b1745f95..c7036359e 100644 --- a/doc/docbook/kiwi-doc-appendix.xml +++ b/doc/docbook/kiwi-doc-appendix.xml @@ -1,16 +1,16 @@ + "http://www.docbook.org/xml/4.5/docbookx.dtd"> - KIWI Man Pages - The following pages will show you the man page of KIWI and the - functions which can be used within config.sh and - index.sh - - - - - - + KIWI Man Pages + The following pages will show you the man page of KIWI and the + functions which can be used within config.sh and + index.sh + + + + + + diff --git a/doc/docbook/kiwi-doc-appliance.xml b/doc/docbook/kiwi-doc-appliance.xml index f9cef1e9b..5427df4d2 100644 --- a/doc/docbook/kiwi-doc-appliance.xml +++ b/doc/docbook/kiwi-doc-appliance.xml @@ -1,243 +1,243 @@ + "http://www.docbook.org/xml/4.5/docbookx.dtd"> - Creating Appliances with KIWI - - - Overview - - KIWI - overview - - Traditionally, computing functions such as word processing or - e-mail handling are delivered as software applications. These - applications are targeted to run on a computer with an installed - general purpose operating system. Applications often have a - specialized installer that must be run by the consumer (whether home - computer user or an administrator in an IT department of a company) to - install the application on the computer in question. For installation - of an application on multiple computers the installation program must - often be run on each computer where the application is to be installed. - In most cases a given application uses only a small part of the - capabilities provided by the general purpose operating system running - on a computer. Additionally if an application needs special settings - to be applied to the general purpose operating system, these often - have to be set by the consumer after the installation is complete. - These settings are often documented in an installation guide that - consumers may or may not read. Last but not least, running a general - purpose operating system to support an application that only requires - a small part of the functionality provided by the general purpose OS - is a waste of computing resources. - - An appliance is the combination of the parts of a general - purpose OS needed by a given application and the application itself, - bundled and delivered as one unit. This unit may be delivered in - a variety of formats, for example a ready to run virtual machine or - a self installing system on optical media or a USB stick. - - Compared to the traditional model of application delivery the - appliance model has a number of advantages. The consumer no longer - has to install a general purpose OS and the application in separate - steps. The application is part of the appliance and the appliance - provider, as the application expert, takes care of the application - "installation". Further, the appliance provider takes care of any - OS tuning that may benefit the application. Last but not least, the - reduced size of the OS does not only consume fewer resources than - a full blow "regular" install of a general purpose OS, but it also - provides a reduced footprint for potential security exposure. From the - application providers point of view there may be an opportunity to - drop the implementation and maintenance of a specialized installer - as the application installation no longer has to be "consumer friendly". - - - The traditional software delivery model certainly has it's place. - However, for many purposes appliances present a more convenient - mechanism for consumers. - - - - The KIWI Model - - KIWI - model - - With KIWI we started to use a different model. Instead of - installing firewall software on top of a general purpose - computer/operating system, the designers/engineers built images - that are designed specifically for the task. These are so called - appliances. When building appliances with KIWI the following - proceeding has proven to work reliably. Nevertheless the following - is just a recommendation and can be adapted to special needs and - environments. - - - - Choose an appropriate image description - template from the provided KIWI examples. Add or adapt - repositories, package names or both, according to the distribution - you want to build an image for. - - - Allow the image to create an in-place git repository to - allow tracking of non-binary changes. This is done by adding - the following line into your config.sh script: - baseSetupPlainTextGITRepository - - - Prepare the preliminary version of your new appliance by - calling kiwi - - - - - Decide for a testing environment. In my opinion a real - hardware based test machine which allows to boot from USB is a - good and fast approach. - + Creating Appliances with KIWI + + + Overview + + KIWI + overview + + Traditionally, computing functions such as word processing or + e-mail handling are delivered as software applications. These + applications are targeted to run on a computer with an installed + general purpose operating system. Applications often have a + specialized installer that must be run by the consumer (whether home + computer user or an administrator in an IT department of a company) to + install the application on the computer in question. For installation + of an application on multiple computers the installation program must + often be run on each computer where the application is to be installed. + In most cases a given application uses only a small part of the + capabilities provided by the general purpose operating system running + on a computer. Additionally if an application needs special settings + to be applied to the general purpose operating system, these often + have to be set by the consumer after the installation is complete. + These settings are often documented in an installation guide that + consumers may or may not read. Last but not least, running a general + purpose operating system to support an application that only requires + a small part of the functionality provided by the general purpose OS + is a waste of computing resources. + + An appliance is the combination of the parts of a general + purpose OS needed by a given application and the application itself, + bundled and delivered as one unit. This unit may be delivered in + a variety of formats, for example a ready to run virtual machine or + a self installing system on optical media or a USB stick. + + Compared to the traditional model of application delivery the + appliance model has a number of advantages. The consumer no longer + has to install a general purpose OS and the application in separate + steps. The application is part of the appliance and the appliance + provider, as the application expert, takes care of the application + "installation". Further, the appliance provider takes care of any + OS tuning that may benefit the application. Last but not least, the + reduced size of the OS does not only consume fewer resources than + a full blow "regular" install of a general purpose OS, but it also + provides a reduced footprint for potential security exposure. From the + application providers point of view there may be an opportunity to + drop the implementation and maintenance of a specialized installer + as the application installation no longer has to be "consumer friendly". + + + The traditional software delivery model certainly has it's place. + However, for many purposes appliances present a more convenient + mechanism for consumers. + + + + The KIWI Model + + KIWI + model + + With KIWI we started to use a different model. Instead of + installing firewall software on top of a general purpose + computer/operating system, the designers/engineers built images + that are designed specifically for the task. These are so called + appliances. When building appliances with KIWI the following + proceeding has proven to work reliably. Nevertheless the following + is just a recommendation and can be adapted to special needs and + environments. + + + + Choose an appropriate image description + template from the provided KIWI examples. Add or adapt + repositories, package names or both, according to the distribution + you want to build an image for. + + + Allow the image to create an in-place git repository to + allow tracking of non-binary changes. This is done by adding + the following line into your config.sh script: + baseSetupPlainTextGITRepository + + + Prepare the preliminary version of your new appliance by + calling kiwi + + + + + Decide for a testing environment. In my opinion a real + hardware based test machine which allows to boot from USB is a + good and fast approach. + <type image="iso" boot="isoboot/suse-..." flags="clic" hybrid="true"/> - - - Create the preliminary live stick image of your new - appliance by calling kiwi - … After successful creation of the - image files find an USB stick which is able to store your - appliance and plug it into a free USB port on your image build - machine. The deployment can be performed from any - OS including Windows as long as a tool to dump data onto a disk - device exists and is used. - - - - Plug in the stick on your test machine and boot it. - - - - After your test system has successfully booted from stick - login into your appliance and start to tweak the system - according to your needs. This includes all actions required to - make the appliance work as you wish. Before you start take - care for the following: - - - - Create an initial package list. This can be done by - calling: - rpm -qa | sort > /tmp/deployPackages - - - Check the output of the command git and include - everything which is unknown to git and surely will not be - changed by you and will not become part of the image - description overlay files to the /.gitignore files - - - - After the initial package list exists and the git - repository is clean you can start to configure the system. You - never should install additional software just by installing an - unmanaged archive or build and install from source. It’s very - hard to find out what binary files had been installed and it’s - also not architecture safe. If there is really no other way - for the software to become part of the image you should - address this issue directly in your image description and the - config.sh script but not after the - initial deployment has happened. - - - As soon as your system works as expected your new - appliance is ready to enter the final stage. At this point you - have done several changes to the system but they are all - tracked and should now become part of your image description. - To include the changes into your image description the - following process should be used: - - - - Check the differences between the currently installed - packages and the initial deployment list. This can be done - by calling: - - rpm -qa | sort > /tmp/appliancePackages + + + Create the preliminary live stick image of your new + appliance by calling kiwi + … After successful creation of the + image files find an USB stick which is able to store your + appliance and plug it into a free USB port on your image build + machine. The deployment can be performed from any + OS including Windows as long as a tool to dump data onto a disk + device exists and is used. + + + + Plug in the stick on your test machine and boot it. + + + + After your test system has successfully booted from stick + login into your appliance and start to tweak the system + according to your needs. This includes all actions required to + make the appliance work as you wish. Before you start take + care for the following: + + + + Create an initial package list. This can be done by + calling: + rpm -qa | sort > /tmp/deployPackages + + + Check the output of the command git and include + everything which is unknown to git and surely will not be + changed by you and will not become part of the image + description overlay files to the /.gitignore files + + + + After the initial package list exists and the git + repository is clean you can start to configure the system. You + never should install additional software just by installing an + unmanaged archive or build and install from source. It’s very + hard to find out what binary files had been installed and it’s + also not architecture safe. If there is really no other way + for the software to become part of the image you should + address this issue directly in your image description and the + config.sh script but not after the + initial deployment has happened. + + + As soon as your system works as expected your new + appliance is ready to enter the final stage. At this point you + have done several changes to the system but they are all + tracked and should now become part of your image description. + To include the changes into your image description the + following process should be used: + + + + Check the differences between the currently installed + packages and the initial deployment list. This can be done + by calling: + + rpm -qa | sort > /tmp/appliancePackages diff -u /tmp/deployPackages /tmp/appliancePackages - Add those packages which are labeled with (+) to the - packages - type="image" section of your config.xml file - and remove those packages which has been removed (−) - appropriately. If there are packages which has been - removed against the will of the package manager make sure - you address the uninstallation of these packages in your - config.sh script. If you have - installed packages from repositories which are not part of - your config.xml file you should also - add these repositories in order to allow KIWI to install - the packages - - - - Check the differences made in the configuration files. - This can be easily done by calling: - git diff >/tmp/appliancePatch - The created patch should become part of your image - description and you should make sure the patch is applied - when preparing the image. According to this the command: - patch -p0 < appliancePatch - needs to be added as part of your - config.sh script. - - - Check for new non binary files added. This can be done - by calling: - git status - All files not under version control so far will be - listed by the command above. Check the contents of this - list make sure to add all files which are not created - automatically to become part of your image description. To - do this simply clone (copy) these files with respect to - the filesystem structure as overlay files in your image - description root/ - directory. - - - - - All your valuable work is now stored in one image - description and can be re-used in all KIWI supported image - types. - - - - Congratulation! To make sure the appliance works as expected - prepare a new image tree and create an image from the new tree. If - you like you can deactivate the creation of the git repository - which will save you some space on the filesystem. If this - appliance is a server I recommend to leave the repository because - it allows you to keep track of changes during the live time of - this appliance. - - - - - Cross Platform Appliance Build - - KIWI - cross-platform - - Building appliances for one processor architecture on another - processor architecture is in general not possible with KIWI. The - exception is that it is possible to build 32 bit (ix86) appliances on a - 64 bit system running on the x86-64 architecture. This cross-platform - limitation is based on the requirement that KIWI be able to execute - installed software inside the unpacked image tree. If the software - installed inside the unpacked image tree does not run on the - architecture of the build platform then KIWI cannot build the - appliance. - - While KIWI has the command line - argument to instruct the package manager zypper - to install packages for the specified architecture, this option - is not intended to support cross-platform appliance builds. - + Add those packages which are labeled with (+) to the + packages + type="image" section of your config.xml file + and remove those packages which has been removed (−) + appropriately. If there are packages which has been + removed against the will of the package manager make sure + you address the uninstallation of these packages in your + config.sh script. If you have + installed packages from repositories which are not part of + your config.xml file you should also + add these repositories in order to allow KIWI to install + the packages + + + + Check the differences made in the configuration files. + This can be easily done by calling: + git diff >/tmp/appliancePatch + The created patch should become part of your image + description and you should make sure the patch is applied + when preparing the image. According to this the command: + patch -p0 < appliancePatch + needs to be added as part of your + config.sh script. + + + Check for new non binary files added. This can be done + by calling: + git status + All files not under version control so far will be + listed by the command above. Check the contents of this + list make sure to add all files which are not created + automatically to become part of your image description. To + do this simply clone (copy) these files with respect to + the filesystem structure as overlay files in your image + description root/ + directory. + + + + + All your valuable work is now stored in one image + description and can be re-used in all KIWI supported image + types. + + + + Congratulation! To make sure the appliance works as expected + prepare a new image tree and create an image from the new tree. If + you like you can deactivate the creation of the git repository + which will save you some space on the filesystem. If this + appliance is a server I recommend to leave the repository because + it allows you to keep track of changes during the live time of + this appliance. + + + + + Cross Platform Appliance Build + + KIWI + cross-platform + + Building appliances for one processor architecture on another + processor architecture is in general not possible with KIWI. The + exception is that it is possible to build 32 bit (ix86) appliances on a + 64 bit system running on the x86-64 architecture. This cross-platform + limitation is based on the requirement that KIWI be able to execute + installed software inside the unpacked image tree. If the software + installed inside the unpacked image tree does not run on the + architecture of the build platform then KIWI cannot build the + appliance. + + While KIWI has the command line + argument to instruct the package manager zypper + to install packages for the specified architecture, this option + is not intended to support cross-platform appliance builds. + diff --git a/doc/docbook/kiwi-doc-caches.xml b/doc/docbook/kiwi-doc-caches.xml index a9f456f61..f634b89d2 100644 --- a/doc/docbook/kiwi-doc-caches.xml +++ b/doc/docbook/kiwi-doc-caches.xml @@ -1,90 +1,90 @@ + "http://www.docbook.org/xml/4.5/docbookx.dtd"> - Image Caches - - KIWI - Caches - - - - Introduction - - The process of creating an appliance could take quite some time - and often the same software is installed over and over again. In - order to speed up that process kiwi is able to create and re-use - so called image caches. An image cache in kiwi is a partial root tree - created from a cache image description. - + Image Caches + + KIWI + Caches + + + + Introduction + + The process of creating an appliance could take quite some time + and often the same software is installed over and over again. In + order to speed up that process kiwi is able to create and re-use + so called image caches. An image cache in kiwi is a partial root tree + created from a cache image description. + -
    - Image Caching Architecture - - - - - -
    +
    + Image Caching Architecture + + + + + +
    - - Before one can use a cache it needs to be created. A cache can be - created from any standard kiwi image description. That means you can - simply use one of the template descriptions and create a cache from - it. But it might be more clever to create image descriptions for the - purpose of caching. Such descriptions could represent a set of patterns - for example. The less special a cache is the more often it can be re-used - - - Once there are caches in the system kiwi selects the best match and - mounts the cache in a way that all write actions (copy-on-write cache) - are redirected to the new root system. That way the cache itself is never changed - and can be re-used simultaniosly for other build processes. As result - the build process doesn't start with an empty tree but with a tree - almost complete. Only the missing parts are now installed and according - to how much the cache already covered this process can speedup the build - -
    + + Before one can use a cache it needs to be created. A cache can be + created from any standard kiwi image description. That means you can + simply use one of the template descriptions and create a cache from + it. But it might be more clever to create image descriptions for the + purpose of caching. Such descriptions could represent a set of patterns + for example. The less special a cache is the more often it can be re-used + + + Once there are caches in the system kiwi selects the best match and + mounts the cache in a way that all write actions (copy-on-write cache) + are redirected to the new root system. That way the cache itself is never changed + and can be re-used simultaniosly for other build processes. As result + the build process doesn't start with an empty tree but with a tree + almost complete. Only the missing parts are now installed and according + to how much the cache already covered this process can speedup the build + +
    - - Example - - Let's say we know that we want to build some images of type 'vmx' - and based on the openSUSE 12.2 JeOS image description. In order to - create image caches for the system and the boot image the following - steps needs to be done: - - - - Copy the base image descriptions used in the build: - cp -a /usr/share/kiwi/image/vmxboot/suse-12.2 /tmp/boot-cache + + Example + + Let's say we know that we want to build some images of type 'vmx' + and based on the openSUSE 12.2 JeOS image description. In order to + create image caches for the system and the boot image the following + steps needs to be done: + + + + Copy the base image descriptions used in the build: + cp -a /usr/share/kiwi/image/vmxboot/suse-12.2 /tmp/boot-cache cp -a /usr/share/kiwi/image/suse-12.2-JeOS /tmp/image-cache - - - Modify boot-cache and image-cache to contain the package - manager. This is required for the later use of the - caches. - <package name="zypper"/> - - - Build the caches: - kiwi --init-cache /tmp/image-cache + + + Modify boot-cache and image-cache to contain the package + manager. This is required for the later use of the + caches. + <package name="zypper"/> + + + Build the caches: + kiwi --init-cache /tmp/image-cache kiwi --init-cache /tmp/boot-cache - - - By default those caches will be created in - /var/cache/kiwi/image. To run a build which - makes use of the cache the following command is used: - kiwi --build suse-12.2-JeOS -d /tmp/myimage --type vmx \ - --cache /var/cache/kiwi/image - - This call is about 50% faster compared to the creation without a - cache. It's important to understand that a cache based build will - create a root tree which contains only the differences - compared to the used cache. Thus at any time you want - to create an image out of it you have to make sure that the cache - exists and is accessible on the system. - - + + + By default those caches will be created in + /var/cache/kiwi/image. To run a build which + makes use of the cache the following command is used: + kiwi --build suse-12.2-JeOS -d /tmp/myimage --type vmx \ + --cache /var/cache/kiwi/image + + This call is about 50% faster compared to the creation without a + cache. It's important to understand that a cache based build will + create a root tree which contains only the differences + compared to the used cache. Thus at any time you want + to create an image out of it you have to make sure that the cache + exists and is accessible on the system. + +
    diff --git a/doc/docbook/kiwi-doc-contributors.xml b/doc/docbook/kiwi-doc-contributors.xml index 188fce0ab..31d82c48a 100644 --- a/doc/docbook/kiwi-doc-contributors.xml +++ b/doc/docbook/kiwi-doc-contributors.xml @@ -1,73 +1,73 @@ + "http://www.docbook.org/xml/4.5/docbookx.dtd"> - Contributors - - KIWI - Contributors - - - - Contributors to KIWI - - - - - SUSE LINUX Products GmbH - - Marcus - Sch??fer - Project Lead, Design, Doc, Implementation - ms@suse.de - - - - Dell - - Praveen - Paladugu - Implementation Centos/RHEL focus - Praveen_Paladugu@dell.com - - - - SUSE LINUX Products GmbH - - Thomas - Schraitle - Documentation, XSLT - toms@suse.de - - - - SUSE LINUX Products GmbH - - Adrian - Schroeter - Build Service integration - adrian@suse.de - - - - SUSE - - Robert - Schweikert - Design, Doc, Implementation - rjschwei@suse.com - - - - SUSE - - Dinar - Valeev - Implementation, Power architecture - dvaleev@suse.com - - - - + Contributors + + KIWI + Contributors + + + + Contributors to KIWI + + + + + SUSE LINUX Products GmbH + + Marcus + Sch??fer + Project Lead, Design, Doc, Implementation + ms@suse.de + + + + Dell + + Praveen + Paladugu + Implementation Centos/RHEL focus + Praveen_Paladugu@dell.com + + + + SUSE LINUX Products GmbH + + Thomas + Schraitle + Documentation, XSLT + toms@suse.de + + + + SUSE LINUX Products GmbH + + Adrian + Schroeter + Build Service integration + adrian@suse.de + + + + SUSE + + Robert + Schweikert + Design, Doc, Implementation + rjschwei@suse.com + + + + SUSE + + Dinar + Valeev + Implementation, Power architecture + dvaleev@suse.com + + + + diff --git a/doc/docbook/kiwi-doc-description.xml b/doc/docbook/kiwi-doc-description.xml index a1d53fb86..4c086c638 100644 --- a/doc/docbook/kiwi-doc-description.xml +++ b/doc/docbook/kiwi-doc-description.xml @@ -1,2148 +1,2148 @@ + "http://www.docbook.org/xml/4.5/docbookx.dtd"> - KIWI Image Description - - KIWI - image description - - In order to be able to create an image with KIWI, a so called - image description must be created. The image description is - represented by a directory which has to contain at least one file - named config.xml or *.kiwi. A good start for such a - description can be found in the examples provided in - /usr/share/doc/packages/kiwi/examples. - -
    - Image Description Directory - - - - - - - - -
    - - The following additional information is optional for the process - of building an image, but most often mandatory for the functionality - of the created operating system: - - - - images.sh - - Optional configuration script while creating the packed - image. This script is called at the beginning of the image - creation process. It is designed to clean-up the image system. - Affected are all the programs and files only needed while the - unpacked image exists. - - - - config.sh - - Optional configuration script while creating the unpacked - image. This script is called at the end of the installation, - but before the package scripts have run. - It is designed to configure the image system, such as the - activation or deactivation of certain services (insserv). The call is not made - until after the switch to the image has been made with chroot. - - - - - root - - Subdirectory that contains special files, directories, and - scripts for adapting the image environment - after the installation of all the image - packages. The entire directory is copied into the root of the - image tree using cp - . - - - - config-yast-firstboot.xml - - Configuration file for the control of the YaST firstboot - service. Similar to the AutoYaST approach, YaST also provides - a boot time service called firstboot. Unfortunately there is - no GUI available to setup the firstboot, but good - documentation in - /usr/share/doc/packages/yast2-firstboot. - Once you have created such a firstboot file in your image - description directory, KIWI will process the file and setup - your image as follows: - - - KIWI enables the firstboot service. - - - While booting the image, YaST is started in firstboot - mode. - - - The firstboot service handles the instructions listed - in the fileconfig-yast-firstboot.xml. - - - - If the process finished successfully, the environment - is cleaned and firstboot will not be called at next - reboot. - - - - - - config-yast-autoyast.xml - - Configuration file which has been created by AutoYaST. To - be able to create such an AutoYaST profile, run: - yast2 autoyast - Once you have saved the information from the AutoYaST UI - as config-yast-autoyast.xml file in your - image description directory KIWI will process on the file and - setup your image as follows: - - - While booting the image YaST is started in AutoYaST - mode automatically - - - The AutoYaST description is parsed and the - instructions are handled by YaST. In other words the - system configuration is performed - - - - If the process finished successfully the environment - is cleaned and AutoYaST won’t be called at next reboot. - - - - - - - config-cdroot.tgz - - Archive which is used for ISO images only. The data in - the archive is uncompressed and stored in the CD/DVD root - directory. This archive can be used, for example, to integrate - a license file or information directly readable from the CD or - DVD. - - - - config-cdroot.sh - - Along with the config-cdroot.tgz one - can provide a script which allows to manipulate the extracted - data. - - - - config/ - - Optional subdirectory that contains Bash scripts that are - called after the installation of all the image packages, - primarily in order to remove the parts of a package that are - not needed for the operating system. The name of the Bash - script must resemble the package name listed in the - config.xml. - - - - - - The config.xml File + KIWI Image Description - KIWI - config.xml + KIWI + image description - The mandatory image definition file is divided into different - sections which describes information like the image name and type - as well as the packages and patterns the image should consist of. - The following information explains the basic structure of the - XML document. When KIWI is executed, the XML structure is - validated by the KIWI RELAX NG based schema. For details on - attributes and values please refer to the schema documentation - file at - /usr/share/doc/packages/kiwi/kiwi.rng.html. + In order to be able to create an image with KIWI, a so called + image description must be created. The image description is + represented by a directory which has to contain at least one file + named config.xml or *.kiwi. A good start for such a + description can be found in the examples provided in + /usr/share/doc/packages/kiwi/examples. - - <sgmltag>image</sgmltag> Element - <image schemaversion="5.2" name="iname" - displayname="text" - kiwirevision="number" - id="10 digit number"> - ... -</image> +
    + Image Description Directory + + + + + + + + +
    - The image definition starts with an image - tag and requires the schema format at version 2.0. The attribute - name specifies the name - of the image which is also used for the filenames created by - KIWI. Because we don’t want spaces in filenames the name attribute must not have any - spaces in its name. - The following optional attributes can be inserted in the - image tag: + The following additional information is optional for the process + of building an image, but most often mandatory for the functionality + of the created operating system: - + - displayname - - Allows setup of the boot menu title for the selected - bootloader. So you can have suse-SLED-foo - as the image name but a different name as the boot display name. - Spaces are not allowed in the display name because it causes - problems for some bootloaders and kiwi did not take the effort - to separate the ones which can display them correctly from the - ones which can't - + images.sh + + Optional configuration script while creating the packed + image. This script is called at the beginning of the image + creation process. It is designed to clean-up the image system. + Affected are all the programs and files only needed while the + unpacked image exists. + - kiwirevision - - specifies a KIWI git revision number which is known to - build a working image from this description. If the KIWI - git revision doesn't match the specified value, the process - will exit. The currently used git revision can be queried - by calling kiwi - . - + config.sh + + Optional configuration script while creating the unpacked + image. This script is called at the end of the installation, + but before the package scripts have run. + It is designed to configure the image system, such as the + activation or deactivation of certain services (insserv). The call is not made + until after the switch to the image has been made with chroot. + + - id - - sets an identification number which appears as file - /etc/ImageID within the image. - - + root + + Subdirectory that contains special files, directories, and + scripts for adapting the image environment + after the installation of all the image + packages. The entire directory is copied into the root of the + image tree using cp + . + - - - Inside the image section the following - mandatory and optional subelements exists. The simplest image - description must define the elements - description, - preferences, repository - and packages (at least one of type="bootstrap"). -
    + + config-yast-firstboot.xml + + Configuration file for the control of the YaST firstboot + service. Similar to the AutoYaST approach, YaST also provides + a boot time service called firstboot. Unfortunately there is + no GUI available to setup the firstboot, but good + documentation in + /usr/share/doc/packages/yast2-firstboot. + Once you have created such a firstboot file in your image + description directory, KIWI will process the file and setup + your image as follows: + + + KIWI enables the firstboot service. + + + While booting the image, YaST is started in firstboot + mode. + + + The firstboot service handles the instructions listed + in the fileconfig-yast-firstboot.xml. + + + + If the process finished successfully, the environment + is cleaned and firstboot will not be called at next + reboot. + + + + + + config-yast-autoyast.xml + + Configuration file which has been created by AutoYaST. To + be able to create such an AutoYaST profile, run: + yast2 autoyast + Once you have saved the information from the AutoYaST UI + as config-yast-autoyast.xml file in your + image description directory KIWI will process on the file and + setup your image as follows: + + + While booting the image YaST is started in AutoYaST + mode automatically + + + The AutoYaST description is parsed and the + instructions are handled by YaST. In other words the + system configuration is performed + + + + If the process finished successfully the environment + is cleaned and AutoYaST won’t be called at next reboot. + + + + + + + config-cdroot.tgz + + Archive which is used for ISO images only. The data in + the archive is uncompressed and stored in the CD/DVD root + directory. This archive can be used, for example, to integrate + a license file or information directly readable from the CD or + DVD. + + + + config-cdroot.sh + + Along with the config-cdroot.tgz one + can provide a script which allows to manipulate the extracted + data. + + + + config/ + + Optional subdirectory that contains Bash scripts that are + called after the installation of all the image packages, + primarily in order to remove the parts of a package that are + not needed for the operating system. The name of the Bash + script must resemble the package name listed in the + config.xml. + + + - - <sgmltag>description</sgmltag> Element - <description type="system"> - <author>an author</author> - <contact>mail</contact> - <specification>short info</specification> -</description> + + The config.xml File + + KIWI + config.xml + + The mandatory image definition file is divided into different + sections which describes information like the image name and type + as well as the packages and patterns the image should consist of. + The following information explains the basic structure of the + XML document. When KIWI is executed, the XML structure is + validated by the KIWI RELAX NG based schema. For details on + attributes and values please refer to the schema documentation + file at + /usr/share/doc/packages/kiwi/kiwi.rng.html. - The mandatory description section - contains information about the creator of this image - description. The attribute type could be either of the value system which - indicates this is a system image description or at value boot - for boot image descriptions. - + + <sgmltag>image</sgmltag> Element + <image schemaversion="5.2" name="iname" + displayname="text" + kiwirevision="number" + id="10 digit number"> + ... +</image> - - <sgmltag>profiles</sgmltag> Element - <profiles> - <profile name="name" description="text"/> - ... -</profiles> + The image definition starts with an image + tag and requires the schema format at version 2.0. The attribute + name specifies the name + of the image which is also used for the filenames created by + KIWI. Because we don’t want spaces in filenames the name attribute must not have any + spaces in its name. + The following optional attributes can be inserted in the + image tag: - The optional profiles section lets you - maintain one image description while allowing for variation of - the sections packages and drivers that are included. A separate - profile element must be specified for each variation. The - profile child element, which has name and description attributes, specifies - an alias name used to mark sections as belonging to a profile, - and a short description explaining what this profile does. + + + displayname + + Allows setup of the boot menu title for the selected + bootloader. So you can have suse-SLED-foo + as the image name but a different name as the boot display name. + Spaces are not allowed in the display name because it causes + problems for some bootloaders and kiwi did not take the effort + to separate the ones which can display them correctly from the + ones which can't + + + + kiwirevision + + specifies a KIWI git revision number which is known to + build a working image from this description. If the KIWI + git revision doesn't match the specified value, the process + will exit. The currently used git revision can be queried + by calling kiwi + . + + + + id + + sets an identification number which appears as file + /etc/ImageID within the image. + + + + - To mark a set of packages/drivers as belonging to a profile, - simply annotate them with the profiles attribute. It is also possible to mark - sections as belonging to multiple profiles by separating the - names in the profiles - attribute with a comma. If a packages or - drivers tag does not have a profiles attribute, it is assumed - to be present for all profiles. - + Inside the image section the following + mandatory and optional subelements exists. The simplest image + description must define the elements + description, + preferences, repository + and packages (at least one of type="bootstrap"). + - - <sgmltag>preferences</sgmltag> Element + + <sgmltag>description</sgmltag> Element + <description type="system"> + <author>an author</author> + <contact>mail</contact> + <specification>short info</specification> +</description> - <preferences profiles="name"> - <version>1.1.2</version> - <packagemanager>zypper</packagemanager> - <type image="name" ...> - <ec2config|systemdisk|oemconfig|pxedeploy|size|split|machine> - </type> -</preferences> + The mandatory description section + contains information about the creator of this image + description. The attribute type could be either of the value system which + indicates this is a system image description or at value boot + for boot image descriptions. + + + <sgmltag>profiles</sgmltag> Element + <profiles> + <profile name="name" description="text"/> + ... +</profiles> - The mandatory preferences section - contains information about the supported image type(s), the used - package manager, the version of this image, and optional - attributes. The image version must be a three-part version - number of the format: Major.Minor.Release. - - KIWI - release format - - In case of changes to the image description the following rules - should apply: + The optional profiles section lets you + maintain one image description while allowing for variation of + the sections packages and drivers that are included. A separate + profile element must be specified for each variation. The + profile child element, which has name and description attributes, specifies + an alias name used to mark sections as belonging to a profile, + and a short description explaining what this profile does. - - - For smaller image modifications that do not add or - remove any new packages, only the release number is - incremented. The config.xml file - remains unchanged. - - - For image changes that involve the addition or removal - of packages the minor number is incremented and the release - number is reset. - - - For image changes that change the size of the image file - the major number is incremented. - - + To mark a set of packages/drivers as belonging to a profile, + simply annotate them with the profiles attribute. It is also possible to mark + sections as belonging to multiple profiles by separating the + names in the profiles + attribute with a comma. If a packages or + drivers tag does not have a profiles attribute, it is assumed + to be present for all profiles. + - By default, KIWI uses the zypper package - manager but it is also possible to use the non SUSE native package - manager called smart. + + <sgmltag>preferences</sgmltag> Element - In general the specification of one - preferences section is sufficient. However, - it’s possible to specify multiple preferences - sections and distinguish between the sections via the profiles attribute. Data may also - be shared between different profiles. Using profiles it is - possible to, for example, configure specific preferences for OEM - image generation. Activation of a given - preferences during image generation is - triggered by the use of the - command line argument. + <preferences profiles="name"> + <version>1.1.2</version> + <packagemanager>zypper</packagemanager> + <type image="name" ...> + <ec2config|systemdisk|oemconfig|pxedeploy|size|split|machine> + </type> +</preferences> - For each preferences block at least one - type element must be defined. It is - possible to specify multiple type elements in - any preferences block. To set a given - type description as the default image use - the boolean attribute primary and set its value to true. The image type to be created - is determined by the value of the image attribute. The following list describes the - supported types and possible values of the image attribute: + The mandatory preferences section + contains information about the supported image type(s), the used + package manager, the version of this image, and optional + attributes. The image version must be a three-part version + number of the format: Major.Minor.Release. + + KIWI + release format + + In case of changes to the image description the following rules + should apply: - - - image="lxc" - - Use the lxc image type to build a linux container image - For additional information refer to the - chapter. - - - - image="[filesystem]" - - Use one of the following image types to build a plain - filesystem image. This will create a file containing the - data in the specified filesystem and you can loop mount - the image to view the contents e.g image="ext3": - - - ext2 - - - ext3 - - - ext4 - - - btrfs - - - squashfs - - - xfs - - - reiserfs - - - - - - image="tbz" - - Use the tbz image type to just pack the unpacked image tree - into a tarball. - - - - image="cpio" - - Use the cpio image type to specify the generation of a - boot image (initrd). When generating a boot image, it is - possible to specify a specific boot profile and boot - kernel using the optional bootprofile="default" and bootkernel="std" attributes. - A boot image should group the various supported - kernels into profiles. If the user chooses not to use the - profiles supplied by KIWI, it is required that one profile - named std be created. This profile will be used if no - other bootkernel is specified. Further it is required to - create a profile named default. This profile is used when - no bootprofile is specified. - It is recommended that special configurations that - omit drivers, use special drivers and/or special packages - be specified as profiles. - The bootprofile and bootkernel attribute are respected - within the definition of a system image. Us the attribute - and value type="system" of the description - element to specify the creation of a system image. The - values of the bootprofile and bootkernel attributes are - used by KIWI when generating the boot image. - - - - image="iso" - - Specify the key-value pair image="iso" to generate a live system suitable for - deployment on optical media (CD or DVD). Use the boot="isoboot/suse-*" attribute - when generating this image type to select the appropriate - boot image for optical media. In addition the optional - flags attribute may - be set to the following values with the effects described - below: - - - clic - - Creates a fuse based compressed read-only - filesystem which allows write operations into a cow - file. If the iso is bigger than 4G you can use the - clic_udf flag instead - - - - seed + - Creates a btrfs based compressed read-only - filesystem which allows write operations into a btrfs - seed device. + For smaller image modifications that do not add or + remove any new packages, only the release number is + incremented. The config.xml file + remains unchanged. - - - overlay - Creates a squashfs based compressed read-only - filesystem which is combined with a write space via - the overlayfs filesystem. overlayfs is part of the - kernel since version 3.7 + For image changes that involve the addition or removal + of packages the minor number is incremented and the release + number is reset. - - - compressed - Creates a split ext3 plus squashfs filesystem and - combines them via a symlink system to a complete system - it is recommended to specify a split - section as a child of this type element. - + For image changes that change the size of the image file + the major number is incremented. - + + + By default, KIWI uses the zypper package + manager but it is also possible to use the non SUSE native package + manager called smart. + + In general the specification of one + preferences section is sufficient. However, + it’s possible to specify multiple preferences + sections and distinguish between the sections via the profiles attribute. Data may also + be shared between different profiles. Using profiles it is + possible to, for example, configure specific preferences for OEM + image generation. Activation of a given + preferences during image generation is + triggered by the use of the + command line argument. + + + For each preferences block at least one + type element must be defined. It is + possible to specify multiple type elements in + any preferences block. To set a given + type description as the default image use + the boolean attribute primary and set its value to true. The image type to be created + is determined by the value of the image attribute. The following list describes the + supported types and possible values of the image attribute: + + + + image="lxc" + + Use the lxc image type to build a linux container image + For additional information refer to the + chapter. + + + + image="[filesystem]" + + Use one of the following image types to build a plain + filesystem image. This will create a file containing the + data in the specified filesystem and you can loop mount + the image to view the contents e.g image="ext3": + + + ext2 + + + ext3 + + + ext4 + + + btrfs + + + squashfs + + + xfs + + + reiserfs + + + + + + image="tbz" + + Use the tbz image type to just pack the unpacked image tree + into a tarball. + + + + image="cpio" + + Use the cpio image type to specify the generation of a + boot image (initrd). When generating a boot image, it is + possible to specify a specific boot profile and boot + kernel using the optional bootprofile="default" and bootkernel="std" attributes. + A boot image should group the various supported + kernels into profiles. If the user chooses not to use the + profiles supplied by KIWI, it is required that one profile + named std be created. This profile will be used if no + other bootkernel is specified. Further it is required to + create a profile named default. This profile is used when + no bootprofile is specified. + It is recommended that special configurations that + omit drivers, use special drivers and/or special packages + be specified as profiles. + The bootprofile and bootkernel attribute are respected + within the definition of a system image. Us the attribute + and value type="system" of the description + element to specify the creation of a system image. The + values of the bootprofile and bootkernel attributes are + used by KIWI when generating the boot image. + + + + image="iso" + + Specify the key-value pair image="iso" to generate a live system suitable for + deployment on optical media (CD or DVD). Use the boot="isoboot/suse-*" attribute + when generating this image type to select the appropriate + boot image for optical media. In addition the optional + flags attribute may + be set to the following values with the effects described + below: + + + clic + + Creates a fuse based compressed read-only + filesystem which allows write operations into a cow + file. If the iso is bigger than 4G you can use the + clic_udf flag instead + + + + seed + + Creates a btrfs based compressed read-only + filesystem which allows write operations into a btrfs + seed device. + + + + overlay + + Creates a squashfs based compressed read-only + filesystem which is combined with a write space via + the overlayfs filesystem. overlayfs is part of the + kernel since version 3.7 + + + + compressed + + Creates a split ext3 plus squashfs filesystem and + combines them via a symlink system to a complete system + it is recommended to specify a split + section as a child of this type element. + + + + + If the flags attribute is not used the filesystem + will be squashfs compressed for /bin /boot /lib /lib64 /opt /sbin + and /usr. The rest of the filesystem is packed into a tmpfs + and linked via symbolic links + + + + + image="oem" + + Use this type to create a virtual disk system suitable + in a preload setting. In addition specify the attributes + filesystem, and + boot="oemboot/suse-*" to control + the filesystem used for the virtual and to specify the + proper boot image. Using the optional format attribute and + setting, the value to iso or usb will create self + installing images suitable for optical media or a USB + stick, respectively. Booting from the media will deploy + the OEM preload image onto the selected storage device of + the system. It is also possible to configure the system to + use logical volumes. Use the optional lvm attribute and specify + the logical volume configuration with the + systemdisk child element. The default + volume group name is kiwiVG. Further configuration of the + image is performed using the appropriate + *config child block. + + + + image="pxe" + + Creating a network boot image is supported by KIWI + with the image="pxe" type. When specifying the creation of + a network boot image use the filesystem and boot="netboot/suse-*" + attributes to specify the filesystem of the image and the + proper boot image. To compress the image file set the + compressed boolean + attribute to true. This setting will compress the image + file and has no influence on the filesystem used within + the image. The compression is often use to support better + transfer times when the pxe image is pushed to the boot + server over a network connection. The pxe image layout is + controlled by using the pxedeploy child + element. + + + + image="split" + + The split image support allows the creation of an + image as split files. Using this technique one can assign + different filesystems and different read-write properties + to the different sections of the image. The + oem, pxe, + usb, and vmx types + can be created as a split system image. Use the boot="oem|netboot|usb|vmx/suse-*" + attribute to select the underlying type of the split + image. The attributes fsreadwrite, fsreadonly are used to control the + read-write properties of the filesystem specified as the + attributes value. Use the appropriate + *config child block to specify the + properties of the underlying image. For example when + building a OEM based split image use the + oemconfig child section. + + + + image="vmx" + + Creation of a virtual disk system is enabled with the + vmx value of the image attribute. Set the filesystem of + the virtual disk with the filesystem attribute and select + the appropriate boot image by setting boot="vmxboot/suse-*" The optional + format attribute is used to specify one of the + virtualization formats supported by QEMU, such as vmdk + (also the VMware format) or qcow2. For the virtual disk + image the optional vga attribute may be used to configure + the kernel framebuffer device. Acceptable values can be + found in the Linux kernel documentation for the + framebuffer device (see + Documentation/fb/vesafb.txt). KIWI + also supports the selection of the bootloader for the + virtual disk according to the rules indicated for the USB + system. Last but not least the virtual disk system may + also be created with a LVM based layout by using the + lvm attribute. The + previously indicated rules apply. Use the + machine child element to specify + appropriate configuration of the virtual disk system. + + + - If the flags attribute is not used the filesystem - will be squashfs compressed for /bin /boot /lib /lib64 /opt /sbin - and /usr. The rest of the filesystem is packed into a tmpfs - and linked via symbolic links - - - - - image="oem" - - Use this type to create a virtual disk system suitable - in a preload setting. In addition specify the attributes - filesystem, and - boot="oemboot/suse-*" to control - the filesystem used for the virtual and to specify the - proper boot image. Using the optional format attribute and - setting, the value to iso or usb will create self - installing images suitable for optical media or a USB - stick, respectively. Booting from the media will deploy - the OEM preload image onto the selected storage device of - the system. It is also possible to configure the system to - use logical volumes. Use the optional lvm attribute and specify - the logical volume configuration with the - systemdisk child element. The default - volume group name is kiwiVG. Further configuration of the - image is performed using the appropriate - *config child block. - - - - image="pxe" - - Creating a network boot image is supported by KIWI - with the image="pxe" type. When specifying the creation of - a network boot image use the filesystem and boot="netboot/suse-*" - attributes to specify the filesystem of the image and the - proper boot image. To compress the image file set the - compressed boolean - attribute to true. This setting will compress the image - file and has no influence on the filesystem used within - the image. The compression is often use to support better - transfer times when the pxe image is pushed to the boot - server over a network connection. The pxe image layout is - controlled by using the pxedeploy child - element. - - - - image="split" - - The split image support allows the creation of an - image as split files. Using this technique one can assign - different filesystems and different read-write properties - to the different sections of the image. The - oem, pxe, - usb, and vmx types - can be created as a split system image. Use the boot="oem|netboot|usb|vmx/suse-*" - attribute to select the underlying type of the split - image. The attributes fsreadwrite, fsreadonly are used to control the - read-write properties of the filesystem specified as the - attributes value. Use the appropriate - *config child block to specify the - properties of the underlying image. For example when - building a OEM based split image use the - oemconfig child section. - - - - image="vmx" - - Creation of a virtual disk system is enabled with the - vmx value of the image attribute. Set the filesystem of - the virtual disk with the filesystem attribute and select - the appropriate boot image by setting boot="vmxboot/suse-*" The optional - format attribute is used to specify one of the - virtualization formats supported by QEMU, such as vmdk - (also the VMware format) or qcow2. For the virtual disk - image the optional vga attribute may be used to configure - the kernel framebuffer device. Acceptable values can be - found in the Linux kernel documentation for the - framebuffer device (see - Documentation/fb/vesafb.txt). KIWI - also supports the selection of the bootloader for the - virtual disk according to the rules indicated for the USB - system. Last but not least the virtual disk system may - also be created with a LVM based layout by using the - lvm attribute. The - previously indicated rules apply. Use the - machine child element to specify - appropriate configuration of the virtual disk system. - - - - - All of the mentioned types can specify the boot attribute which tells KIWI to - call itself to build the requested boot image (initrd). It is - possible to tell KIWI to check for an already built boot image - which is a so called prebuilt boot image. - To activate searching for an appropriate prebuilt boot image the - type section also provides the attribute checkprebuilt="true|false". If specified KIWI will - search for a prebuilt boot image in a directory named - /usr/share/kiwi/image/*boot/*-prebuilt. - Example: If the boot - attribute was set to isoboot/suse-10.3 and checkprebuilt is set to true KIWI will search the prebuilt boot image in - /usr/share/kiwi/image/isoboot/suse-10.3-prebuilt. - The directory KIWI searches for the prebuilt boot images can - also be specified at the commandline with the - parameter. + All of the mentioned types can specify the boot attribute which tells KIWI to + call itself to build the requested boot image (initrd). It is + possible to tell KIWI to check for an already built boot image + which is a so called prebuilt boot image. + To activate searching for an appropriate prebuilt boot image the + type section also provides the attribute checkprebuilt="true|false". If specified KIWI will + search for a prebuilt boot image in a directory named + /usr/share/kiwi/image/*boot/*-prebuilt. + Example: If the boot + attribute was set to isoboot/suse-10.3 and checkprebuilt is set to true KIWI will search the prebuilt boot image in + /usr/share/kiwi/image/isoboot/suse-10.3-prebuilt. + The directory KIWI searches for the prebuilt boot images can + also be specified at the commandline with the + parameter. - Within the type section, there could be other optional - attributes which are either universally valid or can be used - for different image types in the same way. The following list - explains these attributes: + Within the type section, there could be other optional + attributes which are either universally valid or can be used + for different image types in the same way. The following list + explains these attributes: - - - kernelcmdline - - Specifies additional kernel parameters. - The following example disables kernel messages: - kernelcmdline="quiet" - - + - mdraid + kernelcmdline - For disk based image types, aka oem and vmx, - mdraid activates the creation of a software raid image. - The raid inside the image is created in degraded mode - because at creation time we only know about one disk. - It's in the hand of the user to add devices to the raid - after the image runs on the target machine. The value - for mdraid can be either mirroring - or striping, which means the raid - level is set to RAID1 (mirroring) or - RAID0 (striping). + Specifies additional kernel parameters. + The following example disables kernel messages: + kernelcmdline="quiet" - - + + + mdraid + + For disk based image types, aka oem and vmx, + mdraid activates the creation of a software raid image. + The raid inside the image is created in degraded mode + because at creation time we only know about one disk. + It's in the hand of the user to add devices to the raid + after the image runs on the target machine. The value + for mdraid can be either mirroring + or striping, which means the raid + level is set to RAID1 (mirroring) or + RAID0 (striping). + + + - Within the preferences section, there are the following - optional elements: + Within the preferences section, there are the following + optional elements: - - - showlicense - - - Specifies the base name of a license file which is displayed in oem - images before the installation happens. It's possible to add more showlicense - sections to display more licenses one after the other. If no such element - is specified the default 'license' and 'EULA' files are searched. The - search algorithm will append the .txt or .locale.txt suffix to the license - name to form the license file name. You should make sure that you license - files contains this suffix. - - - - - rpm-check-signatures - - Specifies whether RPM should check the package - signature or not - - - - rpm-excludedocs - - Specifies whether RPM should skip installing package - documentation - - - - rpm-force - - Specifies whether RPM should be called with - - - - - - keytable - - Specifies the name of the console keymap to use. The - value corresponds to a map file in - /usr/share/kbd/keymaps. The - KEYTABLE variable in - /etc/sysconfig/keyboard file is set - according to the keyboard mapping. - - - - timezone - - Specifies the time zone. Available time zones are - located in the /usr/share/zoneinfo directory. Specify the - attribute value relative to /usr/share/zoneinfo. For example, specify - Europe/Berlin for - /usr/share/zoneinfo/Europe/Berlin. - KIWI uses this value to configure the timezone in - /etc/localtime for the image. - - - - locale - - Specifies the name of the UTF-8 locale to use, which - defines the contents of the RC_LANG system - environment variable in - /etc/sysconfig/language. Please - note only UTF-8 locales are supported here which also - means that the encoding must not be - part of the locale information. The KIWI schema validates - the locale string according to the following - pattern:[a-z]{2}_[A-Z]{2}(,[a-z]{2}_[A-Z]{2})*. - This means you have to specify the locale like the - following example: en_US or en_US,de_DE - - - - bootsplash-theme - - Specifies the name of the bootsplash theme to use - - - - bootloader-theme - - Specifies the name of the gfxboot theme to use - - - - defaultdestination - - Used if the option is not - specified when calling KIWI - - + + + showlicense + + + Specifies the base name of a license file which is displayed in oem + images before the installation happens. It's possible to add more showlicense + sections to display more licenses one after the other. If no such element + is specified the default 'license' and 'EULA' files are searched. The + search algorithm will append the .txt or .locale.txt suffix to the license + name to form the license file name. You should make sure that you license + files contains this suffix. + + + + + rpm-check-signatures + + Specifies whether RPM should check the package + signature or not + + + + rpm-excludedocs + + Specifies whether RPM should skip installing package + documentation + + + + rpm-force + + Specifies whether RPM should be called with + + + + + + keytable + + Specifies the name of the console keymap to use. The + value corresponds to a map file in + /usr/share/kbd/keymaps. The + KEYTABLE variable in + /etc/sysconfig/keyboard file is set + according to the keyboard mapping. + + + + timezone + + Specifies the time zone. Available time zones are + located in the /usr/share/zoneinfo directory. Specify the + attribute value relative to /usr/share/zoneinfo. For example, specify + Europe/Berlin for + /usr/share/zoneinfo/Europe/Berlin. + KIWI uses this value to configure the timezone in + /etc/localtime for the image. + + + + locale + + Specifies the name of the UTF-8 locale to use, which + defines the contents of the RC_LANG system + environment variable in + /etc/sysconfig/language. Please + note only UTF-8 locales are supported here which also + means that the encoding must not be + part of the locale information. The KIWI schema validates + the locale string according to the following + pattern:[a-z]{2}_[A-Z]{2}(,[a-z]{2}_[A-Z]{2})*. + This means you have to specify the locale like the + following example: en_US or en_US,de_DE + + + + bootsplash-theme + + Specifies the name of the bootsplash theme to use + + - defaultroot - - Used if the option is not - specified when calling KIWI - - - + bootloader-theme + + Specifies the name of the gfxboot theme to use + + + + defaultdestination + + Used if the option is not + specified when calling KIWI + + + + defaultroot + + Used if the option is not + specified when calling KIWI + + + - The type element may contain child - elements to provide specific configuration information for the - given type. The following lists the supported child elements: + The type element may contain child + elements to provide specific configuration information for the + given type. The following lists the supported child elements: - - - ec2config - - The optional ec2config block is used to specify - information relevant only to AWS EC2 images. The following - information can be provided: - <ec2config> - <ec2accountnr> Your AWS account number </ec2accountnr> - <ec2certfile> Path to the AWS cert-*.pem file </ec2certfile> - <ec2privatekeyfile> Path to the AWS pk-*.pem file </ec2privatekeyfile> + + + ec2config + + The optional ec2config block is used to specify + information relevant only to AWS EC2 images. The following + information can be provided: + <ec2config> + <ec2accountnr> Your AWS account number </ec2accountnr> + <ec2certfile> Path to the AWS cert-*.pem file </ec2certfile> + <ec2privatekeyfile> Path to the AWS pk-*.pem file </ec2privatekeyfile> </ec2config> - - - - systemdisk - - Using the optional systemdisk section it is possible to - create a LVM (Logical Volume Management) based storage - layout. By default, the volume group is named - kiwiVG. It - is possible to change the name of the group by setting the - name attribute - to the desired name. Individual volumes within the volume - group are specified using the - volume element. - The following example shows the creation of a volume - named usr and a volume - named var inside the volume - group systemVG. - <systemdisk name="systemVG"> - <volume name="usr" freespace="100M"/> - <volume name="var" size="200M"/> + + + + systemdisk + + Using the optional systemdisk section it is possible to + create a LVM (Logical Volume Management) based storage + layout. By default, the volume group is named + kiwiVG. It + is possible to change the name of the group by setting the + name attribute + to the desired name. Individual volumes within the volume + group are specified using the + volume element. + The following example shows the creation of a volume + named usr and a volume + named var inside the volume + group systemVG. + <systemdisk name="systemVG"> + <volume name="usr" freespace="100M"/> + <volume name="var" size="200M"/> </systemdisk> - The optional attribute - freespace controls the - amount of unused space available after software has been - installed in the given volume. By default the available space - of a created volume is between 10% and 20%. Using the optional - size attribute the - absolute size of the given volume is specified. The - size attribute takes - precedence over the - freespace attribute. If - the specified size is insufficient, based on the estimated - software install size for the given volume, the specified - value will be ignored and a volume with default settings will - be created. This implies that the volume will be 80% to 90% - full. - - - - oemconfig - - By default, the oemboot process will create or modify - a swap, and / partition. It is possible to - influence the behavior by the oem-* - elements explained below. KIWI uses this information to - create the file /config.oempartition - as part of the automatically created oemboot boot image. - The format of the file is a simple - key=value format and created by the - KIWIConfig.sh function named - baseSetupOEMPartition. + The optional attribute + freespace controls the + amount of unused space available after software has been + installed in the given volume. By default the available space + of a created volume is between 10% and 20%. Using the optional + size attribute the + absolute size of the given volume is specified. The + size attribute takes + precedence over the + freespace attribute. If + the specified size is insufficient, based on the estimated + software install size for the given volume, the specified + value will be ignored and a volume with default settings will + be created. This implies that the volume will be 80% to 90% + full. + + + + oemconfig + + By default, the oemboot process will create or modify + a swap, and / partition. It is possible to + influence the behavior by the oem-* + elements explained below. KIWI uses this information to + create the file /config.oempartition + as part of the automatically created oemboot boot image. + The format of the file is a simple + key=value format and created by the + KIWIConfig.sh function named + baseSetupOEMPartition. - <oemconfig> - <oem-systemsize>2000</oem-systemsize> - <oem-... > + <oemconfig> + <oem-systemsize>2000</oem-systemsize> + <oem-... > </oemconfig> - - - oem-boot-titletextoem-boot-title - - By default, the string OEM will be used as the boot manager - menu entry when KIWI creates the GRUB configuration - during deployment. The - oem-boot-title element allows - you to set a custom name for the grub menu entry. - This value is represented by the - OEM_BOOT_TITLE variable in - config.oempartition. - - - - oem-bootwaittrue|falseoem-bootwait - - Specify if the system should wait for user interaction - priot to continuing the boot process after the oem image - has been dumped to the designated storage device (default - value is false). This value is represented by the - OEM_BOOTWAIT variable in - config.oempartition. - - - - oem-inplace-recoverytrue|falseoem-inplace-recovery - - Specify if the recovery archive is stored as part of - the image or if the archive is to be created at the time - the image is deployed to the target storage device. - OEM_RECOVERY_INPLACE variable in - config.oempartition. - - - - oem-kiwi-initrdtrue|falseoem-kiwi-initrd - - If this element is set to true (default value is - false) the oemboot boot image (initrd) will - not be replaced by the system - (mkinitrd) created initrd. This option is useful - when the system is installed on removable storage - such as a USB stick or a portable external drive. - For movable devices it is potentially necessary to - detect the storage location during every boot. This - detection process is part of the oemboot boot image. - This value is represented by the - OEM_KIWI_INITRD variable in - config.oempartition. - - - - oem-partition-installtrue|falseoem-partition-install - - Specify if the image is to be installed into a - free partition on the target storage device. By default - the value is false and Kiwi installs images to a - target device which causes data loss on the device. With - oem-partition-install - set to true any other settings that have influence on - the partition table, such as - oem-swap are ignored. - This value is represented by the - OEM_PARTITION_INSTALL variable in - config.oempartition. - - - - oem-reboottrue|falseoem-reboot - - Specify if the system is to be rebooted after - the oem image has been deployed to the designated - storage device (default value is false). This value - is represented by the OEM_REBOOT - variable in - config.oempartition. - - - - oem-reboot-interactivetrue|falseoem-reboot-interactive - - Specify if the system is to be rebooted after - the oem image has been deployed to the designated - storage device (default value is false). Prior to - reboot a message is posted and must be acknowledged - by the user in order for the system to reboot. This value - is represented by the - OEM_REBOOT_INTERACTIVE variable in - config.oempartition. - - - - oem-recoverytrue|falseoem-recovery - - If this element is set to true (default value is - false), KIWI will create a recovery archive from the - prepared root tree. The archive will appear as - /recovery.tar.bz2 in the - image file. During first boot of the image a single - recovery partition will be created and the recovery - archive will be moved to the recovery partition. An - additional boot menu entry is created that when - selected restores the original root tree on the - system. The user information on the /home partition or in - the /home - directory is not affected by the recovery process. - This value is represented by the OEM_RECOVERY - variable in - config.oempartition. - - - - oem-recoveryIDpartition-idoem-recoveryID - - Specify the partition type for the recovery - partition. The default is to create a Linux - partition (id = 83). This value is represented by - the OEM_RECOVERY_ID variable in - config.oempartition. - - - - oem-silent-boottrue|falseoem-silent-boot - - Specify if the system should boot in silent mode - after the oem image has been deployed to the designated - storage device (default value is false). This value - is represented by the OEM_SILENTBOOT - variable in - config.oempartition. - - - - oem-shutdowntrue|falseoem-shutdown - - Specify if the system is to be powered down after - the oem image has been deployed to the designated - storage device (default value is false). This value - is represented by the OEM_SHUTDOWN - variable in - config.oempartition. - - - - oem-shutdown-interactivetrue|falseoem-shutdown-interactive - - Specify if the system is to be powered down after - the oem image has been deployed to the designated - storage device (default value is false). Prior to - shutdown a message is posted and must be acknowledged - by the user in order for the system to power off. This - value is represented by the - OEM_SHUTDOWN_INTERACTIVE variable in - config.oempartition. - - - - oem-swaptrue|falseoem-swap - - Specify if a swap partition should be created. - The creation of a swap partition is the default - behavior. This value is represented by the - OEM_WITHOUTSWAP variable in - config.oempartition. - - - - oem-swapsizenumber in MBoem-swapsize - - Set the size of the swap partition. If a swap - partition is to be created and the size of the swap - partition is not specified with this optional - element, KIWI will calculate the size of the swap - partition and create a swap partition equal to two - times the RAM installed on the system at initial - boot time. This value is represented by the - OEM_SWAPSIZE variable in - config.oempartition. - - - - oem-systemsizenumber in MBoem-systemsize - - Set the size the operating system is allowed to - consume on the target disk. The size limit does not - include any consideration for swap space or a - recovery partition. - In a setup without a - systemdisk element - this value specifies the size of the root partition. - In a setup including - a systemdisk element - this value specifies the size of the LVM partition which - contains all specified volumes. Thus, the sum of all - specified volume sizes plus the sum of the specified - freespace for each volume must be smaller or equal - to the size specified with the - oem-systemsize. - This value is represented by the variable - OEM_SYSTEMSIZE in - config.oempartition. - - - - oem-unattendedtrue|falseoem-unattended - - The installation of the image to the target system - occurs automatically without requiering user - interaction. If multiple possible target devices are - discovered the image is deployed to the first device. - OEM_UNATTENDED in - config.oempartition. - - - - - - - pxedeploy - - Information contained in the optional - pxedeploy section is only considered - if the image - attribute of the type element is set to - pxe. In order to use - a PXE image it is necessary to create a network boot - infrastructure. Creation of the network boot - infrastructure is simplified by the KIWI provided package - kiwi-pxeboot. This package configures - the basic PXE boot environment as expected by KIWI pxe - images. The kiwi-pxeboot package - creates a directory structure in - /srv/tftpboot. Files created by the - KIWI create step need to be copied to the - /srv/tftpboot directory structure. - For additional details about the PXE image please refer - to the PXE Image chapter later in this document. + + + oem-boot-titletextoem-boot-title + + By default, the string OEM will be used as the boot manager + menu entry when KIWI creates the GRUB configuration + during deployment. The + oem-boot-title element allows + you to set a custom name for the grub menu entry. + This value is represented by the + OEM_BOOT_TITLE variable in + config.oempartition. + + + + oem-bootwaittrue|falseoem-bootwait + + Specify if the system should wait for user interaction + priot to continuing the boot process after the oem image + has been dumped to the designated storage device (default + value is false). This value is represented by the + OEM_BOOTWAIT variable in + config.oempartition. + + + + oem-inplace-recoverytrue|falseoem-inplace-recovery + + Specify if the recovery archive is stored as part of + the image or if the archive is to be created at the time + the image is deployed to the target storage device. + OEM_RECOVERY_INPLACE variable in + config.oempartition. + + + + oem-kiwi-initrdtrue|falseoem-kiwi-initrd + + If this element is set to true (default value is + false) the oemboot boot image (initrd) will + not be replaced by the system + (mkinitrd) created initrd. This option is useful + when the system is installed on removable storage + such as a USB stick or a portable external drive. + For movable devices it is potentially necessary to + detect the storage location during every boot. This + detection process is part of the oemboot boot image. + This value is represented by the + OEM_KIWI_INITRD variable in + config.oempartition. + + + + oem-partition-installtrue|falseoem-partition-install + + Specify if the image is to be installed into a + free partition on the target storage device. By default + the value is false and Kiwi installs images to a + target device which causes data loss on the device. With + oem-partition-install + set to true any other settings that have influence on + the partition table, such as + oem-swap are ignored. + This value is represented by the + OEM_PARTITION_INSTALL variable in + config.oempartition. + + + + oem-reboottrue|falseoem-reboot + + Specify if the system is to be rebooted after + the oem image has been deployed to the designated + storage device (default value is false). This value + is represented by the OEM_REBOOT + variable in + config.oempartition. + + + + oem-reboot-interactivetrue|falseoem-reboot-interactive + + Specify if the system is to be rebooted after + the oem image has been deployed to the designated + storage device (default value is false). Prior to + reboot a message is posted and must be acknowledged + by the user in order for the system to reboot. This value + is represented by the + OEM_REBOOT_INTERACTIVE variable in + config.oempartition. + + + + oem-recoverytrue|falseoem-recovery + + If this element is set to true (default value is + false), KIWI will create a recovery archive from the + prepared root tree. The archive will appear as + /recovery.tar.bz2 in the + image file. During first boot of the image a single + recovery partition will be created and the recovery + archive will be moved to the recovery partition. An + additional boot menu entry is created that when + selected restores the original root tree on the + system. The user information on the /home partition or in + the /home + directory is not affected by the recovery process. + This value is represented by the OEM_RECOVERY + variable in + config.oempartition. + + + + oem-recoveryIDpartition-idoem-recoveryID + + Specify the partition type for the recovery + partition. The default is to create a Linux + partition (id = 83). This value is represented by + the OEM_RECOVERY_ID variable in + config.oempartition. + + + + oem-silent-boottrue|falseoem-silent-boot + + Specify if the system should boot in silent mode + after the oem image has been deployed to the designated + storage device (default value is false). This value + is represented by the OEM_SILENTBOOT + variable in + config.oempartition. + + + + oem-shutdowntrue|falseoem-shutdown + + Specify if the system is to be powered down after + the oem image has been deployed to the designated + storage device (default value is false). This value + is represented by the OEM_SHUTDOWN + variable in + config.oempartition. + + + + oem-shutdown-interactivetrue|falseoem-shutdown-interactive + + Specify if the system is to be powered down after + the oem image has been deployed to the designated + storage device (default value is false). Prior to + shutdown a message is posted and must be acknowledged + by the user in order for the system to power off. This + value is represented by the + OEM_SHUTDOWN_INTERACTIVE variable in + config.oempartition. + + + + oem-swaptrue|falseoem-swap + + Specify if a swap partition should be created. + The creation of a swap partition is the default + behavior. This value is represented by the + OEM_WITHOUTSWAP variable in + config.oempartition. + + + + oem-swapsizenumber in MBoem-swapsize + + Set the size of the swap partition. If a swap + partition is to be created and the size of the swap + partition is not specified with this optional + element, KIWI will calculate the size of the swap + partition and create a swap partition equal to two + times the RAM installed on the system at initial + boot time. This value is represented by the + OEM_SWAPSIZE variable in + config.oempartition. + + + + oem-systemsizenumber in MBoem-systemsize + + Set the size the operating system is allowed to + consume on the target disk. The size limit does not + include any consideration for swap space or a + recovery partition. + In a setup without a + systemdisk element + this value specifies the size of the root partition. + In a setup including + a systemdisk element + this value specifies the size of the LVM partition which + contains all specified volumes. Thus, the sum of all + specified volume sizes plus the sum of the specified + freespace for each volume must be smaller or equal + to the size specified with the + oem-systemsize. + This value is represented by the variable + OEM_SYSTEMSIZE in + config.oempartition. + + + + oem-unattendedtrue|falseoem-unattended + + The installation of the image to the target system + occurs automatically without requiering user + interaction. If multiple possible target devices are + discovered the image is deployed to the first device. + OEM_UNATTENDED in + config.oempartition. + + + + + + + pxedeploy + + Information contained in the optional + pxedeploy section is only considered + if the image + attribute of the type element is set to + pxe. In order to use + a PXE image it is necessary to create a network boot + infrastructure. Creation of the network boot + infrastructure is simplified by the KIWI provided package + kiwi-pxeboot. This package configures + the basic PXE boot environment as expected by KIWI pxe + images. The kiwi-pxeboot package + creates a directory structure in + /srv/tftpboot. Files created by the + KIWI create step need to be copied to the + /srv/tftpboot directory structure. + For additional details about the PXE image please refer + to the PXE Image chapter later in this document. - In addition to the image files it is necessary that - information be provided about the client setup. This - information, such as the image to be used or the - partitioning, is contained in a file with the name - config.MAC - in the directory /srv/tftpboot/KIWI. - The content of this file is created automatically by KIWI - if the pxedeploy section is provided in the image - description. A pxedeploy section is outlined below: - <pxedeploy server="IP" blocksize="4096"> - <timeout>seconds</timeout> - <kernel>kernel-file</kernel> - <initrd>initrd-file</initrd> - <partitions device="/dev/sda"> - <partition type="swap" number="1" size="MB"/> - <partition type="L" number="2" size="MB" - mountpoint="/" target="true"/> - <partition type="fd" number="3"/> - </partitions> - <union ro="dev" rw="dev" type="clicfs"/> - <configuration source="/KIWI/../file" dest="/../file" arch="..."/> - <configuration .../> + In addition to the image files it is necessary that + information be provided about the client setup. This + information, such as the image to be used or the + partitioning, is contained in a file with the name + config.MAC + in the directory /srv/tftpboot/KIWI. + The content of this file is created automatically by KIWI + if the pxedeploy section is provided in the image + description. A pxedeploy section is outlined below: + <pxedeploy server="IP" blocksize="4096"> + <timeout>seconds</timeout> + <kernel>kernel-file</kernel> + <initrd>initrd-file</initrd> + <partitions device="/dev/sda"> + <partition type="swap" number="1" size="MB"/> + <partition type="L" number="2" size="MB" + mountpoint="/" target="true"/> + <partition type="fd" number="3"/> + </partitions> + <union ro="dev" rw="dev" type="clicfs"/> + <configuration source="/KIWI/../file" dest="/../file" arch="..."/> + <configuration .../> </pxedeploy> - - - The server - attribute is used to specify the IP address of the PXE - server. The blocksize attributes specifies the - blocksize for the image download. Other protocols are - supported by KIWI but require the - kiwiserver and - kiwiservertype kernel - parameters to be set when the client boots. - - - The value of the optional - timeout element specifies the - grub timeout in seconds to be used when the KIWI - initrd configures and installs the grub boot loader on - the client machine after the first deployment to allow - standalone boot. - - - Passing kernel parameters is possible with the use - of the optional kernelcmdline attribute in the - type section. The value of this - attribute is a string specifying the settings to be - passed to the kernel by the GRUB bootloader. The KIWI - initrd includes these kernel options when installing - grub for standalone boot - - - The optional kernel and - initrd elements are used to - specify the file names for the kernel and initrd on - the boot server respectively. When using a special - boot method not supported by the distribution’s - standard mkinitrd, it is imperative that the KIWI - initrd remains on the PXE server and also be used for - local boot. If the configured image uses the - split type or the - pxedeploy section includes any - union information the kernel and initrd elements must - be used. - - - The partitions section is - required if the system image is to be installed on a - disk or other permanent storage device. Each partition - is specified with one partition child element. The - mandatory type attribute specifies the partition type - id. - The required number attribute provides the number - of the partition to be created. The size of the - partition may be specified with the optional size - attribute. The optional mountpoint attribute provides - the value for the mount point of the partition. The - optional boolean target attribute identifies the - partition as the system image target partition. KIWI - always generates the swap partition as the first - partition of the netboot boot image. By default, the - second partition is used for the system image. Use the - boolean target - attribute to change this behavior. Providing the value - image for the size attribute triggers KIWI into - calculating the required size for this partition. The - calculated size is sufficient for the created image. - - - - If the system image is based on a read-only - filesystem such as squashfs and should be mounted in - read-write mode use the optional union element. The - type attribute is used to specify one of the supported - overlay filesystem clicfs - Use the ro - attribute to point to the read only device and the rw - attribute to point to the read-write device. - - - The optional configuration - element is used to integrate a network client’s - configuration files that are stored on the server. The - source attribute specifies the path on the server for - the file to be downloaded. The dest attribute - specifies destination of the downloaded file on the - network client starting at the root (/) of the - filesystem. Multiple configuration elements may be - specified such that multiple files can be transferred - to the network client. In addition configuration files - can be bound to a specific client architecture by - setting the optional arch attribute. To specify - multiple architectures use a comma separated string. - - + + + The server + attribute is used to specify the IP address of the PXE + server. The blocksize attributes specifies the + blocksize for the image download. Other protocols are + supported by KIWI but require the + kiwiserver and + kiwiservertype kernel + parameters to be set when the client boots. + + + The value of the optional + timeout element specifies the + grub timeout in seconds to be used when the KIWI + initrd configures and installs the grub boot loader on + the client machine after the first deployment to allow + standalone boot. + + + Passing kernel parameters is possible with the use + of the optional kernelcmdline attribute in the + type section. The value of this + attribute is a string specifying the settings to be + passed to the kernel by the GRUB bootloader. The KIWI + initrd includes these kernel options when installing + grub for standalone boot + + + The optional kernel and + initrd elements are used to + specify the file names for the kernel and initrd on + the boot server respectively. When using a special + boot method not supported by the distribution’s + standard mkinitrd, it is imperative that the KIWI + initrd remains on the PXE server and also be used for + local boot. If the configured image uses the + split type or the + pxedeploy section includes any + union information the kernel and initrd elements must + be used. + + + The partitions section is + required if the system image is to be installed on a + disk or other permanent storage device. Each partition + is specified with one partition child element. The + mandatory type attribute specifies the partition type + id. + The required number attribute provides the number + of the partition to be created. The size of the + partition may be specified with the optional size + attribute. The optional mountpoint attribute provides + the value for the mount point of the partition. The + optional boolean target attribute identifies the + partition as the system image target partition. KIWI + always generates the swap partition as the first + partition of the netboot boot image. By default, the + second partition is used for the system image. Use the + boolean target + attribute to change this behavior. Providing the value + image for the size attribute triggers KIWI into + calculating the required size for this partition. The + calculated size is sufficient for the created image. + + + + If the system image is based on a read-only + filesystem such as squashfs and should be mounted in + read-write mode use the optional union element. The + type attribute is used to specify one of the supported + overlay filesystem clicfs + Use the ro + attribute to point to the read only device and the rw + attribute to point to the read-write device. + + + The optional configuration + element is used to integrate a network client’s + configuration files that are stored on the server. The + source attribute specifies the path on the server for + the file to be downloaded. The dest attribute + specifies destination of the downloaded file on the + network client starting at the root (/) of the + filesystem. Multiple configuration elements may be + specified such that multiple files can be transferred + to the network client. In addition configuration files + can be bound to a specific client architecture by + setting the optional arch attribute. To specify + multiple architectures use a comma separated string. + + - - - - - size - - Use the size element to specify the image size in - Megabytes or Gigabytes. The unit attribute specifies - whether the given value will be interpreted as Megabytes - (unit="M") or Gigabytes (unit="G"). The optional boolean - attribute additive specifies whether or not the given size - should be added to the size of the generated image or not. - In the event of a size specification that is too small - for the generated image, KIWI will expand the size - automatically unless the image size exceeds the specified - size by 100 MB or more. In this case KIWI will generate an - error and exit. - Should the given size exceed the necessary size for - the image KIWI will not alter the image size as the free - space might be required for proper execution of components - within the image. - If the size element is not used, KIWI will create an - image containing approximately 30 % free space. - <size unit="M">1000</size> - - - - split - - For images of type split or iso the information - provided in the optional split section - is considered if the compressed attribute is set to - true. With the configuration in this block it is possible - to determine which files are writable and whether these - files should be persistently writable or temporarily. Note - that for ISO images only temporary write access is - possible. - When processing the provided configuration KIWI - distinguishes between directories and files. For example, - providing /etc as - the value of the name attribute indicates that the - /etc directory - should be writable. However, this does not include any of - the files or sub-directories within /etc. The content of /etc - is populated as symbolic links to the read-only files. The - advantage of setting only a directory to read-write access - is that any newly created files will be stored on the disk - instead of in tmpfs. Creating read-write access to a - directory and it’s files requires two specifications as - shown below. - <split> - <temporary> - read/write access to - <file name="/var"/> - <file name="/var/*"/> - but not on this file: - <except name="/etc/shadow"/> - </temporary> - <persistent> - persistent read/write access to: - <file name="/etc"/> - <file name="/etc/*"/> - but not on this file: - <except name="/etc/passwd"/> - </persistent> + + + + + size + + Use the size element to specify the image size in + Megabytes or Gigabytes. The unit attribute specifies + whether the given value will be interpreted as Megabytes + (unit="M") or Gigabytes (unit="G"). The optional boolean + attribute additive specifies whether or not the given size + should be added to the size of the generated image or not. + In the event of a size specification that is too small + for the generated image, KIWI will expand the size + automatically unless the image size exceeds the specified + size by 100 MB or more. In this case KIWI will generate an + error and exit. + Should the given size exceed the necessary size for + the image KIWI will not alter the image size as the free + space might be required for proper execution of components + within the image. + If the size element is not used, KIWI will create an + image containing approximately 30 % free space. + <size unit="M">1000</size> + + + + split + + For images of type split or iso the information + provided in the optional split section + is considered if the compressed attribute is set to + true. With the configuration in this block it is possible + to determine which files are writable and whether these + files should be persistently writable or temporarily. Note + that for ISO images only temporary write access is + possible. + When processing the provided configuration KIWI + distinguishes between directories and files. For example, + providing /etc as + the value of the name attribute indicates that the + /etc directory + should be writable. However, this does not include any of + the files or sub-directories within /etc. The content of /etc + is populated as symbolic links to the read-only files. The + advantage of setting only a directory to read-write access + is that any newly created files will be stored on the disk + instead of in tmpfs. Creating read-write access to a + directory and it’s files requires two specifications as + shown below. + <split> + <temporary> + read/write access to + <file name="/var"/> + <file name="/var/*"/> + but not on this file: + <except name="/etc/shadow"/> + </temporary> + <persistent> + persistent read/write access to: + <file name="/etc"/> + <file name="/etc/*"/> + but not on this file: + <except name="/etc/passwd"/> + </persistent> </split> - Use the except element to specify exceptions to - previously configured rules. - - - - machine - - The optional machine section serves to specify - information about a VM guest machine. Using the data - provided in this section, KIWI will create a guest - configuration file required to run the image on the target - machine. - If the target is a VMware virtual machine indicated by - the format attribute set to vmdk, KIWI creates a VMware - configuration file. If the target is a Xen virtual machine - indicated by the domain attribute in the machine section - KIWI will create a Xen guest config file. - The sample block below shows the general outline of - the information that can be specified to generate the - configuration file - <machine arch="arch" memory="MB" - HWversion="number" guestOS="suse|sles" - domain="dom0|domU"/> - <vmconfig-entry>Entry_for_VM_config_file<\vmconfig-entry> - <vmconfig-entry .../> - <vmnic driver="name" interface="number" mode="mode"/> - <vmnic ...> - <vmdisk controller="ide|scsi" id="number"/> - <vmdvd controller="ide|scsi" id="number"/> + Use the except element to specify exceptions to + previously configured rules. + + + + machine + + The optional machine section serves to specify + information about a VM guest machine. Using the data + provided in this section, KIWI will create a guest + configuration file required to run the image on the target + machine. + If the target is a VMware virtual machine indicated by + the format attribute set to vmdk, KIWI creates a VMware + configuration file. If the target is a Xen virtual machine + indicated by the domain attribute in the machine section + KIWI will create a Xen guest config file. + The sample block below shows the general outline of + the information that can be specified to generate the + configuration file + <machine arch="arch" memory="MB" + HWversion="number" guestOS="suse|sles" + domain="dom0|domU"/> + <vmconfig-entry>Entry_for_VM_config_file<\vmconfig-entry> + <vmconfig-entry .../> + <vmnic driver="name" interface="number" mode="mode"/> + <vmnic ...> + <vmdisk controller="ide|scsi" id="number"/> + <vmdvd controller="ide|scsi" id="number"/> </machine> - - - arch - - The virtualized architecture. Supported values - are ix86 or - x86_64. The - default value is ix86. - - - - memory - - The mandatory memory attribute specifies how much - memory in MB should be allocated for the virtual - machine - - - - HWversion - - The VMware hardware version number, the default - value is 3. - - - - - guestOS - - The guest OS identifier. For the ix86 - architecture the default value is suse and for the - x86_64 architecture suse-64 is the default. At this - point only the SUSE and SLES guestOS types are - supported. - - - - domain - - The Xen domain setup. This could be either a - dom0 which is the host machine hosting the guests - and therefore doesn’t require a configuration file, - or it could be set to domU which indicates this is a - guest and also requires a guest configuration which - is created by KIWI. - - - - Use the vmconfig-entry - element to create entries in the virtual machine's configuration - file; .vmx for VMware images and .xenconfig for Xen images. - You may specify as many configuration options as desired. The - value of the vmconfig-entry - element is expected to be specified in the syntax required by - the VM configuration file to be written. The value is free - format text and is not validated by Kiwi in any way. The entry - is written to the VM configuration file verbatime. - Use the vmdisk element - to setup the virtual main storage device. - - - controller - - Supported values for the mandatory controller attribute - are ide and - scsi. - - - - id - - The mandatory id attribute specifies the disk id. If - only one disk is set the id value should be set to - 0. - - - - device - - The device attribute specifies the disk that - should appear in the para virtual instance. - Therefore only relevant for Xen - - - - Use the vmdvd element - to setup a virtual optical drive (CD/DVD) connection - - - controller - - Supported values for the mandatory controller attribute - are ide and - scsi. - - - - id - - The mandatory id attribute specifies the disk id. If - only one disk is set the id value should be set to - 0. - - - - Use the vmnic element - to setup the virtual network interface. Multiple - vmnic child elements may be - specified to setup multiple virtual network interfaces. - - - driver - - The mandatory driver attribute specifies the driver - to be used for the virtual network card. The - supported values are e100, vlance, and vmxnet. If the vmxnet driver is - specified the vmware tools must be installed in the - image. - - - - interface - - The mandatory interface attribute specifies the - interface number. If only one interface is set the - value should be set to 0. - - - - mode - - The network mode used to communicate outside - the VM. In many cases the bridged mode is used. - - - + + + arch + + The virtualized architecture. Supported values + are ix86 or + x86_64. The + default value is ix86. + + + + memory + + The mandatory memory attribute specifies how much + memory in MB should be allocated for the virtual + machine + + + + HWversion + + The VMware hardware version number, the default + value is 3. + + + + + guestOS + + The guest OS identifier. For the ix86 + architecture the default value is suse and for the + x86_64 architecture suse-64 is the default. At this + point only the SUSE and SLES guestOS types are + supported. + + + + domain + + The Xen domain setup. This could be either a + dom0 which is the host machine hosting the guests + and therefore doesn’t require a configuration file, + or it could be set to domU which indicates this is a + guest and also requires a guest configuration which + is created by KIWI. + + + + Use the vmconfig-entry + element to create entries in the virtual machine's configuration + file; .vmx for VMware images and .xenconfig for Xen images. + You may specify as many configuration options as desired. The + value of the vmconfig-entry + element is expected to be specified in the syntax required by + the VM configuration file to be written. The value is free + format text and is not validated by Kiwi in any way. The entry + is written to the VM configuration file verbatime. + Use the vmdisk element + to setup the virtual main storage device. + + + controller + + Supported values for the mandatory controller attribute + are ide and + scsi. + + + + id + + The mandatory id attribute specifies the disk id. If + only one disk is set the id value should be set to + 0. + + + + device + + The device attribute specifies the disk that + should appear in the para virtual instance. + Therefore only relevant for Xen + + + + Use the vmdvd element + to setup a virtual optical drive (CD/DVD) connection + + + controller + + Supported values for the mandatory controller attribute + are ide and + scsi. + + + + id + + The mandatory id attribute specifies the disk id. If + only one disk is set the id value should be set to + 0. + + + + Use the vmnic element + to setup the virtual network interface. Multiple + vmnic child elements may be + specified to setup multiple virtual network interfaces. + + + driver + + The mandatory driver attribute specifies the driver + to be used for the virtual network card. The + supported values are e100, vlance, and vmxnet. If the vmxnet driver is + specified the vmware tools must be installed in the + image. + + + + interface + + The mandatory interface attribute specifies the + interface number. If only one interface is set the + value should be set to 0. + + + + mode + + The network mode used to communicate outside + the VM. In many cases the bridged mode is used. + + + + + + - - - - + - - <sgmltag>users</sgmltag> Element + + <sgmltag>users</sgmltag> Element - <users group="group_name" id="number"> - <user home="dir" id="number" name="user" password="..." - pwdformat="encrypted|plain" realname="string" shell="path"/> - ... + <users group="group_name" id="number"> + <user home="dir" id="number" name="user" password="..." + pwdformat="encrypted|plain" realname="string" shell="path"/> + ... </users> - The optional users element lists the users belonging to the - group specified with the group attribute. At least one user - child element must be specified as part of the users element. - Multiple users elements may be specified. + The optional users element lists the users belonging to the + group specified with the group attribute. At least one user + child element must be specified as part of the users element. + Multiple users elements may be specified. - The attributes home, - id, name, pwd, realname, - and shell specify the - created users home directory, the user name, the user’s - password, the user’s real name, and the user’s login shell, - respectively. By default, the value of the password attribute is - expected to be an encrypted string. An encrypted password can be - created using kiwi - . It is also possible to - specify the password as a non encrypted string by using the - pwdformat attribute and setting it’s value to - plain. KIWI will then encrypt the password - prior to the user being added to the system. + The attributes home, + id, name, pwd, realname, + and shell specify the + created users home directory, the user name, the user’s + password, the user’s real name, and the user’s login shell, + respectively. By default, the value of the password attribute is + expected to be an encrypted string. An encrypted password can be + created using kiwi + . It is also possible to + specify the password as a non encrypted string by using the + pwdformat attribute and setting it’s value to + plain. KIWI will then encrypt the password + prior to the user being added to the system. - All specified users and groups will be created if they do - not already exist. By default, the defined users will be part of - the group specified with the group attribute of the users - element and the default group called users. If it - is desired to have the specified users to only be part of the - given group it is necessary to specify the id attribute. It is recommended to - use a group id greater than 100. - + All specified users and groups will be created if they do + not already exist. By default, the defined users will be part of + the group specified with the group attribute of the users + element and the default group called users. If it + is desired to have the specified users to only be part of the + given group it is necessary to specify the id attribute. It is recommended to + use a group id greater than 100. + - - <sgmltag>drivers</sgmltag> Element - <drivers profiles="name"> - <file name="filename"/> - ... + + <sgmltag>drivers</sgmltag> Element + <drivers profiles="name"> + <file name="filename"/> + ... </drivers> - The optional drivers element is only - useful for boot images (initrd). As a boot image doesn’t need to - contain the complete kernel one can save a lot of space if only - the required drivers are part of the image. Therefore the - drivers section exists. If present only the drivers which - matches the file names or glob patterns will be included into - the boot image. Each file is specified relative to the - /lib/modules/Version/kernel directory. + The optional drivers element is only + useful for boot images (initrd). As a boot image doesn’t need to + contain the complete kernel one can save a lot of space if only + the required drivers are part of the image. Therefore the + drivers section exists. If present only the drivers which + matches the file names or glob patterns will be included into + the boot image. Each file is specified relative to the + /lib/modules/Version/kernel directory. - According to the driver element the - specified files are searched in the corresponding directory. The - information about the driver names is provided as environment - variable named like the value of the type attribute and is processed by the function - suseStripKernel. According to this along - with a boot image description a script called - images.sh must exist which calls this - function in order to allow the driver information to have any - effect. - + According to the driver element the + specified files are searched in the corresponding directory. The + information about the driver names is provided as environment + variable named like the value of the type attribute and is processed by the function + suseStripKernel. According to this along + with a boot image description a script called + images.sh must exist which calls this + function in order to allow the driver information to have any + effect. + - - <sgmltag>repository</sgmltag> Element - <repository type="type" alias="name" imageinclude="true|false" - password="password" priority="number" status="replaceable" - username="user-name"> <source path="URL"/> + + <sgmltag>repository</sgmltag> Element + <repository type="type" alias="name" imageinclude="true|false" + password="password" priority="number" status="replaceable" + username="user-name"> <source path="URL"/> </repository> - The mandatory repository element - specifies the location and type of a repository to be used by the - package manager as a package installation source. The mandatory - type attribute - specifies the repository type. A specified repository can only be - accessed by the chosen package manager if the given type is supported - by the specified package manager. KIWI supports smart or zypper as - package managers, specified with the - packagemanager element. The default package manager is - zypper. The following table shows the possible - supported repository types for each package manager: + The mandatory repository element + specifies the location and type of a repository to be used by the + package manager as a package installation source. The mandatory + type attribute + specifies the repository type. A specified repository can only be + accessed by the chosen package manager if the given type is supported + by the specified package manager. KIWI supports smart or zypper as + package managers, specified with the + packagemanager element. The default package manager is + zypper. The following table shows the possible + supported repository types for each package manager: - - Supported Types for zypper and smart - - - - Type - smart Support - zypper Support - - - - - apt-deb - yes - no - - - apt-rpm - yes - no - - - deb-dir - yes - no - - - mirrors - yes - no - - - red-carpet - yes - yes - - - rpm-dir - yes - yes - - - rpm-md - yes - yes - - - slack-site - yes - no - - - up2date-mirrors - yes - no - - - urpmi - yes - no - - - yast2 - yes - yes - - - -
    + + Supported Types for zypper and smart + + + + Type + smart Support + zypper Support + + + + + apt-deb + yes + no + + + apt-rpm + yes + no + + + deb-dir + yes + no + + + mirrors + yes + no + + + red-carpet + yes + yes + + + rpm-dir + yes + yes + + + rpm-md + yes + yes + + + slack-site + yes + no + + + up2date-mirrors + yes + no + + + urpmi + yes + no + + + yast2 + yes + yes + + + +
    - The repository element - has the following optional attributes: + The repository element + has the following optional attributes: - - - alias="name" - - Specifies an alternative name for the configured - repository. If the attribute is not specified KIWI will generate - an alias name by replacing any / in the given - repository location with an _. It is helpful to - set an alias name if the repository path is insufficient in - expressing the purpose of the contained packages. - - - - imageinclude="true|false" - - Specifies whether the given repository should be configured - as a repository in the image or not. The default behavior is - that repositories used to build an image are not configured - as a repository inside the image. This feature allows you to - change the behavior by setting the value to true. The repository is configured - in the image according to the source path as specified with the - path attribute of the - source element. Therefore, - if the path is not a fully qualified URL, you may need to adjust - the repository file in the image to accomodate the expected - location. It is recommended that you use the - alias attribute in - combination with the - imageinclude attribute to - avoid having unpredictable random names assigned to the - repository you wish to include in the image. This also - facilitates modification of the "baseurl" entry in the .repo - file from the config.sh script if you need to make adjustments - to the path. - - - - password="string" - - Specifies a password for the given repository. The - password attribute must - be used in combination with the - username attribute. Dependent on the - repository location this information may not be used. - - - - - prefer-license="true|false" - - The repository providing this attribute will be used - primarly to install the license tarball if found on that - repository. If no repository with a prefered license attribute - exists, the search happens over all repositories. It's not - guaranteed in that case that the search order follows the - repository order like they are written into the XML - description. - - - - priority="number" - - Specifies the repository priority for this given repository. - Priority values are treated differently by different package - managers. Repository priorities allow the package management - system to disambiguate packages that may be contained in more - than one of the configured repositories. The smart package - manager treats packages from repositories with the - highest priority number as preferable to - packages from a repository with a lower priority number. - The value 0 means no priority is set. The - zypper package manager prefers packages from a repository with - a lower priority over packages from - a repository with higher priority values. The value 99 means - no priority is set. - - - - status="replaceable" - - This attribute should only be applied in the context of a - boot image description. Setting the - status to replaceable - indicates that the specified repository my be - replaced by the repositories specified in the image description. - This is important as the KIWI generated boot image, if required, - should be created based on packages from the same repositories - used to build the system image. - - - + + + alias="name" + + Specifies an alternative name for the configured + repository. If the attribute is not specified KIWI will generate + an alias name by replacing any / in the given + repository location with an _. It is helpful to + set an alias name if the repository path is insufficient in + expressing the purpose of the contained packages. + + + + imageinclude="true|false" + + Specifies whether the given repository should be configured + as a repository in the image or not. The default behavior is + that repositories used to build an image are not configured + as a repository inside the image. This feature allows you to + change the behavior by setting the value to true. The repository is configured + in the image according to the source path as specified with the + path attribute of the + source element. Therefore, + if the path is not a fully qualified URL, you may need to adjust + the repository file in the image to accomodate the expected + location. It is recommended that you use the + alias attribute in + combination with the + imageinclude attribute to + avoid having unpredictable random names assigned to the + repository you wish to include in the image. This also + facilitates modification of the "baseurl" entry in the .repo + file from the config.sh script if you need to make adjustments + to the path. + + + + password="string" + + Specifies a password for the given repository. The + password attribute must + be used in combination with the + username attribute. Dependent on the + repository location this information may not be used. + + + - username="name" - - Specifies a user name for the given repository. The - username attribute must - be used in combination with the - password attribute. Dependent on the - repository location this information may not be used. - - + prefer-license="true|false" + + The repository providing this attribute will be used + primarly to install the license tarball if found on that + repository. If no repository with a prefered license attribute + exists, the search happens over all repositories. It's not + guaranteed in that case that the search order follows the + repository order like they are written into the XML + description. + - + + priority="number" + + Specifies the repository priority for this given repository. + Priority values are treated differently by different package + managers. Repository priorities allow the package management + system to disambiguate packages that may be contained in more + than one of the configured repositories. The smart package + manager treats packages from repositories with the + highest priority number as preferable to + packages from a repository with a lower priority number. + The value 0 means no priority is set. The + zypper package manager prefers packages from a repository with + a lower priority over packages from + a repository with higher priority values. The value 99 means + no priority is set. + + + + status="replaceable" + + This attribute should only be applied in the context of a + boot image description. Setting the + status to replaceable + indicates that the specified repository my be + replaced by the repositories specified in the image description. + This is important as the KIWI generated boot image, if required, + should be created based on packages from the same repositories + used to build the system image. + + + + + username="name" + + Specifies a user name for the given repository. The + username attribute must + be used in combination with the + password attribute. Dependent on the + repository location this information may not be used. + + + + - When specifying an https location for a repository it is - generally necessary to include the openssl-certs and - cracklib-dict-full packages in the - bootstrap section of the - image configuration. - - The location of a repository is specified by the - path attribute of the - mandatory source child element. - The location specification may include the - %arch macro which will expand - to the architecture of the image building host. The value for the - path attribute may begin with - any of the following location indicators: + When specifying an https location for a repository it is + generally necessary to include the openssl-certs and + cracklib-dict-full packages in the + bootstrap section of the + image configuration. + + The location of a repository is specified by the + path attribute of the + mandatory source child element. + The location specification may include the + %arch macro which will expand + to the architecture of the image building host. The value for the + path attribute may begin with + any of the following location indicators: - - - dir:///local/path - - An absolute path to a directory accessible through the - local file system. The dir:// prefix may - be omitted. - - - - ftp://URL - - A ftp protocol based network location. - - - - http://URL - - A http protocol based network location. - - - - https://URL - - A https protocol based network location. See the comment - above about the handling of certificates and additional - package requirements in the bootstrap - section of the image configuration. - - - - iso://path/to/isofile - - An absolute path to an .iso file accessible via the local - file system. KIWI will loop mount the the .iso file to a - KIWI created directory with a generated name. The generated path - is provided to the specified package manager as a repository - location. - Using multiple .iso files from the same SLE product, requires - that all .iso files are located in the same directory. Only - the first .iso file is to be specified as a repository in - the config.xml. The first .iso file - contains all information necessary for the package manager to - locate packages that are contained in other .iso files of the - same product. Attempting to use multiple .iso files - in a series as standalone repositories will result in an - error. - - - - obs://$dir1/$dir2 - - A special network location used with the http protocol. - The values of $dir1 and - $dir2 represent the project location in the - openSUSE build service. The location is evaluated as - this://repos/$dir1/$dir2. - The obs:// prefix is also valid as part - of the value for the boot - attribute of the type. If - used with the boot - attribute it is evaluated as - this://images/$dir1/$dir2. - - - - - opensuse://PROJECTNAME - - A special network location used with the http protocol. The - given PROJECTNAME specifies a - project in the openSUSE buildservice. The repository is a - repository of type rpm-md. - For example: path= - "opensuse://openSUSE:10.3/standard" - . - - - - plain://URI - - A plain resource string. Everything following 'plain://' - will be forwarded to the package manager without further - modification. This type of location specification is useful when - KIWI does not support a specific URI but the specified package - manager does. - - - - - smb://Samba share pathname - - A path to a samba share using the cifs protocol. KIWI - creates a mount point and mounts the share including username - and password, if specified. Access to the smb share from within - the new root tree is provided via a cifs mount. Therefore, - the package providing the cifs tools must be included in the - package list for the bootstrap - section of the image configuration. At the time of - this writing the package providing the cifs tools is called - cifs-utils. If any packages provided by the - Samba share are used as part of the boot image the cifs tools - must also be included in the boot image. This is accomplished - with the bootinclude - attribute of the package - element. This is shown in the example below: + + + dir:///local/path + + An absolute path to a directory accessible through the + local file system. The dir:// prefix may + be omitted. + + + + ftp://URL + + A ftp protocol based network location. + + + + http://URL + + A http protocol based network location. + + + + https://URL + + A https protocol based network location. See the comment + above about the handling of certificates and additional + package requirements in the bootstrap + section of the image configuration. + + + + iso://path/to/isofile + + An absolute path to an .iso file accessible via the local + file system. KIWI will loop mount the the .iso file to a + KIWI created directory with a generated name. The generated path + is provided to the specified package manager as a repository + location. + Using multiple .iso files from the same SLE product, requires + that all .iso files are located in the same directory. Only + the first .iso file is to be specified as a repository in + the config.xml. The first .iso file + contains all information necessary for the package manager to + locate packages that are contained in other .iso files of the + same product. Attempting to use multiple .iso files + in a series as standalone repositories will result in an + error. + + + + obs://$dir1/$dir2 + + A special network location used with the http protocol. + The values of $dir1 and + $dir2 represent the project location in the + openSUSE build service. The location is evaluated as + this://repos/$dir1/$dir2. + The obs:// prefix is also valid as part + of the value for the boot + attribute of the type. If + used with the boot + attribute it is evaluated as + this://images/$dir1/$dir2. + + + + + opensuse://PROJECTNAME + + A special network location used with the http protocol. The + given PROJECTNAME specifies a + project in the openSUSE buildservice. The repository is a + repository of type rpm-md. + For example: path= + "opensuse://openSUSE:10.3/standard" + . + + + + plain://URI + + A plain resource string. Everything following 'plain://' + will be forwarded to the package manager without further + modification. This type of location specification is useful when + KIWI does not support a specific URI but the specified package + manager does. + + + + + smb://Samba share pathname + + A path to a samba share using the cifs protocol. KIWI + creates a mount point and mounts the share including username + and password, if specified. Access to the smb share from within + the new root tree is provided via a cifs mount. Therefore, + the package providing the cifs tools must be included in the + package list for the bootstrap + section of the image configuration. At the time of + this writing the package providing the cifs tools is called + cifs-utils. If any packages provided by the + Samba share are used as part of the boot image the cifs tools + must also be included in the boot image. This is accomplished + with the bootinclude + attribute of the package + element. This is shown in the example below: - - <packages type="bootstrap"> - ... - <package name="cifs-utils" bootinclude="true"/> - </packages> - - - - - - this://PATH - - PATH is the relative location to - the image description directory for the curent image. - - - -
    + + <packages type="bootstrap"> + ... + <package name="cifs-utils" bootinclude="true"/> + </packages> + + + + + + this://PATH + + PATH is the relative location to + the image description directory for the curent image. + + + +
    - - <sgmltag>packages</sgmltag> Element - <packages type="type" profiles="name" patternType="type" - <package name="name" arch="arch"/> - <package name="name" replaces="name"/> - <package name="name" bootinclude="true" bootdelete="true"/> - <archive name="name" bootinclude="true"/> - <package .../> - <namedCollection name="name"/> - <namedCollection .../> - <opensuseProduct name="name"/> - <opensuseProduct .../> - <ignore name="name"/> - <ignore .../> + + <sgmltag>packages</sgmltag> Element + <packages type="type" profiles="name" patternType="type" + <package name="name" arch="arch"/> + <package name="name" replaces="name"/> + <package name="name" bootinclude="true" bootdelete="true"/> + <archive name="name" bootinclude="true"/> + <package .../> + <namedCollection name="name"/> + <namedCollection .../> + <opensuseProduct name="name"/> + <opensuseProduct .../> + <ignore name="name"/> + <ignore .../> </packages> - The mandatory packages element specifies - the list of packages (element package) and - patterns (element namedCollection) to be used - with the image. The value of the type attribute specifies how the packages and - patterns listed are handled, supported values are as follows: + The mandatory packages element specifies + the list of packages (element package) and + patterns (element namedCollection) to be used + with the image. The value of the type attribute specifies how the packages and + patterns listed are handled, supported values are as follows: - - - bootstrap - - Bootstrap packages, list of packages for the new - operating system root tree. The packages list the required - components to support a chroot environment in the new - system root tree, such as glibc. - - - - delete - - Delete packages, list of packages to be deleted from - the image being created. - When using the delete type only - package elements are considered, all - other specifications such as - namedCollection are ignored. The - given package names are stored in the - $delete environment variable of the - /.profile file created by KIWI. The - list of package names is returned by the - baseGetPackagesForDeletion - function. This list can then be used to delete the - packages ignoring requirements or dependencies. This can - be accomplished in the config.sh or - images.sh script with the following - code snippet: - rpm -e --nodeps --noscripts \ + + + bootstrap + + Bootstrap packages, list of packages for the new + operating system root tree. The packages list the required + components to support a chroot environment in the new + system root tree, such as glibc. + + + + delete + + Delete packages, list of packages to be deleted from + the image being created. + When using the delete type only + package elements are considered, all + other specifications such as + namedCollection are ignored. The + given package names are stored in the + $delete environment variable of the + /.profile file created by KIWI. The + list of package names is returned by the + baseGetPackagesForDeletion + function. This list can then be used to delete the + packages ignoring requirements or dependencies. This can + be accomplished in the config.sh or + images.sh script with the following + code snippet: + rpm -e --nodeps --noscripts \ $(rpm -q ‘baseGetPackagesForDeletion‘ | grep -v "is not installed") - Note, that the delete value is indiscriminate of the - image type being built. - - - - image - - Image packages, list of packages to be installed in - the image. - - - - iso - - Image packages, a list of additional packages to be - installed when building an ISO image. - - - - oem - - Image packages, a list of additional packages to be - installed when building an OEM image. - - - - pxe - - Image packages, a list of additional packages to be - installed when building an PXE image. - - - - usb - - Image packages, a list of additional packages to be - installed when building a USB image. - - - - vmx - - Image packages, a list of additional packages to be - installed when building a vmx virtual image of any format. - - - - + Note, that the delete value is indiscriminate of the + image type being built. + + + + image + + Image packages, list of packages to be installed in + the image. + + + + iso + + Image packages, a list of additional packages to be + installed when building an ISO image. + + + + oem + + Image packages, a list of additional packages to be + installed when building an OEM image. + + + + pxe + + Image packages, a list of additional packages to be + installed when building an PXE image. + + + + usb + + Image packages, a list of additional packages to be + installed when building a USB image. + + + + vmx + + Image packages, a list of additional packages to be + installed when building a vmx virtual image of any format. + + + + - - Using Patterns - - KIWI - patterns - - Using a pattern name allows you to considerably shorten - the list of specified packages in the config.xml - file. A named pattern, specified with the namedCollection element is a - representation of a predefined list of packages. Specifying a - pattern will install all packages listed in the named pattern to be - installed in the image. Support for patterns is SUSE-specific, - and available with openSUSE 10.1 or later. The optional patternType attribute on the - packages element allows you to - control the installation of dependent packages in the image. - You may assigne one of the following values to the - patternType attribute: - - - - onlyRequired - - Incorporates only patterns and packages that - the specifeid patterns and packages require. This is - a "hard dependency" only resolution. - - - - - plusRecommended - - Incorporates patterns and packages that are required - and recommended by the specified patterns and packages - in config.xml. - - - - - By default, only required patterns and packages are installed. - KIWI depends on the package manager to resolve the specified list - of patterns and packages against the specified repositories and - complete the installation. Note that not all supported package - managers support the use of named patterns, thus the value of the - packageManager element - determines whether you are able to use named patterns or not. - Should the list of specified packages result in a conflict the - image creation process will stop and the information provided by - the package manager will be captured in the build log and will be - displayed in the terminal window where KIWI was started. The - ignore element may be of use - in resolving such conflicts. However, the ignore element is limited to effect - packages named explicitely. Packages installed in the image through - a named pattern are not effected by the ignore element setting. THerefore, - package conflicts created by packages within named patterns cannot - be resolved using the ignore mechanism. Further, if a package is - specified to be ignored, but is required by another package, then - the required package is installed in the image via the automatic - dependency resolution by the package manager in use. - - - - Architecture Restrictions - - KIWI - architecture restrictions - - To restrict a package to a specific architecture, use the - arch attribute to specify a comma separated list of allowed - architectures. Such a package is only installed if the build - systems architecture (uname - ) matches one of the specified values of - the arch attribute. - + + Using Patterns + + KIWI + patterns + + Using a pattern name allows you to considerably shorten + the list of specified packages in the config.xml + file. A named pattern, specified with the namedCollection element is a + representation of a predefined list of packages. Specifying a + pattern will install all packages listed in the named pattern to be + installed in the image. Support for patterns is SUSE-specific, + and available with openSUSE 10.1 or later. The optional patternType attribute on the + packages element allows you to + control the installation of dependent packages in the image. + You may assigne one of the following values to the + patternType attribute: + + + + onlyRequired + + Incorporates only patterns and packages that + the specifeid patterns and packages require. This is + a "hard dependency" only resolution. + + + + + plusRecommended + + Incorporates patterns and packages that are required + and recommended by the specified patterns and packages + in config.xml. + + + + + By default, only required patterns and packages are installed. + KIWI depends on the package manager to resolve the specified list + of patterns and packages against the specified repositories and + complete the installation. Note that not all supported package + managers support the use of named patterns, thus the value of the + packageManager element + determines whether you are able to use named patterns or not. + Should the list of specified packages result in a conflict the + image creation process will stop and the information provided by + the package manager will be captured in the build log and will be + displayed in the terminal window where KIWI was started. The + ignore element may be of use + in resolving such conflicts. However, the ignore element is limited to effect + packages named explicitely. Packages installed in the image through + a named pattern are not effected by the ignore element setting. THerefore, + package conflicts created by packages within named patterns cannot + be resolved using the ignore mechanism. Further, if a package is + specified to be ignored, but is required by another package, then + the required package is installed in the image via the automatic + dependency resolution by the package manager in use. + + + + Architecture Restrictions + + KIWI + architecture restrictions + + To restrict a package to a specific architecture, use the + arch attribute to specify a comma separated list of allowed + architectures. Such a package is only installed if the build + systems architecture (uname + ) matches one of the specified values of + the arch attribute. + - - Image Type Specific Packages - If a package is only required for a specific type of - image and replaces another package you can use the replaces - attribute to tell KIWI to install the package by replacing - another one. For example you can specify the kernel package in - the type="image" section as + + Image Type Specific Packages + If a package is only required for a specific type of + image and replaces another package you can use the replaces + attribute to tell KIWI to install the package by replacing + another one. For example you can specify the kernel package in + the type="image" section as - <package name="kernel-default" replaces="kernel-xen"/> + <package name="kernel-default" replaces="kernel-xen"/> - and in the type="xen" section as + and in the type="xen" section as - <package name="kernel-xen" replaces="kernel-default"/> + <package name="kernel-xen" replaces="kernel-default"/> - The result is the xen kernel if you request a xen image - and the default kernel in any other case. - + The result is the xen kernel if you request a xen image + and the default kernel in any other case. + - - Packages to Become Included Into the Boot Image - The optional attributes bootinclude and bootdelete can be - used to mark a package inside the system image description to - become part of the corresponding boot image (initrd). This - feature is most often used to specify bootsplash and/or - graphics boot related packages inside the system image - description but they are required to be part of the boot image - as the data is used at boot time of the image. - Packages included into the boot image with the bootinclude are still included into - the system image as well. If packages should only be included into - the boot image, but not the system image, they need to be added to - the packages section of - type=delete. - If the - bootdelete attribute is specified along with the bootinclude - attribute this means that the selected package will be marked - as a to become deleted package and is removed - by the contents of the images.sh script of - the corresponding boot image description. - + + Packages to Become Included Into the Boot Image + The optional attributes bootinclude and bootdelete can be + used to mark a package inside the system image description to + become part of the corresponding boot image (initrd). This + feature is most often used to specify bootsplash and/or + graphics boot related packages inside the system image + description but they are required to be part of the boot image + as the data is used at boot time of the image. + Packages included into the boot image with the bootinclude are still included into + the system image as well. If packages should only be included into + the boot image, but not the system image, they need to be added to + the packages section of + type=delete. + If the + bootdelete attribute is specified along with the bootinclude + attribute this means that the selected package will be marked + as a to become deleted package and is removed + by the contents of the images.sh script of + the corresponding boot image description. + - - Data not Available as Packages to Become Included - With the optional archive element it’s - possible to include any kind of data into the image. The - archive elements expects the name of a tarball which must - exist as part of the system image description. KIWI then picks - up the tarball and installs it into the image. If the - bootinclude attribute is set along with the archive element - the data will also become installed into the boot image. - - - -
    + + Data not Available as Packages to Become Included + With the optional archive element it’s + possible to include any kind of data into the image. The + archive elements expects the name of a tarball which must + exist as part of the system image description. KIWI then picks + up the tarball and installs it into the image. If the + bootinclude attribute is set along with the archive element + the data will also become installed into the boot image. + + + +
    diff --git a/doc/docbook/kiwi-doc-ec2.xml b/doc/docbook/kiwi-doc-ec2.xml index 6af57c01e..a0b802922 100644 --- a/doc/docbook/kiwi-doc-ec2.xml +++ b/doc/docbook/kiwi-doc-ec2.xml @@ -1,696 +1,696 @@ + "http://www.docbook.org/xml/4.5/docbookx.dtd"> - EC2 Image — Amazon Elastic Compute Cloud - - KIWI - EC2 image - - - images - EC2 - - - Amazon Elastic Compute Cloud - EC2 image - - - EC2 images - - The Amazon Elastic Compute Cloud (Amazon - EC2) provides an environment known as - - IaaS (Infrastructure as a Service). - In this environment you have the ability to run Virtual - Machines (VMs) on hardware managed by Amazon and the virtualization - infrastructure provided by Amazon. - - The virtualization infrastructure for EC2 is setup to work with - Amazon Machine Images (AMIs). There are two storage models for AMIs: - - - - - S3 (Simple Storage Service) - backed AMI - - - - - - EBS (Elastic Block Store) - backed AMI - - - - The image created with KIWI can be used to create an AMI for both - storage models. For an S3 backed AMI a bundle with a manifest XML file - is required. The bundle can be created using the ec2-ami-tools provided - by Amazon in a post processing step using the image created by KIWI. - - - For an EBS backed AMI the procedure to get to a working AMI - requires more manual steps when compared to the S3 backed AMI approach. - The KIWI created image needs to be uploaded to EC2 and then it needs to - be dumped to an EBS volume. This implies that you need to have a running - AMI in EC2 - - The procedures to handle both storage options are outlined - below. - - You can work with EC2 using the Amazon Web application found - at or you - can use the Amazon provided command line tools. In this example we will - exclusively interact with EC2 using the command line tools. The command - line tools are divided into AMI and - API tools. The AMI tools are designed - to operate on images, while the API tools are designed to work with the - Amazon - REST API. In order - for KIWI to create the bundle for S3 backed AMIs the Amazon AMI tools - must be installed. It is recommended that you install both, the AMI - and API tools on your build system. - - The Amazon tools are not distributed with KIWI and can be - installed using packages from the openSUSE Build Service Cloud:EC2 repository, or can be downloaded from Amazon at - and - . - - Documentation for Amazon EC2 can be found at . The documentation for the command line tools may be - accessed at - and - All commands also support the customary - command line option to display the supported command line arguments - for the given command. - - When working with the Amazon AMI tools it is useful to set the - EC2_HOME, EC2_PRIVATE_KEY, and EC2_CERT environment variables. Setting - EC2_PRIVATE_KEY, and EC2_CERT allows you to forego specification of the - and - command line options with every - command. The EC2_HOME environment variable is used by the tools to - find required libraries. This also transfers to ec2-api-tools. Using - the aws-cli command line tools one first needs to run - aws configure. Using the aws-cli command - line tools has the advantage that these tool provide a consistent - interface across many Amazon services, while the *-api-tools have - separate downloads and installs for each service. The aws-cli tools do - not take the environment variables into consideration and provide a - argument to allow you to manage - multiple accounts. Something that is more challenging with the *-api-tools. - - EC2_HOME - Location of the bin and lib directories installed by the - Amazon tools. A good location for the tools on your - system is /usr/local. - - - EC2_PRIVATE_KEY - Path to your private key file (including the filename). For - example /home/USERNAME/AWS/keys/pk-....pem - - - EC2_CERT - Path to your certificate file (including the filename). For - example /home/USERNAME/AWS/keys/cert-....pem + EC2 Image — Amazon Elastic Compute Cloud + + KIWI + EC2 image + + + images + EC2 + + + Amazon Elastic Compute Cloud + EC2 image + + + EC2 images + + The Amazon Elastic Compute Cloud (Amazon + EC2) provides an environment known as + + IaaS (Infrastructure as a Service). + In this environment you have the ability to run Virtual + Machines (VMs) on hardware managed by Amazon and the virtualization + infrastructure provided by Amazon. + + The virtualization infrastructure for EC2 is setup to work with + Amazon Machine Images (AMIs). There are two storage models for AMIs: + + + + + S3 (Simple Storage Service) + backed AMI + + + + + + EBS (Elastic Block Store) + backed AMI + + + + The image created with KIWI can be used to create an AMI for both + storage models. For an S3 backed AMI a bundle with a manifest XML file + is required. The bundle can be created using the ec2-ami-tools provided + by Amazon in a post processing step using the image created by KIWI. - - - - Please note that your account will be billed by Amazon at the - published rate for any computing resources you consume in EC2. This - includes but is not limited to, running instances, storing data - (your image) on S3 or EBS, and network traffic. - - One final remark before we get started, the default region for any - ec2- command that communicates with the - REST API or sends files to EC2 is the US-East region, i.e. us-east-1. - Therefore, if you want to upload any data to other EC2 regions you must - specify the desired target region. Specifying a region is accomplished - by setting the EC2_URL environment variable, by using the - command line option, or by using - the argument. The - argument is used for the aws-cli - tools. The EC2-URL environment variable and the - argument expect a value in the form - https://ec2.amazonaws.com - (us-east-1). The argument expects - the name of a region as returned by the - aws ec2 describe-regions command. - - - - Building the suse-ec2-guest Example - The example provided with KIWI uses openSUSE as the base - distribution and includes the base pattern plus the vim editor. Also - included is the suse-ami-tools package that provides tools needed - in the EC2 environment. + + For an EBS backed AMI the procedure to get to a working AMI + requires more manual steps when compared to the S3 backed AMI approach. + The KIWI created image needs to be uploaded to EC2 and then it needs to + be dumped to an EBS volume. This implies that you need to have a running + AMI in EC2 + + The procedures to handle both storage options are outlined + below. + + You can work with EC2 using the Amazon Web application found + at or you + can use the Amazon provided command line tools. In this example we will + exclusively interact with EC2 using the command line tools. The command + line tools are divided into AMI and + API tools. The AMI tools are designed + to operate on images, while the API tools are designed to work with the + Amazon + REST API. In order + for KIWI to create the bundle for S3 backed AMIs the Amazon AMI tools + must be installed. It is recommended that you install both, the AMI + and API tools on your build system. + + The Amazon tools are not distributed with KIWI and can be + installed using packages from the openSUSE Build Service Cloud:EC2 repository, or can be downloaded from Amazon at + and + . + + Documentation for Amazon EC2 can be found at . The documentation for the command line tools may be + accessed at + and + All commands also support the customary + command line option to display the supported command line arguments + for the given command. + + When working with the Amazon AMI tools it is useful to set the + EC2_HOME, EC2_PRIVATE_KEY, and EC2_CERT environment variables. Setting + EC2_PRIVATE_KEY, and EC2_CERT allows you to forego specification of the + and + command line options with every + command. The EC2_HOME environment variable is used by the tools to + find required libraries. This also transfers to ec2-api-tools. Using + the aws-cli command line tools one first needs to run + aws configure. Using the aws-cli command + line tools has the advantage that these tool provide a consistent + interface across many Amazon services, while the *-api-tools have + separate downloads and installs for each service. The aws-cli tools do + not take the environment variables into consideration and provide a + argument to allow you to manage + multiple accounts. Something that is more challenging with the *-api-tools. + + EC2_HOME + Location of the bin and lib directories installed by the + Amazon tools. A good location for the tools on your + system is /usr/local. + + + EC2_PRIVATE_KEY + Path to your private key file (including the filename). For + example /home/USERNAME/AWS/keys/pk-....pem + + + EC2_CERT + Path to your certificate file (including the filename). For + example /home/USERNAME/AWS/keys/cert-....pem + + + + Please note that your account will be billed by Amazon at the + published rate for any computing resources you consume in EC2. This + includes but is not limited to, running instances, storing data + (your image) on S3 or EBS, and network traffic. + + One final remark before we get started, the default region for any + ec2- command that communicates with the + REST API or sends files to EC2 is the US-East region, i.e. us-east-1. + Therefore, if you want to upload any data to other EC2 regions you must + specify the desired target region. Specifying a region is accomplished + by setting the EC2_URL environment variable, by using the + command line option, or by using + the argument. The + argument is used for the aws-cli + tools. The EC2-URL environment variable and the + argument expect a value in the form + https://ec2.amazonaws.com + (us-east-1). The argument expects + the name of a region as returned by the + aws ec2 describe-regions command. + + + + Building the suse-ec2-guest Example + The example provided with KIWI uses openSUSE as the base + distribution and includes the base pattern plus the vim editor. Also + included is the suse-ami-tools package that provides tools needed + in the EC2 environment. + - Lets assume you copied the example configuration directory to - /tmp - such that you could add packages to the - config.xml file without - modifying the original example provided by KIWI. + Lets assume you copied the example configuration directory to + /tmp + such that you could add packages to the + config.xml file without + modifying the original example provided by KIWI. - kiwi --prepare /tmp/suse-ec2-guest --root /tmp/myec2 - - kiwi --create /tmp/myec2 -d /tmp/myec2-result -y - - - - Using EC2 and the created image - The file that serves as the basis for the AMI is the - .raw file. This is the disk image - and is used for both S3 and EBS backed AMIs. The file is found - in your destination directory, - /tmp/myec2-result, if you followed the commands given above. Prior to describing - the specifics about using the KIWI produced images the following - section will address some rudimentary general EC2 concepts and - commands that can be used with existing AMIs and the AMIs you can - register with the KIWI created images. - - - Using a registered AMI - This section is not a replacement for the EC2 documentation - mentioned earlier. We will only cover the concepts and commands - necessary to get you started such that you can launch the KIWI - created image in this example. - - Prior to launching any instance in EC2 you need to have a - key-pair. If you do not already have a key-pair in EC2 you can create - one using aws ec2 create-key-pair --key-name command. This creates a public/private key-pair that is used to grant - you access to your running instance via the ssh tools. Generate the - key-pair as shown below, the gsgkey name is arbitrary and used in this example, you can choose any - name you like. The use of the key is quite frequent. Therefore, you - probably want to choose a name that is easy to remember and not too - terribly long to type. - - aws ec2 create-key-pair --key-name gsgkey - - Save the private key returned by the command in a local file. - Using your favorite text editor, paste everything between - (and including) the -----BEGIN RSA PRIVATE KEY----- - and -----END RSA PRIVATE KEY----- - lines into your editor and save the key to a file. The file can have - any name. However, it makes sense to name the file after the key-pair - name you have chosen earlier. If the file is named differently from - the key-pair you will end up launching instances with - mykey and then accessing the instance with - yourkey, which may be a bit weird. As indicated by the heading, - this is your private key, thus make sure you safe guard it - appropriately. On Linux the ssh tools will complain if the key - file does not have the proper permissions. Change the permissions - of your private key file to be read-write by you, the owner, only. - - chown 600 gsgkey - - The public key of your key-pair is stored in the EC2 infrastructure. - EC2 allows you to have multiple key-pairs, to review your existing - key-pairs use the aws ec2 describe-key-pairs command. - - - When you launch an instance of an AMI you must specify a - key-pair name. This selects the public key to be injected into the - instance. The key injection occurs through the amazon init script provided by the - suse-ami-tools package. This - package, as mentioned previously, is already included - in the example's config.xml file. - Do not forget to include this package when you create your own image - descriptions for EC2 or you will not be able to log into your running - instances. Additionally you need to activate this service by adding - suseInsertService amazon in your - config.sh file. - - The key injection mechanism needs to access the network. - Therefore, you must configure the network when you build your image. - Configuration of the network can be accomplished through the overlay - mechanism or via commands in config.sh. The network interface of a - guest in EC2 is always eth0 and it needs to be configured to use DHCP. - In the example the overlay mechanism is used to setup the network - configuration. - - Note that the naming of network devices changed to a - persistent naming scheme based on location of the device. While - this naming scheme provides persistent names on a given system - across reboots, with the underlying assumption that a network - device would not be moved to a different slot on real hardware, - this makes it more difficult to configure the network for - machines with unknown topology. Therefore, kiwi examples for - effected distributions inject a udev rule in config.sh. - - Another prerequisite to launching an instance in EC2 is knowing - the AMI you want to instantiate. The - aws ec2 describe-images command - will provide information about all publicly available AMIs, a rather - lengthy list. Use the - option or other qualifiers to reduce the list to a manageable size. - - - The Amazon EC2 infrastructure uses - PVGrub (Para-Virtual Grub) to boot instances of an AMI. This allows instances to run the kernel - that is part of the AMI, rather than some kernel provided by the - Amazon infrastructure. However, an Amazon provided kernel is still - required to kick things off and in the startup process PVGrub - eventually picks up the /boot/grub/menu.lst file in your image and then boots the kernel specified. Note, that - during the boot process you do not have access to a console and thus - it makes no sense to have multiple kernel entries in your - menu.lst file. Without console - access you do not have an opportunity to choose a kernel. The kernel - command line options are important, please refer to the examples to - see the required options for EC2 images. Each EC2 region has it's own - independent copy of this boot mechanism and the boot mechanism is - differentiated between 32 bit and 64 bit. The boot kernels are named - with an ID that starts with the TLA (Three Letter Acronym) - aki followed by a dash ("-") and - a hex number. - The - table below provides guidelines for the selection of the boot kernel - ID based on Region and image architecture. - - - Amazon Kernel Image IDs - - - - - - - - Region - AKI - Arch - Name - - - - - AP-Northeast - aki-196bf518 - x86 - ec2-public-images-ap-northeast-1/pv-grub-hd00-V1.04-i386.gz.manifest.xml - - - AP-Northeast - aki-1f6bf51e - x86-64 - ec2-public-images-ap-northeast-1/pv-grub-hd00-V1.04-x86_64.gz.manifest.xml - - - AP-Southeast - aki-563e7404 - x86 - ec2-public-images-ap-southeast-1/pv-grub-hd00-V1.04-i386.gz.manifest.xml - - - AP-Southeast - aki-5e3e740c - x86-64 - ec2-public-images-ap-southeast-1/pv-grub-hd00-V1.04-x86_64.gz.manifest.xml - - - AP-Southeast2 - aki-c162fffb - x86 - ec2-public-images-ap-southeast-1/pv-grub-hd00-V1.04-i386.gz.manifest.xml - - - AP-Southeast2 - aki-3b1d8001 - x86-64 - ec2-public-images-ap-southeast-1/pv-grub-hd00-V1.04-x86_64.gz.manifest.xml - - - EU-West - aki-5ea34529 - x86 - ec2-public-images-eu/pv-grub-hd00-V1.04-i386.gz.manifest.xml - - - EU-West - aki-58a3452f - x86-64 - ec2-public-images-eu/pv-grub-hd00-V1.04-x86_64.gz.manifest.xml - - - SA-East - aki-5753f44a - x86 - ec2-public-images-sa/pv-grub-hd00-V1.04-i386.gz.manifest.xml - - - SA-East - aki-5153f44c - x86-64 - ec2-public-images-sa/pv-grub-hd00-V1.04-x86_64.gz.manifest.xml - - - US-East - aki-659ccb0c - x86 - ec2-public-images/pv-grub-hd00-V1.04-i386.gz.manifest.xml - - - US-East - aki-499ccb20 - x86-64 - ec2-public-images/pv-grub-hd00-V1.04-x86_64.gz.manifest.xml - - - US-West - aki-960531d3 - x86 - ec2-public-images-us-west-1/pv-grub-hd00-V1.04-x86_64.gz.manifest.xml - - - US-West - aki-920531d7 - x86-64 - ec2-public-images-us-west-1/pv-grub-hd00-V1.04-x86_64.gz.manifest.xml - - - US-West2 - aki-e28f11d2 - x86 - ec2-public-images-us-west-2/pv-grub-hd00-V1.04-x86_64.gz.manifest.xml - - - US-West2 - aki-e68f11d6 - x86-64 - ec2-public-images-us-west-2/pv-grub-hd00-V1.04-x86_64.gz.manifest.xml - - - -
    + kiwi --prepare /tmp/suse-ec2-guest --root /tmp/myec2 + + kiwi --create /tmp/myec2 -d /tmp/myec2-result -y +
    + + + Using EC2 and the created image + The file that serves as the basis for the AMI is the + .raw file. This is the disk image + and is used for both S3 and EBS backed AMIs. The file is found + in your destination directory, + /tmp/myec2-result, if you followed the commands given above. Prior to describing + the specifics about using the KIWI produced images the following + section will address some rudimentary general EC2 concepts and + commands that can be used with existing AMIs and the AMIs you can + register with the KIWI created images. + + + Using a registered AMI + This section is not a replacement for the EC2 documentation + mentioned earlier. We will only cover the concepts and commands + necessary to get you started such that you can launch the KIWI + created image in this example. + + Prior to launching any instance in EC2 you need to have a + key-pair. If you do not already have a key-pair in EC2 you can create + one using aws ec2 create-key-pair --key-name command. This creates a public/private key-pair that is used to grant + you access to your running instance via the ssh tools. Generate the + key-pair as shown below, the gsgkey name is arbitrary and used in this example, you can choose any + name you like. The use of the key is quite frequent. Therefore, you + probably want to choose a name that is easy to remember and not too + terribly long to type. - The information in the table above was extracted from the Amazon - documentation found at: . As of version 1.04 of the akis the distinction between h0 and h00 is no longer relevant, they are in fact the same aki. - - - AMIs in EC2 already have the aki ID embedded in their - description. Therefore, you only need to know the aki ID when - registering the image or when creating an S3 image bundle. The - - aws ec2 run-instances --image-id IMAGE-ID - - command is used to start an instance. - - Once the instance state for an instance is shown as - running you can log into the - instance using ssh as follows: - - ssh -i PATH_TO_PRIVATE_KEY root@PUBLIC_IP_OF_YOUR_INSTANCE - - The PUBLIC_IP_OF_YOUR_INSTANCE is - displayed as part of the output of the - aws ec2 describe-instances command. - If you are unable to log in, it is most likely that the security - setting for the instance is blocking the ssh access, or that you did - not enable the ssh daemon process on startup. Your - config.sh script should have - a line activating the ssh daemon as follows, - suseInsertService sshd. If you - do not have this entry in config.sh - you will have to rebuild your image. Addressing the problem with - port blocking is accomplished using the - aws ec2 authorize-security-group-ingress command. - - - - - Using a bundle for an S3 backed AMI - The destination directory, - /tmp/myec2-result, if you followed the commands given above, contains the disk - image, .raw file that we will use - to create the image bundle. The ec2-ami-tools must be installed to - create the image bundle. It is a good practice to keep the image - bundle files and the kiwi results separated. Thus you may want to - create a directory for the bundle. If you target different regions you - want to have one directory per region. The following command will - create an image bundle you can upload to an S3 bucket. - - ec2-bundle-image PRIVATE_KEY CERT_FILE ACCOUNTNUMBER IMAGE_NAME AKI_ID ARCHITECTURE PATH_TO_RAW_FILE PATH_TO_BUNDLE_DIR - - - The generated bundle needs to be transfered to Amazon using the - ec2-upload-bundle command line tool. - This tool is part of the Amazon AMI tools. Upload the AMI as follows, - replacing AWS_Key_ID and - AWS_secret_Key_ID with - your Amazon key information. Also you may want to choose a different - name for your bucket than myImages. - If the bucket does not exist in S3 it will be created. + aws ec2 create-key-pair --key-name gsgkey + + Save the private key returned by the command in a local file. + Using your favorite text editor, paste everything between + (and including) the -----BEGIN RSA PRIVATE KEY----- + and -----END RSA PRIVATE KEY----- + lines into your editor and save the key to a file. The file can have + any name. However, it makes sense to name the file after the key-pair + name you have chosen earlier. If the file is named differently from + the key-pair you will end up launching instances with + mykey and then accessing the instance with + yourkey, which may be a bit weird. As indicated by the heading, + this is your private key, thus make sure you safe guard it + appropriately. On Linux the ssh tools will complain if the key + file does not have the proper permissions. Change the permissions + of your private key file to be read-write by you, the owner, only. + + chown 600 gsgkey + + The public key of your key-pair is stored in the EC2 infrastructure. + EC2 allows you to have multiple key-pairs, to review your existing + key-pairs use the aws ec2 describe-key-pairs command. + + + When you launch an instance of an AMI you must specify a + key-pair name. This selects the public key to be injected into the + instance. The key injection occurs through the amazon init script provided by the + suse-ami-tools package. This + package, as mentioned previously, is already included + in the example's config.xml file. + Do not forget to include this package when you create your own image + descriptions for EC2 or you will not be able to log into your running + instances. Additionally you need to activate this service by adding + suseInsertService amazon in your + config.sh file. + + The key injection mechanism needs to access the network. + Therefore, you must configure the network when you build your image. + Configuration of the network can be accomplished through the overlay + mechanism or via commands in config.sh. The network interface of a + guest in EC2 is always eth0 and it needs to be configured to use DHCP. + In the example the overlay mechanism is used to setup the network + configuration. + + Note that the naming of network devices changed to a + persistent naming scheme based on location of the device. While + this naming scheme provides persistent names on a given system + across reboots, with the underlying assumption that a network + device would not be moved to a different slot on real hardware, + this makes it more difficult to configure the network for + machines with unknown topology. Therefore, kiwi examples for + effected distributions inject a udev rule in config.sh. + + Another prerequisite to launching an instance in EC2 is knowing + the AMI you want to instantiate. The + aws ec2 describe-images command + will provide information about all publicly available AMIs, a rather + lengthy list. Use the + option or other qualifiers to reduce the list to a manageable size. + + + The Amazon EC2 infrastructure uses + PVGrub (Para-Virtual Grub) to boot instances of an AMI. This allows instances to run the kernel + that is part of the AMI, rather than some kernel provided by the + Amazon infrastructure. However, an Amazon provided kernel is still + required to kick things off and in the startup process PVGrub + eventually picks up the /boot/grub/menu.lst file in your image and then boots the kernel specified. Note, that + during the boot process you do not have access to a console and thus + it makes no sense to have multiple kernel entries in your + menu.lst file. Without console + access you do not have an opportunity to choose a kernel. The kernel + command line options are important, please refer to the examples to + see the required options for EC2 images. Each EC2 region has it's own + independent copy of this boot mechanism and the boot mechanism is + differentiated between 32 bit and 64 bit. The boot kernels are named + with an ID that starts with the TLA (Three Letter Acronym) + aki followed by a dash ("-") and + a hex number. + The + table below provides guidelines for the selection of the boot kernel + ID based on Region and image architecture. + + + Amazon Kernel Image IDs + + + + + + + + Region + AKI + Arch + Name + + + + + AP-Northeast + aki-196bf518 + x86 + ec2-public-images-ap-northeast-1/pv-grub-hd00-V1.04-i386.gz.manifest.xml + + + AP-Northeast + aki-1f6bf51e + x86-64 + ec2-public-images-ap-northeast-1/pv-grub-hd00-V1.04-x86_64.gz.manifest.xml + + + AP-Southeast + aki-563e7404 + x86 + ec2-public-images-ap-southeast-1/pv-grub-hd00-V1.04-i386.gz.manifest.xml + + + AP-Southeast + aki-5e3e740c + x86-64 + ec2-public-images-ap-southeast-1/pv-grub-hd00-V1.04-x86_64.gz.manifest.xml + + + AP-Southeast2 + aki-c162fffb + x86 + ec2-public-images-ap-southeast-1/pv-grub-hd00-V1.04-i386.gz.manifest.xml + + + AP-Southeast2 + aki-3b1d8001 + x86-64 + ec2-public-images-ap-southeast-1/pv-grub-hd00-V1.04-x86_64.gz.manifest.xml + + + EU-West + aki-5ea34529 + x86 + ec2-public-images-eu/pv-grub-hd00-V1.04-i386.gz.manifest.xml + + + EU-West + aki-58a3452f + x86-64 + ec2-public-images-eu/pv-grub-hd00-V1.04-x86_64.gz.manifest.xml + + + SA-East + aki-5753f44a + x86 + ec2-public-images-sa/pv-grub-hd00-V1.04-i386.gz.manifest.xml + + + SA-East + aki-5153f44c + x86-64 + ec2-public-images-sa/pv-grub-hd00-V1.04-x86_64.gz.manifest.xml + + + US-East + aki-659ccb0c + x86 + ec2-public-images/pv-grub-hd00-V1.04-i386.gz.manifest.xml + + + US-East + aki-499ccb20 + x86-64 + ec2-public-images/pv-grub-hd00-V1.04-x86_64.gz.manifest.xml + + + US-West + aki-960531d3 + x86 + ec2-public-images-us-west-1/pv-grub-hd00-V1.04-x86_64.gz.manifest.xml + + + US-West + aki-920531d7 + x86-64 + ec2-public-images-us-west-1/pv-grub-hd00-V1.04-x86_64.gz.manifest.xml + + + US-West2 + aki-e28f11d2 + x86 + ec2-public-images-us-west-2/pv-grub-hd00-V1.04-x86_64.gz.manifest.xml + + + US-West2 + aki-e68f11d6 + x86-64 + ec2-public-images-us-west-2/pv-grub-hd00-V1.04-x86_64.gz.manifest.xml + + + +
    + + The information in the table above was extracted from the Amazon + documentation found at: . As of version 1.04 of the akis the distinction between h0 and h00 is no longer relevant, they are in fact the same aki. + + + AMIs in EC2 already have the aki ID embedded in their + description. Therefore, you only need to know the aki ID when + registering the image or when creating an S3 image bundle. The + + aws ec2 run-instances --image-id IMAGE-ID + + command is used to start an instance. + + Once the instance state for an instance is shown as + running you can log into the + instance using ssh as follows: + + ssh -i PATH_TO_PRIVATE_KEY root@PUBLIC_IP_OF_YOUR_INSTANCE + + The PUBLIC_IP_OF_YOUR_INSTANCE is + displayed as part of the output of the + aws ec2 describe-instances command. + If you are unable to log in, it is most likely that the security + setting for the instance is blocking the ssh access, or that you did + not enable the ssh daemon process on startup. Your + config.sh script should have + a line activating the ssh daemon as follows, + suseInsertService sshd. If you + do not have this entry in config.sh + you will have to rebuild your image. Addressing the problem with + port blocking is accomplished using the + aws ec2 authorize-security-group-ingress command. - - ec2-upload-bundle -b myImages -a AWS_Key_ID -s AWS_secret_Key_ID \ - -m PATH_TO_MANIFEST_FROM_PREVIOUS_STEP -
    - - After the upload process is complete, register your image - with the EC2 infrastructure using the - aws ec2 register-image - command as shown below. The result of the registration - process is an AMI ID returned on the command line in the form - ami- followed by a random key sequence. - Use this AMI ID to launch your instance as described in the - - section. - - aws ec2 register-image - --image-location myImages/MANIFEST_NAME - ARCH - - This completes the S3 specific setup. The next section - explains the use of the disk image file created by KIWI to create - and EBS backed AMI. -
    - - - Using the disk image for and EBS backed AMI - For the EBS backed image we will also use the - .raw file. Find this file in the - destination directory, /tmp/myec2-result, if you followed the commands given above. - We will use the raw disk image file to create a tarball to speed up - the upload process. After unpacking the tarball in an instance in - EC2 we will dump the image onto a volume with the - dd command. Thus, - dd must be available in the image - you are running. You may also use the dd_rescue if itis available to dump the image. The SUSE Linux Enterprise - AMIs available in EC2 have the - dd_rescue command available. For the - openSUSE AMIs available in EC2 it is easy to install the - dd_rescue command by executing - zypper as shown below. - - zypper in dd_rescue - - The first step in creating an EBS backed AMI is to create a - tarball of the disk image file. This will significantly reduce your - upload time and generate less network traffic. The following commands - are executed on your build machine. - - cd /tmp/myec2-result - tar -cjf myImage.tar.bz *.raw - - The tarball needs to be uploaded to EC2 and unpacked. This - implies that the running instance of your chosen AMI needs to have - sufficient space to store the tarball and the unpacked tarball. - Therefore, it is recommended to create a storage volume as shown - below. Some ami automatically create ephemaral storage that may be - sufficiently big to hold the tarbal and image. For simplicity we - will create our own storage volume. The command - used will return information about the created volume including the - a volume ID that you want to remember. This will - be referred to as STORE_VOL_ID in this example. Execute this command on your local machine. - - aws ec2 create-volume X AV_ZONE - - The X is an integer - value representing the size of the volume to be created in GB - (Giga Bytes). The AV_ZONE - value is one of the Amazon availability zones. For all commands - presented here the AV_ZONE - value must be the same. Possible values for AV_ZONE are obtained with the - aws ec2 describe-availability-zones - - The next step is to launch an instance of your liking in EC2. - This instance will be used to create the EBS volume that will - eventually function as the backing store for your AMI, therefore - this instance must have the dd as - described earlier. Launching the instance is accomplished with the - aws ec2 run-instances command - executed on your local machine. - - aws ec2 run-instances AMI_ID SSH_KEY_NAME SECURITY_GROUP_NAME AvailabilityZone=AV_ZONE INSTANCE_TYPE - - The SECURITY_GROUP_NAME - is optional, but it is best to have a group setup that allows ssh - access by default to avoid having to open the port all the time as - outlined earlier. The INSTANCE_TYPE specified with the - depends on the architecture of your image. The aws ec2 run-instances command returns information about the instance, - including the instance ID, and you want to remember this ID. This ID - will be referred to as INST_ID in this example. - - - Wait until the instance is running, check the status with the - aws ec2 describe-instance-status - command. Once the instance is indicated as running attach the previously created volume to your instance, - by executing the aws ec2 attach-volume - command on your local machine. - - aws ec2 attach-volume STORE_VOL_ID INST_ID /dev/sdf - - The chosen device specified with the is arbitrary, however, you do obviously not want to pick a device node - that is already in use. - - In a different shell login to the running instance as shown in - the section. - - Check that the storage volume is attached using the - aws ec2 describe-volumes command on - your local machine. Once the volume is attached the "State" will be - shown as in-use. - - With the EBS storage volume attached to your instance create a - filesystem on the volume. There is no need to partition the volume. - In the EC2 instance that you previously logged into execute the - mkfs command. - - mkfs -t ext3 /dev/sdf - - Once the filesystem creation is complete mount the volume. - - mount dev/sdf /mnt - - With the storage volume attched, formated and mounted you - now have sufficient space to transfer the image tarball you created - earlier. From the destination directory on your local machine that - contains your tarball you can use sftp of scp to copy the tarball - to your instance. - - - scp PATH_TO_PRIVATE_KEY PATH_TO_THE_TARBALL root@PUBLIC_IP_OF_YOUR_INSTANCE:/mnt - - While the image is transfering you can create a new EC2 volume. - This new volume will become the backing store for your new AMI and - be referred to as VOL_ID - in this example. Use the aws ec2 create-volume command on your local machine as shown previously. This time you want - to make sure that the specified size matches the size of your - image file. - - aws ec2 create-volume X AV_ZONE - - It is good practice to use the size element in your - config.xml file when creating EC2 - images. Using the size element ensures that you have additional space on your root volume - and that you can match the volume size exactly to your image size. - - - As previously, wait for the volume to be created and check the - status with the aws ec2 describe-volumes command. When the volume creation process is complete, attach the new - volume to your running instance by executing the - aws ec2 attach-volume command on - your local machine. - - aws ec2 attach-volume VOL_ID INST_ID /dev/sdg - - Wait until the status for the volume changes to - in-use before proceeding. - - - By now the upload of your image tarball has probably - completed and you can unpack the image on your storage volume in - your EC2 instance. In the shell on your EC2 instance unpack the - tarball as shown below. - - - cd /mnt + + + + Using a bundle for an S3 backed AMI + The destination directory, + /tmp/myec2-result, if you followed the commands given above, contains the disk + image, .raw file that we will use + to create the image bundle. The ec2-ami-tools must be installed to + create the image bundle. It is a good practice to keep the image + bundle files and the kiwi results separated. Thus you may want to + create a directory for the bundle. If you target different regions you + want to have one directory per region. The following command will + create an image bundle you can upload to an S3 bucket. + + ec2-bundle-image PRIVATE_KEY CERT_FILE ACCOUNTNUMBER IMAGE_NAME AKI_ID ARCHITECTURE PATH_TO_RAW_FILE PATH_TO_BUNDLE_DIR + + + The generated bundle needs to be transfered to Amazon using the + ec2-upload-bundle command line tool. + This tool is part of the Amazon AMI tools. Upload the AMI as follows, + replacing AWS_Key_ID and + AWS_secret_Key_ID with + your Amazon key information. Also you may want to choose a different + name for your bucket than myImages. + If the bucket does not exist in S3 it will be created. + + + ec2-upload-bundle -b myImages -a AWS_Key_ID -s AWS_secret_Key_ID \ + -m PATH_TO_MANIFEST_FROM_PREVIOUS_STEP + + + After the upload process is complete, register your image + with the EC2 infrastructure using the + aws ec2 register-image + command as shown below. The result of the registration + process is an AMI ID returned on the command line in the form + ami- followed by a random key sequence. + Use this AMI ID to launch your instance as described in the + + section. + + aws ec2 register-image + --image-location myImages/MANIFEST_NAME + ARCH + + This completes the S3 specific setup. The next section + explains the use of the disk image file created by KIWI to create + and EBS backed AMI. + + + + Using the disk image for and EBS backed AMI + For the EBS backed image we will also use the + .raw file. Find this file in the + destination directory, /tmp/myec2-result, if you followed the commands given above. + We will use the raw disk image file to create a tarball to speed up + the upload process. After unpacking the tarball in an instance in + EC2 we will dump the image onto a volume with the + dd command. Thus, + dd must be available in the image + you are running. You may also use the dd_rescue if itis available to dump the image. The SUSE Linux Enterprise + AMIs available in EC2 have the + dd_rescue command available. For the + openSUSE AMIs available in EC2 it is easy to install the + dd_rescue command by executing + zypper as shown below. + + zypper in dd_rescue + + The first step in creating an EBS backed AMI is to create a + tarball of the disk image file. This will significantly reduce your + upload time and generate less network traffic. The following commands + are executed on your build machine. + + cd /tmp/myec2-result + tar -cjf myImage.tar.bz *.raw + + The tarball needs to be uploaded to EC2 and unpacked. This + implies that the running instance of your chosen AMI needs to have + sufficient space to store the tarball and the unpacked tarball. + Therefore, it is recommended to create a storage volume as shown + below. Some ami automatically create ephemaral storage that may be + sufficiently big to hold the tarbal and image. For simplicity we + will create our own storage volume. The command + used will return information about the created volume including the + a volume ID that you want to remember. This will + be referred to as STORE_VOL_ID in this example. Execute this command on your local machine. + + aws ec2 create-volume X AV_ZONE + + The X is an integer + value representing the size of the volume to be created in GB + (Giga Bytes). The AV_ZONE + value is one of the Amazon availability zones. For all commands + presented here the AV_ZONE + value must be the same. Possible values for AV_ZONE are obtained with the + aws ec2 describe-availability-zones + + The next step is to launch an instance of your liking in EC2. + This instance will be used to create the EBS volume that will + eventually function as the backing store for your AMI, therefore + this instance must have the dd as + described earlier. Launching the instance is accomplished with the + aws ec2 run-instances command + executed on your local machine. + + aws ec2 run-instances AMI_ID SSH_KEY_NAME SECURITY_GROUP_NAME AvailabilityZone=AV_ZONE INSTANCE_TYPE + + The SECURITY_GROUP_NAME + is optional, but it is best to have a group setup that allows ssh + access by default to avoid having to open the port all the time as + outlined earlier. The INSTANCE_TYPE specified with the + depends on the architecture of your image. The aws ec2 run-instances command returns information about the instance, + including the instance ID, and you want to remember this ID. This ID + will be referred to as INST_ID in this example. + + + Wait until the instance is running, check the status with the + aws ec2 describe-instance-status + command. Once the instance is indicated as running attach the previously created volume to your instance, + by executing the aws ec2 attach-volume + command on your local machine. + + aws ec2 attach-volume STORE_VOL_ID INST_ID /dev/sdf + + The chosen device specified with the is arbitrary, however, you do obviously not want to pick a device node + that is already in use. + + In a different shell login to the running instance as shown in + the section. + + Check that the storage volume is attached using the + aws ec2 describe-volumes command on + your local machine. Once the volume is attached the "State" will be + shown as in-use. + + With the EBS storage volume attached to your instance create a + filesystem on the volume. There is no need to partition the volume. + In the EC2 instance that you previously logged into execute the + mkfs command. + + mkfs -t ext3 /dev/sdf + + Once the filesystem creation is complete mount the volume. + + mount dev/sdf /mnt + + With the storage volume attched, formated and mounted you + now have sufficient space to transfer the image tarball you created + earlier. From the destination directory on your local machine that + contains your tarball you can use sftp of scp to copy the tarball + to your instance. + + + scp PATH_TO_PRIVATE_KEY PATH_TO_THE_TARBALL root@PUBLIC_IP_OF_YOUR_INSTANCE:/mnt + + While the image is transfering you can create a new EC2 volume. + This new volume will become the backing store for your new AMI and + be referred to as VOL_ID + in this example. Use the aws ec2 create-volume command on your local machine as shown previously. This time you want + to make sure that the specified size matches the size of your + image file. + + aws ec2 create-volume X AV_ZONE + + It is good practice to use the size element in your + config.xml file when creating EC2 + images. Using the size element ensures that you have additional space on your root volume + and that you can match the volume size exactly to your image size. + + + As previously, wait for the volume to be created and check the + status with the aws ec2 describe-volumes command. When the volume creation process is complete, attach the new + volume to your running instance by executing the + aws ec2 attach-volume command on + your local machine. + + aws ec2 attach-volume VOL_ID INST_ID /dev/sdg + + Wait until the status for the volume changes to + in-use before proceeding. + + + By now the upload of your image tarball has probably + completed and you can unpack the image on your storage volume in + your EC2 instance. In the shell on your EC2 instance unpack the + tarball as shown below. + + + cd /mnt tar myImage.tar.bz2 - After the unpack operation completes you can dump the - image to your EBS volume that will be your backing store for your AMI, - this volume is attached to /dev/sdg in this example. In the shell - on your EC2 instance execute te dd - command as shown below. + After the unpack operation completes you can dump the + image to your EBS volume that will be your backing store for your AMI, + this volume is attached to /dev/sdg in this example. In the shell + on your EC2 instance execute te dd + command as shown below. - dd /mnt/IMAGE_FILE_NAME /dev/sdg + dd /mnt/IMAGE_FILE_NAME /dev/sdg - You have to wait until the dump process is complete before proceeding - to the next step. - + You have to wait until the dump process is complete before proceeding + to the next step. + - With the dump process complete you can now unmount the storage - volume from your EC2 instance by executing the following in the - shell of your running instance. + With the dump process complete you can now unmount the storage + volume from your EC2 instance by executing the following in the + shell of your running instance. - umount /mnt + umount /mnt - You can also exit the shell in your running EC2 instance as all - remaining commands are executed on your local machine. + You can also exit the shell in your running EC2 instance as all + remaining commands are executed on your local machine. - You must detach the volume that is intended as your AMI backing - store from your running instance. Detaching and deleting the storage - volume as well as terminating the running instance are optional. + You must detach the volume that is intended as your AMI backing + store from your running instance. Detaching and deleting the storage + volume as well as terminating the running instance are optional. - aws ec2 detach-volume VOL_ID + aws ec2 detach-volume VOL_ID aws ec2 detach-volume STORE_VOL_ID - Prior to shutting down the instance or deleting the storage volume, - wait until the detach operation has completed. This is indicated by - the available status in the - output of the aws ec2 describe-volumes command. + Prior to shutting down the instance or deleting the storage volume, + wait until the detach operation has completed. This is indicated by + the available status in the + output of the aws ec2 describe-volumes command. - aws ec2 delete-volume STORE_VOL_ID + aws ec2 delete-volume STORE_VOL_ID aws ec2 terminate-instances INST_ID - Your next step is to create a snapshot of the EBS volume that - contains your image. The aws ec2 create-snapshot command returns a snapshot ID that you want to remember and will be - referred to as SNAP_ID in this example. + Your next step is to create a snapshot of the EBS volume that + contains your image. The aws ec2 create-snapshot command returns a snapshot ID that you want to remember and will be + referred to as SNAP_ID in this example. - aws ec2 create-snapshot A_SHORT_DESCRIPTION VOL_ID + aws ec2 create-snapshot A_SHORT_DESCRIPTION VOL_ID - The process of creating the snapshot will take a while and depends on - the size of your volume. Check the status of the snapshot creation - process using the aws ec2 describe-snapshots command. Ignoring the - will create a long list of all - available snapshots. When the process is complete the "Progress" will - change to 100%. + The process of creating the snapshot will take a while and depends on + the size of your volume. Check the status of the snapshot creation + process using the aws ec2 describe-snapshots command. Ignoring the + will create a long list of all + available snapshots. When the process is complete the "Progress" will + change to 100%. - Once the snapshot is complete you can register it as an AMI - with the EC2 infrastructure using the aws ec2 register-image command. + Once the snapshot is complete you can register it as an AMI + with the EC2 infrastructure using the aws ec2 register-image command. - aws ec2 register-image A_NAME A_DESCRIPTION ARCH BOOT_KERNEL_ID /dev/sda '[{"DeviceName":"/dev/sda","Ebs": {"SnapshotId": "SNAP_ID}}]' + aws ec2 register-image A_NAME A_DESCRIPTION ARCH BOOT_KERNEL_ID /dev/sda '[{"DeviceName":"/dev/sda","Ebs": {"SnapshotId": "SNAP_ID}}]' - The aws ec2 register-image command - will return the AMI ID that you can then use to launch your - instance. + The aws ec2 register-image command + will return the AMI ID that you can then use to launch your + instance. - The process of creating an EBS backed AMI is a bit tedious. If - you create EBS backed AMIs more often it might be well worth your time - to script this process using the Amazon REST API. The aws-cli - command line interface is written in Python and you can import the - various modules to incorporate functionality in your script. Another - scripting option is to use the bot interface, another module - implemented in Python. Other interfaces in other scripting languages - are available. + The process of creating an EBS backed AMI is a bit tedious. If + you create EBS backed AMIs more often it might be well worth your time + to script this process using the Amazon REST API. The aws-cli + command line interface is written in Python and you can import the + various modules to incorporate functionality in your script. Another + scripting option is to use the bot interface, another module + implemented in Python. Other interfaces in other scripting languages + are available. - -
    + +
    diff --git a/doc/docbook/kiwi-doc-installation.xml b/doc/docbook/kiwi-doc-installation.xml index 79e57be82..2f5e7ef74 100644 --- a/doc/docbook/kiwi-doc-installation.xml +++ b/doc/docbook/kiwi-doc-installation.xml @@ -1,109 +1,109 @@ + "http://www.docbook.org/xml/4.5/docbookx.dtd"> - Installation - - KIWI - Installation - - - - Installing using Packages - Once you have added the appropriate repositories (more on - this below) to your system you can search for the kiwi packages through - the YaST interface or using zypper as shown - below. - - zypper se kiwi - - The list of packages returned by zypper contains the main package, - simply named kiwi-, the - -doc package containing the documentation files, - and the -desc- packages containing the boot - descriptions for the various image types. Installing this set of - packages is sufficient to build your images. - - Adding repositories to your system can be accomplished using the - YaST interface or the zypper ar command. - - - Distribution Provided Packages - The simplest and most straight forward way to install KIWI is - to use the packages that are part of the SUSE distribution you are - running. In openSUSE the kiwi packages are part of the "standard" - distribution and in SUSE Linux Enterprise kiwi packages are available - in the SDK channel. - - - - Packages used by SUSE Studio - If you use SUSE Studio to set up your configuration and then export - it to build locally on your machine you want to make sure to use the - same version of KIWI that SUSE Studio uses to build images. This - version of KIWI which most often differs from the version released - with a given distribution is available from the openSUSE Build - Service. The repository you want to add to your system is - http://download.opensuse.org/repositories/home:/ctso/DISTRO. - - Once you have the repository added to your system you can search - for the kiwi packages and install them as described above. - - - - Packages for Development Releases - KIWI is under active development and changes almost on a daily - basis. The development code is generally released once a week on - Friday. Sometimes the development releases contain new bugs that break - existing builds. Therefore, this is not necessarily the best release - stream to track if you are looking for critical on time builds of - already configured appliances. However, tracking this stream provides - a great opportunity for you to help in detecting such bugs and by - reporting them on the mailing list you can help the developers. Any - regression fixes are generally released as soon as they are completed. - Thus, there is no need to wait until the next scheduled release on a - Friday. If you add the http://download.opensuse.org/repositories/Virtualization:/Appliances/DISTRO repository to - your system you can track the development release. - - Once you have the repository added to your system you can search - for the kiwi packages and install them as described above. - - - - - - Installing from Source - KIWI is developed and maintained in a git repository on GitHub. - You can clone the source code using the following command. - - git clone https://github.com/openSUSE/kiwi.git - - Before installing from source you want to verify that all the - dependencies are satisfied. The best way to accomplish this is to - install all packages listed as BuildRequires - in the .spec file found in the - rpm directory. Once all dependent packages are - installed change your working directory to the - kiwi directory and build and install from - source. - - make + Installation + + KIWI + Installation + + + + Installing using Packages + Once you have added the appropriate repositories (more on + this below) to your system you can search for the kiwi packages through + the YaST interface or using zypper as shown + below. + + zypper se kiwi + + The list of packages returned by zypper contains the main package, + simply named kiwi-, the + -doc package containing the documentation files, + and the -desc- packages containing the boot + descriptions for the various image types. Installing this set of + packages is sufficient to build your images. + + Adding repositories to your system can be accomplished using the + YaST interface or the zypper ar command. + + + Distribution Provided Packages + The simplest and most straight forward way to install KIWI is + to use the packages that are part of the SUSE distribution you are + running. In openSUSE the kiwi packages are part of the "standard" + distribution and in SUSE Linux Enterprise kiwi packages are available + in the SDK channel. + + + + Packages used by SUSE Studio + If you use SUSE Studio to set up your configuration and then export + it to build locally on your machine you want to make sure to use the + same version of KIWI that SUSE Studio uses to build images. This + version of KIWI which most often differs from the version released + with a given distribution is available from the openSUSE Build + Service. The repository you want to add to your system is + http://download.opensuse.org/repositories/home:/ctso/DISTRO. + + Once you have the repository added to your system you can search + for the kiwi packages and install them as described above. + + + + Packages for Development Releases + KIWI is under active development and changes almost on a daily + basis. The development code is generally released once a week on + Friday. Sometimes the development releases contain new bugs that break + existing builds. Therefore, this is not necessarily the best release + stream to track if you are looking for critical on time builds of + already configured appliances. However, tracking this stream provides + a great opportunity for you to help in detecting such bugs and by + reporting them on the mailing list you can help the developers. Any + regression fixes are generally released as soon as they are completed. + Thus, there is no need to wait until the next scheduled release on a + Friday. If you add the http://download.opensuse.org/repositories/Virtualization:/Appliances/DISTRO repository to + your system you can track the development release. + + Once you have the repository added to your system you can search + for the kiwi packages and install them as described above. + + + + + + Installing from Source + KIWI is developed and maintained in a git repository on GitHub. + You can clone the source code using the following command. + + git clone https://github.com/openSUSE/kiwi.git + + Before installing from source you want to verify that all the + dependencies are satisfied. The best way to accomplish this is to + install all packages listed as BuildRequires + in the .spec file found in the + rpm directory. Once all dependent packages are + installed change your working directory to the + kiwi directory and build and install from + source. + + make make install - The KIWI self tests are executed using: + The KIWI self tests are executed using: - make test + make test - If you want to refresh your source with the latest checked in code - you can simply pull the latest sources from the GitHub repository - using the command shown below. + If you want to refresh your source with the latest checked in code + you can simply pull the latest sources from the GitHub repository + using the command shown below. - git pull + git pull - + diff --git a/doc/docbook/kiwi-doc-introduction.xml b/doc/docbook/kiwi-doc-introduction.xml index aca2405c9..c79ae268a 100644 --- a/doc/docbook/kiwi-doc-introduction.xml +++ b/doc/docbook/kiwi-doc-introduction.xml @@ -1,67 +1,67 @@ + "http://www.docbook.org/xml/4.5/docbookx.dtd"> - Introduction - - KIWI - Introduction - - - - What is KIWI? - KIWI is an image build system for Linux. - A Linux image may present itself in many different formats, - for example the *.iso file you - download to burn a distribution installation file to optical media is an - image. A file used by virtualization systems such as KVM, Xen, or VMware - is an image. The installation of a Linux system on your hard drive can be - turned into an image using the dd command. - Basically, you can think of an image as a Linux system in a file. - Depending on the type of the image you are dealing with you have different - options for using the image. For example you can burn an ISO image to - optical media and then boot your computer from the CD/DVD, or you can run - a Virtual Machine from the *.iso - file (image) stored on your hard drive. - - - What does KIWI do? - KIWI builds images in a variety of formats. - As an image build tool, KIWI builds images in a relatively large - number of supported image formats. The details of the image creation - process are explained in the chapter. The - image format of the image produced by KIWI is defined within a - configuration file named config.xml as described in - . - Note that not all elements and attributes that may be used in - the KIWI config.xml configuration file are listed - or described in this document. The complete schema documentation - can be accessed on the web at - , latest - version, or on you local system using the - file:///usr/share/doc/packages/kiwi/schema/kiwi.html path - as the URL in the browser. - - - How do I use KIWI? - KIWI is a command line tool that is invoked with the - kiwi command in your shell. KIWI needs to be executed - as the root user, as administrative privileges are - required for many operations that need to take place to create an image. - Therefore, when using KIWI you need to be aware of what you are doing and - a certain amount of caution is in order. Running KIWI on your system is - not inherently dangerous to your system, just keep in mind that you are - running as the root user. - An image is created in a two step process as described in the - chapter. Use - kiwi --prepare for the first step and - kiwi --create for the second step. For user convenience - KIWI also has the that combines the - prepare and create steps. - Additional introductory information can also be found on the web at - . - - + Introduction + + KIWI + Introduction + + + + What is KIWI? + KIWI is an image build system for Linux. + A Linux image may present itself in many different formats, + for example the *.iso file you + download to burn a distribution installation file to optical media is an + image. A file used by virtualization systems such as KVM, Xen, or VMware + is an image. The installation of a Linux system on your hard drive can be + turned into an image using the dd command. + Basically, you can think of an image as a Linux system in a file. + Depending on the type of the image you are dealing with you have different + options for using the image. For example you can burn an ISO image to + optical media and then boot your computer from the CD/DVD, or you can run + a Virtual Machine from the *.iso + file (image) stored on your hard drive. + + + What does KIWI do? + KIWI builds images in a variety of formats. + As an image build tool, KIWI builds images in a relatively large + number of supported image formats. The details of the image creation + process are explained in the chapter. The + image format of the image produced by KIWI is defined within a + configuration file named config.xml as described in + . + Note that not all elements and attributes that may be used in + the KIWI config.xml configuration file are listed + or described in this document. The complete schema documentation + can be accessed on the web at + , latest + version, or on you local system using the + file:///usr/share/doc/packages/kiwi/schema/kiwi.html path + as the URL in the browser. + + + How do I use KIWI? + KIWI is a command line tool that is invoked with the + kiwi command in your shell. KIWI needs to be executed + as the root user, as administrative privileges are + required for many operations that need to take place to create an image. + Therefore, when using KIWI you need to be aware of what you are doing and + a certain amount of caution is in order. Running KIWI on your system is + not inherently dangerous to your system, just keep in mind that you are + running as the root user. + An image is created in a two step process as described in the + chapter. Use + kiwi --prepare for the first step and + kiwi --create for the second step. For user convenience + KIWI also has the that combines the + prepare and create steps. + Additional introductory information can also be found on the web at + . + + diff --git a/doc/docbook/kiwi-doc-iso.xml b/doc/docbook/kiwi-doc-iso.xml index d774b0cc3..b212c843c 100644 --- a/doc/docbook/kiwi-doc-iso.xml +++ b/doc/docbook/kiwi-doc-iso.xml @@ -1,251 +1,251 @@ + "http://www.docbook.org/xml/4.5/docbookx.dtd"> - ISO Image—Live Systems - - KIWI - ISO image - - - images - ISO - - - ISO images - - A live system image is an operating System on CD or DVD. In - principle one can treat the CD/DVD as the hard disk of the system - with the restriction that you can’t write data on it. So as soon as - the media is plugged into the computer, the machine is able to boot - from that media. After some time one can login to the system and - work with it like on any other system. All write actions takes place - in RAM space and therefore all changes will be lost as soon as the - computer shuts down. - - - Building the suse-live-iso Example - - - This example is based on openSUSE and includes the KDE desktop. - + ISO Image—Live Systems + + KIWI + ISO image + + + images + ISO + + + ISO images + + A live system image is an operating System on CD or DVD. In + principle one can treat the CD/DVD as the hard disk of the system + with the restriction that you can’t write data on it. So as soon as + the media is plugged into the computer, the machine is able to boot + from that media. After some time one can login to the system and + work with it like on any other system. All write actions takes place + in RAM space and therefore all changes will be lost as soon as the + computer shuts down. + + + Building the suse-live-iso Example + + + This example is based on openSUSE and includes the KDE desktop. + cd /usr/share/doc/packages/kiwi/examples ==> select the example directory for the desired distribution change into it cd suse-... kiwi --build ./suse-live-iso -d /tmp/myiso-result --type iso - - - - Using the Image - There are two ways to use the generated ISO image: - - - - Burn the .iso file - on a CD or DVD with your preferred burn program. Plug in the - CD or DVD into a test computer and (re)boot the machine. Make - sure the computer boot from the CD drive as first boot device. - - - - Use a virtualization system to test the image directly. - Testing an iso can be done with any full virtual system for - example: + + + + Using the Image + There are two ways to use the generated ISO image: + + + + Burn the .iso file + on a CD or DVD with your preferred burn program. Plug in the + CD or DVD into a test computer and (re)boot the machine. Make + sure the computer boot from the CD drive as first boot device. + + + + Use a virtualization system to test the image directly. + Testing an iso can be done with any full virtual system for + example: cd /tmp/myiso-result qemu -cdrom ./suse-*-live-iso.*.iso - - - - - - Flavours - - KIWI supports different filesystems and boot methods along - with the ISO image type. The provided example by default uses a - clicfs compressed - root filesystem. clicfs is a fuse user space filesystem which - reads in data from a compressed image and writes data into a - cow file which can exist in RAM or in persistent area on a disk. - The result is a full writable live-system. The flags attribute - in config.xml exists to be able to have the - following alternative solutions: - - - - flags="compressed" - - Does filesystem compression with squashfs, but don’t - use an overlay filesystem for write support. A symbolic link - list is used instead and thus a split element is required in - config.xml. See the split mode - section below for details. - - - - flags="clic|clic_udf" - - Creates a FUSE based clicfs image and allows write operations - into a cow file. In case of an ISO the write happens into a - ramdisk. If clic_udf is specified the the iso is created - with an udf filesystem and thus this allows to create - live systems bigger than 4G - - - - Flags Not Set - - If no flags - attribute is set no compressed filesystem, no overlay - filesystem will be used. The root tree will be directly part - of the ISO filesystem and the paths: - /bin, /boot, - /lib, /lib64, - /opt, /sbin, and - /usr will be read-only. - - - - - - Split mode - - KIWI - split mode - - - KIWI - overlay filesystem - - If no overlay filesystem is in use but the image filesystem - is based on a compressed filesystem KIWI allows to setup which - files and directories should be writable in a so called split - section. In order to allow to login into the system, at least - the /var directory should - be writable. This is because the PAM authentication requires - to be able to report any login attempt to - /var/log/messages which therefore needs - to be writable. The following split section can be used if the - flag compressed is used: + + + + + + Flavours + + KIWI supports different filesystems and boot methods along + with the ISO image type. The provided example by default uses a + clicfs compressed + root filesystem. clicfs is a fuse user space filesystem which + reads in data from a compressed image and writes data into a + cow file which can exist in RAM or in persistent area on a disk. + The result is a full writable live-system. The flags attribute + in config.xml exists to be able to have the + following alternative solutions: + + + + flags="compressed" + + Does filesystem compression with squashfs, but don’t + use an overlay filesystem for write support. A symbolic link + list is used instead and thus a split element is required in + config.xml. See the split mode + section below for details. + + + + flags="clic|clic_udf" + + Creates a FUSE based clicfs image and allows write operations + into a cow file. In case of an ISO the write happens into a + ramdisk. If clic_udf is specified the the iso is created + with an udf filesystem and thus this allows to create + live systems bigger than 4G + + + + Flags Not Set + + If no flags + attribute is set no compressed filesystem, no overlay + filesystem will be used. The root tree will be directly part + of the ISO filesystem and the paths: + /bin, /boot, + /lib, /lib64, + /opt, /sbin, and + /usr will be read-only. + + + + + + Split mode + + KIWI + split mode + + + KIWI + overlay filesystem + + If no overlay filesystem is in use but the image filesystem + is based on a compressed filesystem KIWI allows to setup which + files and directories should be writable in a so called split + section. In order to allow to login into the system, at least + the /var directory should + be writable. This is because the PAM authentication requires + to be able to report any login attempt to + /var/log/messages which therefore needs + to be writable. The following split section can be used if the + flag compressed is used: <split> - <persistent> - <file name="/var"/> - <file name="/var/*"/> - <file name="/boot"/> - <file name="/boot/*"/> - <file name="/etc"/> - <file name="/etc/*"/> - <file name="/home"/> - <file name="/home/*"/> - <file name="/tmp"/> - <file name="/tmp/*"/> - </persistent> + <persistent> + <file name="/var"/> + <file name="/var/*"/> + <file name="/boot"/> + <file name="/boot/*"/> + <file name="/etc"/> + <file name="/etc/*"/> + <file name="/home"/> + <file name="/home/*"/> + <file name="/tmp"/> + <file name="/tmp/*"/> + </persistent> </split> + + + + Hybrid mode + + KIWI + hybrid mode + + + KIWI + USB sticks + + + A hybrid image is a iso image including a partition table and can + therefore be attached as a CD/DVD and as a + normal disk to the system. This has the advantage that a hybrid + iso live system can be burned to a CD/DVD as well as uploaded to + a USB stick. In order to activate the hybrid feature the hybrid + flag must be set to true as indicated below. + + +<type image="iso" ... hybrid="true"/> + - - Hybrid mode - - KIWI - hybrid mode - + + USB stick images - KIWI - USB sticks + KIWI + USB - A hybrid image is a iso image including a partition table and can - therefore be attached as a CD/DVD and as a - normal disk to the system. This has the advantage that a hybrid - iso live system can be burned to a CD/DVD as well as uploaded to - a USB stick. In order to activate the hybrid feature the hybrid - flag must be set to true as indicated below. + kiwi supports two types of USB stick images. The first type which + are the hybrid ISO images and basically the same as the live ISO images + and the second type which are the OEM virtual disk images. + The deployment of both types can be performed from any OS including + Windows as long as a tool to dump data onto a disk device exists + and is used. -<type image="iso" ... hybrid="true"/> - - - - - USB stick images - - KIWI - USB - - - kiwi supports two types of USB stick images. The first type which - are the hybrid ISO images and basically the same as the live ISO images - and the second type which are the OEM virtual disk images. - The deployment of both types can be performed from any OS including - Windows as long as a tool to dump data onto a disk device exists - and is used. - - - - ISO Hybrid stick - - KIWI - Hybrid stick - - - As indicated above a hybrid iso image also works as USB stick image. - If a hybrid iso is used like a disk image on a writable medium - like a USB stick it's possible to write into a persistent area on - the stick instead of the RAM. kiwi will create an additional ext2 - partition to store that information on the disk if the attribute - hybridpersistent is set to true. - + + ISO Hybrid stick + + KIWI + Hybrid stick + + + As indicated above a hybrid iso image also works as USB stick image. + If a hybrid iso is used like a disk image on a writable medium + like a USB stick it's possible to write into a persistent area on + the stick instead of the RAM. kiwi will create an additional ext2 + partition to store that information on the disk if the attribute + hybridpersistent is set to true. + <type image="iso" ... hybridpersistent="true"/> - - - OEM USB stick - - KIWI - OEM stick - - In contrast to the hybrid iso image it's also possible to - create a oem virtual disk image which is dumped on the stick. - The big advantage with this approach is, that it's possible to - create a stick which contains a live OS but also a data - partition for custom data. The data partition is a fat partition - also recognized by the Windows operating system. In order to - create such a Windows friendly stick one has to pass the option - . - kiwi --create ... --fat-storage 500 - If this option is set kiwi will use the syslinux bootloader for - the image as well as the first partition as fat partition of the - specified size. The live OS itself will live in a LVM which - allows easy manipulation of the logical root volume. For further - information about the OEM image type please refer to the OEM - chapter - - - OEM compressed / readonly USB stick - - KIWI - compressed root - - If a compressed filesystem type like clicfs is used for the - image root directory it's also possible to allow persistent - writing on the USB stick or alternatively disallow that and - let all write actions perfom in RAM only. kiwi provides the - type attribute ramonly for this purpose. So in order to create - a read-only oem stick with compressed root filesystem the - following type section is required: - <type image="oem" filesystem="clicfs" ramonly="true" .../> - - - - + + + OEM USB stick + + KIWI + OEM stick + + In contrast to the hybrid iso image it's also possible to + create a oem virtual disk image which is dumped on the stick. + The big advantage with this approach is, that it's possible to + create a stick which contains a live OS but also a data + partition for custom data. The data partition is a fat partition + also recognized by the Windows operating system. In order to + create such a Windows friendly stick one has to pass the option + . + kiwi --create ... --fat-storage 500 + If this option is set kiwi will use the syslinux bootloader for + the image as well as the first partition as fat partition of the + specified size. The live OS itself will live in a LVM which + allows easy manipulation of the logical root volume. For further + information about the OEM image type please refer to the OEM + chapter + + + OEM compressed / readonly USB stick + + KIWI + compressed root + + If a compressed filesystem type like clicfs is used for the + image root directory it's also possible to allow persistent + writing on the USB stick or alternatively disallow that and + let all write actions perfom in RAM only. kiwi provides the + type attribute ramonly for this purpose. So in order to create + a read-only oem stick with compressed root filesystem the + following type section is required: + <type image="oem" filesystem="clicfs" ramonly="true" .../> + + + + diff --git a/doc/docbook/kiwi-doc-license.xml b/doc/docbook/kiwi-doc-license.xml index a7ab0a9c9..0692fe9d7 100644 --- a/doc/docbook/kiwi-doc-license.xml +++ b/doc/docbook/kiwi-doc-license.xml @@ -1,27 +1,27 @@ + "http://www.docbook.org/xml/4.4/docbookx.dtd"> - License - Permission is granted to copy, distribute and/or modify this - document under the terms of the GNU Free Documentation License, - Version 1.2 or (at your option) version 1.3; with the Invariant - Section being this copyright notice and license. A copy of the - license version 1.2 is included in the appendix entitled GNU - Free Documentation License. - SUSE, openSUSE, the openSUSE logo, Novell, the Novell logo, the N logo, are registered trademarks - of Novell, Inc. in the United States and other countries. Linux is a registered trademark of - Linus Torvalds. All other third party trademarks are the property of - their respective owners. - All information found in this book has been compiled with utmost - attention to detail. However, this does not guarantee complete - accuracy. Neither Novell, Inc., SUSE Linux Products GmbH, the - authors, nor the translators shall be held liable for possible - errors or the consequences thereof. + License + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation License, + Version 1.2 or (at your option) version 1.3; with the Invariant + Section being this copyright notice and license. A copy of the + license version 1.2 is included in the appendix entitled GNU + Free Documentation License. + SUSE, openSUSE, the openSUSE logo, Novell, the Novell logo, the N logo, are registered trademarks + of Novell, Inc. in the United States and other countries. Linux is a registered trademark of + Linus Torvalds. All other third party trademarks are the property of + their respective owners. + All information found in this book has been compiled with utmost + attention to detail. However, this does not guarantee complete + accuracy. Neither Novell, Inc., SUSE Linux Products GmbH, the + authors, nor the translators shall be held liable for possible + errors or the consequences thereof. diff --git a/doc/docbook/kiwi-doc-lxc.xml b/doc/docbook/kiwi-doc-lxc.xml index 8846d23bc..3b1a7a5cf 100644 --- a/doc/docbook/kiwi-doc-lxc.xml +++ b/doc/docbook/kiwi-doc-lxc.xml @@ -1,139 +1,139 @@ + "http://www.docbook.org/xml/4.5/docbookx.dtd"> - Linux Containers and Docker - - KIWI - Container image - - - images - lxc - - - Container image - lxc image - - - Linux Containers (LXC) provide operating - system-level virtualization, utilizing - - Control Groups (cgroups). The - virtualization is similar to technologies in OpenVZ, Linux-VServer, - FreeBSD jails, AIX Workload Partitions, and Solaris Containers. The - network and process space of the container is separated from the - host resources using namespaces. Kernel space information is mounted - into the container root filesystem using the fstab - file in the configuration directory. The container root filesystem - provides the new user space on top of the running kernel of the host. - A Linux container has two components: the container root file system - stored in - /var/lib/lxc/CONTAINER_NAME - and the container configuration stored in - /etc/lxc/CONTAINER_NAME. - The kiwi created container image is packaged in a tarball containing - the root filesystem and the configuration. The tarball is expected - to be inflated at the root level (/) of the target system that - functions as host. + Linux Containers and Docker + + KIWI + Container image + + + images + lxc + + + Container image + lxc image + + + Linux Containers (LXC) provide operating + system-level virtualization, utilizing + + Control Groups (cgroups). The + virtualization is similar to technologies in OpenVZ, Linux-VServer, + FreeBSD jails, AIX Workload Partitions, and Solaris Containers. The + network and process space of the container is separated from the + host resources using namespaces. Kernel space information is mounted + into the container root filesystem using the fstab + file in the configuration directory. The container root filesystem + provides the new user space on top of the running kernel of the host. + A Linux container has two components: the container root file system + stored in + /var/lib/lxc/CONTAINER_NAME + and the container configuration stored in + /etc/lxc/CONTAINER_NAME. + The kiwi created container image is packaged in a tarball containing + the root filesystem and the configuration. The tarball is expected + to be inflated at the root level (/) of the target system that + functions as host. - - Docker is a shipping container system for code that can run virtually - everywhere. Basically is an extension of LXC’s capabilities. As Docker is - based on LXC, a Docker container does not include a separate operating - system. - It relies on the functionality provided by the underlying infrastructure. - As such, it can package the application and all its dependencies - in a virtual container which can be run on any Linux server. - - - On top of LXC, Docker makes it possible to deploy portable containers - across machines, shift focus on application rather than machines, - includes versioning capabilities for tracking successive versions - of a container, allows re-use of containers as a base for other - specialized components, and much more. Find more information about - Docker on its homepage at . - + + Docker is a shipping container system for code that can run virtually + everywhere. Basically is an extension of LXC’s capabilities. As Docker is + based on LXC, a Docker container does not include a separate operating + system. + It relies on the functionality provided by the underlying infrastructure. + As such, it can package the application and all its dependencies + in a virtual container which can be run on any Linux server. + + + On top of LXC, Docker makes it possible to deploy portable containers + across machines, shift focus on application rather than machines, + includes versioning capabilities for tracking successive versions + of a container, allows re-use of containers as a base for other + specialized components, and much more. Find more information about + Docker on its homepage at . + - To use Docker with KIWI, take into account the following issues: - - - - Change the image type in the type element of - the image attribute from - lxc - to docker: - <type image="docker">...</type> - - - NEVER unpack the Docker tarball! If you unpack the tarball it - will overwrite data on the host system. - Use the docker command instead. - - - - - - Building the suse-lxc-guest Example - The lxc-guest example provided with KIWI is based on recent - openSUSE releases, one example configuration per release. The example - provides a very minimal system. + To use Docker with KIWI, take into account the following issues: + + + + Change the image type in the type element of + the image attribute from + lxc + to docker: + <type image="docker">...</type> + + + NEVER unpack the Docker tarball! If you unpack the tarball it + will overwrite data on the host system. + Use the docker command instead. + + + + + + Building the suse-lxc-guest Example + The lxc-guest example provided with KIWI is based on recent + openSUSE releases, one example configuration per release. The example + provides a very minimal system. - cd /usr/share/doc/packages/kiwi/examples + cd /usr/share/doc/packages/kiwi/examples cd suse-... kiwi --prepare ./suse-lxc-guest --root /tmp/mylxc - kiwi --create /tmp/mylxc --type lxc -d /tmp/mylxc-result - + kiwi --create /tmp/mylxc --type lxc -d /tmp/mylxc-result + - - Using the Image - The created container is packaged in a tarball in the destination - directory, mylxc-result - in the example above. Move this tarball to the root level (/) of - the host machine and unpack it. The following commands assume that - the image build machine is also the host machine. + + Using the Image + The created container is packaged in a tarball in the destination + directory, mylxc-result + in the example above. Move this tarball to the root level (/) of + the host machine and unpack it. The following commands assume that + the image build machine is also the host machine. - cp /tmp/mylxc-result/suse-##.#-lxc-guest-lxc.*-1.0.0.tbz / + cp /tmp/mylxc-result/suse-##.#-lxc-guest-lxc.*-1.0.0.tbz / cd / tar -xjf suse-##.#-lxc-guest-lxc.*-1.0.0.tbz lxc-start -n os### -f /etc/lxc/os###/config - + - - Image Configuration Details - The configuration for a container does not need to contain a kernel - package. The container represents the user space that runs on top - of the kernel of the container host system. - The container itself must contain the Linux user space container - tools and thus the lxc package must - be included in the container image. - - Configure the network configuration for the container using the - vmnic element. - The mode - attribute indicates the network mode, veth - by default. While it is possible to configure multiple network - interfaces in the config.xml file, the written - conteiner configuration will only reflect the information configured - for the first vmnic - element found in the config.xml file. The - configuration for the container expects that the host has a configured - network bridge with the name br0. - For complex network setup implementations it is necessary to edit the - config file. - - The generated configuration file restricts the device access - of the container according to a generally accepted best practice - security model. The device access permissions may be modified by - editing the config file for the container. - + + Image Configuration Details + The configuration for a container does not need to contain a kernel + package. The container represents the user space that runs on top + of the kernel of the container host system. + The container itself must contain the Linux user space container + tools and thus the lxc package must + be included in the container image. + + Configure the network configuration for the container using the + vmnic element. + The mode + attribute indicates the network mode, veth + by default. While it is possible to configure multiple network + interfaces in the config.xml file, the written + conteiner configuration will only reflect the information configured + for the first vmnic + element found in the config.xml file. The + configuration for the container expects that the host has a configured + network bridge with the name br0. + For complex network setup implementations it is necessary to edit the + config file. + + The generated configuration file restricts the device access + of the container according to a generally accepted best practice + security model. The device access permissions may be modified by + editing the config file for the container. + diff --git a/doc/docbook/kiwi-doc-maintenance.xml b/doc/docbook/kiwi-doc-maintenance.xml index 4a2027a55..8f2bed684 100644 --- a/doc/docbook/kiwi-doc-maintenance.xml +++ b/doc/docbook/kiwi-doc-maintenance.xml @@ -1,103 +1,103 @@ + "http://www.docbook.org/xml/4.5/docbookx.dtd"> - Maintenance of Operating System Images - - KIWI - maintenance - - Creating an image often results in an appliance solution for a - customer and gives you the freedom of a working solution at that - time. But software develops and you don’t want your solution to - become outdated. Because of this together with an image people - always should think of image-maintenance. The - following paragraph just reflects ideas how to maintain images - created by KIWI: + Maintenance of Operating System Images + + KIWI + maintenance + + Creating an image often results in an appliance solution for a + customer and gives you the freedom of a working solution at that + time. But software develops and you don’t want your solution to + become outdated. Because of this together with an image people + always should think of image-maintenance. The + following paragraph just reflects ideas how to maintain images + created by KIWI: -
    - Image Maintenance Scenarios - - - - - - - - - - - - - - - Image Description as part of a versioning system like - Git, Subversion, etc. to track changes - - - Software package source changes - - - - Faster, because already prepared - cannot handle image description changes - requires free space to store - /tmp/myOSImage - - - - - Image Description changes - - - - Covers all possible changes - does not require storage for prepared trees - slower, because KIWI prepare runs again - - - - - - - -
    +
    + Image Maintenance Scenarios + + + + + + + + + + + + + + + Image Description as part of a versioning system like + Git, Subversion, etc. to track changes + + + Software package source changes + + + + Faster, because already prepared + cannot handle image description changes + requires free space to store + /tmp/myOSImage + + + + + Image Description changes + + + + Covers all possible changes + does not require storage for prepared trees + slower, because KIWI prepare runs again + + + + + + + +
    - The picture in shows two possible - scenarios which requires an image to become updated. The first - reason for updating an image are changes to the software, for - example a new kernel should be used. If this change doesn’t require - additional software or changes in the configuration the update can - be done by KIWI itself using its option. - In combination with KIWI allows to add - an additional repository which may be needed if the updated software - is not part of the original repository. An important thing to know - is that this additional repository is not - stored into the original config.xml file of the - image description. - Another reason for updating an image beside software updates are - configuration changes or enhancements, for example an image should - have replaced its browser with another better browser or a new - service like apache should be enabled. In principle it’s possible to - do all those changes manually within the physical extend but - concerning maintenance this would be a nightmare. Why, because it - will leave the system in an unversioned condition. Nobody knows what - has changed since the very first preparation of this image. So in - short: - - KIWI - physical extends - -
    - Don’t modify physical extends manually! -
    - Changes to the image configuration should be done within the - image description. The image description itself should be part of a - versioning system like subversion. All changes can be tracked down - then and maybe more important can be assigned to product tags and - branches. As a consequence an image must be prepared from scratch - and the old physical extend could be removed. + The picture in shows two possible + scenarios which requires an image to become updated. The first + reason for updating an image are changes to the software, for + example a new kernel should be used. If this change doesn’t require + additional software or changes in the configuration the update can + be done by KIWI itself using its option. + In combination with KIWI allows to add + an additional repository which may be needed if the updated software + is not part of the original repository. An important thing to know + is that this additional repository is not + stored into the original config.xml file of the + image description. + Another reason for updating an image beside software updates are + configuration changes or enhancements, for example an image should + have replaced its browser with another better browser or a new + service like apache should be enabled. In principle it’s possible to + do all those changes manually within the physical extend but + concerning maintenance this would be a nightmare. Why, because it + will leave the system in an unversioned condition. Nobody knows what + has changed since the very first preparation of this image. So in + short: + + KIWI + physical extends + +
    + Don’t modify physical extends manually! +
    + Changes to the image configuration should be done within the + image description. The image description itself should be part of a + versioning system like subversion. All changes can be tracked down + then and maybe more important can be assigned to product tags and + branches. As a consequence an image must be prepared from scratch + and the old physical extend could be removed.
    diff --git a/doc/docbook/kiwi-doc-migrate.xml b/doc/docbook/kiwi-doc-migrate.xml index 8c0668c4a..2d6c66116 100644 --- a/doc/docbook/kiwi-doc-migrate.xml +++ b/doc/docbook/kiwi-doc-migrate.xml @@ -1,152 +1,152 @@ + "http://www.docbook.org/xml/4.5/docbookx.dtd"> - System Analysis/Migration - - KIWI - imge analysis - - KIWI provides a module which allows you to analyse - the running system and create a report and an image description - representing the current state of the machine. Among others this allows - you to clone your currently running system into an image. The - process has the following limitations at the moment: + System Analysis/Migration + + KIWI + imge analysis + + KIWI provides a module which allows you to analyse + the running system and create a report and an image description + representing the current state of the machine. Among others this allows + you to clone your currently running system into an image. The + process has the following limitations at the moment: - - - Works for SUSE systems only (with zypper on board) - - - The process works semi automatically which means depending - on the complexity of the system some manual postprocessing might - be necessary - - + + + Works for SUSE systems only (with zypper on board) + + + The process works semi automatically which means depending + on the complexity of the system some manual postprocessing might + be necessary + + - When calling KIWI’s analysis mode it will try to find the base - version of your operating system and uses the currently active - repositories specified in the zypper database to match the software - which exists in terms of packages and patterns. The result is a list - of packages and patterns which represents your system so far. Of - course there are normally some data which doesn’t belong to any - package. These are for example configurations or user data. KIWI - collects all this information and provides it as custom data. In - addition kiwi offers different data visualisations e.g unmanaged - binary data. Along with the software analysis kiwi also checks - for enabled systemd services, augeas configuration inventory and more. - The process will not go beyond the scope of local filesystems. + When calling KIWI’s analysis mode it will try to find the base + version of your operating system and uses the currently active + repositories specified in the zypper database to match the software + which exists in terms of packages and patterns. The result is a list + of packages and patterns which represents your system so far. Of + course there are normally some data which doesn’t belong to any + package. These are for example configurations or user data. KIWI + collects all this information and provides it as custom data. In + addition kiwi offers different data visualisations e.g unmanaged + binary data. Along with the software analysis kiwi also checks + for enabled systemd services, augeas configuration inventory and more. + The process will not go beyond the scope of local filesystems. - - Create a Clean Repository Set First - When starting with the analysis it is useful to let kiwi - know about all the repositories from which packages has been - installed to the system. In a first step call: + + Create a Clean Repository Set First + When starting with the analysis it is useful to let kiwi + know about all the repositories from which packages has been + installed to the system. In a first step call: - kiwi --describe workstation + kiwi --describe workstation - This will create an HTML report where you can check which - packages and patterns could be assigned to the given base - repository. In almost all cases there will be information about - packages which couldn’t be assigned. You should go to that list - and think of the repository which contains that packages (Packman, - etc). If something is missing add it either to the zypper list on - your system or use the KIWI options … - . + This will create an HTML report where you can check which + packages and patterns could be assigned to the given base + repository. In almost all cases there will be information about + packages which couldn’t be assigned. You should go to that list + and think of the repository which contains that packages (Packman, + etc). If something is missing add it either to the zypper list on + your system or use the KIWI options … + . - Continue calling the following command only if your list is - clean and no skipped packages are used except you know - that this package can’t be provided or is not worth to become part - of the description. + Continue calling the following command only if your list is + clean and no skipped packages are used except you know + that this package can’t be provided or is not worth to become part + of the description. - kiwi --describe workstation --nofiles [--skip package ... ] - + kiwi --describe workstation --nofiles [--skip package ... ] + - - Watch the Custom Files - - KIWI - custom files - - - custom files - - Several reasons could lead to unmanaged data. In most cases - these are user data like pictures, movies but also database - files and external party software not installed as a package - belongs to it. It's up to the user to decide if these data - needs to be part of the description or not. Along with this - important custom data there are unfortunately also a bunch of - other custom data due to packaging inconsistencies or left - over data as result of an upgrade process. These data taints - your system and you are doing good in removing it. - The quality of the description depends on how well the custom - data tree is handled and how clean the system was when the - analysis was started. Those data which should become part of - the image description needs to be moved from the - /tmp/worksation/custom directory - to the /tmp/worksation/root directory - + + Watch the Custom Files + + KIWI + custom files + + + custom files + + Several reasons could lead to unmanaged data. In most cases + these are user data like pictures, movies but also database + files and external party software not installed as a package + belongs to it. It's up to the user to decide if these data + needs to be part of the description or not. Along with this + important custom data there are unfortunately also a bunch of + other custom data due to packaging inconsistencies or left + over data as result of an upgrade process. These data taints + your system and you are doing good in removing it. + The quality of the description depends on how well the custom + data tree is handled and how clean the system was when the + analysis was started. Those data which should become part of + the image description needs to be moved from the + /tmp/worksation/custom directory + to the /tmp/worksation/root directory + - - Checklist - - KIWI - checklist - - - checklist - - After that you should walk through the following check list + + Checklist + + KIWI + checklist + + + checklist + + After that you should walk through the following check list - - - Change author and contact in config.xml - - - - Set appropriate name for your image in - config.xml. - - - Add/modify default type (oem) set in config.xml if needed - - - - If you want to access any remote filesystem it’s a good - idea to let AutoYaST add them on first boot of the system - - - - Check your network setup in - /etc/sysconfig/network. Is this setup - still possible in the cloned environment? Make sure you check - for the MAC address of the card first. - - - + + + Change author and contact in config.xml + + + + Set appropriate name for your image in + config.xml. + + + Add/modify default type (oem) set in config.xml if needed + + + + If you want to access any remote filesystem it’s a good + idea to let AutoYaST add them on first boot of the system + + + + Check your network setup in + /etc/sysconfig/network. Is this setup + still possible in the cloned environment? Make sure you check + for the MAC address of the card first. + + + - - Turn Into an Image… - After the process has finished you should check the size of - the image description. The description itself shouldn’t be that - big. The size of a migrated image description mainly depends on - how many overlay files exists in the root/ directory. You should make sure to maintain - only required overlay files. Now let’s try to create a clone image - from the description. By default an OEM image which is a virtual - disk which is able to run on real hardware too is created. On - success you will also find a ISO file which is an installable - version of the OEM image. If you burn the ISO on a DVD you can use - that DVD to install your cloned image on another computer. + + Turn Into an Image… + After the process has finished you should check the size of + the image description. The description itself shouldn’t be that + big. The size of a migrated image description mainly depends on + how many overlay files exists in the root/ directory. You should make sure to maintain + only required overlay files. Now let’s try to create a clone image + from the description. By default an OEM image which is a virtual + disk which is able to run on real hardware too is created. On + success you will also find a ISO file which is an installable + version of the OEM image. If you burn the ISO on a DVD you can use + that DVD to install your cloned image on another computer. - kiwi --build /tmp/workstation -d /tmp/myResult + kiwi --build /tmp/workstation -d /tmp/myResult - If everything worked well you can test the created OEM image - in any full virtual operating system environment like Qemu or - VMware. Once created the image - description can serve for all image types KIWI supports. - + If everything worked well you can test the created OEM image + in any full virtual operating system environment like Qemu or + VMware. Once created the image + description can serve for all image types KIWI supports. + diff --git a/doc/docbook/kiwi-doc-oem.xml b/doc/docbook/kiwi-doc-oem.xml index 9d3bf367d..aae5b1dd0 100644 --- a/doc/docbook/kiwi-doc-oem.xml +++ b/doc/docbook/kiwi-doc-oem.xml @@ -1,309 +1,309 @@ + "http://www.docbook.org/xml/4.5/docbookx.dtd"> - OEM Image—Preload Systems - - KIWI - OEM image - - - images - OEM - - - OEM images - - An OEM image is a virtual disk image representing all partitions - and bootloader information in the same fashion it exists on a - physical disk. The image format matches the format of the VMX image - type. All flavors discussed previously for the VMX image type apply - to the OEM image type. + OEM Image—Preload Systems + + KIWI + OEM image + + + images + OEM + + + OEM images + + An OEM image is a virtual disk image representing all partitions + and bootloader information in the same fashion it exists on a + physical disk. The image format matches the format of the VMX image + type. All flavors discussed previously for the VMX image type apply + to the OEM image type. - The basic idea behind an OEM image is to provide the virtual - disk data for OEM vendors to support easy deployment of the system - to physical storage media. The deployment can be performed from any - OS including Windows as long as a tool to dump data onto a disk - device exists and is used. The oem image type may also be used to - deploy an image on a USB stick. A USB stick is simply a removable - physical storage device. + The basic idea behind an OEM image is to provide the virtual + disk data for OEM vendors to support easy deployment of the system + to physical storage media. The deployment can be performed from any + OS including Windows as long as a tool to dump data onto a disk + device exists and is used. The oem image type may also be used to + deploy an image on a USB stick. A USB stick is simply a removable + physical storage device. - - Building the suse-oem-preload Example + + Building the suse-oem-preload Example - The OEM example provided with KIWI is based on recent - openSUSE releases, one example configuration per release, and - includes the default and x11 patterns. The image type is a split - type utilizing the distributions default filesystem format for the - read-write partition and the squashfs filesystem for the read-only partition. - Using the additional installiso attribute creates an installable ISO - image. When booting from the ISO image the OEM disk image will be - deployed to the storage media on the booting machine (after - confirmation by the user). + The OEM example provided with KIWI is based on recent + openSUSE releases, one example configuration per release, and + includes the default and x11 patterns. The image type is a split + type utilizing the distributions default filesystem format for the + read-write partition and the squashfs filesystem for the read-only partition. + Using the additional installiso attribute creates an installable ISO + image. When booting from the ISO image the OEM disk image will be + deployed to the storage media on the booting machine (after + confirmation by the user). cd /usr/share/doc/packages/kiwi/examples ==> select the example directory for the desired distribution change into it cd suse-... kiwi --build ./suse-oem-preload -d /tmp/myoem-result --type split - + - - Using the Image - The virtual disk image created by KIWI with the commands shown - above can be tested using virtualization software such as QEMU, - VMware, or VirtualBox. The virtual disk is represented by the file - with the .raw extension, - whereas the file with the .iso extension represents the installation disk for - this oem image. The ISO image is bootable - (filename.iso) and can be burned to optical - media. It is recommended to test the image on a bare test system. - The following command shows how to use QEMU to test the OEM disk - image (filename.raw). + + Using the Image + The virtual disk image created by KIWI with the commands shown + above can be tested using virtualization software such as QEMU, + VMware, or VirtualBox. The virtual disk is represented by the file + with the .raw extension, + whereas the file with the .iso extension represents the installation disk for + this oem image. The ISO image is bootable + (filename.iso) and can be burned to optical + media. It is recommended to test the image on a bare test system. + The following command shows how to use QEMU to test the OEM disk + image (filename.raw). cd /tmp/myoem-result qemu suse-*-oem-preload.*.raw - or using the dd command you can dump the - image onto a test hard disk or USB stick and upon reboot select - the appropriate device as the boot device in the BIOS: + or using the dd command you can dump the + image onto a test hard disk or USB stick and upon reboot select + the appropriate device as the boot device in the BIOS: cd /tmp/myoem-result dd if=suse-*-oem-preload.*.raw of=/dev/device bs=32k - Note, when testing an oem image using the virtual disk image, - i.e. the .raw file, the - geometry of the disk image is not changed and therefore retains - the disk geometry of the host system. This implies that the - re-partitioning performed for a physical disk install during the - oem boot workflow will be skipped. + Note, when testing an oem image using the virtual disk image, + i.e. the .raw file, the + geometry of the disk image is not changed and therefore retains + the disk geometry of the host system. This implies that the + re-partitioning performed for a physical disk install during the + oem boot workflow will be skipped. - You can test the installation procedure in a virtual - environment using the .iso - file. In this case the re-partitioning code in the boot image will - be executed. The following commands show this procedure using - QEMU. + You can test the installation procedure in a virtual + environment using the .iso + file. In this case the re-partitioning code in the boot image will + be executed. The following commands show this procedure using + QEMU. cd /tmp/myoem-result qemu-img create /tmp/mydisk 20G qemu -hda /tmp/mydisk -cdrom suse-*-oem-preload.*.iso -boot d - - - - Flavours - As indicated above the use of the installiso and installstick attributes for the oem image supports - the creation of an installation image. The installation image can - be created in two formats, one suitable for CD/DVD media and a - second suitable for a USB stick. The self installing image deploys - the oem image onto the selected storage device. The installation - process is a simple image dump using the dd command. - During this process the target system remains in terminal mode. The - following configuration snippets show the use of the installiso and installstick attributes to create - the ISO or USB installation image format respectively. + - - - <type image="name" ... installiso="true"/> - Creates a .iso file - which can be burned onto a CD or a DVD. This represents an - installation CD/DVD - - - <type image="name" ... installstick="true"/> - Creates a .raw.install file which can be dumped - (dd) onto a USB stick. This represents an - installation Stick - - + + Flavours + As indicated above the use of the installiso and installstick attributes for the oem image supports + the creation of an installation image. The installation image can + be created in two formats, one suitable for CD/DVD media and a + second suitable for a USB stick. The self installing image deploys + the oem image onto the selected storage device. The installation + process is a simple image dump using the dd command. + During this process the target system remains in terminal mode. The + following configuration snippets show the use of the installiso and installstick attributes to create + the ISO or USB installation image format respectively. - - Specializing the OEM install process - It is possible to specialize the OEM install process by providing - shell scripts with the following names. For more information how - to pack the scripts and make them work in the boot code, see - the chapter . - + - preHWdetect.sh - This script is executed prior to the hardware scan on the - target machine. - - - postHWdetect.sh - This script is executed after the hardware scan on the - target machine. + <type image="name" ... installiso="true"/> + Creates a .iso file + which can be burned onto a CD or a DVD. This represents an + installation CD/DVD - preImageDump.sh - This script is executed immediately prior to the OEM - image dump onto the target storage device. + <type image="name" ... installstick="true"/> + Creates a .raw.install file which can be dumped + (dd) onto a USB stick. This represents an + installation Stick + + + + Specializing the OEM install process + It is possible to specialize the OEM install process by providing + shell scripts with the following names. For more information how + to pack the scripts and make them work in the boot code, see + the chapter . + + + preHWdetect.sh + This script is executed prior to the hardware scan on the + target machine. + - postImageDump.sh - This script is executed directly after the OEM image dump - onto the target storage device once the image checksum has - been successfully verified. - - - - + postHWdetect.sh + This script is executed after the hardware scan on the + target machine. + + + preImageDump.sh + This script is executed immediately prior to the OEM + image dump onto the target storage device. + + + postImageDump.sh + This script is executed directly after the OEM image dump + onto the target storage device once the image checksum has + been successfully verified. + + + + - - Influencing the OEM Partitioning - By default the oemboot process will create/modify a swap, - /home and / - partition. It is possible to influence the behavior with the - oem-* elements. See for details. - + + Influencing the OEM Partitioning + By default the oemboot process will create/modify a swap, + /home and / + partition. It is possible to influence the behavior with the + oem-* elements. See for details. + - - LVM Support - - KIWI - LVM support - - KIWI also provides support for LVM (Logical Volume - Management). In this mode the disk partition table will include - one lvm partition and one standard ext2 boot partition. KIWI - creates the kiwiVG volume group, unless the lvmgroup attribute - has been set, and adds logical volumes to the group based on the - configuration given by the systemdisk block - for this type. The filesystem for the volume group is determined - by the filesystem attribute - of the type element. After booting the system the user has full - control over the volume group and is free to change - (resize/increase) the group and the volumes inside. Support for - LVM has been added for all disk based image types. This includes - the vmx and oem image types. In order to use LVM the existence - of a systemdisk section is - required. The systemdisk - specification may be empty. An empty - systemdisk specification triggers - the creation of one LVM root volume with the default - kiwiVG name. - + + LVM Support + + KIWI + LVM support + + KIWI also provides support for LVM (Logical Volume + Management). In this mode the disk partition table will include + one lvm partition and one standard ext2 boot partition. KIWI + creates the kiwiVG volume group, unless the lvmgroup attribute + has been set, and adds logical volumes to the group based on the + configuration given by the systemdisk block + for this type. The filesystem for the volume group is determined + by the filesystem attribute + of the type element. After booting the system the user has full + control over the volume group and is free to change + (resize/increase) the group and the volumes inside. Support for + LVM has been added for all disk based image types. This includes + the vmx and oem image types. In order to use LVM the existence + of a systemdisk section is + required. The systemdisk + specification may be empty. An empty + systemdisk specification triggers + the creation of one LVM root volume with the default + kiwiVG name. + - kiwi --create /tmp/myoem --type split -d /tmp/myoem-result --lvm + kiwi --create /tmp/myoem --type split -d /tmp/myoem-result --lvm - With the systemdisk section you - can specify to have one or more top level directories in a - separate volume. See for a - detailed explanation. - + With the systemdisk section you + can specify to have one or more top level directories in a + separate volume. See for a + detailed explanation. + - - Partition Based Installation - The default installation method of an OEM is dumping the - entire virtual disk on the selected target disk and repartition - the disk to the real geometry. This works but will also wipe - everything which was on the disk before. KIWI also supports the - installation into already existing partitions. This means the - user can setup a disk with free partitions for the KIWI OEM - installation process. This way already existing data will not be - touched. In order to activate the partition based install mode - the following OEM option has to be set in - config.xml: + + Partition Based Installation + The default installation method of an OEM is dumping the + entire virtual disk on the selected target disk and repartition + the disk to the real geometry. This works but will also wipe + everything which was on the disk before. KIWI also supports the + installation into already existing partitions. This means the + user can setup a disk with free partitions for the KIWI OEM + installation process. This way already existing data will not be + touched. In order to activate the partition based install mode + the following OEM option has to be set in + config.xml: - <oem-partition-install>true</oem-partition-install> + <oem-partition-install>true</oem-partition-install> - Compared to the disk based install the following differences - should be mentioned: + Compared to the disk based install the following differences + should be mentioned: - - - The bootloader will be setup to boot the installed - system. There is no multiboot setup. The user is expected - to implement the setup of a multiboot bootloader. - - - - The oem options for system, swap and home doesn’t have - any effect if the installation happens in predefined - partitions. - - - There is no support for remote (PXE) OEM installation - because KIWI has to loop mount the disk image in order to - access the partitions which can’t be done remotely. - - - The raw disk image is stored uncompressed on the install - media. This is because KIWI needs to loop mount the disk - image which it can’t do if the file is only available as - compressed version. This means the install media in this - mode will be approximately double the size of a standard - install media. - - + + + The bootloader will be setup to boot the installed + system. There is no multiboot setup. The user is expected + to implement the setup of a multiboot bootloader. + + + + The oem options for system, swap and home doesn’t have + any effect if the installation happens in predefined + partitions. + + + There is no support for remote (PXE) OEM installation + because KIWI has to loop mount the disk image in order to + access the partitions which can’t be done remotely. + + + The raw disk image is stored uncompressed on the install + media. This is because KIWI needs to loop mount the disk + image which it can’t do if the file is only available as + compressed version. This means the install media in this + mode will be approximately double the size of a standard + install media. + + - - - - Network Based Installation - Instead of manually dumping the OEM image on the target device - or creating a KIWI install CD, USB stick, there is a third - method of deploying the OEM image on the target device. It's - possible to let the image be downloaded from a PXE boot server - over the network. This requires a PXE network boot server to be - setup properly in the first place For details how to do this - refer to the chapter: . If your pxe - server is running the following steps are required to setup the - install process over the network - - - Make sure you have created an install PXE tarball along with - your oem image: - <type image="oem" ... installpxe="true"/> - - - - unpack the created <image-name>.tgz file and copy the - initrd and kernel images over to your PXE server - tar -xf <image-name>.tgz + + + + Network Based Installation + Instead of manually dumping the OEM image on the target device + or creating a KIWI install CD, USB stick, there is a third + method of deploying the OEM image on the target device. It's + possible to let the image be downloaded from a PXE boot server + over the network. This requires a PXE network boot server to be + setup properly in the first place For details how to do this + refer to the chapter: . If your pxe + server is running the following steps are required to setup the + install process over the network + + + Make sure you have created an install PXE tarball along with + your oem image: + <type image="oem" ... installpxe="true"/> + + + + unpack the created <image-name>.tgz file and copy the + initrd and kernel images over to your PXE server + tar -xf <image-name>.tgz scp initrd-oemboot-*.install.* pxe.server.ip:/srv/tftpboot/boot/initrd scp initrd-oemboot-*.kernel.* pxe.server.ip:/srv/tftpboot/boot/linux - - - - Next copy the system image and md5 sum over to to the PXE - boot server - scp <image-file>.xz pxe.server.ip:/srv/tftpboot/image/ + + + + Next copy the system image and md5 sum over to to the PXE + boot server + scp <image-file>.xz pxe.server.ip:/srv/tftpboot/image/ scp <image-file>.md5 pxe.server.ip:/srv/tftpboot/image/ - - - - At last set the kernel commandline parameters to the append - line in your PXE configuration (for example: - pxelinux.cfg/default). The required - parameters are stored in the file - <image-file>.append from the - KIWI generated install tarball - Optionally the image can be stored on a FTP,HTTP server - specified via the kiwiserver and - kiwiservertype append information. In - this case make sure you copied the system image and md5 file - to the correct location on the ftp, http, etc. server. KIWI - searches the image at one place only which is below the - image/ directory on the root path of - the specified server. initrd and linux kernel are loaded by - PXE thus they require a tftp server to be present. + - - - + + At last set the kernel commandline parameters to the append + line in your PXE configuration (for example: + pxelinux.cfg/default). The required + parameters are stored in the file + <image-file>.append from the + KIWI generated install tarball + Optionally the image can be stored on a FTP,HTTP server + specified via the kiwiserver and + kiwiservertype append information. In + this case make sure you copied the system image and md5 file + to the correct location on the ftp, http, etc. server. KIWI + searches the image at one place only which is below the + image/ directory on the root path of + the specified server. initrd and linux kernel are loaded by + PXE thus they require a tftp server to be present. + + + + diff --git a/doc/docbook/kiwi-doc-pxe.xml b/doc/docbook/kiwi-doc-pxe.xml index dd47f29ce..de662bdf3 100644 --- a/doc/docbook/kiwi-doc-pxe.xml +++ b/doc/docbook/kiwi-doc-pxe.xml @@ -1,85 +1,85 @@ + "http://www.docbook.org/xml/4.5/docbookx.dtd"> - PXE Image—Thin Clients - - KIWI - PXE image - - - images - PXE - - - PXE images - - PXE is a boot protocol implemented in most BIOS implementations - which makes it so interesting. The protocol - sends DHCP requests to assign an IP address and after that it uses - tftp to download kernel and boot instructions. - - - A PXE image consists of a boot image and a system image like all - other image types too. But with a PXE image the image files are - available separately and needs to be copied at specific locations of - a network boot server. - - Setting Up the Required Services - Before you start to build PXE images with KIWI, setup the boot - server. The boot server requires the services atftp and DHCP to - run. - - Atftp Server - In order to setup the atftp server the following steps are required - - - - Install the packages atftp and - kiwi-pxeboot. - - - Edit the file - /etc/sysconfig/atftpd. Set or modify - the following variables: - - + PXE Image—Thin Clients + + KIWI + PXE image + + + images + PXE + + + PXE images + + PXE is a boot protocol implemented in most BIOS implementations + which makes it so interesting. The protocol + sends DHCP requests to assign an IP address and after that it uses + tftp to download kernel and boot instructions. + + + A PXE image consists of a boot image and a system image like all + other image types too. But with a PXE image the image files are + available separately and needs to be copied at specific locations of + a network boot server. + + Setting Up the Required Services + Before you start to build PXE images with KIWI, setup the boot + server. The boot server requires the services atftp and DHCP to + run. + + Atftp Server + In order to setup the atftp server the following steps are required + + + + Install the packages atftp and + kiwi-pxeboot. + + + Edit the file + /etc/sysconfig/atftpd. Set or modify + the following variables: + + ATFTPD_OPTIONS="--daemon --no-multicast" - - + + ATFTPD_DIRECTORY="/srv/tftpboot" - - - - - Run atftpd by - calling the command: + + + + + Run atftpd by + calling the command: rcatftpd start - - - - - - DHCP Server - In contrast to the atftp server setup the following DHCP - server setup can only serve as an example. Depending on your - network structure, the IP addresses, ranges and domain settings - needs to be adapted in order to allow the DHCP server to work - within your network. If you already have a DHCP server running - in your network, make sure that the filename and next-server - information is provided by your server. The following steps - describe how to setup a new DHCP server instance: - - - - Install the package dhcp-server. - - - - Create the file /etc/dhcpd.conf and include the - following statements: + + + + + + DHCP Server + In contrast to the atftp server setup the following DHCP + server setup can only serve as an example. Depending on your + network structure, the IP addresses, ranges and domain settings + needs to be adapted in order to allow the DHCP server to work + within your network. If you already have a DHCP server running + in your network, make sure that the filename and next-server + information is provided by your server. The following steps + describe how to setup a new DHCP server instance: + + + + Install the package dhcp-server. + + + + Create the file /etc/dhcpd.conf and include the + following statements: option domain-name "example.org"; option domain-name-servers 192.168.100.2; option broadcast-address 192.168.100.255; @@ -91,958 +91,958 @@ ddns-update-style none; ddns-updates off; log-facility local7; subnet 192.168.100.0 netmask 255.255.255.0 { - filename "pxelinux.0"; - next-server 192.168.100.2; - range dynamic-bootp 192.168.100.5 192.168.100.20; + filename "pxelinux.0"; + next-server 192.168.100.2; + range dynamic-bootp 192.168.100.5 192.168.100.20; } - - - Edit the file /etc/sysconfig/dhcpd - and setup the network interface the server should listen on: + + + Edit the file /etc/sysconfig/dhcpd + and setup the network interface the server should listen on: DHCPD_INTERFACE="eth0" - - - Run the dhcp server by calling: + + + Run the dhcp server by calling: rcdhcpd start - - - - - - Building the suse-pxe-client Example - The example provided with KIWI is based on openSUSE and - creates an image for a Wyse VX0 terminal with a 128MB flash card - and 512MB of RAM. The image makes use of the squashfs compressed - filesystem and its root tree is deployed as clicfs based - overlay system. + + + + + + Building the suse-pxe-client Example + The example provided with KIWI is based on openSUSE and + creates an image for a Wyse VX0 terminal with a 128MB flash card + and 512MB of RAM. The image makes use of the squashfs compressed + filesystem and its root tree is deployed as clicfs based + overlay system. cd /usr/share/doc/packages/kiwi/examples ==> select the example directory for the desired distribution change into it cd suse-... kiwi --build ./suse-pxe-client -d /tmp/mypxe-result --type pxe - + - - Using the Image - In order to make use of the image all related image parts - needs to be copied onto the boot server. According to the example - the following steps needs to be performed: + + Using the Image + In order to make use of the image all related image parts + needs to be copied onto the boot server. According to the example + the following steps needs to be performed: - - - Change working directory: + + + Change working directory: cd /tmp/mypxe-result - - - Copy of the boot and kernel image: + + + Copy of the boot and kernel image: cp initrd-netboot-suse-*.splash.gz \ - /srv/tftpboot/boot/initrd + /srv/tftpboot/boot/initrd cp initrd-netboot-suse-*.kernel \ - /srv/tftpboot/boot/linux - - - Copy of the system image and md5 sum: + /srv/tftpboot/boot/linux + + + Copy of the system image and md5 sum: cp suse-*-pxe-client.* /srv/tftpboot/image - - - Copy of the image boot configuration. Normally the boot - configuration applies to one client which means it is required - to obtain the MAC address of this client. If the boot - configuration should be used globally, copy the KIWI generated - file as config.default: + + + Copy of the image boot configuration. Normally the boot + configuration applies to one client which means it is required + to obtain the MAC address of this client. If the boot + configuration should be used globally, copy the KIWI generated + file as config.default: cp suse-*-pxe-client.*.config \ - /srv/tftpboot/KIWI/config.MAC - - - Check the PXE configuration file. The PXE configuration - controls which kernel and initrd are loaded and which kernel - parameters are set. When installing the kiwi-pxeboot package, - a default configuration is added. To make sure the - configuration is valid according to this example, insert the - following information into the file - /srv/tftpboot/pxelinux.cfg/default: + /srv/tftpboot/KIWI/config.MAC + + + Check the PXE configuration file. The PXE configuration + controls which kernel and initrd are loaded and which kernel + parameters are set. When installing the kiwi-pxeboot package, + a default configuration is added. To make sure the + configuration is valid according to this example, insert the + following information into the file + /srv/tftpboot/pxelinux.cfg/default: DEFAULT KIWI-Boot LABEL KIWI-Boot - kernel boot/linux - append initrd=boot/initrd vga=0x314 - IPAPPEND 1 + kernel boot/linux + append initrd=boot/initrd vga=0x314 + IPAPPEND 1 LABEL Local-Boot - localboot 0 - - - - Connect the client to the network and boot. - - - - - - Flavours - All the different PXE boot based deployment methods are - controlled by the - config.MAC (or - config.default) file. When a new client - boots up and there is no client configuration file the new client - is registered by uploading a control file to the TFTP server. The - following sections informs about the control and the configuration - file. - - - The PXE Client Control File - This section describes the netboot client control file: + localboot 0 + + + + Connect the client to the network and boot. + + + + + + Flavours + All the different PXE boot based deployment methods are + controlled by the + config.MAC (or + config.default) file. When a new client + boots up and there is no client configuration file the new client + is registered by uploading a control file to the TFTP server. The + following sections informs about the control and the configuration + file. + + + The PXE Client Control File + This section describes the netboot client control file: hwtype.$<$MAC Address$>$ - The control file is primarily used to set up new netboot - clients. In this case, there is no configuration file - corresponding to the client MAC address available. Using the MAC - address information, the control file is created, which is - uploaded to the TFTP servers upload directory - /var/lib/tftpboot/upload. - - - - The PXE Client Configuration File - This section describes the netboot client configuration - file: + The control file is primarily used to set up new netboot + clients. In this case, there is no configuration file + corresponding to the client MAC address available. Using the MAC + address information, the control file is created, which is + uploaded to the TFTP servers upload directory + /var/lib/tftpboot/upload. + + + + The PXE Client Configuration File + This section describes the netboot client configuration + file: config.$<$MAC Address$>$ - The configuration file contains data about image, - configuration, synchronization, or partition parameters. The - configuration file is loaded from the TFTP server directory - /var/lib/tftpboot/KIWI via TFTP for - previously installed netboot clients. New netboot clients are - immediately registered and a new configuration file with the - corresponding MAC address is created. The standard case for the - deployment of a PXE image is one image file based on a - read-write filesystem which is stored onto a local storage - device of the client. Below, find an example to cover this case. + The configuration file contains data about image, + configuration, synchronization, or partition parameters. The + configuration file is loaded from the TFTP server directory + /var/lib/tftpboot/KIWI via TFTP for + previously installed netboot clients. New netboot clients are + immediately registered and a new configuration file with the + corresponding MAC address is created. The standard case for the + deployment of a PXE image is one image file based on a + read-write filesystem which is stored onto a local storage + device of the client. Below, find an example to cover this case. DISK=/dev/sda PART='5;S;x,x;L;/' IMAGE='/dev/sda2;suse-##.#-pxe-client.i686;1.2.8;192.168.100.2;4096' - The following format is used: + The following format is used: IMAGE='device;name;version;srvip;bsize;compressed,...,' CONF='src;dest;srvip;bsize;[hash],...,src;dest;srvip;bsize;[hash]' PART='size;id;Mount,...,size;id;Mount' DISK=device - - - IMAGE - - Specifies which image (name) should be loaded with - which version (version) and to which storage device - (device) it should be linked, e. g., /dev/ram1 or /dev/hda2. The netboot - client partition (device) hda2 defines the root file - system / and hda1 is used for the swap partition. The - numbering of the hard disk device should not be confused - with the RAM disk device, where /dev/ram0 is used for the - initial RAM disk and can not be used as storage device for - the second stage system image. SUSE recommends to use the - device /dev/ram1 - for the RAM disk. If the hard drive is used, a - corresponding partitioning must be performed. - - - srvip - - Specifies the server IP address for the TFTP - download. Must always be indicated, except in PART. - - - - - bsize - - Specifies the block size for the TFTP download. - Must always be indicated, except in PART. If the - block size is too small according to the maximum - number of data packages (32768), linuxrc will - automatically calculate a new blocksize for the - download. - - - - compressed - - Specifies if the image file on the TFTP server - is compressed and handles it accordingly. To specify - a compressed image download only the keyword - "compressed" needs to be added. - If compressed is not specified the standard download - workflow is used. Note: The download will fail if you - specify "compressed" and the - image isn’t compressed. It will also fail if you - don’t specify "compressed" but - the image is compressed. The name of the compressed - image has to contain the suffix .gz and needs to be - compressed with the gzip tool. - Using a compressed image will automatically - deactivate the multicast - download option of atftp. - - - - - - - CONF - - Specifies a comma-separated list of source:target - configuration files. The source (src) corresponds to the - path on the TFTP server and is loaded via TFTP. The - download is made to the file on the netboot client - indicated by the target (dest). Download only happens when - configuration files are missing on the client or, if md5sum hash - is supplied ([hash]), when different. To achieve this, list of - CONF files (and VENDOR_CONF) files is kept on the client in - the /etc/KIWI/InstalledConfigFiles backup file, and - is compared to the CONF data gathered from the config.MAC and also - from other configuration files, e.g. config.group, if supplied. - Configuration files selected for comparison are those with - same (dest) path. If destination path (dest) is same for more configuration - files, only the last one is used (and VENDOR_CONF has always - precedence to CONF). By comparing configuration file lists - present in the current CONF, VENDOR_CONF variables and stored in - the backup file, following actions can result: + + IMAGE + + Specifies which image (name) should be loaded with + which version (version) and to which storage device + (device) it should be linked, e. g., /dev/ram1 or /dev/hda2. The netboot + client partition (device) hda2 defines the root file + system / and hda1 is used for the swap partition. The + numbering of the hard disk device should not be confused + with the RAM disk device, where /dev/ram0 is used for the + initial RAM disk and can not be used as storage device for + the second stage system image. SUSE recommends to use the + device /dev/ram1 + for the RAM disk. If the hard drive is used, a + corresponding partitioning must be performed. + + + + srvip + + Specifies the server IP address for the TFTP + download. Must always be indicated, except in PART. + + + + + bsize + + Specifies the block size for the TFTP download. + Must always be indicated, except in PART. If the + block size is too small according to the maximum + number of data packages (32768), linuxrc will + automatically calculate a new blocksize for the + download. + + + + compressed + + Specifies if the image file on the TFTP server + is compressed and handles it accordingly. To specify + a compressed image download only the keyword + "compressed" needs to be added. + If compressed is not specified the standard download + workflow is used. Note: The download will fail if you + specify "compressed" and the + image isn’t compressed. It will also fail if you + don’t specify "compressed" but + the image is compressed. The name of the compressed + image has to contain the suffix .gz and needs to be + compressed with the gzip tool. + Using a compressed image will automatically + deactivate the multicast + download option of atftp. + + + + + + + CONF + + Specifies a comma-separated list of source:target + configuration files. The source (src) corresponds to the + path on the TFTP server and is loaded via TFTP. The + download is made to the file on the netboot client + indicated by the target (dest). Download only happens when + configuration files are missing on the client or, if md5sum hash + is supplied ([hash]), when different. To achieve this, list of + CONF files (and VENDOR_CONF) files is kept on the client in + the /etc/KIWI/InstalledConfigFiles backup file, and + is compared to the CONF data gathered from the config.MAC and also + from other configuration files, e.g. config.group, if supplied. + Configuration files selected for comparison are those with + same (dest) path. If destination path (dest) is same for more configuration + files, only the last one is used (and VENDOR_CONF has always + precedence to CONF). By comparing configuration file lists + present in the current CONF, VENDOR_CONF variables and stored in + the backup file, following actions can result: - Configuration files synchronization possibilities - - - - - - - cfg file in CONF,VENDOR_CONF - cfg file in InstalledConfigFiles backup - action - - - - - hash_a - hash_a - nothing, keep - - - hash_a - hash_b - download from server - - - none - hash - download from server - - - hash - none - download from server - - - none - none - nothing, keep - - - present - not present - download from server (regardless hash) - - - not present - present - delete on client (regardles hash) - - - -
    - Note that actual configuration files (or their md5sum hashes) on the client machine are not tested, only data from the backup file are used. This means that - actual configuration files can be altered or even deleted without triggering any action, or, on the other hand, an action can be triggered without modifying the - configuration files, only by modifying or removing of the backup file. -
    -
    -
    - - PART - - Specifies the partitioning data. The comma-separated - list must contain the size (size), the type number (id), - and the mount point (Mount). The size is measured in MB by - default. The mount specifies the directory the partition - is mounted to. - - - The first element of the list must define the swap - partition. - - - The second element of the list must define the - root partition. - - - The swap partition must not contain a mount point. - A lowercase letter x must be set - instead. - - - If a partition should take all the space left on a - disk one can set a lower x letter - as size specification. - - - - - - RAID - - In addtion to the PART line it's also allowed to add a raid - array setup. The first parmater of the RAID line is the raid level. - So far only raid1 (mirroring) is supported. The second and third - parameter specifies the raid disk devices which makes up the array. - If a RAID line is present all partitions in PART will be created - as raid partitions. The first raid is named md0 the second one md1 - and so on. It's required to specifiy the correct raid partition in - the IMAGE line according to the PART setup. - A typical raid image setup could look like this: + Configuration files synchronization possibilities + + + + + + + cfg file in CONF,VENDOR_CONF + cfg file in InstalledConfigFiles backup + action + + + + + hash_a + hash_a + nothing, keep + + + hash_a + hash_b + download from server + + + none + hash + download from server + + + hash + none + download from server + + + none + none + nothing, keep + + + present + not present + download from server (regardless hash) + + + not present + present + delete on client (regardles hash) + + + + + Note that actual configuration files (or their md5sum hashes) on the client machine are not tested, only data from the backup file are used. This means that + actual configuration files can be altered or even deleted without triggering any action, or, on the other hand, an action can be triggered without modifying the + configuration files, only by modifying or removing of the backup file. +
    +
    +
    + + PART + + Specifies the partitioning data. The comma-separated + list must contain the size (size), the type number (id), + and the mount point (Mount). The size is measured in MB by + default. The mount specifies the directory the partition + is mounted to. + + + The first element of the list must define the swap + partition. + + + The second element of the list must define the + root partition. + + + The swap partition must not contain a mount point. + A lowercase letter x must be set + instead. + + + If a partition should take all the space left on a + disk one can set a lower x letter + as size specification. + + + + + + RAID + + In addtion to the PART line it's also allowed to add a raid + array setup. The first parmater of the RAID line is the raid level. + So far only raid1 (mirroring) is supported. The second and third + parameter specifies the raid disk devices which makes up the array. + If a RAID line is present all partitions in PART will be created + as raid partitions. The first raid is named md0 the second one md1 + and so on. It's required to specifiy the correct raid partition in + the IMAGE line according to the PART setup. + A typical raid image setup could look like this: DISK=/dev/sda RAID='1;/dev/sda;/dev/sdb' IMAGE='/dev/md1;LimeJeOS-openSUSE-##.#.i686;1.11.3;192.168.100.2;4096' PART='5;S;x,2000;83;/' - - - - DISK - - Specifies the hard disk. Used only with PART and - defines the device via which the hard disk can be - addressed, e.g., /dev/hda. - - - - REBOOT_IMAGE - - If set to a non-empty string, this will reboot the - system after the initial deployment process is done. - This means before the system init process is activated - the system is rebooted. If the machine's default boot - setup is to boot via PXE it will again boot from the - network. - - - - - FORCE_KEXEC - - During the initial deployment process kiwi checks - if the running kernel is the same as the kernel installed - via the system image. If there is a mismatch kiwi activates - the installed kernel by calling kexec. This is mostly the - same as to perform a reboot but without the need of the - BIOS or any bootloader. If FORCE_KEXEC is set to a non-empty - string kiwi will also perform kexec if the kernel versions - matches. - - - - - RELOAD_IMAGE - - If set to a non-empty string, this forces the - configured image to be loaded from the server even if the - image on the disk is up-to-date. The primary purpose of - this setting is to aid debugging. The option is sensible - only for disk based systems. - - - - RELOAD_CONFIG - - If set to a non-empty string, this forces all config - files to be loaded from the server. The primary purpose of - this setting is to aid debugging. The option is sensible - only for disk based systems. - - + + + + DISK + + Specifies the hard disk. Used only with PART and + defines the device via which the hard disk can be + addressed, e.g., /dev/hda. + + - COMBINED_IMAGE - - If set to a non-empty string, indicates that the both - image specified needs to be combined into one bootable - image, whereas the first image defines the read-write part - and the second image defines the read-only part. - - + REBOOT_IMAGE + + If set to a non-empty string, this will reboot the + system after the initial deployment process is done. + This means before the system init process is activated + the system is rebooted. If the machine's default boot + setup is to boot via PXE it will again boot from the + network. + + + - KIWI_INITRD - - Specifies the KIWI initrd to be used for local boot of - the system. The variables value must be set to the name of - the initrd file which is used via PXE network boot. If the - standard tftp setup suggested with the kiwi-pxeboot - package is used all initrd files resides in the boot/ directory below the - tftp server path /var/lib/tftpboot. - Because the tftp server do a chroot into the tftp server - path you need to specify the initrd file as the following - example shows: + FORCE_KEXEC + + During the initial deployment process kiwi checks + if the running kernel is the same as the kernel installed + via the system image. If there is a mismatch kiwi activates + the installed kernel by calling kexec. This is mostly the + same as to perform a reboot but without the need of the + BIOS or any bootloader. If FORCE_KEXEC is set to a non-empty + string kiwi will also perform kexec if the kernel versions + matches. + + + + + RELOAD_IMAGE + + If set to a non-empty string, this forces the + configured image to be loaded from the server even if the + image on the disk is up-to-date. The primary purpose of + this setting is to aid debugging. The option is sensible + only for disk based systems. + + + + RELOAD_CONFIG + + If set to a non-empty string, this forces all config + files to be loaded from the server. The primary purpose of + this setting is to aid debugging. The option is sensible + only for disk based systems. + + + + COMBINED_IMAGE + + If set to a non-empty string, indicates that the both + image specified needs to be combined into one bootable + image, whereas the first image defines the read-write part + and the second image defines the read-only part. + + + + KIWI_INITRD + + Specifies the KIWI initrd to be used for local boot of + the system. The variables value must be set to the name of + the initrd file which is used via PXE network boot. If the + standard tftp setup suggested with the kiwi-pxeboot + package is used all initrd files resides in the boot/ directory below the + tftp server path /var/lib/tftpboot. + Because the tftp server do a chroot into the tftp server + path you need to specify the initrd file as the following + example shows: KIWI_INITRD=/boot/name-of-initrd-file - - - - UNIONFS_CONFIG - - For netboot images there is the - possibility to use clicfs as container filesystem - in combination with a compressed system image. The - recommended compressed filesystem type for the system - image is clicfs. - + + + + UNIONFS_CONFIG + + For netboot images there is the + possibility to use clicfs as container filesystem + in combination with a compressed system image. The + recommended compressed filesystem type for the system + image is clicfs. + UNIONFS_CONFIG=/dev/sda2,/dev/sda3,clicfs - In this example the first device /dev/sda2 represents the - read/write filesystem and the second device /dev/sda3 represents the - compressed system image filesystem. The container - filesystem clicfs is then used to cover the read/write layer - with the read-only device to one read/write filesystem. If - a file on the read-only device is going to be written the - changes inodes are part of the read/write filesystem. - Please note the device specifications in - UNIONFS_CONFIG must correspond with - the IMAGE and PART information. The following example - should explain the interconnections: + In this example the first device /dev/sda2 represents the + read/write filesystem and the second device /dev/sda3 represents the + compressed system image filesystem. The container + filesystem clicfs is then used to cover the read/write layer + with the read-only device to one read/write filesystem. If + a file on the read-only device is going to be written the + changes inodes are part of the read/write filesystem. + Please note the device specifications in + UNIONFS_CONFIG must correspond with + the IMAGE and PART information. The following example + should explain the interconnections: DISK=/dev/sda IMAGE='/dev/sda3;image/myImage;1.1.1;192.168.1.1;4096' PART='200;S;x,300;L;/,x;L;x' UNIONFS_CONFIG=/dev/sda2,/dev/sda3,clicfs - As the second element of the PART list must define the - root partition it’s absolutely important that the first - device in UNIONFS_CONFIG references - this device as read/write device. The second device of - UNIONFS_CONFIG has to reference the - given IMAGE device name. - - - - KIWI_KERNEL_OPTIONS - - Specifies additional command line options to be passed - to the kernel when booting from disk. For instance, to - enable a splash screen, you might use - vga=0x317 - splash=silent. - - - - KIWI_BOOT_TIMEOUT - - Specifies the number of seconds to wait at the grub - boot screen when doing a local boot. The default is 10. - - - - - NBDROOT - - Mount the system image root filesystem remotely via - NBD (Network Block Device). This means there is a server - which exports the root directory of the system image via a - specified export name. The kernel provides the block layer, - together with a remote port that uses the nbd-server - program. For more information on how to set up the server, - see the nbd-server man pages. The kernel on the remote - client can set up a special network block device named - /dev/nb0 using - the nbd-client command. After this device exists, the - mount program is used to mount the root filesystem. To - allow the KIWI boot image to use that, the following - information must be provided: + As the second element of the PART list must define the + root partition it’s absolutely important that the first + device in UNIONFS_CONFIG references + this device as read/write device. The second device of + UNIONFS_CONFIG has to reference the + given IMAGE device name. + + + + KIWI_KERNEL_OPTIONS + + Specifies additional command line options to be passed + to the kernel when booting from disk. For instance, to + enable a splash screen, you might use + vga=0x317 + splash=silent. + + + + KIWI_BOOT_TIMEOUT + + Specifies the number of seconds to wait at the grub + boot screen when doing a local boot. The default is 10. + + + + + NBDROOT + + Mount the system image root filesystem remotely via + NBD (Network Block Device). This means there is a server + which exports the root directory of the system image via a + specified export name. The kernel provides the block layer, + together with a remote port that uses the nbd-server + program. For more information on how to set up the server, + see the nbd-server man pages. The kernel on the remote + client can set up a special network block device named + /dev/nb0 using + the nbd-client command. After this device exists, the + mount program is used to mount the root filesystem. To + allow the KIWI boot image to use that, the following + information must be provided: NBDROOT=NBD.Server.IP.address;\ NBD-Export-Name;/dev/NBD-Device;\ NBD-Swap-Export-Name;/dev/NBD-Swap-Device;\ NBD-Write-Export-Name;/dev/NBD-Write-Device - The server IP and the export name are mandatory - information. Whereas the other parameters are optional. - The default device names are, NBD-Device = /dev/nbd0, NBD-Swap-Device = - /dev/nbd1 and - NBD-Write-Device = /dev/ram1 - . The setup of swap and/R/W over nbd depends - on if there are export names given or not. In addition a - requested nbd swap space is only established if the client - has less than 48 MB of RAM. The optional NBD-Write-Export-Name - and NBD-Write-Device specifies a write COW location for - the root filesystem. A separate write device is only used - together with a union setup based on e.g overlayfs - - - - AOEROOT - - Mount the system image root filesystem remotely via - AoE (ATA over Ethernet). This means there is a server - which exports a block device representing the root - directory of the system image via the AoE subsystem. The - block device could be a partition of a real or a virtual - disk. In order to use the AoE subsystem I recommend to - install the aoetools and - vblade packages from here first: - . Once installed the following example shows how to - export the local /dev/sdb1 partition via AoE: + The server IP and the export name are mandatory + information. Whereas the other parameters are optional. + The default device names are, NBD-Device = /dev/nbd0, NBD-Swap-Device = + /dev/nbd1 and + NBD-Write-Device = /dev/ram1 + . The setup of swap and/R/W over nbd depends + on if there are export names given or not. In addition a + requested nbd swap space is only established if the client + has less than 48 MB of RAM. The optional NBD-Write-Export-Name + and NBD-Write-Device specifies a write COW location for + the root filesystem. A separate write device is only used + together with a union setup based on e.g overlayfs + + + + AOEROOT + + Mount the system image root filesystem remotely via + AoE (ATA over Ethernet). This means there is a server + which exports a block device representing the root + directory of the system image via the AoE subsystem. The + block device could be a partition of a real or a virtual + disk. In order to use the AoE subsystem I recommend to + install the aoetools and + vblade packages from here first: + . Once installed the following example shows how to + export the local /dev/sdb1 partition via AoE: vbladed 0 1 eth0 /dev/sdb1 - Some explanation about this command, each AoE device - is identified by a couple Major/Minor, with major between - 0-65535 and minor between 0-255. AoE is based just over - Ethernet on the OSI models so we need to indicate which - ethernet card we’ll use. In this example we export - /dev/sdb1 with a - major value of 0 and minor of 1 on the eth0 interface. We - are ready to use our partition on the network! To be able - to use the device KIWI needs the information which AoE - device contains the root filesystem. In our example this - is the device /dev/etherd/e0.1. According to this the - AOEROOT variable must be set as follows: + Some explanation about this command, each AoE device + is identified by a couple Major/Minor, with major between + 0-65535 and minor between 0-255. AoE is based just over + Ethernet on the OSI models so we need to indicate which + ethernet card we’ll use. In this example we export + /dev/sdb1 with a + major value of 0 and minor of 1 on the eth0 interface. We + are ready to use our partition on the network! To be able + to use the device KIWI needs the information which AoE + device contains the root filesystem. In our example this + is the device /dev/etherd/e0.1. According to this the + AOEROOT variable must be set as follows: AOEROOT=/dev/etherd/e0.1 - KIWI is now able to mount and use the specified AoE - device as the remote root filesystem. In case of a - compressed read-only image with clicfs, the - AOEROOT variable can also contain a device for the write - actions: + KIWI is now able to mount and use the specified AoE + device as the remote root filesystem. In case of a + compressed read-only image with clicfs, the + AOEROOT variable can also contain a device for the write + actions: AOEROOT=/dev/etherd/e0.1,/dev/ram1 - Writing to RAM is the default but you also can set - another device like another aoe location or a local device - for writing the data - - - - NFSROOT - - Mount the system image root filesystem remotely via NFS - (Network File System). This means there is a - server which exports the root filesystem of the network - client in such a way that the client can mount it - read/write. In order to do that, the boot image must know - the server IP address and the path name where the root - directory exists on this server. The information must be - provided as in the following example: + Writing to RAM is the default but you also can set + another device like another aoe location or a local device + for writing the data + + + + NFSROOT + + Mount the system image root filesystem remotely via NFS + (Network File System). This means there is a + server which exports the root filesystem of the network + client in such a way that the client can mount it + read/write. In order to do that, the boot image must know + the server IP address and the path name where the root + directory exists on this server. The information must be + provided as in the following example: NFSROOT=NFS.Server.IP.address;/path/to/root/tree - - - - KIWI_INITRD - - Specifies the KIWI initrd to be used for a local boot - of the system. The value must be set to the name of the - initrd file which is used via PXE network boot. If the - standard TFTP setup suggested with the kiwi-pxeboot - package is used, all initrd files reside in the /srv/tftpboot/boot/ - directory. Because the TFTP server does a chroot into the - TFTP server path, you must specify the initrd file as - follows: + + + + KIWI_INITRD + + Specifies the KIWI initrd to be used for a local boot + of the system. The value must be set to the name of the + initrd file which is used via PXE network boot. If the + standard TFTP setup suggested with the kiwi-pxeboot + package is used, all initrd files reside in the /srv/tftpboot/boot/ + directory. Because the TFTP server does a chroot into the + TFTP server path, you must specify the initrd file as + follows: KIWI_INITRD=/boot/name-of-initrd-file - - - - KIWI_KERNEL - - Specifies the kernel to be used for a local boot of - the system The same path rules as described for - KIWI_INITRD applies for the kernel - setup: + + + + KIWI_KERNEL + + Specifies the kernel to be used for a local boot of + the system The same path rules as described for + KIWI_INITRD applies for the kernel + setup: KIWI_KERNEL=/boot/name-of-kernel-file - - - - ERROR_INTERRUPT - - Specifies a message which is displayed during first - deployment. Along with the message a shell is provided. - This functionality should be used to send the user a - message if it’s clear the boot process will fail because - the boot environment or something else influences the PXE - boot process in a bad way. - - -
    -
    - - - User another than tftp as Download Protocol - By default all downloads controlled by the KIWI linuxrc code - are performed by an atftp call and therefore uses the tftp - protocol. With PXE the download protocol is fixed and thus you - can’t change the way how the kernel and the boot image (initrd) - is downloaded. As soon as Linux takes over control the following - download protocols http, https and ftp are supported too. KIWI - makes use of the curl program to support the - additional protocols. - - In order to select one of the additional download protocols - the following kernel parameters needs to be setup: - - - - kiwiserver - - Name or IP address of the server who implements the - protocol - - - - kiwiservertype - - Name of the download protocol which could be one of - http, https or ftp - - - - - To setup this parameters edit the file - /srv/tftpboot/pxelinux.cfg/default on - your PXE boot server and change the append line accordingly. - Please note all downloads except for kernel and initrd are now - controlled by the given server and protocol. You need to make - sure that this server provides the same directory and file - structure as initially provided by the kiwi-pxeboot package. - - - - - RAM Only Image - - KIWI - RAM only image - - If there is no local storage and no remote root mount setup - the image can be stored into the main memory of the client. - Please be aware that there should be still enough RAM space - available for the operating system after the image has been - deployed into RAM. Below, find an example: - - - - Use a read-write filesystem in - config.xml, for example - filesystem="ext3" - - - - Create - config.MAC - + + + + ERROR_INTERRUPT + + Specifies a message which is displayed during first + deployment. Along with the message a shell is provided. + This functionality should be used to send the user a + message if it’s clear the boot process will fail because + the boot environment or something else influences the PXE + boot process in a bad way. + + + + + + + User another than tftp as Download Protocol + By default all downloads controlled by the KIWI linuxrc code + are performed by an atftp call and therefore uses the tftp + protocol. With PXE the download protocol is fixed and thus you + can’t change the way how the kernel and the boot image (initrd) + is downloaded. As soon as Linux takes over control the following + download protocols http, https and ftp are supported too. KIWI + makes use of the curl program to support the + additional protocols. + + In order to select one of the additional download protocols + the following kernel parameters needs to be setup: + + + + kiwiserver + + Name or IP address of the server who implements the + protocol + + + + kiwiservertype + + Name of the download protocol which could be one of + http, https or ftp + + + + + To setup this parameters edit the file + /srv/tftpboot/pxelinux.cfg/default on + your PXE boot server and change the append line accordingly. + Please note all downloads except for kernel and initrd are now + controlled by the given server and protocol. You need to make + sure that this server provides the same directory and file + structure as initially provided by the kiwi-pxeboot package. + + + + + RAM Only Image + + KIWI + RAM only image + + If there is no local storage and no remote root mount setup + the image can be stored into the main memory of the client. + Please be aware that there should be still enough RAM space + available for the operating system after the image has been + deployed into RAM. Below, find an example: + + + + Use a read-write filesystem in + config.xml, for example + filesystem="ext3" + + + + Create + config.MAC + IMAGE='/dev/ram1;suse-##.#-pxe-client.i686;1.2.8;192.168.100.2;4096' - - - + + + - - Union Image - - KIWI - union image - - As used in the suse-pxe-client example it is possible to - make use of the clicfs overlay filesystem to combine - two filesystems into one. In case of thin clients there is often - the need for a compressed filesystem due to space limitations. - Unfortunately all common compressed filesystems provides only - read-only access. Combining a read-only filesystem with a - read-write filesystem is a solution for this problem. In order - to use a compressed root filesystem based on clicfs make sure your + + Union Image + + KIWI + union image + + As used in the suse-pxe-client example it is possible to + make use of the clicfs overlay filesystem to combine + two filesystems into one. In case of thin clients there is often + the need for a compressed filesystem due to space limitations. + Unfortunately all common compressed filesystems provides only + read-only access. Combining a read-only filesystem with a + read-write filesystem is a solution for this problem. In order + to use a compressed root filesystem based on clicfs make sure your + config.xml’s filesystem attribute + contains clicfs. + As an alternative to clicfs kiwi also supports the fuse + based unionfs utility. In contrast to clicfs which writes + a block list on the write device, unionfs points all write operations + into another filesystem which allows to mount and watch this + location separately. In order + to use a compressed root filesystem based on unionfs make sure your config.xml’s filesystem attribute - contains clicfs. - As an alternative to clicfs kiwi also supports the fuse - based unionfs utility. In contrast to clicfs which writes - a block list on the write device, unionfs points all write operations - into another filesystem which allows to mount and watch this - location separately. In order - to use a compressed root filesystem based on unionfs make sure your - config.xml’s filesystem attribute - contains squashfs. - Below find examples for the different union modes. - - - Download to Local Storage, Write to Local Storage - - union image - local-local - + contains squashfs. + Below find examples for the different union modes. + + + Download to Local Storage, Write to Local Storage + + union image + local-local + DISK=/dev/sda PART='5;S;x,400;L;/,x;L;x' IMAGE='/dev/sda2;suse-##.#-pxe-client.i386;1.2.8;192.168.100.2;4096' UNIONFS_CONFIG=/dev/sda3,/dev/sda2,unionfs KIWI_INITRD=/boot/initrd - - - Download to Local Storage, Write to RAM - - union image - local-ram - + + + Download to Local Storage, Write to RAM + + union image + local-ram + DISK=/dev/sda PART='5;S;x,400;L;/' IMAGE='/dev/sda2;suse-##.#-pxe-client.i386;1.2.8;192.168.100.2;4096' UNIONFS_CONFIG=tmpfs,/dev/sda2,unionfs - - - Mount from Remote, Write to Local Storage - - union image - remote-local - - For all of the following modes I strongly recommend to check - on a separate client machine in the network if it is possible to - access the exported read-only and read-write device locations. If - accessing devices works the image should also be able to access - them on boot. If the boot fails it should be clear that the reason - is not the exported device. - - - NFSROOT + + + Mount from Remote, Write to Local Storage + + union image + remote-local + + For all of the following modes I strongly recommend to check + on a separate client machine in the network if it is possible to + access the exported read-only and read-write device locations. If + accessing devices works the image should also be able to access + them on boot. If the boot fails it should be clear that the reason + is not the exported device. + + + NFSROOT PART='5;S;x,x;L;x' NFSROOT="192.168.100.2;/srv/kiwi-read-only-path" UNIONFS_CONFIG=/dev/sda2,nfs,unionfs - - AOEROOT + + AOEROOT PART='5;S;x,x;L;x' AOEROOT=/dev/etherd/e0.1,/dev/sda2 UNIONFS_CONFIG=/dev/sda2,aoe,unionfs - - NBDROOT + + NBDROOT PART='5;S;x,x;L;x' NBDROOT=192.168.100.7;root1;/dev/nbd0;;;;/dev/sda2 UNIONFS_CONFIG=/dev/sda2,nbd,unionfs - - - - - Mount from Remote, Write to RAM - - union image - remote-ram - - - NFSROOT + + + + + Mount from Remote, Write to RAM + + union image + remote-ram + + + NFSROOT NFSROOT="192.168.100.2;/srv/kiwi-read-only-path" UNIONFS_CONFIG=tmpfs,nfs,unionfs - - AOEROOT + + AOEROOT AOEROOT=/dev/etherd/e0.1 UNIONFS_CONFIG=tmpfs,aoe,unionfs - - NBDROOT + + NBDROOT NBDROOT=192.168.100.7;root1;/dev/nbd0 UNIONFS_CONFIG=tmpfs,nbd,unionfs - - - - - Mount from Remote, Write to Remote - - union image - remote-remote - - - NFSROOT + + + + + Mount from Remote, Write to Remote + + union image + remote-remote + + + NFSROOT NFSROOT="192.168.100.2;/srv/kiwi-read-only-path" UNIONFS_CONFIG=/srv/kiwi-read-write-path,nfs,unionfs - - AOEROOT + + AOEROOT AOEROOT=/dev/etherd/e0.1,/dev/etherd/e1.1 UNIONFS_CONFIG=aoe,aoe,unionfs - - NBDROOT + + NBDROOT NBDROOT=192.168.100.7;root1;/dev/nbd0;swap1;/dev/nbd1;write1;/dev/nbd2 UNIONFS_CONFIG=nbd,nbd,unionfs - - - - + + + + + + + Split Image + + KIWI + split image + + As an alternative to the UNIONFS_CONFIG + method it is also possible to create a split image and combine + the two portions with the COMBINED_IMAGE + method. This allows to use different filesystems without the + need for an overlay filesystem to combine them together. Below + find an example: - - Split Image - - KIWI - split image - - As an alternative to the UNIONFS_CONFIG - method it is also possible to create a split image and combine - the two portions with the COMBINED_IMAGE - method. This allows to use different filesystems without the - need for an overlay filesystem to combine them together. Below - find an example: - - - - Add a split type in config.xml, for - example + + + Add a split type in config.xml, for + example <type fsreadonly="squashfs" - image="split" fsreadwrite="ext3" boot="netboot/suse-..."/> - - - Add a split section inside the type to describe the - temporary and - persistent parts. For example: + image="split" fsreadwrite="ext3" boot="netboot/suse-..."/> + + + Add a split section inside the type to describe the + temporary and + persistent parts. For example: <split> - <temporary> - allow RAM read/write access to: - <file name="/mnt"/> - <file name="/mnt/*"/> - </temporary> - <persistent> - allow DISK read/write access to: - <file name="/var"/> - <file name="/var/*"/> - <file name="/boot"/> - <file name="/boot/*"/> - <file name="/etc"/> - <file name="/etc/*"/> - <file name="/home"/> - <file name="/home/*"/> - </persistent> + <temporary> + allow RAM read/write access to: + <file name="/mnt"/> + <file name="/mnt/*"/> + </temporary> + <persistent> + allow DISK read/write access to: + <file name="/var"/> + <file name="/var/*"/> + <file name="/boot"/> + <file name="/boot/*"/> + <file name="/etc"/> + <file name="/etc/*"/> + <file name="/home"/> + <file name="/home/*"/> + </persistent> </split> - - - Sample - config.MAC: + + + Sample + config.MAC: IMAGE='/dev/sda2;suse-##.#-pxe-client.i686;1.2.8;192.168.100.2;4096,\ - /dev/sda3;suse-##.#-pxe-client-read-write.i686;1.2.8;192.168.100.2;4096' + /dev/sda3;suse-##.#-pxe-client-read-write.i686;1.2.8;192.168.100.2;4096' PART='200;S;x,500;L;/,x;L' DISK=/dev/sda COMBINED_IMAGE=yes KIWI_INITRD=/boot/initrd - - - - - - Root Tree Over NFS - Instead of installing the image onto a local storage device - of the client it is also possible to let the client mount the - root tree via an NFS - remote mount. Below find an example: - - - - Export the KIWI prepared tree via NFS. - - - Sample - config.MAC: + + + + + + Root Tree Over NFS + Instead of installing the image onto a local storage device + of the client it is also possible to let the client mount the + root tree via an NFS + remote mount. Below find an example: + + + + Export the KIWI prepared tree via NFS. + + + Sample + config.MAC: NFSROOT=192.168.100.7;/tmp/kiwi.nfsroot - - - - - - Root Tree Over NBD - - As an alternative for root over NFS it is also possible to - let the client mount the root tree via a special network block - device. Below find an example: - - - - Use nbd-server to export the KIWI prepared tree. - - - Sample - config.MAC - + + + + + + Root Tree Over NBD + + As an alternative for root over NFS it is also possible to + let the client mount the root tree via a special network block + device. Below find an example: + + + + Use nbd-server to export the KIWI prepared tree. + + + Sample + config.MAC + NBDROOT=192.168.100.7;root1;/dev/nbd0 - - - - - - Root Tree Over AoE - As an alternative for root over NBD it is also possible to - let the client mount the root device via a special ATA over - Ethernet network block device. Below find an example: - - - - Use the vbladed command to bind a - block device to an ethernet interface. The block device can - be a disk partition or a loop device (losetup) but not a - directory like with NBD. - - - Sample - config.MAC: + + + + + + Root Tree Over AoE + As an alternative for root over NBD it is also possible to + let the client mount the root device via a special ATA over + Ethernet network block device. Below find an example: + + + + Use the vbladed command to bind a + block device to an ethernet interface. The block device can + be a disk partition or a loop device (losetup) but not a + directory like with NBD. + + + Sample + config.MAC: AOEROOT=/dev/etherd/e0.1 - This would require the following command to be called - first: + This would require the following command to be called + first: vbladed 0 1 eth0 blockdevice - - - -
    - - Hardware Grouping - While the PXE standard takes care of the ability to create hardware groups via hardware or - IP address groups, it does not take into account groups for non-contiguous hardware or IP - addresses. The PXE standard makes the assumption that each hardware group will be clearly - delineated by a range of IP addresses, or the hardware is from the same vendor. While an ideal - scenario, this may not be the case in an established, slightly dated installation where the - hardware itself has out-lived the vendors that made them. - - KIWI has the ability to create groups for non-contiguous configurations - where different hardware types may be involved due to newer equipment being rotated into - production or older hardware failing and replacements are from different vendors. In addition, - an organization might decide to organize their equipment by function, rather than by vendor, - and may not be able to use the same hardware from one end to the other. - - The Group Configuration File - To make use of the grouping functionality, some new configuration files will be - required. These configuration files currently have to be manually managed rather than - provided, however future versions of KIWI may provide a means of managing groups more - effectively once this feature stabilizes. The number of configuration files required will - depend on the number of hardware groups that will be created, rather than one configuration - file for each MAC address that will reside on the network. - There will be one configuration file that will always be required if using groups, - called: + + + + + + Hardware Grouping + While the PXE standard takes care of the ability to create hardware groups via hardware or + IP address groups, it does not take into account groups for non-contiguous hardware or IP + addresses. The PXE standard makes the assumption that each hardware group will be clearly + delineated by a range of IP addresses, or the hardware is from the same vendor. While an ideal + scenario, this may not be the case in an established, slightly dated installation where the + hardware itself has out-lived the vendors that made them. + + KIWI has the ability to create groups for non-contiguous configurations + where different hardware types may be involved due to newer equipment being rotated into + production or older hardware failing and replacements are from different vendors. In addition, + an organization might decide to organize their equipment by function, rather than by vendor, + and may not be able to use the same hardware from one end to the other. + + The Group Configuration File + To make use of the grouping functionality, some new configuration files will be + required. These configuration files currently have to be manually managed rather than + provided, however future versions of KIWI may provide a means of managing groups more + effectively once this feature stabilizes. The number of configuration files required will + depend on the number of hardware groups that will be created, rather than one configuration + file for each MAC address that will reside on the network. + There will be one configuration file that will always be required if using groups, + called: /srv/tftpboot/KIWI/config.group - This file has a new static element that must exist, and one or more dynamic - elements depending on the number of groups that will be created. For example, the - config.group file defined below lists 3 distinct groups: + This file has a new static element that must exist, and one or more dynamic + elements depending on the number of groups that will be created. For example, the + config.group file defined below lists 3 distinct groups: KIWI_GROUP="test1, test2, test3" test1_KIWI_MAC_LIST="11:11:11:11:11:11, 00:11:00:11:22:CA" @@ -1051,213 +1051,213 @@ test2_KIWI_MAC_LIST="00:22:00:44:00:4D, 99:3F:21:A2:F4:32" test3_KIWI_MAC_LIST="00:54:33:FA:44:33, 84:3D:45:2F:5F:33" - Note: The above hardware addresses contain random entries, and may not reflect actual - hardware. - As we can see in the above example the file contains 1 static element, KIWI_GROUP, and 3 - dynamic elements "test1_KIWI_MAC_LIST, test2_KIWI_MAC_LIST and test3_KIWI_MAC_LIST". The - definitions of these elements are as follows: - - - KIWI_GROUP - This element is the only static definition that needs to exist when using groups. - While there is no implicit limit to the number of groups that can be configured, it - should be kept to a minimum for reasonable management or it could quickly become - un-manageable. It will need to contain one or more group names separated by comma's (,) and - spacing (for readability). In the above example, our group names were: - - - test1 - - - test2 - - - test3 - - - Valid group names are made up of upper and lower case letters, and can use numeric, and - underscore characters. The same rules used to define bash/sh variable names should apply - here, as these names will have to be used as fully defined bash/sh variables when - linking hardware addresses to an assigned group. The following is an example that contains - valid names: + Note: The above hardware addresses contain random entries, and may not reflect actual + hardware. + As we can see in the above example the file contains 1 static element, KIWI_GROUP, and 3 + dynamic elements "test1_KIWI_MAC_LIST, test2_KIWI_MAC_LIST and test3_KIWI_MAC_LIST". The + definitions of these elements are as follows: + + + KIWI_GROUP + This element is the only static definition that needs to exist when using groups. + While there is no implicit limit to the number of groups that can be configured, it + should be kept to a minimum for reasonable management or it could quickly become + un-manageable. It will need to contain one or more group names separated by comma's (,) and + spacing (for readability). In the above example, our group names were: + + + test1 + + + test2 + + + test3 + + + Valid group names are made up of upper and lower case letters, and can use numeric, and + underscore characters. The same rules used to define bash/sh variable names should apply + here, as these names will have to be used as fully defined bash/sh variables when + linking hardware addresses to an assigned group. The following is an example that contains + valid names: KIWI_GROUP="test1, test_my_name, LIST_HARDWARE, Multple_Case_Group_1" - - - <GROUP_NAME>_KIWI_MAC_LIST - The name of this element is dynamic and depends entirely on the list of group names - that were previously defined. Each group name that was used in the KIWI_GROUP - variable, must contain a matching dynamic element, and have KIWI_MAC_LIST appended to - the name. To continue with our previous example, to create hardware lists for the groups - already defined, we need 3 dynamic elements called: - - - test1_KIWI_MAC_LIST - - - test2_KIWI_MAC_LIST - - - test3_KIWI_MAC_LIST - - - These variables will contain a comma delimited list of the hardware addresses for - all of the machines being assigned to the appropriate group, but there are some caveats - that need to be kept in mind. The first caveat is for hardware addresses that contain - the HEX characters A-F. The PXE standard uses capital letters for these characters, and - as a result KIWI does upper case comparisons, so a MAC address that is defined with - lower case letters in this list will never get matched. - The second caveat is that as the list gets longer, it can be harder to maintain - and it has the potential to slow down the booting process. However, testing has been - completed with 1500+ hosts defined, and there was little delay when transferring the - file to a single host. The file size will have a larger impact when trying to download - it to 1500+ hosts, so some consideration will have to take that into account. - The comparison itself still occurred in under half a second while searching - through all 1500+ MAC addresses across 3 defined groups. - - - - - The Group Details File - In addition to the config.group file, - each defined group will require a - config.<GROUP_NAME> file. This file is - exactly like a standard KIWI config.<MAC> file, but is - assigned to a group of hosts rather than a single unit. If we - continue with the example we used in the previous section, we - would need the following files: + + + <GROUP_NAME>_KIWI_MAC_LIST + The name of this element is dynamic and depends entirely on the list of group names + that were previously defined. Each group name that was used in the KIWI_GROUP + variable, must contain a matching dynamic element, and have KIWI_MAC_LIST appended to + the name. To continue with our previous example, to create hardware lists for the groups + already defined, we need 3 dynamic elements called: + + + test1_KIWI_MAC_LIST + + + test2_KIWI_MAC_LIST + + + test3_KIWI_MAC_LIST + + + These variables will contain a comma delimited list of the hardware addresses for + all of the machines being assigned to the appropriate group, but there are some caveats + that need to be kept in mind. The first caveat is for hardware addresses that contain + the HEX characters A-F. The PXE standard uses capital letters for these characters, and + as a result KIWI does upper case comparisons, so a MAC address that is defined with + lower case letters in this list will never get matched. + The second caveat is that as the list gets longer, it can be harder to maintain + and it has the potential to slow down the booting process. However, testing has been + completed with 1500+ hosts defined, and there was little delay when transferring the + file to a single host. The file size will have a larger impact when trying to download + it to 1500+ hosts, so some consideration will have to take that into account. + The comparison itself still occurred in under half a second while searching + through all 1500+ MAC addresses across 3 defined groups. + + + + + The Group Details File + In addition to the config.group file, + each defined group will require a + config.<GROUP_NAME> file. This file is + exactly like a standard KIWI config.<MAC> file, but is + assigned to a group of hosts rather than a single unit. If we + continue with the example we used in the previous section, we + would need the following files: /srv/tftpboot/KIWI/config.test1 /srv/tftpboot/KIWI/config.test2 /srv/tftpboot/KIWI/config.test3 - The contents of these files is the same that would normally reside in a config.<MAC> - file, and all definitions that would be supported for a single host, are supported for a - group of hosts. In addition, if a host is matched to a group, yet the config.<GROUP_NAME> - file does not exist, KIWI will error out. - For example, the following configuration file, called - config.test1 would be used for the group - called "test1": + The contents of these files is the same that would normally reside in a config.<MAC> + file, and all definitions that would be supported for a single host, are supported for a + group of hosts. In addition, if a host is matched to a group, yet the config.<GROUP_NAME> + file does not exist, KIWI will error out. + For example, the following configuration file, called + config.test1 would be used for the group + called "test1": DISK=/dev/sda PART='5;S;x,x;L;/' IMAGE='/dev/sda2;suse-##.#-pxe-client.i686;1.2.8;192.168.100.2;4096' CONF='CONFIGURATIONS/xorg.conf.test1;/etc/X11/xorg.conf;192.168.100.2;4096,\ - CONFIGURATIONS/syslog.conf;/etc/sysconfig/syslog.conf;192.168.100.2;4096' - As a result of this configuration file, the image would be - configured consistently across all the hosts assigned to test1. - The following file called config.test2, - contains a small change that may be specific to a - function: + CONFIGURATIONS/syslog.conf;/etc/sysconfig/syslog.conf;192.168.100.2;4096' + As a result of this configuration file, the image would be + configured consistently across all the hosts assigned to test1. + The following file called config.test2, + contains a small change that may be specific to a + function: DISK=/dev/sda PART='5;S;x,x;L;/' IMAGE='/dev/sda2;suse-##.#-pxe-client.i686;1.2.8;192.168.100.2;4096' CONF='CONFIGURATIONS/xorg.conf.test2;/etc/X11/xorg.conf;192.168.100.2;4096,\ - CONFIGURATIONS/syslog.conf;/etc/sysconfig/syslog.conf;192.168.100.2;4096' - As we can see, while group 1 and 2 share the syslog.conf - configuration file, they have different - xorg.conf files defined, therefore two - distinct groups with one or more hosts assigned to each group - can now be configured by managing a smaller number of - files. - - - Using Hardware Mapping to Provide Overrides - The only issue with running mixed hardware configurations - pertains primarily to hardware differences. For instance, it may - be possible to create a single, xorg.conf - file that is able to work with all of the hardware, but there is - a chance it might not be possible to do so. With this in mind, - KIWI provides a mechanism to provide "default" configurations - that works with the most common hardware configuration, while - providing hardware specific overrides to allow for any - differences and yet have all hardware linked to the same - group. - - The Hardware Mapping Elements - To make use of the hardware linking mechanism, two - additional parameters needs to be added to the group details - file, the one named - config.<group_name>. These two - elements "link" hardware specific configurations to the - appropriate systems. A general example would look like - this: + CONFIGURATIONS/syslog.conf;/etc/sysconfig/syslog.conf;192.168.100.2;4096' + As we can see, while group 1 and 2 share the syslog.conf + configuration file, they have different + xorg.conf files defined, therefore two + distinct groups with one or more hosts assigned to each group + can now be configured by managing a smaller number of + files. + + + Using Hardware Mapping to Provide Overrides + The only issue with running mixed hardware configurations + pertains primarily to hardware differences. For instance, it may + be possible to create a single, xorg.conf + file that is able to work with all of the hardware, but there is + a chance it might not be possible to do so. With this in mind, + KIWI provides a mechanism to provide "default" configurations + that works with the most common hardware configuration, while + providing hardware specific overrides to allow for any + differences and yet have all hardware linked to the same + group. + + The Hardware Mapping Elements + To make use of the hardware linking mechanism, two + additional parameters needs to be added to the group details + file, the one named + config.<group_name>. These two + elements "link" hardware specific configurations to the + appropriate systems. A general example would look like + this: HARDWARE_MAP="vendor_name_model" vendor_name_model_HARDWARE_MAP="00:00:00:11:11:11" - These parameters are not required, and the same functionality can be applied by using - multiple groups to do the same thing, but that might not be desirable to some - administrators. This feature allows for a slightly more complex group to be defined, but - the end result is a single group, that can contain multiple sub-groups ensuring - flexibility in using a mixed set of hardware. - The definitions for the above parameters are as follows: - - - HARDWARE_MAP - This element follows the same rules as defined by the KIWI_GROUP element. However, - this variable will create sub-groups used to ensure multiple types of hardware vendors - can be used within the same group. The name of the group(s) should be clearly - defined, and a good convention to follow would be to use a combination of the vendor - name with the model number or type. This would allow for cases where the same vendor - is used, but differences between alternative models requires different maps to be - used. - - - <HARDWARE_MAP_NAME>_HARDWARE_MAP - This element behaves exactly like the <GROUP_NAME>_KIWI_MAC_LIST element - defined above, in that it lists all MAC addreses that need to be linked to a hardware - map. Any host defined within the list will receive configuration files that have been - specifically defined in a hardware_config.<hardware_map> file, in addition to any - files defined within a CONF element. - - - - - The Hardware Mapping Details File - Once the hardware map has been defined, the last step is to ensure configuration - specific elements are linked to the host(s) in question. This is done by creating a new - hardware_config.<hardware_map> file. The contents of the file is quite simple, and - contains only one element called VENDOR_CONF, as the following example shows: + These parameters are not required, and the same functionality can be applied by using + multiple groups to do the same thing, but that might not be desirable to some + administrators. This feature allows for a slightly more complex group to be defined, but + the end result is a single group, that can contain multiple sub-groups ensuring + flexibility in using a mixed set of hardware. + The definitions for the above parameters are as follows: + + + HARDWARE_MAP + This element follows the same rules as defined by the KIWI_GROUP element. However, + this variable will create sub-groups used to ensure multiple types of hardware vendors + can be used within the same group. The name of the group(s) should be clearly + defined, and a good convention to follow would be to use a combination of the vendor + name with the model number or type. This would allow for cases where the same vendor + is used, but differences between alternative models requires different maps to be + used. + + + <HARDWARE_MAP_NAME>_HARDWARE_MAP + This element behaves exactly like the <GROUP_NAME>_KIWI_MAC_LIST element + defined above, in that it lists all MAC addreses that need to be linked to a hardware + map. Any host defined within the list will receive configuration files that have been + specifically defined in a hardware_config.<hardware_map> file, in addition to any + files defined within a CONF element. + + + + + The Hardware Mapping Details File + Once the hardware map has been defined, the last step is to ensure configuration + specific elements are linked to the host(s) in question. This is done by creating a new + hardware_config.<hardware_map> file. The contents of the file is quite simple, and + contains only one element called VENDOR_CONF, as the following example shows: VENDOR_CONF='CONFIGURATIONS/xorg.conf.hardware_name_model;/etc/X11/xorg.conf;192.168.100.2;4096' - The format of the VENDOR_CONF values is exactly the same as the CONF variable used in - the standard host and group configurations. In addition, files defined within this list - will over-write any files defined in the group configuration, if and only if, all of the - following cases apply: - - - The host is assigned to the current hardware map - - - The file is defined within the CONF and VENDOR_CONF elements - - - NOTE: If a file is not defined in the CONF element, but is defined in the VENDOR_CONF - element, it is simply downloaded to the host as if it was a CONF file. In this case, no - overwritting will take place as it is considered a new file. - - - A Complete Example - The following is an example of a group that is using hardware from multiple vendors. - For the purposes of this example, lets assume the group will have 10 defined hosts, seven - are imaginative HP thinstations, while the remaining three are older Maxterm thinstations. - We will also assume that the differences we are trying to address are specific to the - video card and X.Org drivers used as a result. - With this in mind, we will need the following KIWI specific files: + The format of the VENDOR_CONF values is exactly the same as the CONF variable used in + the standard host and group configurations. In addition, files defined within this list + will over-write any files defined in the group configuration, if and only if, all of the + following cases apply: + + + The host is assigned to the current hardware map + + + The file is defined within the CONF and VENDOR_CONF elements + + + NOTE: If a file is not defined in the CONF element, but is defined in the VENDOR_CONF + element, it is simply downloaded to the host as if it was a CONF file. In this case, no + overwritting will take place as it is considered a new file. + + + A Complete Example + The following is an example of a group that is using hardware from multiple vendors. + For the purposes of this example, lets assume the group will have 10 defined hosts, seven + are imaginative HP thinstations, while the remaining three are older Maxterm thinstations. + We will also assume that the differences we are trying to address are specific to the + video card and X.Org drivers used as a result. + With this in mind, we will need the following KIWI specific files: cd /srv/tftpboot/KIWI ls - config.example1 - config.group - hardware_config.maxterm_3500 - As we can see, there is a KIWI group file, the group configuration or details file, - and a new file that we have not seen before called hardware_config.maxterm_3500. We will - first look at the contents of the config,group file: + config.example1 + config.group + hardware_config.maxterm_3500 + As we can see, there is a KIWI group file, the group configuration or details file, + and a new file that we have not seen before called hardware_config.maxterm_3500. We will + first look at the contents of the config,group file: cat config.group KIWI_GROUP="example1" example1_KIWI_MAC_LIST= - "00:00:00:00:00:01 00:00:00:00:00:02 \ - 00:00:00:00:00:03 00:00:00:00:00:04 \ - 00:00:00:00:00:05 00:00:00:00:00:06 \ - 00:00:00:00:00:07 00:00:00:00:00:08 - 00:00:00:00:00:09 00:00:00:00:00:0A" - Within the file, there is a group called "example1", with ten hosts defined, in this - case with imaginary sequential MAC addresses. Next, we look at the config.example1 group - details/configuration file: + "00:00:00:00:00:01 00:00:00:00:00:02 \ + 00:00:00:00:00:03 00:00:00:00:00:04 \ + 00:00:00:00:00:05 00:00:00:00:00:06 \ + 00:00:00:00:00:07 00:00:00:00:00:08 + 00:00:00:00:00:09 00:00:00:00:00:0A" + Within the file, there is a group called "example1", with ten hosts defined, in this + case with imaginary sequential MAC addresses. Next, we look at the config.example1 group + details/configuration file: cat config.example1 KIWI_INITRD=/boot/initrd @@ -1271,54 +1271,54 @@ RELOAD_IMAGE=yes RELOAD_CONFIG=yes HARDWARE_MAP='maxterm_3500' maxterm_3500_HARDWARE_MAP='00:00:00:00:00:02 00:00:00:00:00:03 00:00:00:00:00:04' - Here, most of the standard KIWI configuration elements are in place, with a few - extras. There are three areas we want to focus our attention on, the CONF, HARDWARE_MAP - and maxterm_3500_HARDWARE_MAP variables, as they are the most critical elements to our - example. - The first parameter to look at is the CONF parameter, - which indicates a prefs.js (for Mozilla - Firefox), and a xorg.conf (for X Windows) files will be copied - to the host during boot up. These files should be considered - defaults for the group, and all hosts defined in this group - will use these files. As such, when the systems boot, both of - these files will be copied over to their local file systems - when the CONF element is processed. - Lastly, we have a hardware mapping group called "maxterm_3500", with three of the - groups hosts defined as part of of a sub-group, or hardware map. The content of this file - is as follows: + Here, most of the standard KIWI configuration elements are in place, with a few + extras. There are three areas we want to focus our attention on, the CONF, HARDWARE_MAP + and maxterm_3500_HARDWARE_MAP variables, as they are the most critical elements to our + example. + The first parameter to look at is the CONF parameter, + which indicates a prefs.js (for Mozilla + Firefox), and a xorg.conf (for X Windows) files will be copied + to the host during boot up. These files should be considered + defaults for the group, and all hosts defined in this group + will use these files. As such, when the systems boot, both of + these files will be copied over to their local file systems + when the CONF element is processed. + Lastly, we have a hardware mapping group called "maxterm_3500", with three of the + groups hosts defined as part of of a sub-group, or hardware map. The content of this file + is as follows: cat hardware_config.maxterm_3500 VENDOR_CONF='xorg.conf.maxterm_3500;/etc/X11/xorg.conf;192.168.1.2;4096, - someconfig.cfg;/etc/sysconfig/someconfig.cfg;192.168.1.2;4096' - When the VENDOR_CONF defintition is used, we are telling KIWI that all files defined - within this element, are specific to the hardware map they are linked to. As a result, any - files listed here will be transferred to a host if, and only if, the host has been linked - to the hardware map via the maxterm_3500_HARDWARE_MAP element. In our example the only - systems that will receive the xorg.conf.maxterm_3500 file will be the three maxterms we - linked to the hardware map itself. - In our VENDOR_CONF element, we are indicating two files - that should be transferred, in addition to any file - transferred during the processing of the CONF element. A - "specific" xorg.conf file, as well as - someconfig.cfg. In the case of the xorg.conf.maxterm_3500 - file, when it is transferred to the host, it will overwrite - the xorg.conf file that was previously - transferred via the CONF element. However, with the - someconfig.cfg file, because it was not - previously defined in the CONF element, it will simply get - transferred over, and is a perfect example of how one could - enable functionality that is not otherwise configured. - As a result of this example, we have seven terminals that - are using a prefs.js and generic xorg.conf file for their - system configuration, and three terminals that are using - prefs.js, a new version of the xorg.conf - file as well as a file called somconfig.cfg. For the purposes - of our example, the contents of the - prefs.js, - xorg.conf, xorg.conf.maxterm_3500 and - someconfig.cfg are arbitrary, and don't - need to be explained here. - - - + someconfig.cfg;/etc/sysconfig/someconfig.cfg;192.168.1.2;4096' + When the VENDOR_CONF defintition is used, we are telling KIWI that all files defined + within this element, are specific to the hardware map they are linked to. As a result, any + files listed here will be transferred to a host if, and only if, the host has been linked + to the hardware map via the maxterm_3500_HARDWARE_MAP element. In our example the only + systems that will receive the xorg.conf.maxterm_3500 file will be the three maxterms we + linked to the hardware map itself. + In our VENDOR_CONF element, we are indicating two files + that should be transferred, in addition to any file + transferred during the processing of the CONF element. A + "specific" xorg.conf file, as well as + someconfig.cfg. In the case of the xorg.conf.maxterm_3500 + file, when it is transferred to the host, it will overwrite + the xorg.conf file that was previously + transferred via the CONF element. However, with the + someconfig.cfg file, because it was not + previously defined in the CONF element, it will simply get + transferred over, and is a perfect example of how one could + enable functionality that is not otherwise configured. + As a result of this example, we have seven terminals that + are using a prefs.js and generic xorg.conf file for their + system configuration, and three terminals that are using + prefs.js, a new version of the xorg.conf + file as well as a file called somconfig.cfg. For the purposes + of our example, the contents of the + prefs.js, + xorg.conf, xorg.conf.maxterm_3500 and + someconfig.cfg are arbitrary, and don't + need to be explained here. + + +
    diff --git a/doc/docbook/kiwi-doc-signkey.xml b/doc/docbook/kiwi-doc-signkey.xml index acbf16579..1fce5bf6d 100644 --- a/doc/docbook/kiwi-doc-signkey.xml +++ b/doc/docbook/kiwi-doc-signkey.xml @@ -1,22 +1,22 @@ + "http://www.docbook.org/xml/4.5/docbookx.dtd"> - Adding signing keys - - package - rpm key - - - signing - build key - - - zypper - unknown package key - - The KIWI image build process uses the distribution package + Adding signing keys + + package + rpm key + + + signing + build key + + + zypper + unknown package key + + The KIWI image build process uses the distribution package management system to install the specified packages into the unpacked image tree that forms the basis for the target image. Installation of these packages requires KIWI to import the GPG keys from the build @@ -28,20 +28,20 @@ will break the image build. After the unpacked image tree is created and the package installation is complete the GPG keys are removed from from the key ring of the image root system. - In order to permanently import the package signing keys into + In order to permanently import the package signing keys into your appliance follow the steps outlined below: - - - Add the package containing the build key to the packages section - <package name="openSUSE-build-key">...</package> - - - Call the import KIWI helper function in the config.sh script - suseImportBuildKey - - + + + Add the package containing the build key to the packages section + <package name="openSUSE-build-key">...</package> + + + Call the import KIWI helper function in the config.sh script + suseImportBuildKey + + - If the image is built with these settings KIWI installs the package containing the keys and imports them permanently to the rpm keyring. + If the image is built with these settings KIWI installs the package containing the keys and imports them permanently to the rpm keyring. diff --git a/doc/docbook/kiwi-doc-source.xml b/doc/docbook/kiwi-doc-source.xml index c925c86ff..530fd3bd9 100644 --- a/doc/docbook/kiwi-doc-source.xml +++ b/doc/docbook/kiwi-doc-source.xml @@ -1,81 +1,81 @@ + "http://www.docbook.org/xml/4.5/docbookx.dtd"> - Installation Source - - KIWI - installation source - - Before you start to use any of the examples provided in the - following chapters your build system has to have a valid - installation source for the distribution you are about to create an - image for. By default, all examples will connect to the network to - find the installation source. It depends on your network bandwidth - how fast an image creation process is and in almost all cases it is - better to prepare a local installation source first. + Installation Source + + KIWI + installation source + + Before you start to use any of the examples provided in the + following chapters your build system has to have a valid + installation source for the distribution you are about to create an + image for. By default, all examples will connect to the network to + find the installation source. It depends on your network bandwidth + how fast an image creation process is and in almost all cases it is + better to prepare a local installation source first. - - Adapt the Example’s config.xml - If you can make sure you have a local installation source - it’s important to change the path attribute inside of the - repository element of the appropriate example to point to your - local source directory. A typically default repository element - looks like the following: + + Adapt the Example’s config.xml + If you can make sure you have a local installation source + it’s important to change the path attribute inside of the + repository element of the appropriate example to point to your + local source directory. A typically default repository element + looks like the following: - <repository type="yast2"> - <source path="opensuse://openSUSE:##.#/standard/"/> - </repository> - + <repository type="yast2"> + <source path="opensuse://openSUSE:##.#/standard/"/> + </repository> + - - Create a Local Installation Source - - KIWI - local installation source - - The following procedure describes how to create a local SUSE - installation source which is stored below the path /images/CDs. If you are using the - local path as described in this document you only need to flip - the given path information inside of the example - config.xml file. + + Create a Local Installation Source + + KIWI + local installation source + + The following procedure describes how to create a local SUSE + installation source which is stored below the path /images/CDs. If you are using the + local path as described in this document you only need to flip + the given path information inside of the example + config.xml file. - - - Find your SUSE standard installation CDs or the DVD and - make them available to the build system. Most Linux systems - auto-mount a previously inserted media automatically. If this - is the case you simply can change the directory to the auto - mounted path below /media. If your system doesn’t mount the device - automatically you can do this with the following command: - mount -o loop /dev/drive-device-name /mnt - - - If you do not have a DVD but a CD set, copy the contents - of all CDs into one directory. It’s - absolutely important that you first start with the - last CD and copy the first CD at last. - In case of CDs you should have a bundle of 4 CDs. Copy them in - the order 4 3 2 1. - - - Copy the contents of the CDs/DVD to your hard drive once - you have access to the media. You need at least 4GB free space - available. The following is intended to create an openSUSE - installation source: + + + Find your SUSE standard installation CDs or the DVD and + make them available to the build system. Most Linux systems + auto-mount a previously inserted media automatically. If this + is the case you simply can change the directory to the auto + mounted path below /media. If your system doesn’t mount the device + automatically you can do this with the following command: + mount -o loop /dev/drive-device-name /mnt + + + If you do not have a DVD but a CD set, copy the contents + of all CDs into one directory. It’s + absolutely important that you first start with the + last CD and copy the first CD at last. + In case of CDs you should have a bundle of 4 CDs. Copy them in + the order 4 3 2 1. + + + Copy the contents of the CDs/DVD to your hard drive once + you have access to the media. You need at least 4GB free space + available. The following is intended to create an openSUSE + installation source: - mkdir -p /image/CDs/full-##.#-i386/ + mkdir -p /image/CDs/full-##.#-i386/ cp -a /mnt/* /image/CDs/full-##.#-i386/ - Remember if you have a CD set start with number 4 first - and after that, eject the CD and insert the next one to - repeat the copy command until all CDs are copied into to - /image - - - + Remember if you have a CD set start with number 4 first + and after that, eject the CD and insert the next one to + repeat the copy command until all CDs are copied into to + /image + + + diff --git a/doc/docbook/kiwi-doc-vmx.xml b/doc/docbook/kiwi-doc-vmx.xml index 0be5c3d00..285067e27 100644 --- a/doc/docbook/kiwi-doc-vmx.xml +++ b/doc/docbook/kiwi-doc-vmx.xml @@ -1,201 +1,201 @@ + "http://www.docbook.org/xml/4.5/docbookx.dtd"> - VMX Image—Virtual Disks - - KIWI - VMX image - - - images - VMX - - - VMX images - - A VMX image is a virtual disk image for use in full - virtualization systems like Qemu or VMware. The image is a file - containing the system represented by the configured packages in - config.xml as well as partition data and bootloader - information. The size of this virtual disk can be specified by using the size element - in the config.xml file or by adding the - command line argument. - - - Building the suse-vm-guest Example - The vm-guest example provided with KIWI is based on recent - openSUSE releases, one example configuration per release. The - example uses base pattern and the virtual disk is formatted using - the distribution default filesystem. - - cd /usr/share/doc/packages/kiwi/examples + VMX Image—Virtual Disks + + KIWI + VMX image + + + images + VMX + + + VMX images + + A VMX image is a virtual disk image for use in full + virtualization systems like Qemu or VMware. The image is a file + containing the system represented by the configured packages in + config.xml as well as partition data and bootloader + information. The size of this virtual disk can be specified by using the size element + in the config.xml file or by adding the + command line argument. + + + Building the suse-vm-guest Example + The vm-guest example provided with KIWI is based on recent + openSUSE releases, one example configuration per release. The + example uses base pattern and the virtual disk is formatted using + the distribution default filesystem. + + cd /usr/share/doc/packages/kiwi/examples cd suse-... kiwi --prepare ./suse-vm-guest --root /tmp/myvm - kiwi --create /tmp/myvm --type vmx -d /tmp/myvm-result - + kiwi --create /tmp/myvm --type vmx -d /tmp/myvm-result + - - Using the Image - The generated virtual disk image serves as the hard disk of - the selected virtualization system (QEMU, VMware, etc.). The - virtual hard disk format differs across virtualization - environments. Some virtualization environments support multiple - virtual disk formats. Using the QEMU virtualization environment - test the created image with the following command: + + Using the Image + The generated virtual disk image serves as the hard disk of + the selected virtualization system (QEMU, VMware, etc.). The + virtual hard disk format differs across virtualization + environments. Some virtualization environments support multiple + virtual disk formats. Using the QEMU virtualization environment + test the created image with the following command: - cd /tmp/myvm-result + cd /tmp/myvm-result qemu suse-##.#-vm-guest.i686-1.1.2.raw -m 256 - - - - Flavours - KIWI always generates a file in the .raw format. The .raw file is a - disk image with a structure equivalent to the structure of a - physical hard disk. Individual virtualization systems have - specific formats to facilitate improved I/O performance to the - virtual disk, represented by the image file, or additional - specified virtual hard disk files. KIWI will generate a specific - format when the format attribute of the type element is added. - - <type image="vmx"... format="name"/> - - The following table lists the supported virtual disk - formats: - - - Supported Virtual Disk Formats - - KIWI - virtual disk formats - - - virtual disk formats - - - - - - - Name - Description - - - - - vmdk - Disk format for VMware - - - vhd - Disk format for Microsoft HyperV - - - ovf - Open Virtual Format requires VMware's ovftool - - - qcow2 - QEMU virtual disk format - - - -
    - - - VMware support - - KIWI - VMware - - - VMware - - A VMware image is accompanied by a guest configuration file. - This file includes information about the hardware to be - represented to the guest image by the VMware virtualization - environment as well as specification of resources such as - memory. - - Within the config.xml file it is - possible to specify the VMware configuration settings. In - addition it is possible to include selected packages in the - created image that are specific to the VM image generation. The - following config.xml snippet provides - general guidance on the elements in - config.xml. - - <packages type="vmx"> - packages you need in VMware only +
    + + + Flavours + KIWI always generates a file in the .raw format. The .raw file is a + disk image with a structure equivalent to the structure of a + physical hard disk. Individual virtualization systems have + specific formats to facilitate improved I/O performance to the + virtual disk, represented by the image file, or additional + specified virtual hard disk files. KIWI will generate a specific + format when the format attribute of the type element is added. + + <type image="vmx"... format="name"/> + + The following table lists the supported virtual disk + formats: + + + Supported Virtual Disk Formats + + KIWI + virtual disk formats + + + virtual disk formats + + + + + + + Name + Description + + + + + vmdk + Disk format for VMware + + + vhd + Disk format for Microsoft HyperV + + + ovf + Open Virtual Format requires VMware's ovftool + + + qcow2 + QEMU virtual disk format + + + +
    + + + VMware support + + KIWI + VMware + + + VMware + + A VMware image is accompanied by a guest configuration file. + This file includes information about the hardware to be + represented to the guest image by the VMware virtualization + environment as well as specification of resources such as + memory. + + Within the config.xml file it is + possible to specify the VMware configuration settings. In + addition it is possible to include selected packages in the + created image that are specific to the VM image generation. The + following config.xml snippet provides + general guidance on the elements in + config.xml. + + <packages type="vmx"> + packages you need in VMware only </packages> <type......> - <machine memory="512"> - <vmdisk controller="ide" id="0"/> - </machine> + <machine memory="512"> + <vmdisk controller="ide" id="0"/> + </machine> </type> - Given the specification above KIWI will create a VMware - guest configuration specifying the availability of 512 MB - of RAM and an IDE disk controller interface for the VM guest. - For additional information about the configuration settings - please refer to the machine section. - - The guest configuration can be loaded through VMware user - interface and may be modified through the GUI. The configuration - file has the .vmx - extension as shown in the example below. - - /tmp/myvm-result/suse-##.#-vm-guest.i686-1.1.2.vmx - - Using the format="vmdk" - attribute of the type start - tag will create the VMware formatted disk image (.vmdk file) and the required - VMware guest configuration (.vmx) file. - - In addition it is possible to create an image for the Xen - virtualization framework. By adding the bootprofile and bootkernel attributes to the - type start tag with values - of xen and xenboot, respectively. Please refer - to the for additional details. - - - - LVM Support - - KIWI - LVM support - - KIWI also provides support for LVM (Logical Volume - Management). In this mode the disk partition table will include - one lvm partition and one standard ext2 boot partition. KIWI - creates the kiwiVG volume group and adds logical volumes as they - are needed and configured according to the image type and - filesystem. After boot of the system the user has full control - over the volume group and is free to change/resize/increase the - group and the volumes inside. Support for LVM has been added for - all image types which are disk based. This includes vmx, oem and - usb. In order to use LVM for the vmx type just add the - option as part of the KIWI create step - or add the attribute lvm="true" as part of the type section in - your config.xml file. - - kiwi --create /tmp/myvm --type vmx -d /tmp/myvm-result --lvm - - With the optional systemdisk section you can set one or more - top level directories into a separate volume. See for a detailed explanation. - - -
    + Given the specification above KIWI will create a VMware + guest configuration specifying the availability of 512 MB + of RAM and an IDE disk controller interface for the VM guest. + For additional information about the configuration settings + please refer to the machine section. + + The guest configuration can be loaded through VMware user + interface and may be modified through the GUI. The configuration + file has the .vmx + extension as shown in the example below. + + /tmp/myvm-result/suse-##.#-vm-guest.i686-1.1.2.vmx + + Using the format="vmdk" + attribute of the type start + tag will create the VMware formatted disk image (.vmdk file) and the required + VMware guest configuration (.vmx) file. + + In addition it is possible to create an image for the Xen + virtualization framework. By adding the bootprofile and bootkernel attributes to the + type start tag with values + of xen and xenboot, respectively. Please refer + to the for additional details. + + + + LVM Support + + KIWI + LVM support + + KIWI also provides support for LVM (Logical Volume + Management). In this mode the disk partition table will include + one lvm partition and one standard ext2 boot partition. KIWI + creates the kiwiVG volume group and adds logical volumes as they + are needed and configured according to the image type and + filesystem. After boot of the system the user has full control + over the volume group and is free to change/resize/increase the + group and the volumes inside. Support for LVM has been added for + all image types which are disk based. This includes vmx, oem and + usb. In order to use LVM for the vmx type just add the + option as part of the KIWI create step + or add the attribute lvm="true" as part of the type section in + your config.xml file. + + kiwi --create /tmp/myvm --type vmx -d /tmp/myvm-result --lvm + + With the optional systemdisk section you can set one or more + top level directories into a separate volume. See for a detailed explanation. + + +
    diff --git a/doc/docbook/kiwi-doc-workflow.xml b/doc/docbook/kiwi-doc-workflow.xml index efa725c11..eac9ec0ad 100644 --- a/doc/docbook/kiwi-doc-workflow.xml +++ b/doc/docbook/kiwi-doc-workflow.xml @@ -1,1019 +1,1019 @@ + "http://www.docbook.org/xml/4.5/docbookx.dtd"> - Basic Workflow - - KIWI - Workflow - - - - Introduction - KIWI creates images in a two step process, as mentioned previously. - The first step, the prepare operation, generates a - so called unpacked image tree (directory) using - the information provided in the config.xml - configuration file. The config.xml file is part of the - configuration directory (tree) that describes the - image to be created by KIWI. The second step, the - create operation, creates the - packed image or image in the - specified format based on the unpacked image, information provided in the - config.xml and the boot image - description specified in the config.xml file. - Generally the KIWI provided boot image description is sufficient to meet - the needs of the image to be created. KIWI also supports the use of - custom boot images. - - - -
    - Image Creation Architecture - - - - - - - - - - - - Encapsulated system reachable via chroot - - - Encapsulated system reachable via kernel - filesystem/extension drivers - - - - -
    - - Prior to building an image with KIWI it is important to understand - the composition of an image, the general concepts of Linux, - including the boot process, and distribution concepts such as package - management. - Installation of a Linux system generally occurs by booting a target - system from an installation source such as an install CD/DVD, a live - CD/DVD, or entering the PXE boot environment. The installation process is - often driven by an installer that interacts with the user to collect - collect information about the installation. This information generally - includes the software to be installed, the - timezone, system user data, - and other information. Once all the information is collected the installer - installs the necessary and specified software onto the target system using - packages from the available software sources (repositories). After the - installation is complete the system generally reboots and enters a - configuration procedure upon startup. The configuration may be fully - automatic or it may include user interaction. - A system image, or image, is a - complete installation of a Linux system in a - file. The image represents an operational system and may or may not - contain the "final" configuration. The behavior of the image upon - deployment varies depending on image type and image configuration. With - KIWI it is possible to completely customize the initial start up behavior - of the image. This may include behavior that allows the image to simply - be deployed inside an existing virtual environment with no required - configuration at start up. It is also possible to create images that - automatically configure themselves in a known target environment. Further, - the startup of an interactive configuration procedure can be integrated - into the image to allow the user to configure the image when it is booted - for the first time. The image configuration possibilities are practically - unlimited. The image creation process with KIWI is automated and does not - require any user interaction. The required information for the image - creation process is provided in the primary configuration file named - config.xml. The image can optionally be customized - using the config.sh and - images.sh scripts. Additional customization can - be accomplished with the use of an optional - overlay tree (directory) called - root. The configuration information is stored - in the so called image description or - configuration directory (tree). -
    - - - Build Process - - KIWI - build process - - - build process - - The creation of an image with KIWI is a two step process, the - first step is called the prepare step and it - must complete successfully before the second step, the - create step can be executed. During the prepare - step KIWI creates a new root tree or so called - unpacked image. The new root tree is created in a - directory specified on the command line with the - argument or the value of the defaultroot - element in the config.xml file. This directory - will be the target for any software packages to be installed during the - image creation process. For package installation KIWI relies on the - package manager specified with the - packagemanager element in the - config.xml file. KIWI supports the - smart and zypper package - managers. The prepare step executes the following major stages: - - - - - Create Target Root Directory - - KIWI - prepare -- create target root directory - - KIWI will exit with an error if the target root tree - already exists to prevent accidental deletion of an existing - unpacked image. Using the - command line argument will force kiwi to delete the existing - target directory and create a new unpacked image in a new - directory with the same name. - - - - - Install Packages - - KIWI - prepare -- install packages - - Initially KIWI configures the package manager - (zypper by default) to be used for the image creation to use - the repositories specified in the configuration file and/or - specified on the command line. Following the repository setup the - packages specified in the - bootstrap section are installed - in a temporary workspace external to the target root tree. This - establishes the initial environment, to support the completion - of the process in chroot setting. The essential packages to - specify as part of the bootstrap environment are the - filesystem and - glibc-locale packages. The dependency chain - of these two packages is sufficient to populate the bootstrap - environment with all required software to support the installation - of packages into the new root tree. The installation of software - packages through the selected package manager may install packages - that you do not want in your image. Removing undesired packages - can be accomplished by specifying the packages you would like to - remove from the image as children of a - packages element where the - value of the type attribute - of the packages element is - set to delete. - - - - - Apply The Overlay Tree - - KIWI - prepare -- apply overlay tree - - After the package installation with the package manager is - complete, KIWI will apply all files and directories present in the - overlay directory named root inside the - configuration directory to the target root tree. This allows - you to over write any file that was installed by one of the - packages installed during the installation phase. Files and - directories will appear in the unpacked image tree in the same - location as they are found in the directory named - root. - - - - - Apply Archives - - KIWI - prepare -- apply archives - - Any archives specified with the - archive element in the - config.xml file are applied in the - specified order (top to bottom) after the overlay tree copy - operation is complete. Archives are unpacked at the top level of - the new root tree and files will be located according to their - path in the archive. As with the overlay tree, it is possible to - over write any file in the target root tree. - - - - - Execute User Defined config.sh Script - - KIWI - prepare -- user defined scripts config.sh - - At the end of the preparation stage the optional script - named config.sh is executed at the root - level of the target root tree. The primary intended use of this - script is to complete system configuration such as service - activation. For detailed description pre-defined configuration - functions consult the - man page. - - - - - Manage The New Root Tree - - KIWI - prepare -- manage target root tree - - The unpacked image directory is just a directory, as far as the - build system is concerned and you can manipulate the content of - this directory to your liking. Further, as this directory - represents a system installation you can chroot into this directory - and run in the chroot environment to make changes. However, - it is strongly discouraged to apply changes directly to the - unpacked root, as any changes you apply will be lost when the - prepare step for the image is repeated. - In addition you may introduce errors into the unpacked root tree - that may lead to very difficult to track kiwi build issues - during the create step of the image build - process. The best practice is to apply any necessary changes to - the configuration directory followed by a new prepare - operation. If you inspect the created unpacked root tree you will - find a directory named image - at the top level that you would not find on a system installed - with the distribution installer. This directory contains information - KIWI requires during the create step, including a copy of the - config.xml file. You can make modifications - to data in this directory to influence the create step, however, - as mentioned previously this is discouraged and changes will be lost - once the prepare step is repeated. - - - - - Successful completion of the prepare step - is a the pre-requisite for the create step of the - image build process. With the successful completion of the image - preparation the unpacked root tree is considered complete and consistent. - Creating the packed, or final image requires the execution of the - create step. Multiple images can be created using - the same unpacked root tree, for example it is possible to create - a self installing OEM image and a virtual machine image from - one unpacked root tree, under the condition that both image types - are specified in the config.xml when the prepare - step is executed. During the create step the - following major operations are performed by kiwi: - - + Basic Workflow - KIWI - stages + KIWI + Workflow - - - Execute User Defined images.sh Script + + + Introduction + KIWI creates images in a two step process, as mentioned previously. + The first step, the prepare operation, generates a + so called unpacked image tree (directory) using + the information provided in the config.xml + configuration file. The config.xml file is part of the + configuration directory (tree) that describes the + image to be created by KIWI. The second step, the + create operation, creates the + packed image or image in the + specified format based on the unpacked image, information provided in the + config.xml and the boot image + description specified in the config.xml file. + Generally the KIWI provided boot image description is sufficient to meet + the needs of the image to be created. KIWI also supports the use of + custom boot images. + + + +
    + Image Creation Architecture + + + + + + + + + + + + Encapsulated system reachable via chroot + + + Encapsulated system reachable via kernel + filesystem/extension drivers + + + + +
    + + Prior to building an image with KIWI it is important to understand + the composition of an image, the general concepts of Linux, + including the boot process, and distribution concepts such as package + management. + Installation of a Linux system generally occurs by booting a target + system from an installation source such as an install CD/DVD, a live + CD/DVD, or entering the PXE boot environment. The installation process is + often driven by an installer that interacts with the user to collect + collect information about the installation. This information generally + includes the software to be installed, the + timezone, system user data, + and other information. Once all the information is collected the installer + installs the necessary and specified software onto the target system using + packages from the available software sources (repositories). After the + installation is complete the system generally reboots and enters a + configuration procedure upon startup. The configuration may be fully + automatic or it may include user interaction. + A system image, or image, is a + complete installation of a Linux system in a + file. The image represents an operational system and may or may not + contain the "final" configuration. The behavior of the image upon + deployment varies depending on image type and image configuration. With + KIWI it is possible to completely customize the initial start up behavior + of the image. This may include behavior that allows the image to simply + be deployed inside an existing virtual environment with no required + configuration at start up. It is also possible to create images that + automatically configure themselves in a known target environment. Further, + the startup of an interactive configuration procedure can be integrated + into the image to allow the user to configure the image when it is booted + for the first time. The image configuration possibilities are practically + unlimited. The image creation process with KIWI is automated and does not + require any user interaction. The required information for the image + creation process is provided in the primary configuration file named + config.xml. The image can optionally be customized + using the config.sh and + images.sh scripts. Additional customization can + be accomplished with the use of an optional + overlay tree (directory) called + root. The configuration information is stored + in the so called image description or + configuration directory (tree). +
    + + + Build Process - KIWI - create -- user defined scripts images.sh + KIWI + build process - At the beginning of the image creation process the optional - images.sh script is executed at the top level - of the unpacked image directory. Unlike the - config.sh script, the - images.sh script does not have a target use - case. The script is most often used to remove files that are no - needed in the final image. For example if an appliance is being - built that is targeted for specific hardware one can remove all - unnecessary kernel drivers from the image using this script. - Consult the man page for - a detailed description of pre-defined functions available in - the images.sh script. -
    -
    - - - Create Requested Image Type - KIWI - create -- requested image types + build process - The image types that can be created from a prepared image tree - depend on the types specified in the image description - config.xml file. The configuration file - must contain contain at least one - type element. The figure below - shows the currently image types: - - -
    - Image Types - - - - - - - - - - - - - - Live Image on CD, DVD or USB stick - - - Virtual system than can be used in VMware, Xen, - Amazon Cloud, KVM, etc. virtual environments. Depending - on the format a guest configuration file is created. - - - Preload system for install media CD/DVD or USB - stick - - - Network boot image. KIWI also provides the bootp - environment via the package kiwi-pxeboot - - - - -
    -
    -
    - - Detailed information, including step by step instructions about using - the kiwi command and building specific images, as - well as the configuration of the supported image types is provided - later. - - Most Linux systems use a special boot image to control - the system boot process after the system firmware, BIOS or UEFI, - hands control of the hardware to the operating system. This boot image - is called the initrd. The Linux kernel loads the - initrd, a compressed cpio initial ramdisk, into RAM and executes - init or, if present, linuxrc. - KIWI creates the boot image as part of the create - step in the image build process. Each image type has a specialized - image description that describes the boot image. Common functionality is - shared between the boot images through a set of functions. The boot image - descriptions follow the same principles as the system image descriptions - and are provided by KIWI. The boot image descriptions provided by KIWI - cover almost all use cases and it should not be necessary for the majority - of KIWI users to implement their own boot descriptions. - -
    - Image Descriptions - - - - - - - - - - - - - Boot image descriptions are provided by KIWI, use is - recommended but not required - - - The system image description is created by the KIWI user, - or a KIWI provided template may be used - - - - -
    - - - The boot image descriptions are stored in the - /usr/share/kiwi/image/*boot - directories. KIWI selects the boot image to build based on the value of - the boot attribute of the - type element. The attribute value is - expected in the general form of - boottype/distribution - . For example to select the OEM boot image for openSUSE - version 12.1 the value of the boot - attribute should be oemboot/suse-12.1. - The boot image description only represent the initrd and as such serves - a limited purpose. The system image description created by the person - building the image is ultimately the image that runs on the target system. - Boot image descriptions are complete and consistent descriptions that - allow you to build the boot image outside of the system image build - process. The resulting boot image can be stored and re-used as described - in the section. -
    - - - Boot Image Hook-Scripts - - KIWI - hook scripts - - - hook scripts - - All KIWI created boot images contain kiwi boot code that gets - executed when the image is booted for the first time. This boot - code is different for the various image types and provides hooks - to execute user defined custom shell scripts. The shell scripts - provided by the user may extend the first boot process and are - expected to exist inside the boot image in a specific location with - specific names. The naming and timing of the execution of - the hook scripts is image type dependent and described later. - The instructions below explain the concepts of hook scripts, which is - common to all image types, and how to include the scripts - in the initrd. - - - All hook scripts must be located in the kiwi-hooks directory at the top - level of the initrd. The best approach to including the hook - scripts in the initrd is to create an archive of a kiwi-hooks directory that - contains the custom boot scripts. - mkdir kiwi-hooks ---> place all scripts inside kiwi-hooks -tar -cf kiwi-hooks.tgz kiwi-hooks/ - The tarball must be located at the top level of the image - description directory, this is the same level that contains - the config.xml file. - - - Hook scripts are executed using a predetermined name that - is hard coded into the kiwi boot code. This name is extended - using the .sh extension and differs by - boot image type. Therefore, the boot script naming in the archive - must be exact. Boot scripts are sourced in the kiwi boot code. This - provides the hook script access to all variables set in the boot - environment. This also implies that no separate shell process - is started and the boot scripts do not have to have the - executable bit set. Encoding the interpreter location with the - #! comment is superfluous. - - - Hook scripts are only executed from within kiwi's boot - code and must therefore be part of the KIWI created boot - image. Including the content of a tarball in the initrd is - accomplished by setting the value of the bootinclude attribute of the - archive element to - true in the - config.xml file as shown below: - <packages type="image"> - <archive name="kiwi-hooks.tgz" bootinclude="true"/> -</packages> - The concept of including an archive in the boot image follows - the same concepts described for the system image previously. - The setting in the system image description will have no - effect if a pre-built boot image is being used. In order to - use an archive in a pre-built boot image the archive must be - part of the boot image description in which case it is not - necessary to set the bootinclude attribute. - - - The following list provides information about the hook names, - timing of the execution, and the applicable boot image. - - - - handleSplash - - This hook is called prior to any dialog/exception message or - progress dialog. The hook can be used to customize the behavior - of the splash screen. kiwi automatically hides a plymouth or - kernel based splash screen if there is only one active console - - - - - - - init - - This hook is called before udev is started. The hook - exists only for the pxe image type. - - - - - - - preconfig|postconfig - - The hooks are called before and after the client configuration - files (CONF contents) are setup, respectively. The hooks exist - only for the pxe image type. - - - + The creation of an image with KIWI is a two step process, the + first step is called the prepare step and it + must complete successfully before the second step, the + create step can be executed. During the prepare + step KIWI creates a new root tree or so called + unpacked image. The new root tree is created in a + directory specified on the command line with the + argument or the value of the defaultroot + element in the config.xml file. This directory + will be the target for any software packages to be installed during the + image creation process. For package installation KIWI relies on the + package manager specified with the + packagemanager element in the + config.xml file. KIWI supports the + smart and zypper package + managers. The prepare step executes the following major stages: - + + - predownload|postdownload - - The hooks are called before and after the client image receives - the root filesystem, respectively. The hooks exist only for - the pxe image type. - + Create Target Root Directory + + KIWI + prepare -- create target root directory + + KIWI will exit with an error if the target root tree + already exists to prevent accidental deletion of an existing + unpacked image. Using the + command line argument will force kiwi to delete the existing + target directory and create a new unpacked image in a new + directory with the same name. - - + - preImageDump|postImageDump - - The hooks are called before and after the install image is - dumped on the target disk, respectively. The hooks exist only for - the oem image type. - + Install Packages + + KIWI + prepare -- install packages + + Initially KIWI configures the package manager + (zypper by default) to be used for the image creation to use + the repositories specified in the configuration file and/or + specified on the command line. Following the repository setup the + packages specified in the + bootstrap section are installed + in a temporary workspace external to the target root tree. This + establishes the initial environment, to support the completion + of the process in chroot setting. The essential packages to + specify as part of the bootstrap environment are the + filesystem and + glibc-locale packages. The dependency chain + of these two packages is sufficient to populate the bootstrap + environment with all required software to support the installation + of packages into the new root tree. The installation of software + packages through the selected package manager may install packages + that you do not want in your image. Removing undesired packages + can be accomplished by specifying the packages you would like to + remove from the image as children of a + packages element where the + value of the type attribute + of the packages element is + set to delete. - - + - preLoadConfiguration|postLoadConfiguration - - The hooks are called before and after the client configuration - file config.MAC is loaded, respectively. The hooks exist only for - the pxe image type. - + Apply The Overlay Tree + + KIWI + prepare -- apply overlay tree + + After the package installation with the package manager is + complete, KIWI will apply all files and directories present in the + overlay directory named root inside the + configuration directory to the target root tree. This allows + you to over write any file that was installed by one of the + packages installed during the installation phase. Files and + directories will appear in the unpacked image tree in the same + location as they are found in the directory named + root. - - + - premount|postmount - - The hooks are called before and after the client root - filesystem is mounted, respectively. The hooks exist only for - the pxe image type. - + Apply Archives + + KIWI + prepare -- apply archives + + Any archives specified with the + archive element in the + config.xml file are applied in the + specified order (top to bottom) after the overlay tree copy + operation is complete. Archives are unpacked at the top level of + the new root tree and files will be located according to their + path in the archive. As with the overlay tree, it is possible to + over write any file in the target root tree. - - + - prenetwork|postnetwork - - The hooks are called before and after the client network - is setup, respectively. The hooks exist only for - the pxe image type. - + Execute User Defined config.sh Script + + KIWI + prepare -- user defined scripts config.sh + + At the end of the preparation stage the optional script + named config.sh is executed at the root + level of the target root tree. The primary intended use of this + script is to complete system configuration such as service + activation. For detailed description pre-defined configuration + functions consult the + man page. - - prepartition|postpartition - - The hooks are called before and after the client creates - the partition table on the target disk, respectively. The hooks - exist only for the pxe image type. - + Manage The New Root Tree + + KIWI + prepare -- manage target root tree + + The unpacked image directory is just a directory, as far as the + build system is concerned and you can manipulate the content of + this directory to your liking. Further, as this directory + represents a system installation you can chroot into this directory + and run in the chroot environment to make changes. However, + it is strongly discouraged to apply changes directly to the + unpacked root, as any changes you apply will be lost when the + prepare step for the image is repeated. + In addition you may introduce errors into the unpacked root tree + that may lead to very difficult to track kiwi build issues + during the create step of the image build + process. The best practice is to apply any necessary changes to + the configuration directory followed by a new prepare + operation. If you inspect the created unpacked root tree you will + find a directory named image + at the top level that you would not find on a system installed + with the distribution installer. This directory contains information + KIWI requires during the create step, including a copy of the + config.xml file. You can make modifications + to data in this directory to influence the create step, however, + as mentioned previously this is discouraged and changes will be lost + once the prepare step is repeated. + + + Successful completion of the prepare step + is a the pre-requisite for the create step of the + image build process. With the successful completion of the image + preparation the unpacked root tree is considered complete and consistent. + Creating the packed, or final image requires the execution of the + create step. Multiple images can be created using + the same unpacked root tree, for example it is possible to create + a self installing OEM image and a virtual machine image from + one unpacked root tree, under the condition that both image types + are specified in the config.xml when the prepare + step is executed. During the create step the + following major operations are performed by kiwi: + + + KIWI + stages + - preprobe|postprobe - - The hooks are called before and after the loading of modules - not handled by udev, respectively. The hooks exist only for the - pxe image type. - + Execute User Defined images.sh Script + + KIWI + create -- user defined scripts images.sh + + At the beginning of the image creation process the optional + images.sh script is executed at the top level + of the unpacked image directory. Unlike the + config.sh script, the + images.sh script does not have a target use + case. The script is most often used to remove files that are no + needed in the final image. For example if an appliance is being + built that is targeted for specific hardware one can remove all + unnecessary kernel drivers from the image using this script. + Consult the man page for + a detailed description of pre-defined functions available in + the images.sh script. - - preswap|postswap - - The hooks are called before and after the creation of the - swap space, respectively. The hooks exist only for the - pxe image type. - + Create Requested Image Type + + KIWI + create -- requested image types + + The image types that can be created from a prepared image tree + depend on the types specified in the image description + config.xml file. The configuration file + must contain contain at least one + type element. The figure below + shows the currently image types: + +
    + Image Types + + + + + + + + + + + + + + Live Image on CD, DVD or USB stick + + + Virtual system than can be used in VMware, Xen, + Amazon Cloud, KVM, etc. virtual environments. Depending + on the format a guest configuration file is created. + + + Preload system for install media CD/DVD or USB + stick + + + Network boot image. KIWI also provides the bootp + environment via the package kiwi-pxeboot + + + + +
    +
    + Detailed information, including step by step instructions about using + the kiwi command and building specific images, as + well as the configuration of the supported image types is provided + later. + + Most Linux systems use a special boot image to control + the system boot process after the system firmware, BIOS or UEFI, + hands control of the hardware to the operating system. This boot image + is called the initrd. The Linux kernel loads the + initrd, a compressed cpio initial ramdisk, into RAM and executes + init or, if present, linuxrc. + KIWI creates the boot image as part of the create + step in the image build process. Each image type has a specialized + image description that describes the boot image. Common functionality is + shared between the boot images through a set of functions. The boot image + descriptions follow the same principles as the system image descriptions + and are provided by KIWI. The boot image descriptions provided by KIWI + cover almost all use cases and it should not be necessary for the majority + of KIWI users to implement their own boot descriptions. + +
    + Image Descriptions + + + + + + + + + + + + + Boot image descriptions are provided by KIWI, use is + recommended but not required + + + The system image description is created by the KIWI user, + or a KIWI provided template may be used + + + + +
    + + + The boot image descriptions are stored in the + /usr/share/kiwi/image/*boot + directories. KIWI selects the boot image to build based on the value of + the boot attribute of the + type element. The attribute value is + expected in the general form of + boottype/distribution + . For example to select the OEM boot image for openSUSE + version 12.1 the value of the boot + attribute should be oemboot/suse-12.1. + The boot image description only represent the initrd and as such serves + a limited purpose. The system image description created by the person + building the image is ultimately the image that runs on the target system. + Boot image descriptions are complete and consistent descriptions that + allow you to build the boot image outside of the system image build + process. The resulting boot image can be stored and re-used as described + in the section. +
    + + + Boot Image Hook-Scripts + + KIWI + hook scripts + + + hook scripts + + All KIWI created boot images contain kiwi boot code that gets + executed when the image is booted for the first time. This boot + code is different for the various image types and provides hooks + to execute user defined custom shell scripts. The shell scripts + provided by the user may extend the first boot process and are + expected to exist inside the boot image in a specific location with + specific names. The naming and timing of the execution of + the hook scripts is image type dependent and described later. + The instructions below explain the concepts of hook scripts, which is + common to all image types, and how to include the scripts + in the initrd. + - - preactivate - - This hook is called before the root filesystem is moved to / - The hook exists only for the pxe - image type. - - + All hook scripts must be located in the kiwi-hooks directory at the top + level of the initrd. The best approach to including the hook + scripts in the initrd is to create an archive of a kiwi-hooks directory that + contains the custom boot scripts. + mkdir kiwi-hooks +--> place all scripts inside kiwi-hooks +tar -cf kiwi-hooks.tgz kiwi-hooks/ + The tarball must be located at the top level of the image + description directory, this is the same level that contains + the config.xml file. - - - preCallInit - - This hook is called in before the initialization process, - init or systemd, is started. At call time the root filesystem - has already been moved to /. The hook exists only for the - oem and vmx image types. - - - - + Hook scripts are executed using a predetermined name that + is hard coded into the kiwi boot code. This name is extended + using the .sh extension and differs by + boot image type. Therefore, the boot script naming in the archive + must be exact. Boot scripts are sourced in the kiwi boot code. This + provides the hook script access to all variables set in the boot + environment. This also implies that no separate shell process + is started and the boot scripts do not have to have the + executable bit set. Encoding the interpreter location with the + #! comment is superfluous. + - - preException - - This hook is called before a system error is handled, the - actual error message is passed as parameter. This hook can be - used for all image types. - - + Hook scripts are only executed from within kiwi's boot + code and must therefore be part of the KIWI created boot + image. Including the content of a tarball in the initrd is + accomplished by setting the value of the bootinclude attribute of the + archive element to + true in the + config.xml file as shown below: + <packages type="image"> + <archive name="kiwi-hooks.tgz" bootinclude="true"/> +</packages> + The concept of including an archive in the boot image follows + the same concepts described for the system image previously. + The setting in the system image description will have no + effect if a pre-built boot image is being used. In order to + use an archive in a pre-built boot image the archive must be + part of the boot image description in which case it is not + necessary to set the bootinclude attribute. - + + The following list provides information about the hook names, + timing of the execution, and the applicable boot image. + - preHWdetect|postHWdetect + handleSplash - The hooks are called before and after the install image boot - code detects the possible target storage device(s). - The hook exists only for the oem image type. + This hook is called prior to any dialog/exception message or + progress dialog. The hook can be used to customize the behavior + of the splash screen. kiwi automatically hides a plymouth or + kernel based splash screen if there is only one active console - preNetworkRelease + init - This hook is called before the network connection is released. - The hook exists only for the pxe image type. + This hook is called before udev is started. The hook + exists only for the pxe image type. - - - The execution of hooks can be globaly deactivated by passing the - following variable to the kernel commandline: - KIWI_FORBID_HOOKS=1 In addition to the hook - script itself it's also possible to run a post command after the - hook script was called. This allows to run commands tied to a hook - script without changing the initrd and thus provides a certain - flexibility when writing the hook. The post command execution is - based on variables one can pass to the kernel commandline to - extend an existing hook script. There are the following rules for - the processing of these information + - - The hook must activate the command post - processing - Post hook commands are only processed if the - corresponding hook script activates this. The variable the - hook script has to set follows the naming schema: - KIWI_ALLOW_HOOK_CMD_|HOOKNAME|=1 For example: - KIWI_ALLOW_HOOK_CMD_preHWdetect=1 If this - is set as part of the preHWdetect.sh hook script code the - post command execution is activated - - + + preconfig|postconfig + + The hooks are called before and after the client configuration + files (CONF contents) are setup, respectively. The hooks exist + only for the pxe image type. + + + + - - KIWI_HOOK_CMD_|HOOKNAME| - The variable containing the command to become - executed must match the following naming schema. For - example: - KIWI_HOOK_CMD_preHWdetect="ls -l" This - would cause the preHWdetect hook to call ls - -l at the end of the hook script code - - + + predownload|postdownload + + The hooks are called before and after the client image receives + the root filesystem, respectively. The hooks exist only for + the pxe image type. + + + + - - KIWI_FORBID_HOOK_CMDS - If this variable is set to something non empty the - post hook command execution is deactivated however the - basic hook script invocation is still active unless - KIWI_FORBID_HOOKS is also set - - - - - - - - Boot Image Customization - - KIWI - initrd customization - - - initrd customization - - The KIWI provided boot image descriptions should satisfy the - requirements for a majority of image builds and the environments in - which these images are deployed. For the circumstances that require - customized boot images KIWI provides mechanisms in the system image - config.xml file to influence the boot image - content. Using these mechanisms allows the user to still base the - boot image on the KIWI provided descriptions rather than defining a - completely new and custom boot image description. Creating a - custom boot image that is not based on the KIWI provided descriptions - is also possible. The following question and answer section provides - solutions to the most common customization needs fro the initrd - created by kiwi. - - - - - - Why is the boot image so big and can I reduce it's size ? - KIWI includes all required tools and libraries to boot the - image in all circumstances in the target environment for the - image type. If target environment is well defined it is - possible to remove data from that is known not to be needed. - This will decrease the size of the initrd to and decrease - boot time. Removing files in the boot image is accomplished - by adding a strip section - to the system image config.xml file, - with the type attribute - set to delete, as shown - below. - <strip type="delete"/> - <file name="..."/> -</strip> - Removing files that are needed my result in an image that - cannot be booted. - - - - - - Can drivers be added to the boot image? - KIWI uses a subset of the kernel. Should you encounter - problems due to a missing driver that is part of the - "standard" kernel but has not bee included by the kiwi build - process you can add the driver by adding a drivers section to the system - image config.xml file, as shown below. - <drivers> - <file name="drivers/..."/> -</drivers> - If the driver is provided by a package, the package itself - needs to be specified as part of the image package section and it - must be marked for boot image inclusion by setting the value - of the bootinclude - attribute of the package - element to true, as - shown below. - <packages type="image"/> - <package name="..." bootinclude="true"/> -</packages> - - - + + preImageDump|postImageDump + + The hooks are called before and after the install image is + dumped on the target disk, respectively. The hooks exist only for + the oem image type. + + + + + + + preLoadConfiguration|postLoadConfiguration + + The hooks are called before and after the client configuration + file config.MAC is loaded, respectively. The hooks exist only for + the pxe image type. + + + - + + + premount|postmount + + The hooks are called before and after the client root + filesystem is mounted, respectively. The hooks exist only for + the pxe image type. + + + + + + + prenetwork|postnetwork + + The hooks are called before and after the client network + is setup, respectively. The hooks exist only for + the pxe image type. + + + + + + + prepartition|postpartition + + The hooks are called before and after the client creates + the partition table on the target disk, respectively. The hooks + exist only for the pxe image type. + + + + + + + preprobe|postprobe + + The hooks are called before and after the loading of modules + not handled by udev, respectively. The hooks exist only for the + pxe image type. + + + + + + + preswap|postswap + + The hooks are called before and after the creation of the + swap space, respectively. The hooks exist only for the + pxe image type. + + + + + + + preactivate + + This hook is called before the root filesystem is moved to / + The hook exists only for the pxe + image type. + + + + + + + preCallInit + + This hook is called in before the initialization process, + init or systemd, is started. At call time the root filesystem + has already been moved to /. The hook exists only for the + oem and vmx image types. + + + + + + + preException + + This hook is called before a system error is handled, the + actual error message is passed as parameter. This hook can be + used for all image types. + + + + + + + preHWdetect|postHWdetect + + The hooks are called before and after the install image boot + code detects the possible target storage device(s). + The hook exists only for the oem image type. + + + + + + + preNetworkRelease + + This hook is called before the network connection is released. + The hook exists only for the pxe image type. + + + + + + The execution of hooks can be globaly deactivated by passing the + following variable to the kernel commandline: + KIWI_FORBID_HOOKS=1 In addition to the hook + script itself it's also possible to run a post command after the + hook script was called. This allows to run commands tied to a hook + script without changing the initrd and thus provides a certain + flexibility when writing the hook. The post command execution is + based on variables one can pass to the kernel commandline to + extend an existing hook script. There are the following rules for + the processing of these information + + + The hook must activate the command post + processing + Post hook commands are only processed if the + corresponding hook script activates this. The variable the + hook script has to set follows the naming schema: + KIWI_ALLOW_HOOK_CMD_|HOOKNAME|=1 For example: + KIWI_ALLOW_HOOK_CMD_preHWdetect=1 If this + is set as part of the preHWdetect.sh hook script code the + post command execution is activated + + + + + KIWI_HOOK_CMD_|HOOKNAME| + The variable containing the command to become + executed must match the following naming schema. For + example: + KIWI_HOOK_CMD_preHWdetect="ls -l" This + would cause the preHWdetect hook to call ls + -l at the end of the hook script code + + + + + KIWI_FORBID_HOOK_CMDS + If this variable is set to something non empty the + post hook command execution is deactivated however the + basic hook script invocation is still active unless + KIWI_FORBID_HOOKS is also set + + + + + + + + Boot Image Customization + + KIWI + initrd customization + + + initrd customization + + The KIWI provided boot image descriptions should satisfy the + requirements for a majority of image builds and the environments in + which these images are deployed. For the circumstances that require + customized boot images KIWI provides mechanisms in the system image + config.xml file to influence the boot image + content. Using these mechanisms allows the user to still base the + boot image on the KIWI provided descriptions rather than defining a + completely new and custom boot image description. Creating a + custom boot image that is not based on the KIWI provided descriptions + is also possible. The following question and answer section provides + solutions to the most common customization needs fro the initrd + created by kiwi. + + + - How to add missing tools/libraries? - Additional software can be added to the boot image with the - use of the bootinclude - attribute of the package - element or the archive - element. At the end of the boot image creation process kiwi - attempts to reduce the size of the boot image by removing - files that are not part of a known list of required files, - any detectable dependencies of the files listed are - preserved as well. The list of known required files is hard - coded in the - /usr/share/kiwi/modules/KIWIConfig.txt - file. If you added files to the boot image that are needed - in your specific use case you need to instruct kiwi to not - strip the files you have added to the boot image. This is - accomplished by adding a strip section to the system image - config.xml file, with the type attribute set to tools, as shown below. - <strip type="tools"/> - <file name="..."/> + + Why is the boot image so big and can I reduce it's size ? + KIWI includes all required tools and libraries to boot the + image in all circumstances in the target environment for the + image type. If target environment is well defined it is + possible to remove data from that is known not to be needed. + This will decrease the size of the initrd to and decrease + boot time. Removing files in the boot image is accomplished + by adding a strip section + to the system image config.xml file, + with the type attribute + set to delete, as shown + below. + <strip type="delete"/> + <file name="..."/> </strip> - the removal/preservation of files is name base and the path - is immaterial. Therefore, you only have to specify the file - name that is to be preserved. - + Removing files that are needed my result in an image that + cannot be booted. + - + - Is it possible to add boot code? - - Yes, as described in the section above, - KIWI supports the execution of boot code at various times for - various image types using hook scripts. - + Can drivers be added to the boot image? + KIWI uses a subset of the kernel. Should you encounter + problems due to a missing driver that is part of the + "standard" kernel but has not bee included by the kiwi build + process you can add the driver by adding a drivers section to the system + image config.xml file, as shown below. + <drivers> + <file name="drivers/..."/> +</drivers> + If the driver is provided by a package, the package itself + needs to be specified as part of the image package section and it + must be marked for boot image inclusion by setting the value + of the bootinclude + attribute of the package + element to true, as + shown below. + <packages type="image"/> + <package name="..." bootinclude="true"/> +</packages> + - - - - Is it possible to include completely custom boot code? - - No. In cases where the provided hooks are insufficient and the - KIWI provided boot code needs to be replaced completed it is - necessary to create a custom boot image description. In this case, - all parts of the boot image description must be created by the - user. It is best to use one of the KIWI provided boot descriptions - as a template. - + + + How to add missing tools/libraries? + Additional software can be added to the boot image with the + use of the bootinclude + attribute of the package + element or the archive + element. At the end of the boot image creation process kiwi + attempts to reduce the size of the boot image by removing + files that are not part of a known list of required files, + any detectable dependencies of the files listed are + preserved as well. The list of known required files is hard + coded in the + /usr/share/kiwi/modules/KIWIConfig.txt + file. If you added files to the boot image that are needed + in your specific use case you need to instruct kiwi to not + strip the files you have added to the boot image. This is + accomplished by adding a strip section to the system image + config.xml file, with the type attribute set to tools, as shown below. + <strip type="tools"/> + <file name="..."/> +</strip> + the removal/preservation of files is name base and the path + is immaterial. Therefore, you only have to specify the file + name that is to be preserved. - - - + - - - Using Pre-built Boot Images - - KIWI - pre-built boot images - - - pre-built boot images - - During the create step of the KIWI image building process kiwi, - creates the so called boot image, as described previously, based on - the specified boot image description in the - config.xml configuration file. This creation - process takes time and can be short circuited by using pre-built - boot images. - As described earlier, the KIWI provided boot images can be found - in the - /usr/share/kiwi/image/*boot - directories. Located within the - *boot directories are boot - image description trees named for the applicable distribution. For - example the oemboot/suse-SLES11 - directory is the boot image description for an OEM image for - SUSE Linux Enterprise Server 11. The boot image configuration trees - are complete image descriptions, very similar in nature to the system - image descriptions created most commonly for image building, that kiwi - uses to create the boot image during the system image creation process. - Therefore, it is possible to build these boot images outside of the - system image build process. The result of a build of one of the boot - image descriptions is a pre-built boot image that can be used in many - image builds for the same distribution and type. The following commands - show the creation of a pre-built boot image for openSUSE 12.1 for the OEM - image type. - - kiwi --prepare /usr/share/kiwi/image/oemboot/suse-12.1 --root /tmp/oem121_initunpacked - - kiwi --create /tmp/oem121_initunpacked -d /mystore/kiwiprebuiltboot - - The commands above result in the creation of the OEM boot image - for openSUSE 12.1 in the directory - /mystore/kiwiprebuiltboot. This boot image can - readily be used by any kiwi build for an openSUSE 12.1 OEM image. - Using the pre-built image requires that the value of the - checkprebuilt attribute of the - type element be set to - true and that the location of - the boot image is provided with the - command line argument, or - the defaultprebuilt element in - the config.xml file. - - Using pre-built boot images has the advantage that the boot image - does not have to be re-created every time a specific image type for - a given distribution is rebuilt. Additionally, this process provides a - convenient way to maintain customized boot images. One disadvantage to - the use of pre-built images is that it is not possible to integrate the - latest updates of tools that are part of the initrd in the image as - the pre-built boot image will contain only the latest versions available - in the specified repositories on the build date. However, in most cases - this does not represent a concern/issue as the initrd in the image - generally gets replaced once the image is deployed. - - + + + Is it possible to add boot code? + + Yes, as described in the section above, + KIWI supports the execution of boot code at various times for + various image types using hook scripts. + + + - - Boot Parameters - - KIWI - boot parameters - - - boot parameters - - A KIWI created initrd based on one of the KIWI provided boot - image descriptions recognizes kernel parameters that are useful - for debugging purposes, should the image not boot. These parameters may - not work if the image contains a custom boot image where the kiwi boot - code has been replaced, and the parameters are not recognized after - the initial KIWI created initrd has been replaced by the "regular" - distribution created initrd after the initial boot of the image. - - - - <parameter>kiwidebug=1</parameter> - If the boot process encounters a fatal error, the - default behavior is to reboot the system 120 seconds. The - exception behavior is changed by setting - the parameter. With the value of - the parameter set to 1 the system will enter a limited shell - environment should a fatal error occur during boot. The - shell contains the standard basic commands. The - /var/log/kiwi.boot boot log file may - be consulted to develop a better understanding of the boot - failure. In addition to the spawned shell process kiwi also - starts the dropbear ssh server if the environment is - suitable. Support for ssh into the boot image is possible in - the netboot and oemboot (in PXE boot mode) boot images. For - isoboot and vmxboot boot images there is no remote login - support because they don't setup a network. In order to have - dropbear installed as part of the boot image the following - needs to be added to the system image configuration: - <packages type="image"/> - <package name="dropbear" bootinclude="true"/> -</packages> - It's required that the repo setup provides dropbear. Once - dropbear is there the kiwi boot code will start the service. - In order to access the boot image via ssh it's required to - provide a public key on the pxe server in the directory: - server-root/KIWI/debug_ssh.pub. kiwi - only searches for that filename so it's required to name it - debug_ssh.pub. Adding more than one public - key to this file is possible exactly like the common SSH - file authorized_keys. The path - server-root depends on what server type was - configured to download the image. By default this is done - via tftp. In that case the complete path to put the public - key to is - /srv/tftpboot/KIWI/debug_ssh.pub. on - the pxe server. If ftp or http is used the server-root path - is different. If a public key was found you can login as - follows: - ssh root@<ip> It - might be useful to have a copy tool like scp or rsync as - part of the boot image as well. Adding rsync as bootincluded - package does not increase the size of the initrd much and - would allow to extract e.g the kiwi boot log as follows: - RSYNC_RSH='ssh -l root' -rsync -avz <ip>:/var/log/boot.kiwi . - - - + + + + Is it possible to include completely custom boot code? + + No. In cases where the provided hooks are insufficient and the + KIWI provided boot code needs to be replaced completed it is + necessary to create a custom boot image description. In this case, + all parts of the boot image description must be created by the + user. It is best to use one of the KIWI provided boot descriptions + as a template. + + + - + - - Common and Distribution Specific Code - - KIWI - common code - - - KIWI - distribution specific code - - KIWI is designed to be in principal distribution independent and - the majority of the kiwi implementation follows this design principal. - However, Linux distributions differ from each other, primarily in the - package management area as well as the creation and composition of - the boot image. - - Within the KIWI code base major areas of Linux distribution - differences are isolated into specific regions of the code. The - remainder of the code is common and distribution independent. - - KIWI provided functions that are distribution specific contain - the distribution name as a prefix, such as - suseStripKernel. Scripts that are part of the boot - code and are distribution specific are identified by a prefix of - the distribution name followed by a -, - suse-linuxrc for example. When kiwi creates a boot - image for a SUSE distribution the suse-linuxrc file - from the boot discription is used as the linuxrc - file that the Linux kernel calls. - - With this design and implementation t is possible to maintain - distribution specific code in the same project while also providing - explicit hints to the user when distribution specific code is being - used. The implemented SUSE specific code can be used as a guideline - to support other distributions. - + + + Using Pre-built Boot Images + + KIWI + pre-built boot images + + + pre-built boot images + + During the create step of the KIWI image building process kiwi, + creates the so called boot image, as described previously, based on + the specified boot image description in the + config.xml configuration file. This creation + process takes time and can be short circuited by using pre-built + boot images. + As described earlier, the KIWI provided boot images can be found + in the + /usr/share/kiwi/image/*boot + directories. Located within the + *boot directories are boot + image description trees named for the applicable distribution. For + example the oemboot/suse-SLES11 + directory is the boot image description for an OEM image for + SUSE Linux Enterprise Server 11. The boot image configuration trees + are complete image descriptions, very similar in nature to the system + image descriptions created most commonly for image building, that kiwi + uses to create the boot image during the system image creation process. + Therefore, it is possible to build these boot images outside of the + system image build process. The result of a build of one of the boot + image descriptions is a pre-built boot image that can be used in many + image builds for the same distribution and type. The following commands + show the creation of a pre-built boot image for openSUSE 12.1 for the OEM + image type. + + kiwi --prepare /usr/share/kiwi/image/oemboot/suse-12.1 --root /tmp/oem121_initunpacked + + kiwi --create /tmp/oem121_initunpacked -d /mystore/kiwiprebuiltboot + + The commands above result in the creation of the OEM boot image + for openSUSE 12.1 in the directory + /mystore/kiwiprebuiltboot. This boot image can + readily be used by any kiwi build for an openSUSE 12.1 OEM image. + Using the pre-built image requires that the value of the + checkprebuilt attribute of the + type element be set to + true and that the location of + the boot image is provided with the + command line argument, or + the defaultprebuilt element in + the config.xml file. + + Using pre-built boot images has the advantage that the boot image + does not have to be re-created every time a specific image type for + a given distribution is rebuilt. Additionally, this process provides a + convenient way to maintain customized boot images. One disadvantage to + the use of pre-built images is that it is not possible to integrate the + latest updates of tools that are part of the initrd in the image as + the pre-built boot image will contain only the latest versions available + in the specified repositories on the build date. However, in most cases + this does not represent a concern/issue as the initrd in the image + generally gets replaced once the image is deployed. + + + + + Boot Parameters + + KIWI + boot parameters + + + boot parameters + + A KIWI created initrd based on one of the KIWI provided boot + image descriptions recognizes kernel parameters that are useful + for debugging purposes, should the image not boot. These parameters may + not work if the image contains a custom boot image where the kiwi boot + code has been replaced, and the parameters are not recognized after + the initial KIWI created initrd has been replaced by the "regular" + distribution created initrd after the initial boot of the image. + + + + <parameter>kiwidebug=1</parameter> + If the boot process encounters a fatal error, the + default behavior is to reboot the system 120 seconds. The + exception behavior is changed by setting + the parameter. With the value of + the parameter set to 1 the system will enter a limited shell + environment should a fatal error occur during boot. The + shell contains the standard basic commands. The + /var/log/kiwi.boot boot log file may + be consulted to develop a better understanding of the boot + failure. In addition to the spawned shell process kiwi also + starts the dropbear ssh server if the environment is + suitable. Support for ssh into the boot image is possible in + the netboot and oemboot (in PXE boot mode) boot images. For + isoboot and vmxboot boot images there is no remote login + support because they don't setup a network. In order to have + dropbear installed as part of the boot image the following + needs to be added to the system image configuration: + <packages type="image"/> + <package name="dropbear" bootinclude="true"/> +</packages> + It's required that the repo setup provides dropbear. Once + dropbear is there the kiwi boot code will start the service. + In order to access the boot image via ssh it's required to + provide a public key on the pxe server in the directory: + server-root/KIWI/debug_ssh.pub. kiwi + only searches for that filename so it's required to name it + debug_ssh.pub. Adding more than one public + key to this file is possible exactly like the common SSH + file authorized_keys. The path + server-root depends on what server type was + configured to download the image. By default this is done + via tftp. In that case the complete path to put the public + key to is + /srv/tftpboot/KIWI/debug_ssh.pub. on + the pxe server. If ftp or http is used the server-root path + is different. If a public key was found you can login as + follows: + ssh root@<ip> It + might be useful to have a copy tool like scp or rsync as + part of the boot image as well. Adding rsync as bootincluded + package does not increase the size of the initrd much and + would allow to extract e.g the kiwi boot log as follows: + RSYNC_RSH='ssh -l root' +rsync -avz <ip>:/var/log/boot.kiwi . + + + + + + + + Common and Distribution Specific Code + + KIWI + common code + + + KIWI + distribution specific code + + KIWI is designed to be in principal distribution independent and + the majority of the kiwi implementation follows this design principal. + However, Linux distributions differ from each other, primarily in the + package management area as well as the creation and composition of + the boot image. + + Within the KIWI code base major areas of Linux distribution + differences are isolated into specific regions of the code. The + remainder of the code is common and distribution independent. + + KIWI provided functions that are distribution specific contain + the distribution name as a prefix, such as + suseStripKernel. Scripts that are part of the boot + code and are distribution specific are identified by a prefix of + the distribution name followed by a -, + suse-linuxrc for example. When kiwi creates a boot + image for a SUSE distribution the suse-linuxrc file + from the boot discription is used as the linuxrc + file that the Linux kernel calls. + + With this design and implementation t is possible to maintain + distribution specific code in the same project while also providing + explicit hints to the user when distribution specific code is being + used. The implemented SUSE specific code can be used as a guideline + to support other distributions. +
    diff --git a/doc/docbook/kiwi-doc-xen.xml b/doc/docbook/kiwi-doc-xen.xml index 0be00c5fb..42ddebff4 100644 --- a/doc/docbook/kiwi-doc-xen.xml +++ b/doc/docbook/kiwi-doc-xen.xml @@ -1,83 +1,83 @@ + "http://www.docbook.org/xml/4.5/docbookx.dtd"> - Xen Image—Paravirtual Systems - - KIWI - XEN image - - - images - XEN - - - XEN image - - Xen is a free software virtual machine monitor. It allows - several guest operating systems to be executed on the same computer - hardware at the same time. + Xen Image—Paravirtual Systems + + KIWI + XEN image + + + images + XEN + + + XEN image + + Xen is a free software virtual machine monitor. It allows + several guest operating systems to be executed on the same computer + hardware at the same time. - A Xen system is structured with the Xen hypervisor as the lowest - and most privileged layer. Above this layer are one or more guest - operating systems, which the hypervisor schedules across the - physical CPUs. The first guest operating system, called in Xen - terminology domain 0 (dom0), is booted automatically - when the hypervisor boots and given special management privileges - and direct access to the physical hardware. The system administrator - logs into dom0 in order to start any further guest operating - systems, called domain 0 (domU) in Xen terminology. - A Xen image is a virtual disk like a vmx but with the xen kernel - installed. In order to run it a Xen dom0 server needs to run. Xen - images in KIWI makes use of the PVGrub method supported by current - Xen versions. Xen extracts the kernel and initrd from the virtual - disk as well as the grub configuration and displays the menu which - allows emulation of the Grub console - - - Building the suse-xen-guest Example - The latest example provided with KIWI is based on openSUSE - and includes the base pattern. + A Xen system is structured with the Xen hypervisor as the lowest + and most privileged layer. Above this layer are one or more guest + operating systems, which the hypervisor schedules across the + physical CPUs. The first guest operating system, called in Xen + terminology domain 0 (dom0), is booted automatically + when the hypervisor boots and given special management privileges + and direct access to the physical hardware. The system administrator + logs into dom0 in order to start any further guest operating + systems, called domain 0 (domU) in Xen terminology. + A Xen image is a virtual disk like a vmx but with the xen kernel + installed. In order to run it a Xen dom0 server needs to run. Xen + images in KIWI makes use of the PVGrub method supported by current + Xen versions. Xen extracts the kernel and initrd from the virtual + disk as well as the grub configuration and displays the menu which + allows emulation of the Grub console + + + Building the suse-xen-guest Example + The latest example provided with KIWI is based on openSUSE + and includes the base pattern. - cd /usr/share/doc/packages/kiwi/examples cd suse-... + cd /usr/share/doc/packages/kiwi/examples cd suse-... kiwi --prepare ./suse-xen-guest --root /tmp/myxen - kiwi --create /tmp/myxen --type vmx -d /tmp/myxen-result - + kiwi --create /tmp/myxen --type vmx -d /tmp/myxen-result + - - Using the Image - In order to run a domain U the Xen tool xm - needs to be called in conjunction with the KIWI generated domainU - configuration file + + Using the Image + In order to run a domain U the Xen tool xm + needs to be called in conjunction with the KIWI generated domainU + configuration file - xm create -c /tmp/myxen-result/ - the-file-with-suffix.xenconfig - + xm create -c /tmp/myxen-result/ + the-file-with-suffix.xenconfig + - - Flavours - With KIWI you can provide the information required to create a - guest configuration as part of the config.xml file. Additionally - you can group special packages which you may only need in this - para virtual environment with a profile. + + Flavours + With KIWI you can provide the information required to create a + guest configuration as part of the config.xml file. Additionally + you can group special packages which you may only need in this + para virtual environment with a profile. - <packages type="image" profiles="xenFlavour"> - <package name="kernel-xen" replaces="kernel-ec2"/> + <packages type="image" profiles="xenFlavour"> + <package name="kernel-xen" replaces="kernel-ec2"/> </packages> <type ....> - <machine memory="512" domain="domU"> - <vmdisk ... device="/dev/xvda"/> - </machine> + <machine memory="512" domain="domU"> + <vmdisk ... device="/dev/xvda"/> + </machine> </type> - If this information is present KIWI will create a Xen domain U - configuration with 512 MB of RAM and expects the disk at /dev/xvda. Additional information - to setup the Xen guest machine properties are explained in the - machine section. The KIWI Xen domain U configuration is stored in - the file /tmp/myxen-result/suse-##.#-xen-guest.####-#.#.#.xenconfig. + If this information is present KIWI will create a Xen domain U + configuration with 512 MB of RAM and expects the disk at /dev/xvda. Additional information + to setup the Xen guest machine properties are explained in the + machine section. The KIWI Xen domain U configuration is stored in + the file /tmp/myxen-result/suse-##.#-xen-guest.####-#.#.#.xenconfig. - + diff --git a/doc/docbook/kiwi-doc.xml b/doc/docbook/kiwi-doc.xml index 3209f479f..331f83ad9 100644 --- a/doc/docbook/kiwi-doc.xml +++ b/doc/docbook/kiwi-doc.xml @@ -1,87 +1,87 @@ + "http://www.docbook.org/xml/4.5/docbookx.dtd"> - openSUSE-KIWI Image System - Cookbook - - KIWI Version - - - - Software Engineer - SUSE LINUX Products GmbH - - Marcus - Schäfer - Project, Design and Implementation - ms@suse.de -
    - SUSE LINUX Products GmbH - Maxfeldstrasse 5 - 90409 Nürnberg -
    -
    - - - Documentation Specialist - SUSE LINUX Products GmbH - - Thomas - Schraitle - Various text improvements, migration to DocBook - toms@suse.de - - - - SUSE LLC - - Robert - Schweikert - Various text improvements, implementation - rjschwei@suse.com - -
    - + openSUSE-KIWI Image System + Cookbook + + KIWI Version + + + + Software Engineer + SUSE LINUX Products GmbH + + Marcus + Schäfer + Project, Design and Implementation + ms@suse.de +
    + SUSE LINUX Products GmbH + Maxfeldstrasse 5 + 90409 Nürnberg +
    +
    + + + Documentation Specialist + SUSE LINUX Products GmbH + + Thomas + Schraitle + Various text improvements, migration to DocBook + toms@suse.de + + + + SUSE LLC + + Robert + Schweikert + Various text improvements, implementation + rjschwei@suse.com + +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + - + - - - - - -
    - - - - - - - - - - - - - - - - - - - - -
    diff --git a/doc/docbook/kiwi-man-config.sh.xml b/doc/docbook/kiwi-man-config.sh.xml index ed869d282..1f3cf0995 100644 --- a/doc/docbook/kiwi-man-config.sh.xml +++ b/doc/docbook/kiwi-man-config.sh.xml @@ -1,56 +1,56 @@ + "-//OASIS//DTD DocBook XML V4.4//EN" + "http://www.docbook.org/xml/4.4/docbookx.dtd"> - - - manpages - kiwi::config.sh - - KIWI - - Created: - - - Marcus - Schäfer - Developer - ms (AT) suse.de - - - - - kiwi::config.sh - 1 - _KV_ - KIWI Manualpage - - - KIWI::config.sh - Configuration File for KIWI image description - + + + manpages + kiwi::config.sh + + KIWI + + Created: + + + Marcus + Schäfer + Developer + ms (AT) suse.de + + + + + kiwi::config.sh + 1 + _KV_ + KIWI Manualpage + + + KIWI::config.sh + Configuration File for KIWI image description + - - Description - - The KIWI image description allows to have an optional config.sh script - in place. This script should be designed to take over control of adding - the image operating system configuration. Configuration in that sense - means stuff like activating services, creating configuration files, prepare - an environment for a firstboot workflow, etc. What you shouldn't do in - config.sh is breaking your systems integrity by for example removing - packages or pieces of software. Something like that can be done in images.sh. - The config.sh script is called after the user and groups have - been set up. If there are SUSE Linux related YaST XML information, these are - validated before config.sh is called too. If you exit config.sh with an - exit code != 0 kiwi will exit with an error too. - + + Description + + The KIWI image description allows to have an optional config.sh script + in place. This script should be designed to take over control of adding + the image operating system configuration. Configuration in that sense + means stuff like activating services, creating configuration files, prepare + an environment for a firstboot workflow, etc. What you shouldn't do in + config.sh is breaking your systems integrity by for example removing + packages or pieces of software. Something like that can be done in images.sh. + The config.sh script is called after the user and groups have + been set up. If there are SUSE Linux related YaST XML information, these are + validated before config.sh is called too. If you exit config.sh with an + exit code != 0 kiwi will exit with an error too. + - - Template for config.sh - + + Template for config.sh + #====================================== # Functions... #-------------------------------------- @@ -81,437 +81,437 @@ baseCleanMount # Exit safely #-------------------------------------- exit 0 - - - + + + - - Common functions - - The .kconfig file allows to make use of a common - set of functions. Functions specific to SUSE Linux specific begin with - the name suse. Functions applicable to all linux - systems starts with the name base. - The following list describes the functions available inside the - config.sh script. - - - - baseCleanMount - - - Umount the system filesystems /proc, - /dev/pts, and - /sys. - - - - - baseDisableCtrlAltDel - - - Disable the - Ctrl - Alt - Del - key sequence setting in /etc/inittab - - - - - baseGetPackagesForDeletion - - - Return the name(s) of packages which will be deleted - - - - - baseGetProfilesUsed - - - Return the name(s) of profiles used to build this image - - - - - baseSetRunlevel {value} - - - Set the default run level - - - - - baseSetupBoot - - - Set up the linuxrc as init - - - - - baseSetupBusyBox {-f} - - - activates busybox if installed for all links from - the busybox/busybox.links file—you can - choose custom apps to be forced into busybox with the - option as first parameter, for example: - - baseSetupBusyBox -f /bin/zcat /bin/vi - - - - baseSetupInPlaceGITRepository - - - Create an in place git repository of the root - directory. This process may take some time and you - may expect problems with binary data handling - - - - - baseSetupInPlaceSVNRepository {path_list} - - - Create an in place subversion repository for the - specified directories. A standard call could look like this - baseSetupInPlaceSVNRepository /etc, - /srv, and /var/log - - - - - baseSetupPlainTextGITRepository - - - Create an in place git repository of the root - directory containing all plain/text files. - - - - - baseSetupUserPermissions - - - Search all home directories of all users listed in /etc/passwd - and change the ownership of all files to belong to the correct - user and group. - - - - - baseStripAndKeep {list of info-files to keep} - - - helper function for strip* functions - read stdin lines of files to check for removing - params: files which should be keep - - - - - baseStripDocs {list of docu names to keep} - - - remove all documentation, except one given as parameter - - - - - baseStripInfos {list of info-files to keep} - - - remove all info files, except one given as parameter - - - - - baseStripLocales {list of locales} - - - remove all locales, except one given as parameter - - - - - baseStripMans {list of manpages to keep} - - - remove all manual pages, except one given as parameter - example: baseStripMans more less - - - - - baseStripRPM - - - remove rpms defined in config.xml under image=delete section - - - - - baseStripTools {list of toolpath} {list of tools} - - - helper function for suseStripInitrd function - params: toolpath, tools - - - - - baseStripUnusedLibs - - - remove libraries which are not directly linked - against applications in the bin directories - - - - - baseUpdateSysConfig {filename} {variable} {value} - - - update sysconfig variable contents - - - - - Debug {message} - - - Helper function to print a message - if the variable DEBUG is set to 1 - - - - - Echo {echo commandline} - - - Helper function to print a message to the controlling terminal - - - - - Rm {list of files} - - - Helper function to delete files and announce it to log - - - - - Rpm {rpm commandline} - - - Helper function to the RPM function and announce it to log - - - - - suseActivateDefaultServices - - - Call all postin scriptlets which among other things activates - all required default services using suseInsertService - - - - - suseActivateServices - - - Check all services in /etc/init.d/ and activate them - by calling suseInsertService - - - - - suseCloneRunlevel {runlevel} - - - Clone the given runlevel to work in the same way - as the default runlevel 3. - - - - - suseConfig - - - Setup keytable language and timezone if specified in config.xml and - call SuSEconfig afterwards - - - - - suseInsertService {servicename} - - - Recursively insert a service. If there is a service - required for this service it will be inserted first. The suse - insserv program is used here - - - - - suseRemoveService {servicename} - - - Remove a service and its dependent services - using the suse insserv program - - - - - suseService {servicename} {on|off} - - - Activate/Deactivate a service by using the chkconfig program - The function requires the service name and the value on or off - as parameters - - - - - suseServiceDefaultOn - - - Activates the following services to be on by default using the - chkconfig program: boot.rootfsck boot.cleanup boot.localfs boot.localnet - boot.clock policykitd dbus consolekit haldaemon network atd syslog cron kbd - - - - - suseSetupProductInformation - - - This function will use zypper to search for the installed - product and install all product specific packages. This function - only makes sense if zypper is used as packagemanager - - - - - suseStripPackager {-a} - - - Remove smart or zypper packages and db files - Also remove rpm package and db if given - - - - - - - - Profile environment variables - - The .profile environment file contains a specific set of variables which - are listed below. Some of the functions above makes use of the variables. - + + Common functions + + The .kconfig file allows to make use of a common + set of functions. Functions specific to SUSE Linux specific begin with + the name suse. Functions applicable to all linux + systems starts with the name base. + The following list describes the functions available inside the + config.sh script. + - - $kiwi_compressed - - - The value of the compressed attribute set in the type element - in config.xml - - - - - $kiwi_delete - - - A list of all packages which are part of the packages section - with type="delete" in config.xml - - - - - $kiwi_drivers - - - A comma separated list of the driver entries as listed in the - drivers section of the config.xml. - - - - - $kiwi_iname - - - The name of the image as listed in config.xml - - - - - $kiwi_iversion - - - The image version string major.minor.release - - - - - $kiwi_keytable - - - The contents of the keytable setup as done in config.xml - - - - - $kiwi_language - - - The contents of the locale setup as done in config.xml - - - - - $kiwi_profiles - - - A list of profiles used to build this image - - - - - $kiwi_size - - - The predefined size value for this image. This is not the computed - size but only the optional size value of the preferences section + + baseCleanMount + + + Umount the system filesystems /proc, + /dev/pts, and + /sys. + + + + + baseDisableCtrlAltDel + + + Disable the + Ctrl + Alt + Del + key sequence setting in /etc/inittab + + + + + baseGetPackagesForDeletion + + + Return the name(s) of packages which will be deleted + + + + + baseGetProfilesUsed + + + Return the name(s) of profiles used to build this image + + + + + baseSetRunlevel {value} + + + Set the default run level + + + + + baseSetupBoot + + + Set up the linuxrc as init + + + + + baseSetupBusyBox {-f} + + + activates busybox if installed for all links from + the busybox/busybox.links file—you can + choose custom apps to be forced into busybox with the + option as first parameter, for example: + + baseSetupBusyBox -f /bin/zcat /bin/vi + + + + baseSetupInPlaceGITRepository + + + Create an in place git repository of the root + directory. This process may take some time and you + may expect problems with binary data handling + + + + + baseSetupInPlaceSVNRepository {path_list} + + + Create an in place subversion repository for the + specified directories. A standard call could look like this + baseSetupInPlaceSVNRepository /etc, + /srv, and /var/log + + + + + baseSetupPlainTextGITRepository + + + Create an in place git repository of the root + directory containing all plain/text files. + + + + + baseSetupUserPermissions + + + Search all home directories of all users listed in /etc/passwd + and change the ownership of all files to belong to the correct + user and group. + + + + + baseStripAndKeep {list of info-files to keep} + + + helper function for strip* functions + read stdin lines of files to check for removing + params: files which should be keep + + + + + baseStripDocs {list of docu names to keep} + + + remove all documentation, except one given as parameter + + + + + baseStripInfos {list of info-files to keep} + + + remove all info files, except one given as parameter + + + + + baseStripLocales {list of locales} + + + remove all locales, except one given as parameter + + + + + baseStripMans {list of manpages to keep} + + + remove all manual pages, except one given as parameter + example: baseStripMans more less + + + + + baseStripRPM + + + remove rpms defined in config.xml under image=delete section + + + + + baseStripTools {list of toolpath} {list of tools} + + + helper function for suseStripInitrd function + params: toolpath, tools + + + + + baseStripUnusedLibs + + + remove libraries which are not directly linked + against applications in the bin directories + + + + + baseUpdateSysConfig {filename} {variable} {value} + + + update sysconfig variable contents + + + + + Debug {message} + + + Helper function to print a message + if the variable DEBUG is set to 1 + + + + + Echo {echo commandline} + + + Helper function to print a message to the controlling terminal + + + + + Rm {list of files} + + + Helper function to delete files and announce it to log + + + + + Rpm {rpm commandline} + + + Helper function to the RPM function and announce it to log + + + + + suseActivateDefaultServices + + + Call all postin scriptlets which among other things activates + all required default services using suseInsertService + + + + + suseActivateServices + + + Check all services in /etc/init.d/ and activate them + by calling suseInsertService + + + + + suseCloneRunlevel {runlevel} + + + Clone the given runlevel to work in the same way + as the default runlevel 3. + + + + + suseConfig + + + Setup keytable language and timezone if specified in config.xml and + call SuSEconfig afterwards + + + + + suseInsertService {servicename} + + + Recursively insert a service. If there is a service + required for this service it will be inserted first. The suse + insserv program is used here + + + + + suseRemoveService {servicename} + + + Remove a service and its dependent services + using the suse insserv program + + + + + suseService {servicename} {on|off} + + + Activate/Deactivate a service by using the chkconfig program + The function requires the service name and the value on or off + as parameters + + + + + suseServiceDefaultOn + + + Activates the following services to be on by default using the + chkconfig program: boot.rootfsck boot.cleanup boot.localfs boot.localnet + boot.clock policykitd dbus consolekit haldaemon network atd syslog cron kbd + + + + + suseSetupProductInformation + + + This function will use zypper to search for the installed + product and install all product specific packages. This function + only makes sense if zypper is used as packagemanager + + + + + suseStripPackager {-a} + + + Remove smart or zypper packages and db files + Also remove rpm package and db if given + + + + + + + + Profile environment variables + + The .profile environment file contains a specific set of variables which + are listed below. Some of the functions above makes use of the variables. + + + + $kiwi_compressed + + + The value of the compressed attribute set in the type element in config.xml - - - - - $kiwi_timezone - - - The contents of the timezone setup as done in config.xml - - - - - $kiwi_type - - - The basic image type. Can be a simply filesystem image type of - ext2, ext3, reiserfs, squashfs, cpio, or one of the following complex - image types: iso, split, usb, vmx, oem, xen, or pxe. - - - - - + + + + + $kiwi_delete + + + A list of all packages which are part of the packages section + with type="delete" in config.xml + + + + + $kiwi_drivers + + + A comma separated list of the driver entries as listed in the + drivers section of the config.xml. + + + + + $kiwi_iname + + + The name of the image as listed in config.xml + + + + + $kiwi_iversion + + + The image version string major.minor.release + + + + + $kiwi_keytable + + + The contents of the keytable setup as done in config.xml + + + + + $kiwi_language + + + The contents of the locale setup as done in config.xml + + + + + $kiwi_profiles + + + A list of profiles used to build this image + + + + + $kiwi_size + + + The predefined size value for this image. This is not the computed + size but only the optional size value of the preferences section + in config.xml + + + + + $kiwi_timezone + + + The contents of the timezone setup as done in config.xml + + + + + $kiwi_type + + + The basic image type. Can be a simply filesystem image type of + ext2, ext3, reiserfs, squashfs, cpio, or one of the following complex + image types: iso, split, usb, vmx, oem, xen, or pxe. + + + + + diff --git a/doc/docbook/kiwi-man-images.sh.xml b/doc/docbook/kiwi-man-images.sh.xml index 5ada29ad0..93371c294 100644 --- a/doc/docbook/kiwi-man-images.sh.xml +++ b/doc/docbook/kiwi-man-images.sh.xml @@ -1,54 +1,54 @@ + "-//OASIS//DTD DocBook XML V4.4//EN" + "http://www.docbook.org/xml/4.4/docbookx.dtd"> - - - manpages - kiwi::images.sh - - KIWI - - Created: - - - Marcus - Schäfer - Developer - ms (AT) suse.de - - - - - kiwi::images.sh - 1 - _KV_ - KIWI Manualpage - - - KIWI::images.sh - Configuration File for KIWI image description - + + + manpages + kiwi::images.sh + + KIWI + + Created: + + + Marcus + Schäfer + Developer + ms (AT) suse.de + + + + + kiwi::images.sh + 1 + _KV_ + KIWI Manualpage + + + KIWI::images.sh + Configuration File for KIWI image description + - - Description - - The KIWI image description allows to have an optional images.sh script - in place. This script is called at the beginning of the KIWI create step. - It is allowed to remove software there to shrink down the size of the - image. Most often images.sh is used for boot images because they needs - to be small. As images.sh is called in the create step you should be - aware to design the script in a way that it can be called multiple times - without shooting itself into its knee. As KIWI allows to create different - image types from one previously prepared tree one needs to take into account - that images.sh can be called more than one time. If you exit images.sh - with an exit code != 0 KIWI will exit with an error too. - - - Template for images.sh - #====================================== + + Description + + The KIWI image description allows to have an optional images.sh script + in place. This script is called at the beginning of the KIWI create step. + It is allowed to remove software there to shrink down the size of the + image. Most often images.sh is used for boot images because they needs + to be small. As images.sh is called in the create step you should be + aware to design the script in a way that it can be called multiple times + without shooting itself into its knee. As KIWI allows to create different + image types from one previously prepared tree one needs to take into account + that images.sh can be called more than one time. If you exit images.sh + with an exit code != 0 KIWI will exit with an error too. + + + Template for images.sh + #====================================== # Functions... #-------------------------------------- test -f /.kconfig && . /.kconfig @@ -68,236 +68,236 @@ echo "Configure image: [$kiwi_iname]..." # Exit safely #-------------------------------------- exit - - - - - Common functions - - The .kconfig file allows to make use of a common - set of functions. Functions specific to SUSE Linux specific begin with - the name suse. Functions applicable to all linux - systems starts with the name base. - The following list describes the functions available inside the - images.sh script. - - - - baseCleanMount - - - Umount the system filesystems /proc, - /dev/pts, and - /sys. - - - - - baseGetProfilesUsed - - - Return the name(s) of profiles used to build this image. - - - - - baseGetPackagesForDeletion - - - Return the list of packages setup in the packages type="delete" - section of the config.xml used to build - this image. - - - - - baseSetupOEMPartition - - - Writes the file /config.oempartition depending on the following - config.xml parameters: oem-reboot, oem-swapsize, oem-systemsize, - oem-swap,oem-boot-title,oem-recovery, oem-kiwi-initrd. - kiwi takes the information from config.xml and creates the - config.oempartition file as part of the automatically created - boot image (initrd). The information must be available as part - of the boot image because it controls the OEM repartition - workflow on first boot of an OEM image. Detailed information - about the meaning of each option can be found in the OEM - chapter of the KIWI cookbook. - - - - - suseGFXBoot {theme} {loadertype} - - - This function requires the gfxboot and at least one bootsplash-theme-* - package to be installed in order to work correctly. The function - creates from this package data a graphics boot screen for the isolinux - and grub boot loaders. Additionally it creates the bootsplash files - for the resolutions 800x600, 1024x768, and 1280x1024 - - - - - suseStripKernel - - - This function removes all kernel drivers which are not listed in - the *drivers sections of the config.xml - file. - - - - - suseStripInitrd - - - This function removes a whole bunch of tools binaries and libraries which - are not required in order to boot a suse system with KIWI. - - - - - Rm {list of files} - - - Helper function to delete files and announce it to log. - - - - - Rpm {rpm commandline} - - - Helper function to the rpm function and announce it to log. - - - - - Echo {echo commandline} - - - Helper function to print a message to the controlling - terminal. - - - - - Debug {message} - - - Helper function to print a message - if the variable DEBUG is set to 1. - - - - - - - Profile environment variables - - The .profile environment file contains a specific set of variables which - are listed below. Some of the functions above makes use of the variables. - + + + + + Common functions + + The .kconfig file allows to make use of a common + set of functions. Functions specific to SUSE Linux specific begin with + the name suse. Functions applicable to all linux + systems starts with the name base. + The following list describes the functions available inside the + images.sh script. + - - $kiwi_iname - - - The name of the image as listed in config.xml - - - - - $kiwi_iversion - - - The image version string major.minor.release - - - - - $kiwi_keytable - - - The contents of the keytable setup as done in config.xml - - - - - $kiwi_language - - - The contents of the locale setup as done in config.xml - - - - - $kiwi_timezone - - - The contents of the timezone setup as done in config.xml - - - - - $kiwi_delete - - - A list of all packages which are part of the packages section - with type="delete" in config.xml - - - - - $kiwi_profiles - - - A list of profiles used to build this image - - - - - $kiwi_drivers - - - A comma separated list of the driver entries as listed in the - drivers section of the config.xml. - - - - - $kiwi_size - - - The predefined size value for this image. This is not the computed - size but only the optional size value of the preferences section - in config.xml - - - - - $kiwi_compressed - - - The value of the compressed attribute set in the type element - in config.xml - - - - - $kiwi_type - - - The basic image type. Can be a simply filesystem image type of - ext2, ext3, reiserfs, squashfs, and cpio or one of the following complex - image types: iso split usb vmx oem xen pxe - - - - - + + baseCleanMount + + + Umount the system filesystems /proc, + /dev/pts, and + /sys. + + + + + baseGetProfilesUsed + + + Return the name(s) of profiles used to build this image. + + + + + baseGetPackagesForDeletion + + + Return the list of packages setup in the packages type="delete" + section of the config.xml used to build + this image. + + + + + baseSetupOEMPartition + + + Writes the file /config.oempartition depending on the following + config.xml parameters: oem-reboot, oem-swapsize, oem-systemsize, + oem-swap,oem-boot-title,oem-recovery, oem-kiwi-initrd. + kiwi takes the information from config.xml and creates the + config.oempartition file as part of the automatically created + boot image (initrd). The information must be available as part + of the boot image because it controls the OEM repartition + workflow on first boot of an OEM image. Detailed information + about the meaning of each option can be found in the OEM + chapter of the KIWI cookbook. + + + + + suseGFXBoot {theme} {loadertype} + + + This function requires the gfxboot and at least one bootsplash-theme-* + package to be installed in order to work correctly. The function + creates from this package data a graphics boot screen for the isolinux + and grub boot loaders. Additionally it creates the bootsplash files + for the resolutions 800x600, 1024x768, and 1280x1024 + + + + + suseStripKernel + + + This function removes all kernel drivers which are not listed in + the *drivers sections of the config.xml + file. + + + + + suseStripInitrd + + + This function removes a whole bunch of tools binaries and libraries which + are not required in order to boot a suse system with KIWI. + + + + + Rm {list of files} + + + Helper function to delete files and announce it to log. + + + + + Rpm {rpm commandline} + + + Helper function to the rpm function and announce it to log. + + + + + Echo {echo commandline} + + + Helper function to print a message to the controlling + terminal. + + + + + Debug {message} + + + Helper function to print a message + if the variable DEBUG is set to 1. + + + + + + + Profile environment variables + + The .profile environment file contains a specific set of variables which + are listed below. Some of the functions above makes use of the variables. + + + + $kiwi_iname + + + The name of the image as listed in config.xml + + + + + $kiwi_iversion + + + The image version string major.minor.release + + + + + $kiwi_keytable + + + The contents of the keytable setup as done in config.xml + + + + + $kiwi_language + + + The contents of the locale setup as done in config.xml + + + + + $kiwi_timezone + + + The contents of the timezone setup as done in config.xml + + + + + $kiwi_delete + + + A list of all packages which are part of the packages section + with type="delete" in config.xml + + + + + $kiwi_profiles + + + A list of profiles used to build this image + + + + + $kiwi_drivers + + + A comma separated list of the driver entries as listed in the + drivers section of the config.xml. + + + + + $kiwi_size + + + The predefined size value for this image. This is not the computed + size but only the optional size value of the preferences section + in config.xml + + + + + $kiwi_compressed + + + The value of the compressed attribute set in the type element + in config.xml + + + + + $kiwi_type + + + The basic image type. Can be a simply filesystem image type of + ext2, ext3, reiserfs, squashfs, and cpio or one of the following complex + image types: iso split usb vmx oem xen pxe + + + + + diff --git a/doc/docbook/kiwi-man-kiwirc.xml b/doc/docbook/kiwi-man-kiwirc.xml index d72b7da35..c9e629baf 100644 --- a/doc/docbook/kiwi-man-kiwirc.xml +++ b/doc/docbook/kiwi-man-kiwirc.xml @@ -1,119 +1,119 @@ + "-//OASIS//DTD DocBook XML V4.4//EN" + "http://www.docbook.org/xml/4.4/docbookx.dtd"> - - - manpages - kiwi::kiwirc - - >KIWI - - Created: - - - Robert - Schweikert - Developer - rschweikert (AT) novell.com - - - - - kiwi::kiwirc - 1 - _KV_ - KIWI Manualpage - - - KIWI::kiwirc - Resource file for the Kiwi imaging system - + + + manpages + kiwi::kiwirc + + >KIWI + + Created: + + + Robert + Schweikert + Developer + rschweikert (AT) novell.com + + + + + kiwi::kiwirc + 1 + _KV_ + KIWI Manualpage + + + KIWI::kiwirc + Resource file for the Kiwi imaging system + - - Description - - The KIWI imaging toolchain supports the use of an optional resource - file named .kiwirc located in the users home directory. - - - The file is sourced by a Perl process and thus Perl compatible syntax - for the supported variable settings is required. - + + Description + + The KIWI imaging toolchain supports the use of an optional resource + file named .kiwirc located in the users home directory. + + + The file is sourced by a Perl process and thus Perl compatible syntax + for the supported variable settings is required. + - - Template for .kiwi.rc - $BasePath='/usr/share/kiwi'; + + Template for .kiwi.rc + $BasePath='/usr/share/kiwi'; $Gzip='bzip2'; $LogServerPort='4455'; $System='/usr/share/kiwi/image'; - - - - - Supported Resource Settings - - KIWI recognizes the BasePath, Gzip, LogServerPort, LuksCipher, and - System settings in the .kiwirc file. - - - - BasePath - - - Path to the location of the KIWI image system components, such as - modules, tests, image descriptions etc. - - - The default value is /usr/share/kiwi - - - - - Gzip - - - Specify the compression utility to be used for various compression - tasks during image generation. - - - The default value is gzip - - - - - LogServerPort - - - Specify a port number for log message queuing. - - - The default value is off - - - - - LuksCipher - - - Specify the cipher for the encrypted Luks filesystem. - - - - - System - - - Specify the location of the KIWI system image description. - - - The default value is the value of BasePath concatenated with - /image. - - - - - + + + + + Supported Resource Settings + + KIWI recognizes the BasePath, Gzip, LogServerPort, LuksCipher, and + System settings in the .kiwirc file. + + + + BasePath + + + Path to the location of the KIWI image system components, such as + modules, tests, image descriptions etc. + + + The default value is /usr/share/kiwi + + + + + Gzip + + + Specify the compression utility to be used for various compression + tasks during image generation. + + + The default value is gzip + + + + + LogServerPort + + + Specify a port number for log message queuing. + + + The default value is off + + + + + LuksCipher + + + Specify the cipher for the encrypted Luks filesystem. + + + + + System + + + Specify the location of the KIWI system image description. + + + The default value is the value of BasePath concatenated with + /image. + + + + + diff --git a/doc/docbook/kiwi-man.xml b/doc/docbook/kiwi-man.xml index 7c2480553..bae27cce9 100644 --- a/doc/docbook/kiwi-man.xml +++ b/doc/docbook/kiwi-man.xml @@ -1,831 +1,831 @@ + "-//OASIS//DTD DocBook XML V4.4//EN" + "http://www.docbook.org/xml/4.4/docbookx.dtd"> - - - manpages - kiwi - - KIWI - - Created: - - - Marcus - Schaefer - Developer - ms (AT) suse.de - - - - - kiwi - 1 - _KV_ - KIWI Manualpage - - - kiwi - Creating Operating System Images - + + + manpages + kiwi + + KIWI + + Created: + + + Marcus + Schaefer + Developer + ms (AT) suse.de + + + + + kiwi + 1 + _KV_ + KIWI Manualpage + + + kiwi + Creating Operating System Images + - - Synopsis - - kiwi - - -l - --list - - - - kiwi - - -o - --clone - - image-path - - -d - - destination - - - kiwi - - -b - --build - - image-path - - -d - - destination - - + + Synopsis + + kiwi + + -l + --list + + + + kiwi + + -o + --clone + + image-path + + -d + + destination + + + kiwi + + -b + --build + + image-path + + -d + + destination + + - - Basics - - KIWI is a complete imaging solution that is based on an image - description. Such a description is represented by a directory - which includes at least one config.xml file - and may as well include other files like scripts or configuration - data. The kiwi-templates package provides example descriptions - based on a JeOS system. JeOS means Just enough Operating System. - KIWI provides image templates based on that axiom which means a - JeOS is a small, text only based image including a predefined - remote source setup to allow installation of missing software - components at a later point in time. - - - Detailed description of the kiwi image system - exists in the system design document in . KIWI - always operates in two steps. The KIWI option just - combines both steps into one to make it easier to start with KIWI. - The first step is the preparation step and if that step was successful, - a creation step follows which is able to create different image output - types. If you have started with an example and want to add you own - changes it might be a good idea to clone of from this example. This - can be done by simply copying the entire image description or you can - let KIWI do that for you by using the kiwi command. - - - In the preparation step, - you prepare a directory including the contents of your new - filesystem based on one or more software package source(s) - The creation step is based on the result of the - preparation step and uses the contents of the new image root tree to - create the output image. If the image type ISO was requested, the - output image would be a file with the suffix .iso representing a live system on - CD or DVD. Other than that KIWI is able to create images for - virtual and para-virtual (Xen) environments as well as for USB - stick, PXE network clients and OEM customized Linux systems. - - + + Basics + + KIWI is a complete imaging solution that is based on an image + description. Such a description is represented by a directory + which includes at least one config.xml file + and may as well include other files like scripts or configuration + data. The kiwi-templates package provides example descriptions + based on a JeOS system. JeOS means Just enough Operating System. + KIWI provides image templates based on that axiom which means a + JeOS is a small, text only based image including a predefined + remote source setup to allow installation of missing software + components at a later point in time. + + + Detailed description of the kiwi image system + exists in the system design document in . KIWI + always operates in two steps. The KIWI option just + combines both steps into one to make it easier to start with KIWI. + The first step is the preparation step and if that step was successful, + a creation step follows which is able to create different image output + types. If you have started with an example and want to add you own + changes it might be a good idea to clone of from this example. This + can be done by simply copying the entire image description or you can + let KIWI do that for you by using the kiwi command. + + + In the preparation step, + you prepare a directory including the contents of your new + filesystem based on one or more software package source(s) + The creation step is based on the result of the + preparation step and uses the contents of the new image root tree to + create the output image. If the image type ISO was requested, the + output image would be a file with the suffix .iso representing a live system on + CD or DVD. Other than that KIWI is able to create images for + virtual and para-virtual (Xen) environments as well as for USB + stick, PXE network clients and OEM customized Linux systems. + + - - Image Preparation and Creation - - kiwi - - -p - --prepare - - image-path - - - -r - --root - - image-root - --cache directory - + + Image Preparation and Creation + + kiwi + + -p + --prepare + + image-path + + + -r + --root + + image-root + --cache directory + - - kiwi - - -c - --create - - image-root - - - -d - --destdir - - destination - --type image-type - - + + kiwi + + -c + --create + + image-root + + + -d + --destdir + + destination + --type image-type + + - - Image Upgrade - - If the image root tree is stored and not removed, it can be - used for upgrading the image according to the changes - made in the repositories used for this image. If a distributor - provides an update channel for package updates and an image - config.xml includes this update channel as - repository, it is useful to store the image root tree and upgrade - the tree according to changes on the update channel. Given that the - root tree exists it's also possible to add or remove software - and recreate the image of the desired type. - - - kiwi - - -u - --upgrade - - image-root - --add-package name - --add-pattern name - - + + Image Upgrade + + If the image root tree is stored and not removed, it can be + used for upgrading the image according to the changes + made in the repositories used for this image. If a distributor + provides an update channel for package updates and an image + config.xml includes this update channel as + repository, it is useful to store the image root tree and upgrade + the tree according to changes on the update channel. Given that the + root tree exists it's also possible to add or remove software + and recreate the image of the desired type. + + + kiwi + + -u + --upgrade + + image-root + --add-package name + --add-pattern name + + - - System Analysis - - KIWI provides a module which allows you to analyse - the running system and create a report and an image description - representing the current state of the machine. Among others this allows - you to clone your currently running system into an image. - The system requires the zypper backend in order to work properly. - - - The process will always place it's result into the - /tmp/$OptionValueOf--describe directory. The reason for - this is because - /tmp is always excluded from - the analysis and therefore - we can safely place new files there without influencing the - process itself. You should have at least 100 MB free space for - the cache file and the image description all the rest are just - hard links. - - - As one result a HTML based report file is created which - contains important information about the system. You are free to - ignore that information but with the risk that the image from - that description - does not represent the same system which is running at the moment. - The less issues left in the report the better is the result. - In most cases a manual fine tuning is required. This includes - the repository selection and the unmanaged files along with the - configuration details of your currently running operating system. - You should understand the module as a helper to analyse running - linux systems. - - kiwi - - --describe - - name - - - - - Image Postprocessing Modes - - The KIWI post-processing modes are used for special image deployment - tasks, like installing the image on a USB stick. So to say they are the - third step after preparation and creation. KIWI calls the postprocessing - modules automatically according to the specified output image type and - attributes but it's also possible to call them manually. - - kiwi - --bootvm initrd - --bootvm-system systemImage - --bootvm-disksize size - - kiwi - --bootcd initrd - - kiwi - --installcd initrd - --installcd-system raw-system-image - - kiwi - --installstick initrd - --installstick-system raw-system-image - - kiwi - --installpxe initrd - --installpxe-system raw-system-image - - + + System Analysis + + KIWI provides a module which allows you to analyse + the running system and create a report and an image description + representing the current state of the machine. Among others this allows + you to clone your currently running system into an image. + The system requires the zypper backend in order to work properly. + + + The process will always place it's result into the + /tmp/$OptionValueOf--describe directory. The reason for + this is because + /tmp is always excluded from + the analysis and therefore + we can safely place new files there without influencing the + process itself. You should have at least 100 MB free space for + the cache file and the image description all the rest are just + hard links. + + + As one result a HTML based report file is created which + contains important information about the system. You are free to + ignore that information but with the risk that the image from + that description + does not represent the same system which is running at the moment. + The less issues left in the report the better is the result. + In most cases a manual fine tuning is required. This includes + the repository selection and the unmanaged files along with the + configuration details of your currently running operating system. + You should understand the module as a helper to analyse running + linux systems. + + kiwi + + --describe + + name + + + + + Image Postprocessing Modes + + The KIWI post-processing modes are used for special image deployment + tasks, like installing the image on a USB stick. So to say they are the + third step after preparation and creation. KIWI calls the postprocessing + modules automatically according to the specified output image type and + attributes but it's also possible to call them manually. + + kiwi + --bootvm initrd + --bootvm-system systemImage + --bootvm-disksize size + + kiwi + --bootcd initrd + + kiwi + --installcd initrd + --installcd-system raw-system-image + + kiwi + --installstick initrd + --installstick-system raw-system-image + + kiwi + --installpxe initrd + --installpxe-system raw-system-image + + - - Image Format Conversion - - The KIWI format conversion is useful to perform the creation of - another image output format like vmdk for VMware or ovf the open - virtual machine format. Along with the conversion KIWI also creates - the virtual machine configuration according to the format if - there is a machine section specified in the XML description - - kiwi - --convert systemImage - --format vmdk|ovf|qcow2|vhd - - + + Image Format Conversion + + The KIWI format conversion is useful to perform the creation of + another image output format like vmdk for VMware or ovf the open + virtual machine format. Along with the conversion KIWI also creates + the virtual machine configuration according to the format if + there is a machine section specified in the XML description + + kiwi + --convert systemImage + --format vmdk|ovf|qcow2|vhd + + - - Helper Tools - - The helper tools provide optional functions like - creating a crypted password string for the users section of the - config.xml file as well as signing the image - description with an md5sum hash and adding splash data to - the boot image used by the bootloader. - - - kiwi --createpassword - - kiwi --createhash - image-path - - - kiwi - - -i - --info - - ImagePath - --select - - repo-patterns|patterns|types|sources|size|profiles|packages|version - + + Helper Tools + + The helper tools provide optional functions like + creating a crypted password string for the users section of the + config.xml file as well as signing the image + description with an md5sum hash and adding splash data to + the boot image used by the bootloader. + + + kiwi --createpassword - - kiwi - --setup-splash initrd + kiwi --createhash + image-path - - The following list describes the helper tools more detailed - - - - - - - Create a crypted password hash and prints it on the console. - The user can use the string as value for the pwd attribute in - the XML users section - - - - - - - - - Sign your image description with a md5sum. The result is written to a file - named .checksum.md and is checked if KIWI creates - an image from this description. - - - - - - | - - - - - List general information about the image description. So far you can get - information about the available patterns in the configured repositories with - repo-patterns, a list of used patterns for this image - with patterns, a list of supported image types - with types, a list of source URLs with - sources, an estimation about the install size and - the size of the packages marked as to be deleted with size, - a list of profiles with profiles, - a list of solved packages to become installed with packages, - and the information about the appliance name and version with version - - - - - - - - - Create splash screen from the data inside the initrd - and re-create the initrd with the splash screen attached - to the initrd cpio archive. This enables the kernel - to load the splash screen at boot time. If splashy is used - only a link to the original initrd will be created - - - - - - - - Global Options - - - - profile-name - - - Use the specified profile. A profile is a part of the - XML image description and therefore can enhance each section - with additional information. For example adding packages. - - - - - - URL - - - Set/Overwrite the repo URL for the first repo listed in the - configuration file that does not have a "fixed" status. - The change is temporary and will not be written to the - XML file. - - - - - - type - - - Set/Overwrite repo type for the first listed repo. - The supported repo types depends on the packagemanager. - Commonly supported are rpm-md, rpm-dir and yast2. - The change is temporary and will not be written to the - XML file. - - - - - - name - - - Set/Overwrite alias name for the first listed repo. - Alias names are optional free form text. If not set the source - attribute value is used and builds the alias name by replacing - each / with a _. An alias name should be set if the - source argument doesn't really explain what this repository - contains. The change is temporary and will not be written to the - XML file. - - - - - - number - - - Set/Overwrite priority for the first listed repo. - Works with the smart packagemanager only. The Channel - priority assigned to all packages available in - this channel (0 if not set). If the exact same package - is available in more than one channel, the highest - priority is used. - - - - - , - - - - - - - Add the given repository and type for this run of an - image prepare or upgrade process. Multiple - / - options are possible. The change will not be written to the - config.xml file - - - - - - - Ignore all repositories specified so far, in XML or - elsewhere. This option should be used in conjunction with - subsequent calls to to specify - repositories at the commandline that override previous - specifications. - - - - - - | - - - Write to the log file - Filename instead of the terminal. - - - - - - - - Specify an alternate command to run when compressing - boot and system images. Command must accept - gzip options. - - - - - - - - - Set the package manager to use for this image. If set it - will temporarily overwrite the value set in the xml - description. - - - - - | - - - - Set a special target-architecture. This overrides the - used architecture for the image-packages in zypp.conf. - When used with smart this option doesn't have any effect. - - - - - - - - Prints a stack trace in case of internal errors - - - - - - - - - Controls the verbosity level for the instsource module + + kiwi + + -i + --info + + ImagePath + --select + + repo-patterns|patterns|types|sources|size|profiles|packages|version + + + + kiwi + --setup-splash initrd + + + The following list describes the helper tools more detailed - - - - + + + + + + Create a crypted password hash and prints it on the console. + The user can use the string as value for the pwd attribute in + the XML users section + + + + + + + + + Sign your image description with a md5sum. The result is written to a file + named .checksum.md and is checked if KIWI creates + an image from this description. + + + + + + | + + + + + List general information about the image description. So far you can get + information about the available patterns in the configured repositories with + repo-patterns, a list of used patterns for this image + with patterns, a list of supported image types + with types, a list of source URLs with + sources, an estimation about the install size and + the size of the packages marked as to be deleted with size, + a list of profiles with profiles, + a list of solved packages to become installed with packages, + and the information about the appliance name and version with version + + + + + + + + + Create splash screen from the data inside the initrd + and re-create the initrd with the splash screen attached + to the initrd cpio archive. This enables the kernel + to load the splash screen at boot time. If splashy is used + only a link to the original initrd will be created + + + + + + + + Global Options + + + + profile-name + + + Use the specified profile. A profile is a part of the + XML image description and therefore can enhance each section + with additional information. For example adding packages. + + + + + + URL + + + Set/Overwrite the repo URL for the first repo listed in the + configuration file that does not have a "fixed" status. + The change is temporary and will not be written to the + XML file. + + + + + + type + + + Set/Overwrite repo type for the first listed repo. + The supported repo types depends on the packagemanager. + Commonly supported are rpm-md, rpm-dir and yast2. + The change is temporary and will not be written to the + XML file. + + + + + + name + + + Set/Overwrite alias name for the first listed repo. + Alias names are optional free form text. If not set the source + attribute value is used and builds the alias name by replacing + each / with a _. An alias name should be set if the + source argument doesn't really explain what this repository + contains. The change is temporary and will not be written to the + XML file. + + + + + + number + + + Set/Overwrite priority for the first listed repo. + Works with the smart packagemanager only. The Channel + priority assigned to all packages available in + this channel (0 if not set). If the exact same package + is available in more than one channel, the highest + priority is used. + + + + + , + + + + + + + Add the given repository and type for this run of an + image prepare or upgrade process. Multiple + / + options are possible. The change will not be written to the + config.xml file + + + + + + + Ignore all repositories specified so far, in XML or + elsewhere. This option should be used in conjunction with + subsequent calls to to specify + repositories at the commandline that override previous + specifications. + + + + + + | + + + Write to the log file + Filename instead of the terminal. + + + + + + + + Specify an alternate command to run when compressing + boot and system images. Command must accept + gzip options. + + + + + + + + + Set the package manager to use for this image. If set it + will temporarily overwrite the value set in the xml + description. + + + + + | + + + + Set a special target-architecture. This overrides the + used architecture for the image-packages in zypp.conf. + When used with smart this option doesn't have any effect. + + + + + + + + Prints a stack trace in case of internal errors + + + + + + + + + Controls the verbosity level for the instsource module + + + + + - - Image Preparation Options - - - | - - - Set up the physical extend, chroot system below the given - root-path path. If no option is - given, KIWI will search for the attribute defaultroot in - config.xml. If no root directory is - known, a mktemp directory will be created - and used as root directory. - - - - - - - - Force creation of new root directory. If the directory - already exists, it is deleted. - - - - - + + Image Preparation Options + + + | + + + Set up the physical extend, chroot system below the given + root-path path. If no option is + given, KIWI will search for the attribute defaultroot in + config.xml. If no root directory is + known, a mktemp directory will be created + and used as root directory. + + + + + + + + Force creation of new root directory. If the directory + already exists, it is deleted. + + + + + - - Image Upgrade/Preparation Options - + + Image Upgrade/Preparation Options + + + directory + + + + When specifying a cache directory, KIWI will create a cache each for + patterns and packages and re-use them, if possible, for subsequent + root tree preparations of this and/or other images + + + - directory + package - When specifying a cache directory, KIWI will create a cache each for - patterns and packages and re-use them, if possible, for subsequent - root tree preparations of this and/or other images + Add the given package name to the list of image packages + multiple options are possible. The change + will not be written to the XML description. - - package - - - - Add the given package name to the list of image packages - multiple options are possible. The change - will not be written to the XML description. - - - + + name + + + + Add the given pattern name to the list of image packages + multiple options are possible. The change + will not be written to the xml description. Patterns can be handled + by SUSE based repositories only. + + + - name + package - Add the given pattern name to the list of image packages - multiple options are possible. The change - will not be written to the xml description. Patterns can be handled - by SUSE based repositories only. + Removes the given package by adding it the list of packages + to become removed. The change will not be written to the xml + description. - - package - - - - Removes the given package by adding it the list of packages - to become removed. The change will not be written to the xml - description. - - - - - + + - - Image Creation Options - - - | - - - Specify destination directory to store the image file(s) - If not specified, KIWI will try to find the attribute - defaultdestination which can be - specified in the preferences section - of the config.xml file. If it exists its value is used as - destination directory. If no destination information can be found, - an error occurs. - - - - - | - - - Specify the output image type to use for this image. Each type - is described in a type section of the - preferences section. At least one type has to be specified in the - config.xml description. By default, - the types specifying the primary attribute will be - used. If there is no primary attribute set, the first type - section of the preferences section is the primary type. - The types are only evaluated when KIWI runs the - step. With the - option one can distinguish between the - types stored in config.xml - - - - - | - - - Strip shared objects and executables - only makes sense in - combination with - - - - - - - - Search in Directory for - pre-built boot images. - - - - - - - - in case of an iso image the checkmedia program generates - a md5sum into the ISO header. If the option is - specified a new boot menu entry will be generated which - allows to check this media - - - - - - - - Use the logical volume manager to control the disk. - The partition table will include one lvm partition and - one standard ext2 boot partition. Use of this option - makes sense for the create step only and also only for - the image types: vmx, oem, and usb - - - - - - - - - When calling KIWI in creation mode this option will set - the block size in bytes. For ISO images with the old style - ramdisk setup a blocksize of 4096 bytes is required - - - - - - - - - When calling KIWI in creation mode this option will set - the journal size in mega bytes for ext[23] based filesystems - and in blocks if the reiser filesystem is used - - - - - - - - - When calling KIWI in creation mode this option will set - the inode size in bytes. This option has no effect if the - reiser filesystem is used - - - - - + + Image Creation Options + + + | + + + Specify destination directory to store the image file(s) + If not specified, KIWI will try to find the attribute + defaultdestination which can be + specified in the preferences section + of the config.xml file. If it exists its value is used as + destination directory. If no destination information can be found, + an error occurs. + + + + + | + + + Specify the output image type to use for this image. Each type + is described in a type section of the + preferences section. At least one type has to be specified in the + config.xml description. By default, + the types specifying the primary attribute will be + used. If there is no primary attribute set, the first type + section of the preferences section is the primary type. + The types are only evaluated when KIWI runs the + step. With the + option one can distinguish between the + types stored in config.xml + + + + + | + + + Strip shared objects and executables - only makes sense in + combination with + + + + + + + + Search in Directory for + pre-built boot images. + + + + + + + + in case of an iso image the checkmedia program generates + a md5sum into the ISO header. If the option is + specified a new boot menu entry will be generated which + allows to check this media + + + + + + + + Use the logical volume manager to control the disk. + The partition table will include one lvm partition and + one standard ext2 boot partition. Use of this option + makes sense for the create step only and also only for + the image types: vmx, oem, and usb + + + + + - Set the bytes/inode ratio. This option has no - effect if the reiser filesystem is used + When calling KIWI in creation mode this option will set + the block size in bytes. For ISO images with the old style + ramdisk setup a blocksize of 4096 bytes is required - - - - - - When calling kiwi in creation mode this option will set the number - of mounts after which the filesystem will be checked. Set to 0 to - disable checks. - This option applies only to ext[234] filesystems. - - - - - - - - - When calling kiwi in creation mode this option will set the maximal time - between two filesystem checks. Set to 0 to disable time-dependent checks. - This option applies only to ext[234] filesystems. - - - - - - - - - if the syslinux bootlaoder is used this option allows to - specify the size of the fat partition. This is useful if - the fat space is not only used for booting the system but - also for custom data. Therefore this option makes sense - when building a USB stick image (image type: usb or oem) - - - - - + + - Select the tool to create partition tables. Supported are - parted and fdasd (s390). By default parted is used + When calling KIWI in creation mode this option will set + the journal size in mega bytes for ext[23] based filesystems + and in blocks if the reiser filesystem is used - - + + + - Activates check for matching kernels between boot and - system image. The kernel check also tries to fix the boot - image if no matching kernel was found. + When calling KIWI in creation mode this option will set + the inode size in bytes. This option has no effect if the + reiser filesystem is used - - - - - Specifies a custom mbrid. The number value is treated as - decimal number which is internally translated into a 4byte - hex value. The allowed range therefore is from 0x0 to - max 0xffffffff. By default kiwi creates a random value - - - - - - - - Specifies the location of a custom script which is called - right before the bootloader is installed. This allows to modify - the bootloader configuration file written by kiwi. The scripts - working directory is the one which represents the image - structure including the bootloader configuration files. Please - have in mind that according to the image type, architecture - and bootloader type the files/directory structure and also - the name of the bootloader configuration files might be - different. - - - - - - - - For More Information - More information about KIWI, its files can be found at: - - - + + + + + + Set the bytes/inode ratio. This option has no + effect if the reiser filesystem is used + + + + + + - KIWI wiki + + When calling kiwi in creation mode this option will set the number + of mounts after which the filesystem will be checked. Set to 0 to + disable checks. + This option applies only to ext[234] filesystems. + - - - config.xml + + + + - The configuration XML file that contains every - aspect for the image creation. + + When calling kiwi in creation mode this option will set the maximal time + between two filesystem checks. Set to 0 to disable time-dependent checks. + This option applies only to ext[234] filesystems. + - - - + + + + - The system documentation which describes the supported image - types in detail. + + if the syslinux bootlaoder is used this option allows to + specify the size of the fat partition. This is useful if + the fat space is not only used for booting the system but + also for custom data. Therefore this option makes sense + when building a USB stick image (image type: usb or oem) + - - - + + + + + + + Select the tool to create partition tables. Supported are + parted and fdasd (s390). By default parted is used + + + + + + + + Activates check for matching kernels between boot and + system image. The kernel check also tries to fix the boot + image if no matching kernel was found. + + + + + - The KIWI RELAX NG XML Schema documentation. - + + Specifies a custom mbrid. The number value is treated as + decimal number which is internally translated into a 4byte + hex value. The allowed range therefore is from 0x0 to + max 0xffffffff. By default kiwi creates a random value + - + + + + + + Specifies the location of a custom script which is called + right before the bootloader is installed. This allows to modify + the bootloader configuration file written by kiwi. The scripts + working directory is the one which represents the image + structure including the bootloader configuration files. Please + have in mind that according to the image type, architecture + and bootloader type the files/directory structure and also + the name of the bootloader configuration files might be + different. + + + - + + + + For More Information + More information about KIWI, its files can be found at: + + + + + KIWI wiki + + + + config.xml + + The configuration XML file that contains every + aspect for the image creation. + + + + + + The system documentation which describes the supported image + types in detail. + + + + + + The KIWI RELAX NG XML Schema documentation. + + + + + diff --git a/doc/docbook/xslt/fo/docbook.xsl b/doc/docbook/xslt/fo/docbook.xsl index e74afc163..9dfdd8202 100644 --- a/doc/docbook/xslt/fo/docbook.xsl +++ b/doc/docbook/xslt/fo/docbook.xsl @@ -1,30 +1,30 @@ + xmlns:fo="http://www.w3.org/1999/XSL/Format" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> - + - - A4 - - 1 - - - 0pt - - - + + A4 + + 1 + + + 0pt + + + - - + + - - + + - - + + @@ -57,448 +57,448 @@ reference toc,title - - #E0E0E0 - - - - - - inherit - - - pt - - - - - - - - pt - - - - wrap - - - - 24.8832pt - bold - - - - - - - - 'Charis SIL' - 'Charis SIL' - - 'DejaVu Sans Mono' - - 11 - - - - navy - brown - navy - navy - - - - - - - - - - element - - + + #E0E0E0 + - - - - - - - - - - - - - - - - - - - </ - - > - - - - - - - - & - - ; - - - - - - - &# - - ; - - - - - - - % - - ; - - - - - - - <? - - > - - - - - - - <? - - ?> - - - - - - < - - > - - - - - < - - /> - - - - - <!-- - - --> - - - - - - - - - - - - - - - - - - - - - - - - - -   - - - - - - - - - - - - - - - - - - - - - - - + + + + inherit + + + pt + + + + + + + + pt + + + + wrap + + + + 24.8832pt + bold + + + + + - + 'DejaVu Sans Mono' + + 11 + + + + navy + brown + navy + navy + + + + + + + + + + element + + + + + + + + + + + + + + + + + + + + + + </ + + > + + + + + + + + & + + ; + + + + + + + &# + + ; + + + + + + + % + + ; + + + + + + + <? + + > + + + + + + + <? + + ?> + + + + + + < + + > + + + + + < + + /> + + + + + <!-- + + --> + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + +   + + + + + + + + + + + + + + + + - + + + + + - - - --> - - - - - - - - - - - - - - -   - - - - - - - bold - 1em - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4em - - - 4em - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + +   + + + + + + + bold + 1em + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + 4em + + + 4em + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + url( + + ) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Don't know how to generate Unicode callouts + when $callout.unicode.start.character is + + + + + + + + + - - - - - - - - - - + + + + + + + + - - - - Don't know how to generate Unicode callouts - when $callout.unicode.start.character is - - - - - - - - - - - - - - + + - + + + - - - - - - - - - - - - + + + diff --git a/doc/docbook/xslt/html/docbook.xsl b/doc/docbook/xslt/html/docbook.xsl index d0ef6caa8..50af54745 100644 --- a/doc/docbook/xslt/html/docbook.xsl +++ b/doc/docbook/xslt/html/docbook.xsl @@ -1,17 +1,17 @@ + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> - + - - - + + + susebooks.css - + @@ -23,7 +23,7 @@ - + diff --git a/doc/docbook/xslt/html/formal.xsl b/doc/docbook/xslt/html/formal.xsl index d127dd648..7d8c54484 100644 --- a/doc/docbook/xslt/html/formal.xsl +++ b/doc/docbook/xslt/html/formal.xsl @@ -1,27 +1,27 @@ - - - - - - - - - -

    - - - + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> - - - - - - -

    + + + + + + + + +

    + + + + + + + + + + +

    - +
    diff --git a/doc/docbook/xslt/html/sections.xsl b/doc/docbook/xslt/html/sections.xsl index 21e9662c4..dcd4091a6 100644 --- a/doc/docbook/xslt/html/sections.xsl +++ b/doc/docbook/xslt/html/sections.xsl @@ -1,91 +1,91 @@ + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> - - - - - - - - - # - - - ¶ - - - + + + + + + + + + # + + + ¶ + + + - - - - - + + + + + - + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - 6 - - - - - - - - - - clear: both - - - - - - - - - - - - - - - - - + + + + 6 + + + + + + + + + + clear: both + + + + + + + + + + + + + + + + + - + diff --git a/doc/docbook/xslt/profiling/db4index-profile.xsl b/doc/docbook/xslt/profiling/db4index-profile.xsl index 6468cfb3a..9ffc39c6f 100644 --- a/doc/docbook/xslt/profiling/db4index-profile.xsl +++ b/doc/docbook/xslt/profiling/db4index-profile.xsl @@ -1,17 +1,17 @@ + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> - - - - - + + + + + \ No newline at end of file diff --git a/doc/docbook/xslt/profiling/db4index.xsl b/doc/docbook/xslt/profiling/db4index.xsl index add3f62f7..ab5dd2a51 100644 --- a/doc/docbook/xslt/profiling/db4index.xsl +++ b/doc/docbook/xslt/profiling/db4index.xsl @@ -1,47 +1,47 @@ + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> - + + - - + + - - - - - - - - - - - environment variables - - - - - + + + + + + + + + + + environment variables + + + + + - - - - - - - - - - - - devices - file extensions - directories - - ** Other filenames[@class] ** - filename: Unknown @class= - - - - - - - - - + + + + + + + + + + + + devices + file extensions + directories + + ** Other filenames[@class] ** + filename: Unknown @class= + + + + + + + + + - - - - - - - - - - attributes - - - - - + + + + + + + + + + attributes + + + + + - - - - - - - - - - - - - services - server - filesystems - protocols - macros - - ** Other systemitems ** - systemitem: Unknown @class= - - - - - - - - - + + + + + + + + + + + + + services + server + filesystems + protocols + macros + + ** Other systemitems ** + systemitem: Unknown @class= + + + + + + + + + diff --git a/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_cloud/config.xml b/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_cloud/config.xml index 4a02a0507..5257724cb 100644 --- a/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_cloud/config.xml +++ b/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_cloud/config.xml @@ -1,70 +1,70 @@ - - Robert Schweikert - rjschwei@suse.com - OpenNebula Cloud Node configuration - - - - - OpenNebula Cloud Node - true - true - 2048 - true - - - 1.3.0 - zypper - false - true - en_US - us.map.gz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + Robert Schweikert + rjschwei@suse.com + OpenNebula Cloud Node configuration + + + + + OpenNebula Cloud Node + true + true + 2048 + true + + + 1.3.0 + zypper + false + true + en_US + us.map.gz + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_cloud/root/usr/share/firstboot/scripts/cloudNodeConfig b/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_cloud/root/usr/share/firstboot/scripts/cloudNodeConfig index 95ba5c906..90dbc5bc5 100755 --- a/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_cloud/root/usr/share/firstboot/scripts/cloudNodeConfig +++ b/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_cloud/root/usr/share/firstboot/scripts/cloudNodeConfig @@ -12,377 +12,377 @@ import time #------------------------------------------------------------------------ def configureNode(confSettings): - """Configure this node.""" - # Setup keyboard layout - layout = confSettings['keyLayout'] - msg = 'Setting keyboard layout to: %s\n' %layout - syslog.syslog(syslog.LOG_INFO, msg) - os.system('/sbin/yast2 keyboard set layout=%s' %layout) - # Setup the timezone - zone = confSettings['timezone'] - hwc = confSettings['hwclock'].lower() - msg = 'Setting timezone and hwclock to: %s, %s' %(zone, hwc) - syslog.syslog(syslog.LOG_INFO, msg) - os.system('/sbin/yast2 timezone set timezone=%s hwclock=%s' %(zone, hwc)) - # Setup hostname - domain = confSettings['domainname'] - name = confSettings['hostname'] - host = '%s.%s' %(name, domain) - msg = 'Setting hostname to: %s\n' %host - hf = open('/etc/HOSTNAME', 'w') - hf.write(host) - hf.close() - # Add the hostname to the dhcp configuration info - lines = open('/etc/sysconfig/network/dhcp', 'r').readlines() - dhf = open('/etc/sysconfig/network/dhcp', 'w') - for ln in lines: - if ln.find('DHCLIENT_HOSTNAME_OPTION') != -1: - dhf.write('DHCLIENT_HOSTNAME_OPTION="%s"' %name) - continue - dhf.write(ln) - dhf.close() - # Add the dhcp feature to avoid dhcp acceptance from servers other than - # the head node - feature = confSettings['dhcpFeature'] - msg = 'Setting dhclient required feature to: %s\n' %feature - syslog.syslog(syslog.LOG_INFO, msg) - dhcf = open('/etc/dhclient.conf','a') - dhcf.write('option %s code 239 = ip-address;\n' %feature) - dhcf.write('request %s;\n' %feature) - dhcf.write('require %s;\n' %feature) - dhcf.close() - # Setup the name resolution - syslog.syslog(syslog.LOG_INFO, 'Setting up resolve.conf\n') - res = open('/etc/resolv.conf', 'w') - res.write(confSettings['resolve']) - res.close() - # Setup the routes - syslog.syslog(syslog.LOG_INFO, 'Setting up routes\n') - routes = open('/etc/sysconfig/network/routes', 'w') - routes.write(confSettings['routes']) - routes.close() - # Setup the root password - syslog.syslog(syslog.LOG_INFO, 'Setting root password\n') - lines = open('/etc/shadow', 'r').readlines() - shadow = open('/etc/shadow','w') - for ln in lines: - if ln[:4] == 'root': - shadow.write('root:') - shadow.write(confSettings['rootpass']) - shadow.write(':') - shadow.write(ln.split(':')[2]) - shadow.write('::::::\n') - continue - shadow.write(ln) - shadow.close() - # Setup the cloud administartor acount - # Use eval; convert strings to tuple - gname, gid = eval(confSettings['groupID']) - uname, uid, pwd = eval(confSettings['userID']) - msg = 'Setting up %s with uid, gid: %s, %s\n' %(uname,uid,gid) - syslog.syslog(syslog.LOG_INFO, msg) - res = os.system('/usr/sbin/groupadd -g %s %s' %(gid, gname)) - if res: - msg = 'Could not add %s group. ' %gname - msg += 'Incomplete configuration\n' + """Configure this node.""" + # Setup keyboard layout + layout = confSettings['keyLayout'] + msg = 'Setting keyboard layout to: %s\n' %layout syslog.syslog(syslog.LOG_INFO, msg) - return -1 - groups = 'kvm,root,%s' %gname - res = os.system( - '/usr/sbin/useradd -c "%s" -d %s -g %s -G %s -u %s -p %s -m %s' - %('Cloud admin', '/var/lib/one', gid, groups, uid, pwd, uname)) - if res: - msg = 'Could not add %s user. ' %uname - msg += 'Incomplete configuration\n' + os.system('/sbin/yast2 keyboard set layout=%s' %layout) + # Setup the timezone + zone = confSettings['timezone'] + hwc = confSettings['hwclock'].lower() + msg = 'Setting timezone and hwclock to: %s, %s' %(zone, hwc) syslog.syslog(syslog.LOG_INFO, msg) - return -1 - # Setup nfs mount in fstab - syslog.syslog(syslog.LOG_INFO, 'Setting up NFS mount in fstab\n') - fst = open('/etc/fstab', 'a') - fst.write(confSettings['serverIP']) - fst.write(':/var/lib/one') - fst.write('\t/var/lib/one\tnfs\tdefaults,comment=systemd.automount\t1 1\n') - fst.close() - - return 1 + os.system('/sbin/yast2 timezone set timezone=%s hwclock=%s' %(zone, hwc)) + # Setup hostname + domain = confSettings['domainname'] + name = confSettings['hostname'] + host = '%s.%s' %(name, domain) + msg = 'Setting hostname to: %s\n' %host + hf = open('/etc/HOSTNAME', 'w') + hf.write(host) + hf.close() + # Add the hostname to the dhcp configuration info + lines = open('/etc/sysconfig/network/dhcp', 'r').readlines() + dhf = open('/etc/sysconfig/network/dhcp', 'w') + for ln in lines: + if ln.find('DHCLIENT_HOSTNAME_OPTION') != -1: + dhf.write('DHCLIENT_HOSTNAME_OPTION="%s"' %name) + continue + dhf.write(ln) + dhf.close() + # Add the dhcp feature to avoid dhcp acceptance from servers other than + # the head node + feature = confSettings['dhcpFeature'] + msg = 'Setting dhclient required feature to: %s\n' %feature + syslog.syslog(syslog.LOG_INFO, msg) + dhcf = open('/etc/dhclient.conf','a') + dhcf.write('option %s code 239 = ip-address;\n' %feature) + dhcf.write('request %s;\n' %feature) + dhcf.write('require %s;\n' %feature) + dhcf.close() + # Setup the name resolution + syslog.syslog(syslog.LOG_INFO, 'Setting up resolve.conf\n') + res = open('/etc/resolv.conf', 'w') + res.write(confSettings['resolve']) + res.close() + # Setup the routes + syslog.syslog(syslog.LOG_INFO, 'Setting up routes\n') + routes = open('/etc/sysconfig/network/routes', 'w') + routes.write(confSettings['routes']) + routes.close() + # Setup the root password + syslog.syslog(syslog.LOG_INFO, 'Setting root password\n') + lines = open('/etc/shadow', 'r').readlines() + shadow = open('/etc/shadow','w') + for ln in lines: + if ln[:4] == 'root': + shadow.write('root:') + shadow.write(confSettings['rootpass']) + shadow.write(':') + shadow.write(ln.split(':')[2]) + shadow.write('::::::\n') + continue + shadow.write(ln) + shadow.close() + # Setup the cloud administartor acount + # Use eval; convert strings to tuple + gname, gid = eval(confSettings['groupID']) + uname, uid, pwd = eval(confSettings['userID']) + msg = 'Setting up %s with uid, gid: %s, %s\n' %(uname,uid,gid) + syslog.syslog(syslog.LOG_INFO, msg) + res = os.system('/usr/sbin/groupadd -g %s %s' %(gid, gname)) + if res: + msg = 'Could not add %s group. ' %gname + msg += 'Incomplete configuration\n' + syslog.syslog(syslog.LOG_INFO, msg) + return -1 + groups = 'kvm,root,%s' %gname + res = os.system( + '/usr/sbin/useradd -c "%s" -d %s -g %s -G %s -u %s -p %s -m %s' + %('Cloud admin', '/var/lib/one', gid, groups, uid, pwd, uname)) + if res: + msg = 'Could not add %s user. ' %uname + msg += 'Incomplete configuration\n' + syslog.syslog(syslog.LOG_INFO, msg) + return -1 + # Setup nfs mount in fstab + syslog.syslog(syslog.LOG_INFO, 'Setting up NFS mount in fstab\n') + fst = open('/etc/fstab', 'a') + fst.write(confSettings['serverIP']) + fst.write(':/var/lib/one') + fst.write('\t/var/lib/one\tnfs\tdefaults,comment=systemd.automount\t1 1\n') + fst.close() + + return 1 #---------------------------------------------------------------------------- def getConfigFromServer(): - """Get the configuration from the service running on the head node.""" - syslog.syslog(syslog.LOG_INFO, 'Obtain node configuration from head\n') - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - try: - s.connect(('169.254.1.1', 8445)) - except: - msg = 'Could not connect to head node at 169.254.1.1 port 8445\n' - syslog.syslog(syslog.LOG_INFO, msg) - return -1 - # Request the configuration info from the head node - s.send('PROVIDE_CONFIG') - confSettings = {} - confData = '' - # Read the configuration data from the socket - while 1: - data = s.recv(4096) - confData += data - if confData.find('COMPLETE') != -1: - break - s.close() - # Populate the configuration data dict - for confItem in confData.split(';'): - key, value = confItem.split('=', 1) - if key != 'COMPLETE': - confSettings[key] = value - return confSettings + """Get the configuration from the service running on the head node.""" + syslog.syslog(syslog.LOG_INFO, 'Obtain node configuration from head\n') + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + try: + s.connect(('169.254.1.1', 8445)) + except: + msg = 'Could not connect to head node at 169.254.1.1 port 8445\n' + syslog.syslog(syslog.LOG_INFO, msg) + return -1 + # Request the configuration info from the head node + s.send('PROVIDE_CONFIG') + confSettings = {} + confData = '' + # Read the configuration data from the socket + while 1: + data = s.recv(4096) + confData += data + if confData.find('COMPLETE') != -1: + break + s.close() + # Populate the configuration data dict + for confItem in confData.split(';'): + key, value = confItem.split('=', 1) + if key != 'COMPLETE': + confSettings[key] = value + return confSettings #---------------------------------------------------------------------------- def getFirstConnectedInterface(): - """Find the interface that has a cable connected.""" - # Bring up every interface so we can reliably figure out the one - # that is connected - iFaces = glob.glob('/sys/class/net/eth*') - for iFace in iFaces: - name = iFace.split('/')[-1] - os.system('/sbin/ifconfig %s up' %name) - # Allow time for the interface to activate - time.sleep(5) - - iFaceInfo = os.popen('/usr/sbin/hwinfo --network').readlines() - iFaceName = None - processBlock = None - for ln in iFaceInfo: - if ln.strip() == '': - processBlock = None - continue - if processBlock: - if ln.find('SysFS ID') != -1: - iFaceName = ln.split(':')[-1].split('/')[-1].strip() - continue - if ln.find('Link detected') != -1: - carrier = ln.split(':')[-1].strip() - if carrier == 'yes': - if iFaceName: - return iFaceName - else: - continue - if re.match(r'^\d+:.*Ethernet$',ln): - processBlock = 1 - continue + """Find the interface that has a cable connected.""" + # Bring up every interface so we can reliably figure out the one + # that is connected + iFaces = glob.glob('/sys/class/net/eth*') + for iFace in iFaces: + name = iFace.split('/')[-1] + os.system('/sbin/ifconfig %s up' %name) + # Allow time for the interface to activate + time.sleep(5) + + iFaceInfo = os.popen('/usr/sbin/hwinfo --network').readlines() + iFaceName = None + processBlock = None + for ln in iFaceInfo: + if ln.strip() == '': + processBlock = None + continue + if processBlock: + if ln.find('SysFS ID') != -1: + iFaceName = ln.split(':')[-1].split('/')[-1].strip() + continue + if ln.find('Link detected') != -1: + carrier = ln.split(':')[-1].strip() + if carrier == 'yes': + if iFaceName: + return iFaceName + else: + continue + if re.match(r'^\d+:.*Ethernet$',ln): + processBlock = 1 + continue - return -1 # No network interface is connected + return -1 # No network interface is connected #---------------------------------------------------------------------------- def registerNode(): - """Register this node with the head node.""" - syslog.syslog(syslog.LOG_INFO, 'Register the node with the head node.\n') - # Get the IP and MAC Address of this node - ipInfo = os.popen('/sbin/ifconfig').readlines() - processBlk = None - ipAddr = None - macAddr = None - for ln in ipInfo: - if ipAddr and macAddr: - break - if processBlk: - if ln.find('inet addr') != -1: - ipAddr = ln.split(':')[1].split()[0].strip() - continue - # We always setup br0, see setupCloudNetwork() - if ln.find('br0') != -1: - processBlk = 1 - macAddr = ln.split()[-1].strip() - if not ipAddr: - msg = 'Could not determine IP of this node. ' - msg += 'Unable to gergister node.\n' - syslog.syslog(syslog.LOG_INFO, msg) - return -1 - if not macAddr: - msg = 'Could not determine MAC of this node. ' - msg += 'Unable to gergister node.\n' - syslog.syslog(syslog.LOG_INFO, msg) - return -1 - # Get the server IP from fstab, see configureNode() - fst = open('/etc/fstab','r').readlines() - servIP = None - for ln in fst: - if ln.find('/var/lib/one') != -1: - servIP = ln.split(':')[0].strip() - if not servIP: - msg = 'Could not determine head node IP from /etc/fstab. ' - msg += 'Unable to gergister node.\n' - syslog.syslog(syslog.LOG_INFO, msg) - return -1 - # Hostname - myName = open('/etc/HOSTNAME', 'r').read().split('.')[0].strip() - # Connect to server and register - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - try: - s.connect((servIP, 8445)) - except: - msg = 'Could not connect to head node at %s port 8445\n' %servIP - syslog.syslog(syslog.LOG_INFO, msg) - return -1 - regInfo = '%s;%s;%s' %(macAddr, ipAddr, myName) - s.send(regInfo) - s.close() + """Register this node with the head node.""" + syslog.syslog(syslog.LOG_INFO, 'Register the node with the head node.\n') + # Get the IP and MAC Address of this node + ipInfo = os.popen('/sbin/ifconfig').readlines() + processBlk = None + ipAddr = None + macAddr = None + for ln in ipInfo: + if ipAddr and macAddr: + break + if processBlk: + if ln.find('inet addr') != -1: + ipAddr = ln.split(':')[1].split()[0].strip() + continue + # We always setup br0, see setupCloudNetwork() + if ln.find('br0') != -1: + processBlk = 1 + macAddr = ln.split()[-1].strip() + if not ipAddr: + msg = 'Could not determine IP of this node. ' + msg += 'Unable to gergister node.\n' + syslog.syslog(syslog.LOG_INFO, msg) + return -1 + if not macAddr: + msg = 'Could not determine MAC of this node. ' + msg += 'Unable to gergister node.\n' + syslog.syslog(syslog.LOG_INFO, msg) + return -1 + # Get the server IP from fstab, see configureNode() + fst = open('/etc/fstab','r').readlines() + servIP = None + for ln in fst: + if ln.find('/var/lib/one') != -1: + servIP = ln.split(':')[0].strip() + if not servIP: + msg = 'Could not determine head node IP from /etc/fstab. ' + msg += 'Unable to gergister node.\n' + syslog.syslog(syslog.LOG_INFO, msg) + return -1 + # Hostname + myName = open('/etc/HOSTNAME', 'r').read().split('.')[0].strip() + # Connect to server and register + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + try: + s.connect((servIP, 8445)) + except: + msg = 'Could not connect to head node at %s port 8445\n' %servIP + syslog.syslog(syslog.LOG_INFO, msg) + return -1 + regInfo = '%s;%s;%s' %(macAddr, ipAddr, myName) + s.send(regInfo) + s.close() - return 1 - + return 1 + #---------------------------------------------------------------------------- def removeConfNetworkSetting(iFace): - """Shutdown the configuration network and remove the configuration.""" - syslog.syslog(syslog.LOG_INFO, 'Shutdown configuration network\n') - os.system('/sbin/ifdown %s' %iFace) - msg = 'Remove configuration network interface config\n' - syslog.syslog(syslog.LOG_INFO, msg) - os.remove('/etc/sysconfig/network/ifcfg-%s' %iFace) + """Shutdown the configuration network and remove the configuration.""" + syslog.syslog(syslog.LOG_INFO, 'Shutdown configuration network\n') + os.system('/sbin/ifdown %s' %iFace) + msg = 'Remove configuration network interface config\n' + syslog.syslog(syslog.LOG_INFO, msg) + os.remove('/etc/sysconfig/network/ifcfg-%s' %iFace) #---------------------------------------------------------------------------- def setupCloudNetwork(iFace): - """Setup the configuration for the cloud network and fire it up.""" - msg = 'Setup cloud network configuration as br0\n' - syslog.syslog(syslog.LOG_INFO, msg) - cfgF = open('/etc/sysconfig/network/ifcfg-br0', 'w') - cfgF.write("BOOTPROTO='dhcp'\n") - cfgF.write("BRIDGE='yes'\n") - cfgF.write("BRIDGE_FORWARDDELAY='0'\n") - cfgF.write("BRIDGE_PORTS='%s'\n" %iFace) - cfgF.write("BRIDGE_STP='off'\n") - cfgF.write("BROADCAST=''\n") - cfgF.write("ETHTOOL_OPTIONS=''\n") - cfgF.write("MTU=''\n") - cfgF.write("NAME=''\n") - cfgF.write("NETWORK=''\n") - cfgF.write("REMOTE_IPADDR=''\n") - cfgF.write("STARTMODE='auto'\n") - cfgF.write("USERCONTROL='no'") - cfgF.close() - + """Setup the configuration for the cloud network and fire it up.""" + msg = 'Setup cloud network configuration as br0\n' + syslog.syslog(syslog.LOG_INFO, msg) + cfgF = open('/etc/sysconfig/network/ifcfg-br0', 'w') + cfgF.write("BOOTPROTO='dhcp'\n") + cfgF.write("BRIDGE='yes'\n") + cfgF.write("BRIDGE_FORWARDDELAY='0'\n") + cfgF.write("BRIDGE_PORTS='%s'\n" %iFace) + cfgF.write("BRIDGE_STP='off'\n") + cfgF.write("BROADCAST=''\n") + cfgF.write("ETHTOOL_OPTIONS=''\n") + cfgF.write("MTU=''\n") + cfgF.write("NAME=''\n") + cfgF.write("NETWORK=''\n") + cfgF.write("REMOTE_IPADDR=''\n") + cfgF.write("STARTMODE='auto'\n") + cfgF.write("USERCONTROL='no'") + cfgF.close() + #---------------------------------------------------------------------------- def setupConfNetwork(iFace): - """Setup the interface provided as the configuration network with a - static IP.""" - syslog.syslog(syslog.LOG_INFO, 'Setup configuration network 169.254.1.2\n') - cfgF = open('/etc/sysconfig/network/ifcfg-%s' %iFace, 'w') - cfgF.write("BOOTPROTO='static'\n") - cfgF.write("BROADCAST=''\n") - cfgF.write("ETHTOOL_OPTIONS=''\n") - cfgF.write("IPADDR='169.254.1.2/24'\n") - cfgF.write("MTU=''\n") - cfgF.write("NAME='Cloud configuration network'\n") - cfgF.write("NETWORK=''\n") - cfgF.write("REMOTE_IPADDR=''\n") - cfgF.write("STARTMODE='auto'\n") - cfgF.write("USERCONTROL='no'") - cfgF.close() + """Setup the interface provided as the configuration network with a + static IP.""" + syslog.syslog(syslog.LOG_INFO, 'Setup configuration network 169.254.1.2\n') + cfgF = open('/etc/sysconfig/network/ifcfg-%s' %iFace, 'w') + cfgF.write("BOOTPROTO='static'\n") + cfgF.write("BROADCAST=''\n") + cfgF.write("ETHTOOL_OPTIONS=''\n") + cfgF.write("IPADDR='169.254.1.2/24'\n") + cfgF.write("MTU=''\n") + cfgF.write("NAME='Cloud configuration network'\n") + cfgF.write("NETWORK=''\n") + cfgF.write("REMOTE_IPADDR=''\n") + cfgF.write("STARTMODE='auto'\n") + cfgF.write("USERCONTROL='no'") + cfgF.close() #---------------------------------------------------------------------------- def startCloudNetwork(): - """Start the cloud network.""" - syslog.syslog(syslog.LOG_INFO, 'Starting cloud network\n') - os.system('/sbin/ifup br0') - cnt = 0 - # Cannot depend on the ifup exit status as we need to play a trick to - # disable IPv6 which always leads to a non zero exit status - # Therefore we probe whether or not we get an IP address assigned - while cnt < 10: - time.sleep(15) # give dhcp a chance to get an address - processBlock = None - ifaceInfo = os.popen('/sbin/ifconfig').readlines() - for ln in ifaceInfo: - if ln.find('br0') != -1: - processBlock = 1 - continue - if processBlock and ln.find('inet addr') != -1: - addr = ln.split(':')[1].split()[0].strip() - if addr.find('.') != -1: - cnt = 99 - break - cnt += 1 - if cnt != 100: - return -1 + """Start the cloud network.""" + syslog.syslog(syslog.LOG_INFO, 'Starting cloud network\n') + os.system('/sbin/ifup br0') + cnt = 0 + # Cannot depend on the ifup exit status as we need to play a trick to + # disable IPv6 which always leads to a non zero exit status + # Therefore we probe whether or not we get an IP address assigned + while cnt < 10: + time.sleep(15) # give dhcp a chance to get an address + processBlock = None + ifaceInfo = os.popen('/sbin/ifconfig').readlines() + for ln in ifaceInfo: + if ln.find('br0') != -1: + processBlock = 1 + continue + if processBlock and ln.find('inet addr') != -1: + addr = ln.split(':')[1].split()[0].strip() + if addr.find('.') != -1: + cnt = 99 + break + cnt += 1 + if cnt != 100: + return -1 - return 1 + return 1 #---------------------------------------------------------------------------- def startNetwork(iFace, type): - """Start the specified network interface.""" - msg = 'Start %s network interface on %s\n' %(type, iFace) - syslog.syslog(syslog.LOG_INFO, msg) - res = os.system('/sbin/ifup %s' %iFace) - if res: - return -1 + """Start the specified network interface.""" + msg = 'Start %s network interface on %s\n' %(type, iFace) + syslog.syslog(syslog.LOG_INFO, msg) + res = os.system('/sbin/ifup %s' %iFace) + if res: + return -1 - return 1 + return 1 #---------------------------------------------------------------------------- if __name__ == "__main__": - syslog.openlog('[CLOUD_NODE_SETUP]', syslog.LOG_PID, syslog.LOG_DAEMON) - syslog.syslog(syslog.LOG_INFO, 'Start node registration and setup\n') - iFace = getFirstConnectedInterface() - if iFace == -1: - msg = 'Could not determine connected network interface aborting' - msg += ' node configuration\n' + syslog.openlog('[CLOUD_NODE_SETUP]', syslog.LOG_PID, syslog.LOG_DAEMON) + syslog.syslog(syslog.LOG_INFO, 'Start node registration and setup\n') + iFace = getFirstConnectedInterface() + if iFace == -1: + msg = 'Could not determine connected network interface aborting' + msg += ' node configuration\n' + syslog.syslog(syslog.LOG_INFO, msg) + syslog.closelog() + sys.exit(1) + setupConfNetwork(iFace) + res = startNetwork(iFace, 'configuration') + if res == -1: + msg = 'Could not start the network interface to configure the ' + msg += 'cloud node, manual configuration required.\n' + syslog.syslog(syslog.LOG_INFO, msg) + syslog.closelog() + sys.exit(1) + confDict = getConfigFromServer() + if confDict == -1: + msg = 'Could not connect to configuration server at 169.254.1.1 ' + msg += 'cloud node, manual configuration required.\n' + msg += 'This IP: 169.254.1.2\n' + syslog.syslog(syslog.LOG_INFO, msg) + syslog.closelog() + sys.exit(1) + removeConfNetworkSetting(iFace) + setupCloudNetwork(iFace) + res = configureNode(confDict) + if res == -1: + msg = 'Configuration failure. Manual configuration required.\n' + syslog.syslog(syslog.LOG_INFO, msg) + syslog.closelog() + sys.exit(1) + # Setup cloud network + res = startCloudNetwork() + if res == -1: + msg = 'Cloud network setup and start up failed. Manual configuration ' + msg += 'required\n' + syslog.syslog(syslog.LOG_INFO, msg) + syslog.closelog() + sys.exit(1) + # Register the node with the head node + res = registerNode() + if res == -1: + msg = 'Could not register the node. Manual registration on head node ' + msg += 'required. (dhcp and one)\n' + syslog.syslog(syslog.LOG_INFO, msg) + syslog.closelog() + sys.exit(1) + # Mount the oneadmin home directory + msg = 'Mount oneadmin home directory.\n' syslog.syslog(syslog.LOG_INFO, msg) - syslog.closelog() - sys.exit(1) - setupConfNetwork(iFace) - res = startNetwork(iFace, 'configuration') - if res == -1: - msg = 'Could not start the network interface to configure the ' - msg += 'cloud node, manual configuration required.\n' - syslog.syslog(syslog.LOG_INFO, msg) - syslog.closelog() - sys.exit(1) - confDict = getConfigFromServer() - if confDict == -1: - msg = 'Could not connect to configuration server at 169.254.1.1 ' - msg += 'cloud node, manual configuration required.\n' - msg += 'This IP: 169.254.1.2\n' - syslog.syslog(syslog.LOG_INFO, msg) - syslog.closelog() - sys.exit(1) - removeConfNetworkSetting(iFace) - setupCloudNetwork(iFace) - res = configureNode(confDict) - if res == -1: - msg = 'Configuration failure. Manual configuration required.\n' - syslog.syslog(syslog.LOG_INFO, msg) - syslog.closelog() - sys.exit(1) - # Setup cloud network - res = startCloudNetwork() - if res == -1: - msg = 'Cloud network setup and start up failed. Manual configuration ' - msg += 'required\n' - syslog.syslog(syslog.LOG_INFO, msg) - syslog.closelog() - sys.exit(1) - # Register the node with the head node - res = registerNode() - if res == -1: - msg = 'Could not register the node. Manual registration on head node ' - msg += 'required. (dhcp and one)\n' - syslog.syslog(syslog.LOG_INFO, msg) - syslog.closelog() - sys.exit(1) - # Mount the oneadmin home directory - msg = 'Mount oneadmin home directory.\n' - syslog.syslog(syslog.LOG_INFO, msg) - res = os.system('mount /var/lib/one') - if res != 0: - msg = 'Mount of oneadmin home directory failed. Manual mount ' - msg += 'required.\n' + res = os.system('mount /var/lib/one') + if res != 0: + msg = 'Mount of oneadmin home directory failed. Manual mount ' + msg += 'required.\n' + syslog.syslog(syslog.LOG_INFO, msg) + syslog.closelog() + sys.exit(1) + # tmp dir for oned + if not os.path.exists('/var/tmp/one'): + if not os.path.exists('/var/tmp'): + os.mkdir('/var/tmp') + os.mkdir('/var/tmp/one') + os.system('chown oneadmin:cloud /var/tmp/one') + + msg = 'Cloud node configuration completed with success.\n' syslog.syslog(syslog.LOG_INFO, msg) syslog.closelog() - sys.exit(1) - # tmp dir for oned - if not os.path.exists('/var/tmp/one'): - if not os.path.exists('/var/tmp'): - os.mkdir('/var/tmp') - os.mkdir('/var/tmp/one') - os.system('chown oneadmin:cloud /var/tmp/one') - - msg = 'Cloud node configuration completed with success.\n' - syslog.syslog(syslog.LOG_INFO, msg) - syslog.closelog() diff --git a/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_guest/config.xml b/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_guest/config.xml index 2423837c5..b49da4c15 100644 --- a/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_guest/config.xml +++ b/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_guest/config.xml @@ -1,38 +1,38 @@ - - Robert Schweikert - rjschwei@suse.com - openSUSE 12.2 virtual disk system - - - - 1.0.0 - zypper - false - true - en_US - us.map.gz - - - - - - - - - - - - - - - - - - - - - + + Robert Schweikert + rjschwei@suse.com + openSUSE 12.2 virtual disk system + + + + 1.0.0 + zypper + false + true + en_US + us.map.gz + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_guest/root/etc/init.d/boot b/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_guest/root/etc/init.d/boot index ae3d29845..98768a296 100755 --- a/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_guest/root/etc/init.d/boot +++ b/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_guest/root/etc/init.d/boot @@ -26,7 +26,7 @@ set +e # test -z "$CONSOLE" && CONSOLE=/dev/console set -- $(stty size < $CONSOLE) - LINES=$1 + LINES=$1 COLUMNS=$2 export LINES COLUMNS CONSOLE @@ -41,10 +41,10 @@ exec 0<> $CONSOLE 1>&0 2>&0 REDIRECT="`showconsole 2>/dev/null`" export REDIRECT if test $COLUMNS -eq 0 ; then - # Serial: columns and lines are not defined - LINES=24 - COLUMNS=80 - test "$TERM" = "linux" -o -z "$TERM" && TERM=vt102 + # Serial: columns and lines are not defined + LINES=24 + COLUMNS=80 + test "$TERM" = "linux" -o -z "$TERM" && TERM=vt102 fi # @@ -70,27 +70,27 @@ mount -n -t sysfs sysfs /sys rc_status -v -r if test -d /sys/kernel/debug ; then - while read dev type ; do - if test "$type" = "debugfs" ; then - echo -n "Mounting debugfs at /sys/kernel/debug" - mount -n -t debugfs debugfs /sys/kernel/debug - rc_status -v -r - fi - done < /proc/filesystems + while read dev type ; do + if test "$type" = "debugfs" ; then + echo -n "Mounting debugfs at /sys/kernel/debug" + mount -n -t debugfs debugfs /sys/kernel/debug + rc_status -v -r + fi + done < /proc/filesystems fi # # mount tmpfs on /dev if not already done by initramfs # while read dev dir type options; do - if test "$dir" = "/dev" -a "$type" = "tmpfs"; then - DEV_MOUNTED=1; - break; - fi + if test "$dir" = "/dev" -a "$type" = "tmpfs"; then + DEV_MOUNTED=1; + break; + fi done < /proc/mounts if test -z "$DEV_MOUNTED"; then - echo -n "Mounting tmpfs at /dev" - mount -n -t tmpfs -o mode=0755 udev /dev - rc_status -v -r + echo -n "Mounting tmpfs at /dev" + mount -n -t tmpfs -o mode=0755 udev /dev + rc_status -v -r fi # @@ -111,9 +111,9 @@ rc_status -v -r # otty=$(stty -g) if test "$FLOW_CONTROL" = "yes" ; then - stty -nl ixon ignbrk -brkint + stty -nl ixon ignbrk -brkint else - stty -nl -ixon ignbrk -brkint + stty -nl -ixon ignbrk -brkint fi # @@ -122,21 +122,21 @@ fi DO_CONFIRM="" read -t 2 check < /proc/cmdline 2> /dev/null case "$check" in - *confirm*) DO_CONFIRM=yes ;; + *confirm*) DO_CONFIRM=yes ;; esac test -z "$CONFIRM_PROMPT_TIMEOUT" && CONFIRM_PROMPT_TIMEOUT=5 if test "$PROMPT_FOR_CONFIRM" = "yes" -a "$DO_CONFIRM" != "yes" ; then - echo -en "${extd}Enter Interactive startup mode?${norm}" - rc_timer_on "$CONFIRM_PROMPT_TIMEOUT" 37 - read -t "$CONFIRM_PROMPT_TIMEOUT" -n 1 \ - -p " ${extd}y${norm}/[${extd}n${norm}]("${CONFIRM_PROMPT_TIMEOUT}s") " answer - rc_timer_off - case "$answer" in - [yYiI]) DO_CONFIRM=yes ;; - *) DO_CONFIRM= ;; - esac - unset answer - echo + echo -en "${extd}Enter Interactive startup mode?${norm}" + rc_timer_on "$CONFIRM_PROMPT_TIMEOUT" 37 + read -t "$CONFIRM_PROMPT_TIMEOUT" -n 1 \ + -p " ${extd}y${norm}/[${extd}n${norm}]("${CONFIRM_PROMPT_TIMEOUT}s") " answer + rc_timer_off + case "$answer" in + [yYiI]) DO_CONFIRM=yes ;; + *) DO_CONFIRM= ;; + esac + unset answer + echo fi export DO_CONFIRM @@ -146,11 +146,11 @@ export DO_CONFIRM # test -x /sbin/blogd -a -n "$REDIRECT" && /sbin/blogd $REDIRECT if test -z "$REDIRECT" ; then - if (echo -n > /dev/tty) 2>/dev/null ; then - REDIRECT=/dev/tty - else - REDIRECT=/dev/console - fi + if (echo -n > /dev/tty) 2>/dev/null ; then + REDIRECT=/dev/tty + else + REDIRECT=/dev/console + fi fi # @@ -182,60 +182,60 @@ startpar -v &> /dev/null || RUN_PARALLEL="no" # if test "$RUN_PARALLEL" = "yes" ; then - # - # Start scripts in parallel with make behaviour of startpar - # + # + # Start scripts in parallel with make behaviour of startpar + # - startopt="-p4 -t 30 -T 3 $(splashmake)" - eval $(startpar $startopt -M boot) - failed="${failed:+$failed }$failed_service" - skipped="${skipped:+$skipped }$skipped_service" + startopt="-p4 -t 30 -T 3 $(splashmake)" + eval $(startpar $startopt -M boot) + failed="${failed:+$failed }$failed_service" + skipped="${skipped:+$skipped }$skipped_service" - unset failed_service skipped_service startopt + unset failed_service skipped_service startopt elif test -d ${bootrc}/ ; then - # - # Start scripts in given link order - # - for i in ${bootrc}/S${rex}*; do - - test -f $i || continue - - B=${i##*/} - script=${B#*S$rex} - B=${B%$script} - - if test "$DO_CONFIRM" = "yes" ; then - rc_confirm -t $CONFIRM_PROMPT_TIMEOUT "Start bootup script ${script}" < $REDIRECT > $REDIRECT 2>&1 - case "$?" in - 0) true ;; - 1) continue ;; - 2) DO_CONFIRM="" - esac - fi - - blogger "$script start" - - if test -x "$i" ; then - $i start - else - echo Running $i - /bin/sh $i b - rc_status -v1 -r - fi - status=$? - echo -en "$rc_reset" - splashprogress "$script start" - - case $status in - [1-47]) failed="${failed:+$failed }$script" ;; - [56]) skipped="${skipped:+$skipped }$script" ;; - 0|*) ;; - esac - - blogger "'$script start' exits with status $status" - done + # + # Start scripts in given link order + # + for i in ${bootrc}/S${rex}*; do + + test -f $i || continue + + B=${i##*/} + script=${B#*S$rex} + B=${B%$script} + + if test "$DO_CONFIRM" = "yes" ; then + rc_confirm -t $CONFIRM_PROMPT_TIMEOUT "Start bootup script ${script}" < $REDIRECT > $REDIRECT 2>&1 + case "$?" in + 0) true ;; + 1) continue ;; + 2) DO_CONFIRM="" + esac + fi + + blogger "$script start" + + if test -x "$i" ; then + $i start + else + echo Running $i + /bin/sh $i b + rc_status -v1 -r + fi + status=$? + echo -en "$rc_reset" + splashprogress "$script start" + + case $status in + [1-47]) failed="${failed:+$failed }$script" ;; + [56]) skipped="${skipped:+$skipped }$script" ;; + 0|*) ;; + esac + + blogger "'$script start' exits with status $status" + done fi splashtrigger "rlreached B" @@ -246,27 +246,27 @@ splashtrigger "rlreached B" echo -n "System Boot Control: " echo -e "The system has been ${stat}${extd}set up${norm}" if test -n "$failed" ; then - n=$((${#failed} + 7)) - echo -n "Failed features: " - test $n -lt 47 && echo -en "\033[${COLUMNS}C\033[${n}D" - echo -e "${warn}${failed}${norm}" + n=$((${#failed} + 7)) + echo -n "Failed features: " + test $n -lt 47 && echo -en "\033[${COLUMNS}C\033[${n}D" + echo -e "${warn}${failed}${norm}" fi if test -n "$skipped" ; then - n=$((${#skipped} + 7)) - echo -n "Skipped features: " - test $n -lt 47 && echo -en "\033[${COLUMNS}C\033[${n}D" - echo -e "${attn}${skipped}${norm}" + n=$((${#skipped} + 7)) + echo -n "Skipped features: " + test $n -lt 47 && echo -en "\033[${COLUMNS}C\033[${n}D" + echo -e "${attn}${skipped}${norm}" fi # # Start user defined bootup script. # if test -f /etc/init.d/boot.local ; then - echo -n "System Boot Control: " - echo "Running /etc/init.d/boot.local" - /bin/sh /etc/init.d/boot.local - rc_status -v1 -r - splashtrigger "boot.local" + echo -n "System Boot Control: " + echo "Running /etc/init.d/boot.local" + /bin/sh /etc/init.d/boot.local + rc_status -v1 -r + splashtrigger "boot.local" fi # @@ -283,7 +283,7 @@ test -s /lib/bootcycle/stats && . /lib/bootcycle/stats # Remember for master resource script # if test "$DO_CONFIRM" = "yes" ; then - touch /var/run/do_confirm + touch /var/run/do_confirm fi # @@ -295,34 +295,34 @@ stty $otty # Let YaST2 finish its installation, if you installed with YaST2 # if test -f /var/lib/YaST2/runme_at_boot ; then - HOSTTYPE=$(uname -m) - splashtrigger "YaST" - exec 0<> $REDIRECT 1>&0 2>&0 - # if yast2 failed, this ensures proper system setup - #ulimit -c unlimited - touch /var/lib/YaST2/run_suseconfig - if test -x /usr/lib/YaST2/startup/YaST2.Second-Stage; then - /usr/lib/YaST2/startup/YaST2.Second-Stage - else - # oops, yast2 not installed - rm -f /var/lib/YaST2/runme_at_boot - fi + HOSTTYPE=$(uname -m) + splashtrigger "YaST" + exec 0<> $REDIRECT 1>&0 2>&0 + # if yast2 failed, this ensures proper system setup + #ulimit -c unlimited + touch /var/lib/YaST2/run_suseconfig + if test -x /usr/lib/YaST2/startup/YaST2.Second-Stage; then + /usr/lib/YaST2/startup/YaST2.Second-Stage + else + # oops, yast2 not installed + rm -f /var/lib/YaST2/runme_at_boot + fi fi if test -f /var/lib/YaST2/reconfig_system ; then - HOSTTYPE=$(uname -m) - splashtrigger "YaST" - exec 0<> $REDIRECT 1>&0 2>&0 - if test -x /usr/lib/YaST2/startup/YaST2.Firstboot; then - /usr/lib/YaST2/startup/YaST2.Firstboot - else - # oops, yast2-firstboot not installed - rm -f /var/lib/YaST2/reconfig_system - fi + HOSTTYPE=$(uname -m) + splashtrigger "YaST" + exec 0<> $REDIRECT 1>&0 2>&0 + if test -x /usr/lib/YaST2/startup/YaST2.Firstboot; then + /usr/lib/YaST2/startup/YaST2.Firstboot + else + # oops, yast2-firstboot not installed + rm -f /var/lib/YaST2/reconfig_system + fi fi # run SuSEconfig (with args) if needed if test -f /var/lib/YaST2/run_suseconfig ; then - /sbin/SuSEconfig `cat /var/lib/YaST2/run_suseconfig` - rm -f /var/lib/YaST2/run_suseconfig + /sbin/SuSEconfig `cat /var/lib/YaST2/run_suseconfig` + rm -f /var/lib/YaST2/run_suseconfig fi rc_reset diff --git a/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/config.xml b/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/config.xml index 675f93fdb..c9585f50a 100644 --- a/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/config.xml +++ b/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/config.xml @@ -1,77 +1,77 @@ - - Robert Schweikert - rjschwei@suse.com - OpenNebula Head Node configuration - - - - - OpenNebula Head Node - true - true - 2048 - true - - - 1.5.0 - zypper - false - true - en_US - us.map.gz - - - - - - - - - - - - - - - - - - - - - - - - - - - + + Robert Schweikert + rjschwei@suse.com + OpenNebula Head Node configuration + + + + + OpenNebula Head Node + true + true + 2048 + true + + + 1.5.0 + zypper + false + true + en_US + us.map.gz + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/root/etc/YaST2/firstboot.xml b/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/root/etc/YaST2/firstboot.xml index 4d3a60b32..e2b303a2c 100644 --- a/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/root/etc/YaST2/firstboot.xml +++ b/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/root/etc/YaST2/firstboot.xml @@ -1,65 +1,65 @@ + xmlns:config="http://www.suse.com/1.0/configns"> - firstboot + firstboot - - - - yes - yes - all - - firstboot - - installation - + + + + yes + yes + all + + firstboot + + installation + - - - firstboot_welcome - - - - true - firstboot_licenses - - - - true - firstboot_keyboard - - - - true - firstboot_timezone - - - - true - inst_root - - - - true - opennebula - - - - firstboot_write - no - no - - - - inst_suseconfig - no - no - + + + firstboot_welcome + + + + true + firstboot_licenses + + + + true + firstboot_keyboard + + + + true + firstboot_timezone + + + + true + inst_root + + + + true + opennebula + + + + firstboot_write + no + no + + + + inst_suseconfig + no + no + - - - + + + diff --git a/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/root/home/ctester/testVM.README b/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/root/home/ctester/testVM.README index d36decebc..fb16e3ee2 100644 --- a/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/root/home/ctester/testVM.README +++ b/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/root/home/ctester/testVM.README @@ -1,17 +1,17 @@ The startTestVM script is expected to be executed only once. It's sole purpose is to facilitate easy and quick verification that the images built using the OBS OpenNebula packages work as intended. The working condition is defined as: - - generated guest image can be registered - - registered image can be started - - it is possible to log into the running image (manual action) + - generated guest image can be registered + - registered image can be started + - it is possible to log into the running image (manual action) The script should only be run on initial setup of the cloud after the head node and at least one cloud node have been set up. Prior to executing the startTestVM script: - verify there is a registered host - # sudo -u oneadmin env ONE_AUTH=/var/lib/one/.one/one_auth onehost list + # sudo -u oneadmin env ONE_AUTH=/var/lib/one/.one/one_auth onehost list - make sure you have an image that matches the output of - # grep PATH testVM.one + # grep PATH testVM.one Then run the script as the oneadmin user diff --git a/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/root/home/ctester/testVM.vmd b/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/root/home/ctester/testVM.vmd index b8b3d0cb6..8be0f8405 100644 --- a/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/root/home/ctester/testVM.vmd +++ b/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/root/home/ctester/testVM.vmd @@ -3,15 +3,15 @@ MEMORY = 512 CPU = 1 OS = [ ARCH = x86_64, - BOOT = hd, - ROOT = sda1 ] + BOOT = hd, + ROOT = sda1 ] DISK = [ IMAGE_ID = 0, - DRIVER = qcow2 ] + DRIVER = qcow2 ] NIC = [ MAC = "00:16:3e:7e:18:26", - BRIDGE = br0 ] + BRIDGE = br0 ] GRAPHICS = [ TYPE = "vnc", - LISTEN = "0.0.0.0", - PORT = "5905" ] + LISTEN = "0.0.0.0", + PORT = "5905" ] diff --git a/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/root/usr/sbin/suseNebulaConfSrv b/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/root/usr/sbin/suseNebulaConfSrv index 53d66a14d..16f347085 100755 --- a/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/root/usr/sbin/suseNebulaConfSrv +++ b/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/root/usr/sbin/suseNebulaConfSrv @@ -22,166 +22,166 @@ macPat = re.compile(macPattern) #--------------------------------------------------------------------------- class CloudConfigService(SocketServer.StreamRequestHandler): - """Cloud head node information provider.""" - def __init__(self, request, client_address, server): - self.srvInfo = {} - # Collect the information we want to make propagate to the cloud node - # Keyboard layout - os.system('/sbin/yast2 keyboard summary >& /tmp/.kdb.info') - info = open('/tmp/.kdb.info', 'r').read() - os.remove('/tmp/.kdb.info') - self.srvInfo['keyLayout'] = info.split(':')[-1].strip() - # Timezone and HW clock setting (assume HW clock on nodes is set the - # same by default - os.system('/sbin/yast2 timezone summary >& /tmp/.tz.info') - info = open('/tmp/.tz.info', 'r').readlines() - os.remove('/tmp/.tz.info') - timezone = None - hwClockSet = None - for ln in info: - if ln.find('Current Time Zone') != -1: - timezone = ln.split(':')[-1].strip() - if ln.find('Hardware Clock') != -1: - hwClockSet = ln.split(':')[-1].strip() - self.srvInfo['timezone'] = timezone - self.srvInfo['hwclock'] = hwClockSet - # Root passwd - lines = open('/etc/shadow', 'r').readlines() - passWd = None - for ln in lines: - if ln[0:4] == 'root': - passWd = ln.split(':')[1] - self.srvInfo['rootpass'] = passWd - # IP address - lines = open('/etc/sysconfig/network/ifcfg-br0', 'r').readlines() - ipAddr = None - for ln in lines: - if ln[0:7] == 'IPADDR=': - # [1:] at end removes leading quote - ipAddr = ln.split('=')[-1].split('/')[0].strip()[1:] - self.srvInfo['serverIP'] = ipAddr - # DHCP feature identifier - lines = open('/etc/dhcpd.conf','r').readlines() - dhcpFeature = None - domainname = None - for ln in lines: - if ln.find('domain-name') != -1: - # [1:-2] remove leading and trailing quotes and ; - domainname = ln.split()[-1].strip()[1:-2] - # 239 is the assigned ID for the feature, hard coded in the YaST - # configuration module - if ln.find('code 239') != -1: - dhcpFeature = ln.split()[1].strip() - self.srvInfo['dhcpFeature'] = dhcpFeature - self.srvInfo['domainname'] = domainname - # Name resolution - self.srvInfo['resolve'] = open('/etc/resolv.conf', 'r').read() - # The configured routes - routes = open('/etc/sysconfig/network/routes', 'r').read() - self.srvInfo['routes'] = routes - # The one use ID - lines = open('/etc/passwd', 'r').readlines() - for ln in lines: - if ln.find('oneadmin') != -1: - self.srvInfo['userID'] = ('oneadmin', ln.split(':')[2], - ln.split(':')[1]) - break - # The cloud group ID - lines = open('/etc/group', 'r').readlines() - for ln in lines: - if ln.find('cloud') != -1: - self.srvInfo['groupID'] = ('cloud', ln.split(':')[2]) - break - SocketServer.StreamRequestHandler.__init__(self, request, - client_address, server) - - #---------------------------------------------------------------------- - def generateHostName(self): - """Generate a new host name""" - # Create a host name for the host requesting the information - while (os.path.exists('/var/lock/nebula-hostname.lock')): - # We have to wait another cloud node is being configured - pass - os.system('touch /var/lock/nebula-hostname.lock') - cntr = None - if not os.path.exists('/var/lib/one/.nodecnt'): - cntr = 1 - cntFl = open('/var/lib/one/.nodecnt', 'w') - cntFl.write('%d' %cntr) - cntFl.close() - if not cntr: - cntr = open('/var/lib/one/.nodecnt', 'r').read() - cntr = eval(cntr) - cntr += 1 - cntFl = open('/var/lib/one/.nodecnt', 'w') - cntFl.write('%d' %cntr) - cntFl.close() - hostname = self.srvInfo['dhcpFeature'] + '-%d' %cntr - os.remove('/var/lock/nebula-hostname.lock') - return hostname + """Cloud head node information provider.""" + def __init__(self, request, client_address, server): + self.srvInfo = {} + # Collect the information we want to make propagate to the cloud node + # Keyboard layout + os.system('/sbin/yast2 keyboard summary >& /tmp/.kdb.info') + info = open('/tmp/.kdb.info', 'r').read() + os.remove('/tmp/.kdb.info') + self.srvInfo['keyLayout'] = info.split(':')[-1].strip() + # Timezone and HW clock setting (assume HW clock on nodes is set the + # same by default + os.system('/sbin/yast2 timezone summary >& /tmp/.tz.info') + info = open('/tmp/.tz.info', 'r').readlines() + os.remove('/tmp/.tz.info') + timezone = None + hwClockSet = None + for ln in info: + if ln.find('Current Time Zone') != -1: + timezone = ln.split(':')[-1].strip() + if ln.find('Hardware Clock') != -1: + hwClockSet = ln.split(':')[-1].strip() + self.srvInfo['timezone'] = timezone + self.srvInfo['hwclock'] = hwClockSet + # Root passwd + lines = open('/etc/shadow', 'r').readlines() + passWd = None + for ln in lines: + if ln[0:4] == 'root': + passWd = ln.split(':')[1] + self.srvInfo['rootpass'] = passWd + # IP address + lines = open('/etc/sysconfig/network/ifcfg-br0', 'r').readlines() + ipAddr = None + for ln in lines: + if ln[0:7] == 'IPADDR=': + # [1:] at end removes leading quote + ipAddr = ln.split('=')[-1].split('/')[0].strip()[1:] + self.srvInfo['serverIP'] = ipAddr + # DHCP feature identifier + lines = open('/etc/dhcpd.conf','r').readlines() + dhcpFeature = None + domainname = None + for ln in lines: + if ln.find('domain-name') != -1: + # [1:-2] remove leading and trailing quotes and ; + domainname = ln.split()[-1].strip()[1:-2] + # 239 is the assigned ID for the feature, hard coded in the YaST + # configuration module + if ln.find('code 239') != -1: + dhcpFeature = ln.split()[1].strip() + self.srvInfo['dhcpFeature'] = dhcpFeature + self.srvInfo['domainname'] = domainname + # Name resolution + self.srvInfo['resolve'] = open('/etc/resolv.conf', 'r').read() + # The configured routes + routes = open('/etc/sysconfig/network/routes', 'r').read() + self.srvInfo['routes'] = routes + # The one use ID + lines = open('/etc/passwd', 'r').readlines() + for ln in lines: + if ln.find('oneadmin') != -1: + self.srvInfo['userID'] = ('oneadmin', ln.split(':')[2], + ln.split(':')[1]) + break + # The cloud group ID + lines = open('/etc/group', 'r').readlines() + for ln in lines: + if ln.find('cloud') != -1: + self.srvInfo['groupID'] = ('cloud', ln.split(':')[2]) + break + SocketServer.StreamRequestHandler.__init__(self, request, + client_address, server) + + #---------------------------------------------------------------------- + def generateHostName(self): + """Generate a new host name""" + # Create a host name for the host requesting the information + while (os.path.exists('/var/lock/nebula-hostname.lock')): + # We have to wait another cloud node is being configured + pass + os.system('touch /var/lock/nebula-hostname.lock') + cntr = None + if not os.path.exists('/var/lib/one/.nodecnt'): + cntr = 1 + cntFl = open('/var/lib/one/.nodecnt', 'w') + cntFl.write('%d' %cntr) + cntFl.close() + if not cntr: + cntr = open('/var/lib/one/.nodecnt', 'r').read() + cntr = eval(cntr) + cntr += 1 + cntFl = open('/var/lib/one/.nodecnt', 'w') + cntFl.write('%d' %cntr) + cntFl.close() + hostname = self.srvInfo['dhcpFeature'] + '-%d' %cntr + os.remove('/var/lock/nebula-hostname.lock') + return hostname - #---------------------------------------------------------------------- - def handle(self): - """Handle the information request""" - requestType = self.request.recv(512).strip() - if requestType == 'PROVIDE_CONFIG': - syslog.openlog('[CLOUD_INFO_SRV]',syslog.LOG_PID,syslog.LOG_DAEMON) - syslog.syslog(syslog.LOG_INFO, 'Provide cloud config info\n') - self.srvInfo['hostname'] = self.generateHostName() - for key in self.srvInfo.keys(): - # Send a key value pair for each entry - self.request.send('%s=%s;' %(key,self.srvInfo[key])) - self.request.send('COMPLETE=finished') - syslog.closelog() + #---------------------------------------------------------------------- + def handle(self): + """Handle the information request""" + requestType = self.request.recv(512).strip() + if requestType == 'PROVIDE_CONFIG': + syslog.openlog('[CLOUD_INFO_SRV]',syslog.LOG_PID,syslog.LOG_DAEMON) + syslog.syslog(syslog.LOG_INFO, 'Provide cloud config info\n') + self.srvInfo['hostname'] = self.generateHostName() + for key in self.srvInfo.keys(): + # Send a key value pair for each entry + self.request.send('%s=%s;' %(key,self.srvInfo[key])) + self.request.send('COMPLETE=finished') + syslog.closelog() #--------------------------------------------------------------------------- def sigHandler(signum, frame): - """Signal handler for termination""" - syslog.openlog('[CLOUD_INFO_SRV]',syslog.LOG_PID,syslog.LOG_DAEMON) - syslog.syslog(syslog.LOG_INFO, 'Terminating server on signal: %d' %signum) - syslog.closelog() - if os.path.exists('/var/lock/nebula-hostname.lock'): - os.remove('/var/lock/nebula-hostname.lock') - os.remove('/var/run/suseNebula/infoSrv.pid') - sys.exit(0) + """Signal handler for termination""" + syslog.openlog('[CLOUD_INFO_SRV]',syslog.LOG_PID,syslog.LOG_DAEMON) + syslog.syslog(syslog.LOG_INFO, 'Terminating server on signal: %d' %signum) + syslog.closelog() + if os.path.exists('/var/lock/nebula-hostname.lock'): + os.remove('/var/lock/nebula-hostname.lock') + os.remove('/var/run/suseNebula/infoSrv.pid') + sys.exit(0) #--------------------------------------------------------------------------- if __name__ == "__main__": - syslog.openlog('[CLOUD_INFO_SRV]', syslog.LOG_PID, syslog.LOG_DAEMON) - syslog.syslog(syslog.LOG_INFO, 'Cloud Info Server start\n') + syslog.openlog('[CLOUD_INFO_SRV]', syslog.LOG_PID, syslog.LOG_DAEMON) + syslog.syslog(syslog.LOG_INFO, 'Cloud Info Server start\n') - # Consistency check for pid file - if not os.path.exists('/var/run/suseNebula'): - os.system('mkdir -p /var/run/suseNebula') - if os.path.exists('/var/run/suseNebula/infoSrv.pid'): - msg = 'Found pid file, another server is running, not starting a ' - msg += 'new one.' - syslog.syslog(syslog.LOG_ERR, msg) - syslog.closelog() - sys.exit(1) - - server = SocketServer.TCPServer(('169.254.1.1', 8445), CloudConfigService) + # Consistency check for pid file + if not os.path.exists('/var/run/suseNebula'): + os.system('mkdir -p /var/run/suseNebula') + if os.path.exists('/var/run/suseNebula/infoSrv.pid'): + msg = 'Found pid file, another server is running, not starting a ' + msg += 'new one.' + syslog.syslog(syslog.LOG_ERR, msg) + syslog.closelog() + sys.exit(1) + + server = SocketServer.TCPServer(('169.254.1.1', 8445), CloudConfigService) - if not server: - syslog.syslog(syslog.LOG_ERR, 'Could not create server, exiting\n') - syslog.closelog() - sys.exit(1) + if not server: + syslog.syslog(syslog.LOG_ERR, 'Could not create server, exiting\n') + syslog.closelog() + sys.exit(1) - # Write pid to a file - pid = os.getpid() - if not os.path.exists('/var/run/suseNebula'): - os.mkdir('/var/run/suseNebula') - pidFl = open('/var/run/suseNebula/infoSrv.pid', 'w'); - pidFl.write('%d\n' %pid) - pidFl.close() + # Write pid to a file + pid = os.getpid() + if not os.path.exists('/var/run/suseNebula'): + os.mkdir('/var/run/suseNebula') + pidFl = open('/var/run/suseNebula/infoSrv.pid', 'w'); + pidFl.write('%d\n' %pid) + pidFl.close() - # Register signal handler - signal.signal(signal.SIGHUP, sigHandler) - signal.signal(signal.SIGTERM, sigHandler) - signal.signal(signal.SIGINT, sigHandler) + # Register signal handler + signal.signal(signal.SIGHUP, sigHandler) + signal.signal(signal.SIGTERM, sigHandler) + signal.signal(signal.SIGINT, sigHandler) - # No additional message will be printed, close the log - syslog.syslog(syslog.LOG_INFO, 'Cloud Info Server running\n') - syslog.closelog() - server.serve_forever() - + # No additional message will be printed, close the log + syslog.syslog(syslog.LOG_INFO, 'Cloud Info Server running\n') + syslog.closelog() + server.serve_forever() + diff --git a/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/root/usr/sbin/suseNebulaRegSrv b/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/root/usr/sbin/suseNebulaRegSrv index 6750aa28a..8c144b621 100755 --- a/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/root/usr/sbin/suseNebulaRegSrv +++ b/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/root/usr/sbin/suseNebulaRegSrv @@ -22,127 +22,127 @@ macPat = re.compile(macPattern) #------------------------------------------------------------------------------ class RegistrationHandler(SocketServer.BaseRequestHandler): - """Cloud head node registration request handler.""" - def handle(self): - syslog.openlog('[NOD_REG]',syslog.LOG_PID, syslog.LOG_DAEMON) - syslog.syslog(syslog.LOG_INFO, 'Cloud node registration\n') - # self.request is the TCP socket connected to the client - macAddr, ipAddr, name = self.request.recv(1024).strip().split(';') - # Verify proper MAC Address format - if not macPat.match(macAddr): - msg = 'Received improper data for MAC Address ' - msg += macAddr - msg += ' -> skip registration\n' - syslog.syslog(syslog.LOG_ERR, msg) - syslog.closelog() - return - # Verify the IP address format - if not ipPat.match(ipAddr): - msg = 'Received improper data for IP Adress ' - msg += ipAddr - msg += ' -> skip registration\n' - syslog.syslog(syslog.LOG_ERR, msg) - syslog.closelog() - return - syslog.syslog(syslog.LOG_INFO, 'MAC Address: %s\n' %macAddr) - syslog.syslog(syslog.LOG_INFO, 'IP Address: %s\n' %ipAddr) - syslog.syslog(syslog.LOG_INFO, 'Node name: %s\n' %name) - # Setup the dhcp server to make sure the node being registered - # always gets the same IP address - lines = open('/etc/dhcpd.conf', 'r').readlines() - processBlock = None - for ln in lines: - if ln.find(name) != -1: - processBlock = 1 - continue - if processBlock and ln.find('fixed-address') != -1: - setIP = ln.split()[-1].strip()[:-1] - if setIP != ipAddr: - msg = 'Host with name "%s" already registered with ' %name - msg += 'IP "%s". Cannot register node.\n' %ipAddr - syslog.syslog(syslog.LOG_INFO, msg) - syslog.closelog() - return - dhconf = open('/etc/dhcpd.conf', 'a') - dhconf.write('\n') - dhconf.write('host %s {\n' %name) - dhconf.write(' hardware ethernet %s;\n' %macAddr) - dhconf.write(' fixed-address %s;\n' %ipAddr) - dhconf.write('}\n') - dhconf.close() - # Restart the dhcp server as we just change the config - os.system('/bin/systemctl restart dhcpd.service >& /dev/null') - # Create hosts entry - hosts = open('/etc/hosts', 'a') - hosts.write('%s %s\n' %(ipAddr, name)) - hosts.close() - # Register node with Nebula infrastructure - cmd = '/usr/bin/sudo env ONE_AUTH=/var/lib/one/.one/one_auth ' - cmd += '/usr/bin/onehost create %s -i im_kvm -v vmm_kvm ' %ipAddr - cmd += '-n vnm_kvm' - res = os.system(cmd) - if res: - msg = 'Registration failed, onehost command with non zero status\n' - syslog.syslog(syslog.LOG_ERR, msg) - syslog.closelog() - return - syslog.syslog(syslog.LOG_ERR, 'Node registration succesful.\n') - syslog.closelog() + """Cloud head node registration request handler.""" + def handle(self): + syslog.openlog('[NOD_REG]',syslog.LOG_PID, syslog.LOG_DAEMON) + syslog.syslog(syslog.LOG_INFO, 'Cloud node registration\n') + # self.request is the TCP socket connected to the client + macAddr, ipAddr, name = self.request.recv(1024).strip().split(';') + # Verify proper MAC Address format + if not macPat.match(macAddr): + msg = 'Received improper data for MAC Address ' + msg += macAddr + msg += ' -> skip registration\n' + syslog.syslog(syslog.LOG_ERR, msg) + syslog.closelog() + return + # Verify the IP address format + if not ipPat.match(ipAddr): + msg = 'Received improper data for IP Adress ' + msg += ipAddr + msg += ' -> skip registration\n' + syslog.syslog(syslog.LOG_ERR, msg) + syslog.closelog() + return + syslog.syslog(syslog.LOG_INFO, 'MAC Address: %s\n' %macAddr) + syslog.syslog(syslog.LOG_INFO, 'IP Address: %s\n' %ipAddr) + syslog.syslog(syslog.LOG_INFO, 'Node name: %s\n' %name) + # Setup the dhcp server to make sure the node being registered + # always gets the same IP address + lines = open('/etc/dhcpd.conf', 'r').readlines() + processBlock = None + for ln in lines: + if ln.find(name) != -1: + processBlock = 1 + continue + if processBlock and ln.find('fixed-address') != -1: + setIP = ln.split()[-1].strip()[:-1] + if setIP != ipAddr: + msg = 'Host with name "%s" already registered with ' %name + msg += 'IP "%s". Cannot register node.\n' %ipAddr + syslog.syslog(syslog.LOG_INFO, msg) + syslog.closelog() + return + dhconf = open('/etc/dhcpd.conf', 'a') + dhconf.write('\n') + dhconf.write('host %s {\n' %name) + dhconf.write(' hardware ethernet %s;\n' %macAddr) + dhconf.write(' fixed-address %s;\n' %ipAddr) + dhconf.write('}\n') + dhconf.close() + # Restart the dhcp server as we just change the config + os.system('/bin/systemctl restart dhcpd.service >& /dev/null') + # Create hosts entry + hosts = open('/etc/hosts', 'a') + hosts.write('%s %s\n' %(ipAddr, name)) + hosts.close() + # Register node with Nebula infrastructure + cmd = '/usr/bin/sudo env ONE_AUTH=/var/lib/one/.one/one_auth ' + cmd += '/usr/bin/onehost create %s -i im_kvm -v vmm_kvm ' %ipAddr + cmd += '-n vnm_kvm' + res = os.system(cmd) + if res: + msg = 'Registration failed, onehost command with non zero status\n' + syslog.syslog(syslog.LOG_ERR, msg) + syslog.closelog() + return + syslog.syslog(syslog.LOG_ERR, 'Node registration succesful.\n') + syslog.closelog() #------------------------------------------------------------------------------ def sigHandler(signum, frame): - """Signal handler for termination""" - syslog.openlog('[NOD_REG]',syslog.LOG_PID,syslog.LOG_DAEMON) - syslog.syslog(syslog.LOG_INFO, 'Terminating server on signal: %d' %signum) - syslog.closelog() - os.remove('/var/run/suseNebula/regSrv.pid') - sys.exit(0) + """Signal handler for termination""" + syslog.openlog('[NOD_REG]',syslog.LOG_PID,syslog.LOG_DAEMON) + syslog.syslog(syslog.LOG_INFO, 'Terminating server on signal: %d' %signum) + syslog.closelog() + os.remove('/var/run/suseNebula/regSrv.pid') + sys.exit(0) #------------------------------------------------------------------------------ if __name__ == "__main__": - syslog.openlog('[NOD_REG]', syslog.LOG_PID, syslog.LOG_DAEMON) - syslog.syslog(syslog.LOG_INFO, 'Start node registration service\n') - # Determine the IP address of this host - inetInfo = os.popen('/sbin/ifconfig').readlines() - ipAddr = None - # Use the first IPv4 address found - for item in inetInfo: - if item.find('inet addr') != -1: - # Extract the IP address from line expected in following format - # inet addr:192.168.1.6 Bcast:192.168.1.255 Mask:255.255.255.0 - ipAddr = item.strip().split()[1].split(':')[-1] - if ipPat.match(ipAddr): - break + syslog.openlog('[NOD_REG]', syslog.LOG_PID, syslog.LOG_DAEMON) + syslog.syslog(syslog.LOG_INFO, 'Start node registration service\n') + # Determine the IP address of this host + inetInfo = os.popen('/sbin/ifconfig').readlines() + ipAddr = None + # Use the first IPv4 address found + for item in inetInfo: + if item.find('inet addr') != -1: + # Extract the IP address from line expected in following format + # inet addr:192.168.1.6 Bcast:192.168.1.255 Mask:255.255.255.0 + ipAddr = item.strip().split()[1].split(':')[-1] + if ipPat.match(ipAddr): + break - if not ipAddr: - # No IP address found. Print a message to syslog and exit - syslog.syslog(syslog.LOG_ERR, - 'Could not determine IP address, exiting\n') - syslog.closelog() - sys.exit(1) - - server = SocketServer.TCPServer((ipAddr, 8445), RegistrationHandler) + if not ipAddr: + # No IP address found. Print a message to syslog and exit + syslog.syslog(syslog.LOG_ERR, + 'Could not determine IP address, exiting\n') + syslog.closelog() + sys.exit(1) + + server = SocketServer.TCPServer((ipAddr, 8445), RegistrationHandler) - if not server: - syslog.syslog(syslog.LOG_ERR, 'Could not create server, exiting\n') - syslog.closelog() - sys.exit(1) + if not server: + syslog.syslog(syslog.LOG_ERR, 'Could not create server, exiting\n') + syslog.closelog() + sys.exit(1) - # Write pid to a file - pid = os.getpid() - if not os.path.exists('/var/run/suseNebula'): - os.mkdir('/var/run/suseNebula') - pidFl = open('/var/run/suseNebula/regSrv.pid', 'w'); - pidFl.write('%d\n' %pid) - pidFl.close() + # Write pid to a file + pid = os.getpid() + if not os.path.exists('/var/run/suseNebula'): + os.mkdir('/var/run/suseNebula') + pidFl = open('/var/run/suseNebula/regSrv.pid', 'w'); + pidFl.write('%d\n' %pid) + pidFl.close() - # Register signal handler - signal.signal(signal.SIGHUP, sigHandler) - signal.signal(signal.SIGTERM, sigHandler) - signal.signal(signal.SIGINT, sigHandler) + # Register signal handler + signal.signal(signal.SIGHUP, sigHandler) + signal.signal(signal.SIGTERM, sigHandler) + signal.signal(signal.SIGINT, sigHandler) - # No additional message will be printed, close the log - syslog.syslog(syslog.LOG_INFO, 'Cloud registration service running\n') - syslog.closelog() - server.serve_forever() - + # No additional message will be printed, close the log + syslog.syslog(syslog.LOG_INFO, 'Cloud registration service running\n') + syslog.closelog() + server.serve_forever() + diff --git a/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/root/usr/share/YaST2/clients/opennebula.ycp b/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/root/usr/share/YaST2/clients/opennebula.ycp index 742d1e459..3e06e25e1 100644 --- a/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/root/usr/share/YaST2/clients/opennebula.ycp +++ b/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/root/usr/share/YaST2/clients/opennebula.ycp @@ -9,178 +9,178 @@ */ { - textdomain "susenebula"; - - import "FileUtils"; - import "Hostname"; - import "IP"; - import "Label"; - import "Mode"; - import "Netmask"; - import "Popup"; - import "Report"; - import "Service"; - import "Wizard"; - - import "YaPI::NETWORK"; - - string hostname = "SUSENebula-Head"; - string domain = ""; - string ip = "192.168.1.2"; - string netmask = "255.255.255.0"; - string ip_min = ""; - string ip_max = ""; - string clustername = "SUSENebula"; - string route = ""; - string cadminp = "susenebula"; - list nameservers = []; - list searchdomains = []; - - // network export map - map network = $[]; - // dhcp server export map - map dhcp = $[]; - - // write entered settings to the system - boolean WriteSettings () { - - // 1. Write Network - map write_network = $[ - "hostname" : network["hostname"]:$[], - "dns" : network["dns"]:$[], - ]; - - write_network["hostname","domain"] = domain; - write_network["hostname","name"] = hostname; - - write_network["dns","nameservers"] = nameservers; - write_network["dns","searches"] = searchdomains; - - write_network["route"] = $[ - "default" : $[ - "via" : route - ] - ]; - - map interface = network["interfaces"]:$[]; - - // ip r|grep default|cut -d' ' -f5 - if (haskey (interface, "eth0")) - { - interface["eth0","bootproto"] = "static"; - interface["eth0","ipaddr"] = sformat ("%1/%2", ip, Netmask::ToBits (netmask)); - write_network["interface"] = interface; - } - y2internal ("network to write: %1", write_network); - map network_written = YaPI::NETWORK::Write (write_network); - - Service::Restart ("network"); - - // 2. Write DHCP server DhcpServer: settings/directives/range - // Min/Max IP -> set the IP address range for dhcp server. - - // Read DhcpServer after network is configured - /* - DhcpServer::Read (); - dhcp = DhcpServer::Export (); - y2internal ("dhcp: %1", dhcp); - */ - - string subnet_ip = IP::ComputeNetwork (ip, netmask); - - dhcp["allowed_interfaces"] = ["eth0"]; - dhcp["start_service"] = true; - dhcp["use_ldap"] = false; - dhcp["settings"] = [ - $[ - "children" : [], - "directives" : [ - $[ - "key" : "default-lease-time", - "type" : "directive", - "value" : "14400" - ], - $[ - "key" : "max-lease-time", - "type" : "directive", - "value" : "172800" - ], - $[ - "key" : "range", - "type" : "directive", - "value" : sformat ("%1 %2", ip_min, ip_max) - ] - ], - "id" : sformat ("%1 netmask %2", subnet_ip, netmask), - "options" : [], - "parent_id" : "", - "parent_type" : "", - "type" : "subnet" - ], - $[ - "children" : [ - $[ - "id" : sformat ("%1 netmask %2", subnet_ip, netmask), - "type" : "subnet" - ] - ], - "directives" : [ - $[ - "key" : "max-lease-time", - "type" : "directive", - "value" : "7200" - ], - $[ - "key" : "ddns-updates", - "type" : "directive", - "value" : "off" - ], - $[ - "key" : "ddns-update-style", - "type" : "directive", - "value" : "none" - ], - $[ - "key" : "log-facility", - "type" : "directive", - "value" : "local7" - ], - $[ - "key" : "default-lease-time", - "type" : "directive", - "value" : "600" - ], - ], - "options" : [ - $[ - "key" : "suse-nebula", - "type" : "option", - "value" : "code 239 = ip-address" - ], - $[ - "key" : "suse-nebula", - "type" : "option", - "value" : ip - ], - $[ - "key" : "domain-name", - "type" : "option", - "value" : sformat ("\"%1\"", domain), - ], - ], - "id" :"", - "parent_id" : "", - "parent_type" : "", - "type" : "" - ] - ]; - /* - y2internal ("importing dhcp settings: %1", dhcp); - DhcpServer::Import (dhcp); - DhcpServer::Write (); - */ - - string dhcpd_conf = sformat ( + textdomain "susenebula"; + + import "FileUtils"; + import "Hostname"; + import "IP"; + import "Label"; + import "Mode"; + import "Netmask"; + import "Popup"; + import "Report"; + import "Service"; + import "Wizard"; + + import "YaPI::NETWORK"; + + string hostname = "SUSENebula-Head"; + string domain = ""; + string ip = "192.168.1.2"; + string netmask = "255.255.255.0"; + string ip_min = ""; + string ip_max = ""; + string clustername = "SUSENebula"; + string route = ""; + string cadminp = "susenebula"; + list nameservers = []; + list searchdomains = []; + + // network export map + map network = $[]; + // dhcp server export map + map dhcp = $[]; + + // write entered settings to the system + boolean WriteSettings () { + + // 1. Write Network + map write_network = $[ + "hostname" : network["hostname"]:$[], + "dns" : network["dns"]:$[], + ]; + + write_network["hostname","domain"] = domain; + write_network["hostname","name"] = hostname; + + write_network["dns","nameservers"] = nameservers; + write_network["dns","searches"] = searchdomains; + + write_network["route"] = $[ + "default" : $[ + "via" : route + ] + ]; + + map interface = network["interfaces"]:$[]; + + // ip r|grep default|cut -d' ' -f5 + if (haskey (interface, "eth0")) + { + interface["eth0","bootproto"] = "static"; + interface["eth0","ipaddr"] = sformat ("%1/%2", ip, Netmask::ToBits (netmask)); + write_network["interface"] = interface; + } + y2internal ("network to write: %1", write_network); + map network_written = YaPI::NETWORK::Write (write_network); + + Service::Restart ("network"); + + // 2. Write DHCP server DhcpServer: settings/directives/range + // Min/Max IP -> set the IP address range for dhcp server. + + // Read DhcpServer after network is configured + /* + DhcpServer::Read (); + dhcp = DhcpServer::Export (); + y2internal ("dhcp: %1", dhcp); + */ + + string subnet_ip = IP::ComputeNetwork (ip, netmask); + + dhcp["allowed_interfaces"] = ["eth0"]; + dhcp["start_service"] = true; + dhcp["use_ldap"] = false; + dhcp["settings"] = [ + $[ + "children" : [], + "directives" : [ + $[ + "key" : "default-lease-time", + "type" : "directive", + "value" : "14400" + ], + $[ + "key" : "max-lease-time", + "type" : "directive", + "value" : "172800" + ], + $[ + "key" : "range", + "type" : "directive", + "value" : sformat ("%1 %2", ip_min, ip_max) + ] + ], + "id" : sformat ("%1 netmask %2", subnet_ip, netmask), + "options" : [], + "parent_id" : "", + "parent_type" : "", + "type" : "subnet" + ], + $[ + "children" : [ + $[ + "id" : sformat ("%1 netmask %2", subnet_ip, netmask), + "type" : "subnet" + ] + ], + "directives" : [ + $[ + "key" : "max-lease-time", + "type" : "directive", + "value" : "7200" + ], + $[ + "key" : "ddns-updates", + "type" : "directive", + "value" : "off" + ], + $[ + "key" : "ddns-update-style", + "type" : "directive", + "value" : "none" + ], + $[ + "key" : "log-facility", + "type" : "directive", + "value" : "local7" + ], + $[ + "key" : "default-lease-time", + "type" : "directive", + "value" : "600" + ], + ], + "options" : [ + $[ + "key" : "suse-nebula", + "type" : "option", + "value" : "code 239 = ip-address" + ], + $[ + "key" : "suse-nebula", + "type" : "option", + "value" : ip + ], + $[ + "key" : "domain-name", + "type" : "option", + "value" : sformat ("\"%1\"", domain), + ], + ], + "id" :"", + "parent_id" : "", + "parent_type" : "", + "type" : "" + ] + ]; + /* + y2internal ("importing dhcp settings: %1", dhcp); + DhcpServer::Import (dhcp); + DhcpServer::Write (); + */ + + string dhcpd_conf = sformat ( "option rfc3442-classless-static-routes code 121 = array of unsigned integer 8; option domain-name \"%1\"; max-lease-time 7200; @@ -191,175 +191,175 @@ option suse-nebula code 239 = ip-address; option suse-nebula %2; # Set the address range to be handed out. subnet %3 netmask %4 { - range %5 %6; - default-lease-time 86400000; - max-lease-time 1728000000000; + range %5 %6; + default-lease-time 86400000; + max-lease-time 1728000000000; }", domain, ip, subnet_ip, netmask, ip_min, ip_max); - SCR::Write (.target.string, "/etc/dhcpd.conf", dhcpd_conf); + SCR::Write (.target.string, "/etc/dhcpd.conf", dhcpd_conf); - SCR::Write (.sysconfig.dhcpd.DHCPD_INTERFACE, "eth0"); - SCR::Write (.sysconfig.dhcpd, nil); + SCR::Write (.sysconfig.dhcpd.DHCPD_INTERFACE, "eth0"); + SCR::Write (.sysconfig.dhcpd, nil); - Service::Enable ("dhcpd"); - Service::Start ("dhcpd"); + Service::Enable ("dhcpd"); + Service::Start ("dhcpd"); - // 3. Write onedamin authentication file - string oneauth = sformat ("oneadmin:%1", cadminp); - SCR::Write (.target.string, "/var/lib/one/.one/one_auth", oneauth); - - return true; - } - - // initialize network data - boolean ReadNetworkSettings () { - network = YaPI::NETWORK::Read (); - y2internal ("network: %1", network); - nameservers = network["dns","nameservers"]:[]; - searchdomains = network["dns","searches"]:[]; + // 3. Write onedamin authentication file + string oneauth = sformat ("oneadmin:%1", cadminp); + SCR::Write (.target.string, "/var/lib/one/.one/one_auth", oneauth); + return true; - } - - ReadNetworkSettings (); - - term contents = `HBox (`HSpacing (1), `VBox ( - `Frame (_("Network Configuration"), `VBox ( - // text entry label - `InputField (`id ("clustername"), `opt (`hstretch), _("C&luster Name"), clustername), - `HBox ( - // text entry label - `InputField (`id ("hostname"), `opt (`hstretch), _("&Hostname"), hostname), - // text entry label - `InputField (`id ("domain"), `opt (`hstretch), _("&Domain Name"), domain) - ), - `HBox ( - // text entry label - `InputField (`id ("ip"), `opt (`hstretch), _("&IP Address"), ip), - // text entry label - `InputField (`id ("netmask"), `opt (`hstretch), _("&Netmask"), netmask) - ), - // text entry label - `InputField (`id ("route"), `opt (`hstretch), _("Default Route"), route), - `HBox ( - // text entry label - `InputField (`id ("nameservers"), `opt (`hstretch), _("Name Servers"), mergestring (nameservers, " ")), - // text entry label - `InputField (`id ("searches"), `opt (`hstretch), _("Search Domains"), mergestring (searchdomains, " ")) - ) - )), - `VSpacing (2), - // frame label - `Frame (_("IP Address Range for Cloud Nodes"), `HBox ( - // text entry label - `InputField (`id ("ip_min"), `opt (`hstretch), _("Min IP Address"), ip_min), - // text entry label - `InputField (`id ("ip_max"), `opt (`hstretch), _("Max IP Address"), ip_max) - )), - `VSpacing (2), - // frame label - `Frame (_("Cloud Administrator"), `VBox ( - // text entry label - `InputField (`id ("cadminp"), `opt (`hstretch), _("Password for Cloud Administration"), cadminp), - `VSpacing (1), - `Label ("The password is stored in plain text in the file /var/lib/one/.one/one_auth and is used for cloud administration only. -This is not the password for the cloud administrator (oneadmin) user account. The oneadmin account has no password.") - )) - ), `HSpacing (1)); - - if (Mode::normal ()) - Wizard::OpenOKDialog (); - - string help_text = ""; - - // dialog caption - Wizard::SetContents (_("SUSENebula"), contents, help_text, true, true); - - UI::ChangeWidget (`id ("hostname"), `ValidChars, Hostname::ValidChars); - foreach (string key, ["ip", "ip_min", "ip_max"], { - UI::ChangeWidget (`id (key), `ValidChars, IP::ValidChars4); - }); - any ret = `back; - while (true) - { - ret = UI::UserInput (); - if (ret == `ok || ret == `next) - { - cadminp = (string) UI::QueryWidget (`id ("cadminp"), `Value); - clustername = (string) UI::QueryWidget (`id ("clustername"), `Value); - hostname = (string) UI::QueryWidget (`id ("hostname"), `Value); - domain = (string) UI::QueryWidget (`id ("domain"), `Value); - ip = (string) UI::QueryWidget (`id ("ip"), `Value); - ip_min = (string) UI::QueryWidget (`id ("ip_min"), `Value); - ip_max = (string) UI::QueryWidget (`id ("ip_max"), `Value); - netmask = (string) UI::QueryWidget (`id ("netmask"), `Value); - route = (string) UI::QueryWidget (`id ("route"), `Value); - string dns = (string) UI::QueryWidget (`id ("nameservers"), `Value); - nameservers = splitstring (dns, ", "); - string searches = (string) UI::QueryWidget (`id ("searches"), `Value); - searchdomains = splitstring (searches, ", "); - - if (!Hostname::Check (hostname)) - { - Report::Error (Hostname::ValidHost ()); - UI::SetFocus (`id ("hostname")); - continue; } - if (!Hostname::CheckDomain (domain)) - { - Report::Error (Hostname::ValidDomain ()); - UI::SetFocus (`id ("domain")); - continue; + + // initialize network data + boolean ReadNetworkSettings () { + network = YaPI::NETWORK::Read (); + y2internal ("network: %1", network); + nameservers = network["dns","nameservers"]:[]; + searchdomains = network["dns","searches"]:[]; + return true; } - if (!IP::Check (ip)) + + ReadNetworkSettings (); + + term contents = `HBox (`HSpacing (1), `VBox ( + `Frame (_("Network Configuration"), `VBox ( + // text entry label + `InputField (`id ("clustername"), `opt (`hstretch), _("C&luster Name"), clustername), + `HBox ( + // text entry label + `InputField (`id ("hostname"), `opt (`hstretch), _("&Hostname"), hostname), + // text entry label + `InputField (`id ("domain"), `opt (`hstretch), _("&Domain Name"), domain) + ), + `HBox ( + // text entry label + `InputField (`id ("ip"), `opt (`hstretch), _("&IP Address"), ip), + // text entry label + `InputField (`id ("netmask"), `opt (`hstretch), _("&Netmask"), netmask) + ), + // text entry label + `InputField (`id ("route"), `opt (`hstretch), _("Default Route"), route), + `HBox ( + // text entry label + `InputField (`id ("nameservers"), `opt (`hstretch), _("Name Servers"), mergestring (nameservers, " ")), + // text entry label + `InputField (`id ("searches"), `opt (`hstretch), _("Search Domains"), mergestring (searchdomains, " ")) + ) + )), + `VSpacing (2), + // frame label + `Frame (_("IP Address Range for Cloud Nodes"), `HBox ( + // text entry label + `InputField (`id ("ip_min"), `opt (`hstretch), _("Min IP Address"), ip_min), + // text entry label + `InputField (`id ("ip_max"), `opt (`hstretch), _("Max IP Address"), ip_max) + )), + `VSpacing (2), + // frame label + `Frame (_("Cloud Administrator"), `VBox ( + // text entry label + `InputField (`id ("cadminp"), `opt (`hstretch), _("Password for Cloud Administration"), cadminp), + `VSpacing (1), + `Label ("The password is stored in plain text in the file /var/lib/one/.one/one_auth and is used for cloud administration only. +This is not the password for the cloud administrator (oneadmin) user account. The oneadmin account has no password.") + )) + ), `HSpacing (1)); + + if (Mode::normal ()) + Wizard::OpenOKDialog (); + + string help_text = ""; + + // dialog caption + Wizard::SetContents (_("SUSENebula"), contents, help_text, true, true); + + UI::ChangeWidget (`id ("hostname"), `ValidChars, Hostname::ValidChars); + foreach (string key, ["ip", "ip_min", "ip_max"], { + UI::ChangeWidget (`id (key), `ValidChars, IP::ValidChars4); + }); + any ret = `back; + while (true) { - Report::Error (IP::Valid4 ()); - UI::SetFocus (`id ("ip")); - continue; - } - if (!IP::Check (ip_min)) + ret = UI::UserInput (); + if (ret == `ok || ret == `next) { - Report::Error (IP::Valid4 ()); - UI::SetFocus (`id ("ip_min")); - continue; + cadminp = (string) UI::QueryWidget (`id ("cadminp"), `Value); + clustername = (string) UI::QueryWidget (`id ("clustername"), `Value); + hostname = (string) UI::QueryWidget (`id ("hostname"), `Value); + domain = (string) UI::QueryWidget (`id ("domain"), `Value); + ip = (string) UI::QueryWidget (`id ("ip"), `Value); + ip_min = (string) UI::QueryWidget (`id ("ip_min"), `Value); + ip_max = (string) UI::QueryWidget (`id ("ip_max"), `Value); + netmask = (string) UI::QueryWidget (`id ("netmask"), `Value); + route = (string) UI::QueryWidget (`id ("route"), `Value); + string dns = (string) UI::QueryWidget (`id ("nameservers"), `Value); + nameservers = splitstring (dns, ", "); + string searches = (string) UI::QueryWidget (`id ("searches"), `Value); + searchdomains = splitstring (searches, ", "); + + if (!Hostname::Check (hostname)) + { + Report::Error (Hostname::ValidHost ()); + UI::SetFocus (`id ("hostname")); + continue; + } + if (!Hostname::CheckDomain (domain)) + { + Report::Error (Hostname::ValidDomain ()); + UI::SetFocus (`id ("domain")); + continue; + } + if (!IP::Check (ip)) + { + Report::Error (IP::Valid4 ()); + UI::SetFocus (`id ("ip")); + continue; + } + if (!IP::Check (ip_min)) + { + Report::Error (IP::Valid4 ()); + UI::SetFocus (`id ("ip_min")); + continue; + } + if (!IP::Check (ip_max)) + { + Report::Error (IP::Valid4 ()); + UI::SetFocus (`id ("ip_max")); + continue; + } + + if (IP::ToInteger (ip_min) <= IP::ToInteger (ip) && + IP::ToInteger (ip) <= IP::ToInteger (ip_max)) + { + // error message + Report::Error (_("IP Address is within the IP range that should be offered by DHCP server.")); + UI::SetFocus (`id ("ip_min")); + continue; + } + + if (IP::ToInteger (ip_min) > IP::ToInteger (ip_max)) + { + // error message + Popup::Message(_("The lowest address must be lower than the highest one.")); + UI::SetFocus (`id ("ip_min")); + continue; + } + + + WriteSettings (); + break; } - if (!IP::Check (ip_max)) + if (ret == `cancel || ret == `abort) { - Report::Error (IP::Valid4 ()); - UI::SetFocus (`id ("ip_max")); - continue; + break; } - - if (IP::ToInteger (ip_min) <= IP::ToInteger (ip) && - IP::ToInteger (ip) <= IP::ToInteger (ip_max)) + if (ret == `back) { - // error message - Report::Error (_("IP Address is within the IP range that should be offered by DHCP server.")); - UI::SetFocus (`id ("ip_min")); - continue; + break; } - - if (IP::ToInteger (ip_min) > IP::ToInteger (ip_max)) - { - // error message - Popup::Message(_("The lowest address must be lower than the highest one.")); - UI::SetFocus (`id ("ip_min")); - continue; } - - - WriteSettings (); - break; - } - if (ret == `cancel || ret == `abort) - { - break; - } - if (ret == `back) - { - break; - } - } - if (Mode::normal ()) - Wizard::CloseDialog (); - return ret; + if (Mode::normal ()) + Wizard::CloseDialog (); + return ret; } diff --git a/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/root/usr/share/firstboot/scripts/finalizeSetup b/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/root/usr/share/firstboot/scripts/finalizeSetup index 2e27be3ed..f99cb7108 100755 --- a/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/root/usr/share/firstboot/scripts/finalizeSetup +++ b/doc/examples/extras/suse-12.2/suse-nebula-cloud/cloud_head/root/usr/share/firstboot/scripts/finalizeSetup @@ -15,20 +15,20 @@ import time confFiles = glob.glob('/etc/sysconfig/network/ifcfg-eth*') numConfInterf = len(confFiles) if numConfInterf > 1: - syslog.openlog('[BR_SETUP]', syslog.LOG_PID, syslog.LOG_DAEMON) - syslog.syslog(syslog.LOG_INFO, 'Bridge setup\n') - msg = 'Multiple configured eth devices found, cannot resolve ambiguity\n' - syslog.syslog(syslog.LOG_ERR, msg) - syslog.closelog() - sys.exit(1) + syslog.openlog('[BR_SETUP]', syslog.LOG_PID, syslog.LOG_DAEMON) + syslog.syslog(syslog.LOG_INFO, 'Bridge setup\n') + msg = 'Multiple configured eth devices found, cannot resolve ambiguity\n' + syslog.syslog(syslog.LOG_ERR, msg) + syslog.closelog() + sys.exit(1) if numConfInterf < 1: - syslog.openlog('[BR_SETUP]', syslog.LOG_PID, syslog.LOG_DAEMON) - syslog.syslog(syslog.LOG_INFO, 'Bridge setup\n') - msg = 'No eth interface configured, cannot setup bridge\n' - syslog.syslog(syslog.LOG_ERR, msg) - syslog.closelog() - sys.exit(1) + syslog.openlog('[BR_SETUP]', syslog.LOG_PID, syslog.LOG_DAEMON) + syslog.syslog(syslog.LOG_INFO, 'Bridge setup\n') + msg = 'No eth interface configured, cannot setup bridge\n' + syslog.syslog(syslog.LOG_ERR, msg) + syslog.closelog() + sys.exit(1) # Get the configured IP address (includes the subnet mask) interfConf = confFiles[0] @@ -36,9 +36,9 @@ interfaceName = interfConf.split('-')[-1] lines = open(interfConf, 'r').readlines() ipAddr = None for ln in lines: - if ln.find('IPADDR') != -1: - ipAddr = ln.strip().split('=')[-1] - break + if ln.find('IPADDR') != -1: + ipAddr = ln.strip().split('=')[-1] + break # Stop the running network services os.system('/bin/systemctl stop dhcpd.service >& /dev/null') @@ -68,10 +68,10 @@ brCfg.close() lines = open('/etc/sysconfig/dhcpd', 'r').readlines() conf = open('/etc/sysconfig/dhcpd', 'w') for ln in lines: - if ln.find('DHCPD_INTERFACE') != -1: - conf.write('DHCPD_INTERFACE="br0"\n') - continue - conf.write(ln) + if ln.find('DHCPD_INTERFACE') != -1: + conf.write('DHCPD_INTERFACE="br0"\n') + continue + conf.write(ln) conf.close() # Remove the old network configuration file @@ -91,20 +91,20 @@ os.system('/sbin/SuSEconfig >& /dev/null') os.system('/bin/chown oneadmin:cloud /var/lib/one/.one/one_auth') if not os.path.exists('/var/lock/one'): - os.mkdir('/var/lock/one') + os.mkdir('/var/lock/one') os.system('/bin/chown -R oneadmin:cloud /var/lock/one') # Initial setup of the cloud service res = os.system('/usr/bin/sudo -u oneadmin /usr/bin/env ONE_AUTH=/var/lib/one/.one/one_auth /usr/sbin/onedsetup >& /var/log/one/onedsetup.log') if res: - if os.path.exists('/var/log/one/oned.log'): - os.rename('/var/log/one/oned.log','/var/log/one/oned.setup.log') - syslog.openlog('[ONED_INIT]', syslog.LOG_PID, syslog.LOG_DAEMON) - msg = 'Possible error with initialization of oned, check log files\n' - msg += 'in /var/log/one' - syslog.syslog(syslog.LOG_INFO, msg) - syslog.closelog() - + if os.path.exists('/var/log/one/oned.log'): + os.rename('/var/log/one/oned.log','/var/log/one/oned.setup.log') + syslog.openlog('[ONED_INIT]', syslog.LOG_PID, syslog.LOG_DAEMON) + msg = 'Possible error with initialization of oned, check log files\n' + msg += 'in /var/log/one' + syslog.syslog(syslog.LOG_INFO, msg) + syslog.closelog() + # Everything needs to catch up time.sleep(5) diff --git a/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_cloud/config.xml b/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_cloud/config.xml index c6954f1ae..e9bcdeadf 100644 --- a/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_cloud/config.xml +++ b/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_cloud/config.xml @@ -1,75 +1,75 @@ - - Robert Schweikert - rjschwei@suse.com - OpenNebula Cloud Node configuration - - - - - OpenNebula Cloud Node - true - true - 2048 - true - - - 1.3.0 - zypper - false - true - en_US - us.map.gz - openSUSE - openSUSE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + Robert Schweikert + rjschwei@suse.com + OpenNebula Cloud Node configuration + + + + + OpenNebula Cloud Node + true + true + 2048 + true + + + 1.3.0 + zypper + false + true + en_US + us.map.gz + openSUSE + openSUSE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_cloud/root/usr/share/firstboot/scripts/cloudNodeConfig b/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_cloud/root/usr/share/firstboot/scripts/cloudNodeConfig index 95ba5c906..90dbc5bc5 100755 --- a/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_cloud/root/usr/share/firstboot/scripts/cloudNodeConfig +++ b/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_cloud/root/usr/share/firstboot/scripts/cloudNodeConfig @@ -12,377 +12,377 @@ import time #------------------------------------------------------------------------ def configureNode(confSettings): - """Configure this node.""" - # Setup keyboard layout - layout = confSettings['keyLayout'] - msg = 'Setting keyboard layout to: %s\n' %layout - syslog.syslog(syslog.LOG_INFO, msg) - os.system('/sbin/yast2 keyboard set layout=%s' %layout) - # Setup the timezone - zone = confSettings['timezone'] - hwc = confSettings['hwclock'].lower() - msg = 'Setting timezone and hwclock to: %s, %s' %(zone, hwc) - syslog.syslog(syslog.LOG_INFO, msg) - os.system('/sbin/yast2 timezone set timezone=%s hwclock=%s' %(zone, hwc)) - # Setup hostname - domain = confSettings['domainname'] - name = confSettings['hostname'] - host = '%s.%s' %(name, domain) - msg = 'Setting hostname to: %s\n' %host - hf = open('/etc/HOSTNAME', 'w') - hf.write(host) - hf.close() - # Add the hostname to the dhcp configuration info - lines = open('/etc/sysconfig/network/dhcp', 'r').readlines() - dhf = open('/etc/sysconfig/network/dhcp', 'w') - for ln in lines: - if ln.find('DHCLIENT_HOSTNAME_OPTION') != -1: - dhf.write('DHCLIENT_HOSTNAME_OPTION="%s"' %name) - continue - dhf.write(ln) - dhf.close() - # Add the dhcp feature to avoid dhcp acceptance from servers other than - # the head node - feature = confSettings['dhcpFeature'] - msg = 'Setting dhclient required feature to: %s\n' %feature - syslog.syslog(syslog.LOG_INFO, msg) - dhcf = open('/etc/dhclient.conf','a') - dhcf.write('option %s code 239 = ip-address;\n' %feature) - dhcf.write('request %s;\n' %feature) - dhcf.write('require %s;\n' %feature) - dhcf.close() - # Setup the name resolution - syslog.syslog(syslog.LOG_INFO, 'Setting up resolve.conf\n') - res = open('/etc/resolv.conf', 'w') - res.write(confSettings['resolve']) - res.close() - # Setup the routes - syslog.syslog(syslog.LOG_INFO, 'Setting up routes\n') - routes = open('/etc/sysconfig/network/routes', 'w') - routes.write(confSettings['routes']) - routes.close() - # Setup the root password - syslog.syslog(syslog.LOG_INFO, 'Setting root password\n') - lines = open('/etc/shadow', 'r').readlines() - shadow = open('/etc/shadow','w') - for ln in lines: - if ln[:4] == 'root': - shadow.write('root:') - shadow.write(confSettings['rootpass']) - shadow.write(':') - shadow.write(ln.split(':')[2]) - shadow.write('::::::\n') - continue - shadow.write(ln) - shadow.close() - # Setup the cloud administartor acount - # Use eval; convert strings to tuple - gname, gid = eval(confSettings['groupID']) - uname, uid, pwd = eval(confSettings['userID']) - msg = 'Setting up %s with uid, gid: %s, %s\n' %(uname,uid,gid) - syslog.syslog(syslog.LOG_INFO, msg) - res = os.system('/usr/sbin/groupadd -g %s %s' %(gid, gname)) - if res: - msg = 'Could not add %s group. ' %gname - msg += 'Incomplete configuration\n' + """Configure this node.""" + # Setup keyboard layout + layout = confSettings['keyLayout'] + msg = 'Setting keyboard layout to: %s\n' %layout syslog.syslog(syslog.LOG_INFO, msg) - return -1 - groups = 'kvm,root,%s' %gname - res = os.system( - '/usr/sbin/useradd -c "%s" -d %s -g %s -G %s -u %s -p %s -m %s' - %('Cloud admin', '/var/lib/one', gid, groups, uid, pwd, uname)) - if res: - msg = 'Could not add %s user. ' %uname - msg += 'Incomplete configuration\n' + os.system('/sbin/yast2 keyboard set layout=%s' %layout) + # Setup the timezone + zone = confSettings['timezone'] + hwc = confSettings['hwclock'].lower() + msg = 'Setting timezone and hwclock to: %s, %s' %(zone, hwc) syslog.syslog(syslog.LOG_INFO, msg) - return -1 - # Setup nfs mount in fstab - syslog.syslog(syslog.LOG_INFO, 'Setting up NFS mount in fstab\n') - fst = open('/etc/fstab', 'a') - fst.write(confSettings['serverIP']) - fst.write(':/var/lib/one') - fst.write('\t/var/lib/one\tnfs\tdefaults,comment=systemd.automount\t1 1\n') - fst.close() - - return 1 + os.system('/sbin/yast2 timezone set timezone=%s hwclock=%s' %(zone, hwc)) + # Setup hostname + domain = confSettings['domainname'] + name = confSettings['hostname'] + host = '%s.%s' %(name, domain) + msg = 'Setting hostname to: %s\n' %host + hf = open('/etc/HOSTNAME', 'w') + hf.write(host) + hf.close() + # Add the hostname to the dhcp configuration info + lines = open('/etc/sysconfig/network/dhcp', 'r').readlines() + dhf = open('/etc/sysconfig/network/dhcp', 'w') + for ln in lines: + if ln.find('DHCLIENT_HOSTNAME_OPTION') != -1: + dhf.write('DHCLIENT_HOSTNAME_OPTION="%s"' %name) + continue + dhf.write(ln) + dhf.close() + # Add the dhcp feature to avoid dhcp acceptance from servers other than + # the head node + feature = confSettings['dhcpFeature'] + msg = 'Setting dhclient required feature to: %s\n' %feature + syslog.syslog(syslog.LOG_INFO, msg) + dhcf = open('/etc/dhclient.conf','a') + dhcf.write('option %s code 239 = ip-address;\n' %feature) + dhcf.write('request %s;\n' %feature) + dhcf.write('require %s;\n' %feature) + dhcf.close() + # Setup the name resolution + syslog.syslog(syslog.LOG_INFO, 'Setting up resolve.conf\n') + res = open('/etc/resolv.conf', 'w') + res.write(confSettings['resolve']) + res.close() + # Setup the routes + syslog.syslog(syslog.LOG_INFO, 'Setting up routes\n') + routes = open('/etc/sysconfig/network/routes', 'w') + routes.write(confSettings['routes']) + routes.close() + # Setup the root password + syslog.syslog(syslog.LOG_INFO, 'Setting root password\n') + lines = open('/etc/shadow', 'r').readlines() + shadow = open('/etc/shadow','w') + for ln in lines: + if ln[:4] == 'root': + shadow.write('root:') + shadow.write(confSettings['rootpass']) + shadow.write(':') + shadow.write(ln.split(':')[2]) + shadow.write('::::::\n') + continue + shadow.write(ln) + shadow.close() + # Setup the cloud administartor acount + # Use eval; convert strings to tuple + gname, gid = eval(confSettings['groupID']) + uname, uid, pwd = eval(confSettings['userID']) + msg = 'Setting up %s with uid, gid: %s, %s\n' %(uname,uid,gid) + syslog.syslog(syslog.LOG_INFO, msg) + res = os.system('/usr/sbin/groupadd -g %s %s' %(gid, gname)) + if res: + msg = 'Could not add %s group. ' %gname + msg += 'Incomplete configuration\n' + syslog.syslog(syslog.LOG_INFO, msg) + return -1 + groups = 'kvm,root,%s' %gname + res = os.system( + '/usr/sbin/useradd -c "%s" -d %s -g %s -G %s -u %s -p %s -m %s' + %('Cloud admin', '/var/lib/one', gid, groups, uid, pwd, uname)) + if res: + msg = 'Could not add %s user. ' %uname + msg += 'Incomplete configuration\n' + syslog.syslog(syslog.LOG_INFO, msg) + return -1 + # Setup nfs mount in fstab + syslog.syslog(syslog.LOG_INFO, 'Setting up NFS mount in fstab\n') + fst = open('/etc/fstab', 'a') + fst.write(confSettings['serverIP']) + fst.write(':/var/lib/one') + fst.write('\t/var/lib/one\tnfs\tdefaults,comment=systemd.automount\t1 1\n') + fst.close() + + return 1 #---------------------------------------------------------------------------- def getConfigFromServer(): - """Get the configuration from the service running on the head node.""" - syslog.syslog(syslog.LOG_INFO, 'Obtain node configuration from head\n') - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - try: - s.connect(('169.254.1.1', 8445)) - except: - msg = 'Could not connect to head node at 169.254.1.1 port 8445\n' - syslog.syslog(syslog.LOG_INFO, msg) - return -1 - # Request the configuration info from the head node - s.send('PROVIDE_CONFIG') - confSettings = {} - confData = '' - # Read the configuration data from the socket - while 1: - data = s.recv(4096) - confData += data - if confData.find('COMPLETE') != -1: - break - s.close() - # Populate the configuration data dict - for confItem in confData.split(';'): - key, value = confItem.split('=', 1) - if key != 'COMPLETE': - confSettings[key] = value - return confSettings + """Get the configuration from the service running on the head node.""" + syslog.syslog(syslog.LOG_INFO, 'Obtain node configuration from head\n') + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + try: + s.connect(('169.254.1.1', 8445)) + except: + msg = 'Could not connect to head node at 169.254.1.1 port 8445\n' + syslog.syslog(syslog.LOG_INFO, msg) + return -1 + # Request the configuration info from the head node + s.send('PROVIDE_CONFIG') + confSettings = {} + confData = '' + # Read the configuration data from the socket + while 1: + data = s.recv(4096) + confData += data + if confData.find('COMPLETE') != -1: + break + s.close() + # Populate the configuration data dict + for confItem in confData.split(';'): + key, value = confItem.split('=', 1) + if key != 'COMPLETE': + confSettings[key] = value + return confSettings #---------------------------------------------------------------------------- def getFirstConnectedInterface(): - """Find the interface that has a cable connected.""" - # Bring up every interface so we can reliably figure out the one - # that is connected - iFaces = glob.glob('/sys/class/net/eth*') - for iFace in iFaces: - name = iFace.split('/')[-1] - os.system('/sbin/ifconfig %s up' %name) - # Allow time for the interface to activate - time.sleep(5) - - iFaceInfo = os.popen('/usr/sbin/hwinfo --network').readlines() - iFaceName = None - processBlock = None - for ln in iFaceInfo: - if ln.strip() == '': - processBlock = None - continue - if processBlock: - if ln.find('SysFS ID') != -1: - iFaceName = ln.split(':')[-1].split('/')[-1].strip() - continue - if ln.find('Link detected') != -1: - carrier = ln.split(':')[-1].strip() - if carrier == 'yes': - if iFaceName: - return iFaceName - else: - continue - if re.match(r'^\d+:.*Ethernet$',ln): - processBlock = 1 - continue + """Find the interface that has a cable connected.""" + # Bring up every interface so we can reliably figure out the one + # that is connected + iFaces = glob.glob('/sys/class/net/eth*') + for iFace in iFaces: + name = iFace.split('/')[-1] + os.system('/sbin/ifconfig %s up' %name) + # Allow time for the interface to activate + time.sleep(5) + + iFaceInfo = os.popen('/usr/sbin/hwinfo --network').readlines() + iFaceName = None + processBlock = None + for ln in iFaceInfo: + if ln.strip() == '': + processBlock = None + continue + if processBlock: + if ln.find('SysFS ID') != -1: + iFaceName = ln.split(':')[-1].split('/')[-1].strip() + continue + if ln.find('Link detected') != -1: + carrier = ln.split(':')[-1].strip() + if carrier == 'yes': + if iFaceName: + return iFaceName + else: + continue + if re.match(r'^\d+:.*Ethernet$',ln): + processBlock = 1 + continue - return -1 # No network interface is connected + return -1 # No network interface is connected #---------------------------------------------------------------------------- def registerNode(): - """Register this node with the head node.""" - syslog.syslog(syslog.LOG_INFO, 'Register the node with the head node.\n') - # Get the IP and MAC Address of this node - ipInfo = os.popen('/sbin/ifconfig').readlines() - processBlk = None - ipAddr = None - macAddr = None - for ln in ipInfo: - if ipAddr and macAddr: - break - if processBlk: - if ln.find('inet addr') != -1: - ipAddr = ln.split(':')[1].split()[0].strip() - continue - # We always setup br0, see setupCloudNetwork() - if ln.find('br0') != -1: - processBlk = 1 - macAddr = ln.split()[-1].strip() - if not ipAddr: - msg = 'Could not determine IP of this node. ' - msg += 'Unable to gergister node.\n' - syslog.syslog(syslog.LOG_INFO, msg) - return -1 - if not macAddr: - msg = 'Could not determine MAC of this node. ' - msg += 'Unable to gergister node.\n' - syslog.syslog(syslog.LOG_INFO, msg) - return -1 - # Get the server IP from fstab, see configureNode() - fst = open('/etc/fstab','r').readlines() - servIP = None - for ln in fst: - if ln.find('/var/lib/one') != -1: - servIP = ln.split(':')[0].strip() - if not servIP: - msg = 'Could not determine head node IP from /etc/fstab. ' - msg += 'Unable to gergister node.\n' - syslog.syslog(syslog.LOG_INFO, msg) - return -1 - # Hostname - myName = open('/etc/HOSTNAME', 'r').read().split('.')[0].strip() - # Connect to server and register - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - try: - s.connect((servIP, 8445)) - except: - msg = 'Could not connect to head node at %s port 8445\n' %servIP - syslog.syslog(syslog.LOG_INFO, msg) - return -1 - regInfo = '%s;%s;%s' %(macAddr, ipAddr, myName) - s.send(regInfo) - s.close() + """Register this node with the head node.""" + syslog.syslog(syslog.LOG_INFO, 'Register the node with the head node.\n') + # Get the IP and MAC Address of this node + ipInfo = os.popen('/sbin/ifconfig').readlines() + processBlk = None + ipAddr = None + macAddr = None + for ln in ipInfo: + if ipAddr and macAddr: + break + if processBlk: + if ln.find('inet addr') != -1: + ipAddr = ln.split(':')[1].split()[0].strip() + continue + # We always setup br0, see setupCloudNetwork() + if ln.find('br0') != -1: + processBlk = 1 + macAddr = ln.split()[-1].strip() + if not ipAddr: + msg = 'Could not determine IP of this node. ' + msg += 'Unable to gergister node.\n' + syslog.syslog(syslog.LOG_INFO, msg) + return -1 + if not macAddr: + msg = 'Could not determine MAC of this node. ' + msg += 'Unable to gergister node.\n' + syslog.syslog(syslog.LOG_INFO, msg) + return -1 + # Get the server IP from fstab, see configureNode() + fst = open('/etc/fstab','r').readlines() + servIP = None + for ln in fst: + if ln.find('/var/lib/one') != -1: + servIP = ln.split(':')[0].strip() + if not servIP: + msg = 'Could not determine head node IP from /etc/fstab. ' + msg += 'Unable to gergister node.\n' + syslog.syslog(syslog.LOG_INFO, msg) + return -1 + # Hostname + myName = open('/etc/HOSTNAME', 'r').read().split('.')[0].strip() + # Connect to server and register + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + try: + s.connect((servIP, 8445)) + except: + msg = 'Could not connect to head node at %s port 8445\n' %servIP + syslog.syslog(syslog.LOG_INFO, msg) + return -1 + regInfo = '%s;%s;%s' %(macAddr, ipAddr, myName) + s.send(regInfo) + s.close() - return 1 - + return 1 + #---------------------------------------------------------------------------- def removeConfNetworkSetting(iFace): - """Shutdown the configuration network and remove the configuration.""" - syslog.syslog(syslog.LOG_INFO, 'Shutdown configuration network\n') - os.system('/sbin/ifdown %s' %iFace) - msg = 'Remove configuration network interface config\n' - syslog.syslog(syslog.LOG_INFO, msg) - os.remove('/etc/sysconfig/network/ifcfg-%s' %iFace) + """Shutdown the configuration network and remove the configuration.""" + syslog.syslog(syslog.LOG_INFO, 'Shutdown configuration network\n') + os.system('/sbin/ifdown %s' %iFace) + msg = 'Remove configuration network interface config\n' + syslog.syslog(syslog.LOG_INFO, msg) + os.remove('/etc/sysconfig/network/ifcfg-%s' %iFace) #---------------------------------------------------------------------------- def setupCloudNetwork(iFace): - """Setup the configuration for the cloud network and fire it up.""" - msg = 'Setup cloud network configuration as br0\n' - syslog.syslog(syslog.LOG_INFO, msg) - cfgF = open('/etc/sysconfig/network/ifcfg-br0', 'w') - cfgF.write("BOOTPROTO='dhcp'\n") - cfgF.write("BRIDGE='yes'\n") - cfgF.write("BRIDGE_FORWARDDELAY='0'\n") - cfgF.write("BRIDGE_PORTS='%s'\n" %iFace) - cfgF.write("BRIDGE_STP='off'\n") - cfgF.write("BROADCAST=''\n") - cfgF.write("ETHTOOL_OPTIONS=''\n") - cfgF.write("MTU=''\n") - cfgF.write("NAME=''\n") - cfgF.write("NETWORK=''\n") - cfgF.write("REMOTE_IPADDR=''\n") - cfgF.write("STARTMODE='auto'\n") - cfgF.write("USERCONTROL='no'") - cfgF.close() - + """Setup the configuration for the cloud network and fire it up.""" + msg = 'Setup cloud network configuration as br0\n' + syslog.syslog(syslog.LOG_INFO, msg) + cfgF = open('/etc/sysconfig/network/ifcfg-br0', 'w') + cfgF.write("BOOTPROTO='dhcp'\n") + cfgF.write("BRIDGE='yes'\n") + cfgF.write("BRIDGE_FORWARDDELAY='0'\n") + cfgF.write("BRIDGE_PORTS='%s'\n" %iFace) + cfgF.write("BRIDGE_STP='off'\n") + cfgF.write("BROADCAST=''\n") + cfgF.write("ETHTOOL_OPTIONS=''\n") + cfgF.write("MTU=''\n") + cfgF.write("NAME=''\n") + cfgF.write("NETWORK=''\n") + cfgF.write("REMOTE_IPADDR=''\n") + cfgF.write("STARTMODE='auto'\n") + cfgF.write("USERCONTROL='no'") + cfgF.close() + #---------------------------------------------------------------------------- def setupConfNetwork(iFace): - """Setup the interface provided as the configuration network with a - static IP.""" - syslog.syslog(syslog.LOG_INFO, 'Setup configuration network 169.254.1.2\n') - cfgF = open('/etc/sysconfig/network/ifcfg-%s' %iFace, 'w') - cfgF.write("BOOTPROTO='static'\n") - cfgF.write("BROADCAST=''\n") - cfgF.write("ETHTOOL_OPTIONS=''\n") - cfgF.write("IPADDR='169.254.1.2/24'\n") - cfgF.write("MTU=''\n") - cfgF.write("NAME='Cloud configuration network'\n") - cfgF.write("NETWORK=''\n") - cfgF.write("REMOTE_IPADDR=''\n") - cfgF.write("STARTMODE='auto'\n") - cfgF.write("USERCONTROL='no'") - cfgF.close() + """Setup the interface provided as the configuration network with a + static IP.""" + syslog.syslog(syslog.LOG_INFO, 'Setup configuration network 169.254.1.2\n') + cfgF = open('/etc/sysconfig/network/ifcfg-%s' %iFace, 'w') + cfgF.write("BOOTPROTO='static'\n") + cfgF.write("BROADCAST=''\n") + cfgF.write("ETHTOOL_OPTIONS=''\n") + cfgF.write("IPADDR='169.254.1.2/24'\n") + cfgF.write("MTU=''\n") + cfgF.write("NAME='Cloud configuration network'\n") + cfgF.write("NETWORK=''\n") + cfgF.write("REMOTE_IPADDR=''\n") + cfgF.write("STARTMODE='auto'\n") + cfgF.write("USERCONTROL='no'") + cfgF.close() #---------------------------------------------------------------------------- def startCloudNetwork(): - """Start the cloud network.""" - syslog.syslog(syslog.LOG_INFO, 'Starting cloud network\n') - os.system('/sbin/ifup br0') - cnt = 0 - # Cannot depend on the ifup exit status as we need to play a trick to - # disable IPv6 which always leads to a non zero exit status - # Therefore we probe whether or not we get an IP address assigned - while cnt < 10: - time.sleep(15) # give dhcp a chance to get an address - processBlock = None - ifaceInfo = os.popen('/sbin/ifconfig').readlines() - for ln in ifaceInfo: - if ln.find('br0') != -1: - processBlock = 1 - continue - if processBlock and ln.find('inet addr') != -1: - addr = ln.split(':')[1].split()[0].strip() - if addr.find('.') != -1: - cnt = 99 - break - cnt += 1 - if cnt != 100: - return -1 + """Start the cloud network.""" + syslog.syslog(syslog.LOG_INFO, 'Starting cloud network\n') + os.system('/sbin/ifup br0') + cnt = 0 + # Cannot depend on the ifup exit status as we need to play a trick to + # disable IPv6 which always leads to a non zero exit status + # Therefore we probe whether or not we get an IP address assigned + while cnt < 10: + time.sleep(15) # give dhcp a chance to get an address + processBlock = None + ifaceInfo = os.popen('/sbin/ifconfig').readlines() + for ln in ifaceInfo: + if ln.find('br0') != -1: + processBlock = 1 + continue + if processBlock and ln.find('inet addr') != -1: + addr = ln.split(':')[1].split()[0].strip() + if addr.find('.') != -1: + cnt = 99 + break + cnt += 1 + if cnt != 100: + return -1 - return 1 + return 1 #---------------------------------------------------------------------------- def startNetwork(iFace, type): - """Start the specified network interface.""" - msg = 'Start %s network interface on %s\n' %(type, iFace) - syslog.syslog(syslog.LOG_INFO, msg) - res = os.system('/sbin/ifup %s' %iFace) - if res: - return -1 + """Start the specified network interface.""" + msg = 'Start %s network interface on %s\n' %(type, iFace) + syslog.syslog(syslog.LOG_INFO, msg) + res = os.system('/sbin/ifup %s' %iFace) + if res: + return -1 - return 1 + return 1 #---------------------------------------------------------------------------- if __name__ == "__main__": - syslog.openlog('[CLOUD_NODE_SETUP]', syslog.LOG_PID, syslog.LOG_DAEMON) - syslog.syslog(syslog.LOG_INFO, 'Start node registration and setup\n') - iFace = getFirstConnectedInterface() - if iFace == -1: - msg = 'Could not determine connected network interface aborting' - msg += ' node configuration\n' + syslog.openlog('[CLOUD_NODE_SETUP]', syslog.LOG_PID, syslog.LOG_DAEMON) + syslog.syslog(syslog.LOG_INFO, 'Start node registration and setup\n') + iFace = getFirstConnectedInterface() + if iFace == -1: + msg = 'Could not determine connected network interface aborting' + msg += ' node configuration\n' + syslog.syslog(syslog.LOG_INFO, msg) + syslog.closelog() + sys.exit(1) + setupConfNetwork(iFace) + res = startNetwork(iFace, 'configuration') + if res == -1: + msg = 'Could not start the network interface to configure the ' + msg += 'cloud node, manual configuration required.\n' + syslog.syslog(syslog.LOG_INFO, msg) + syslog.closelog() + sys.exit(1) + confDict = getConfigFromServer() + if confDict == -1: + msg = 'Could not connect to configuration server at 169.254.1.1 ' + msg += 'cloud node, manual configuration required.\n' + msg += 'This IP: 169.254.1.2\n' + syslog.syslog(syslog.LOG_INFO, msg) + syslog.closelog() + sys.exit(1) + removeConfNetworkSetting(iFace) + setupCloudNetwork(iFace) + res = configureNode(confDict) + if res == -1: + msg = 'Configuration failure. Manual configuration required.\n' + syslog.syslog(syslog.LOG_INFO, msg) + syslog.closelog() + sys.exit(1) + # Setup cloud network + res = startCloudNetwork() + if res == -1: + msg = 'Cloud network setup and start up failed. Manual configuration ' + msg += 'required\n' + syslog.syslog(syslog.LOG_INFO, msg) + syslog.closelog() + sys.exit(1) + # Register the node with the head node + res = registerNode() + if res == -1: + msg = 'Could not register the node. Manual registration on head node ' + msg += 'required. (dhcp and one)\n' + syslog.syslog(syslog.LOG_INFO, msg) + syslog.closelog() + sys.exit(1) + # Mount the oneadmin home directory + msg = 'Mount oneadmin home directory.\n' syslog.syslog(syslog.LOG_INFO, msg) - syslog.closelog() - sys.exit(1) - setupConfNetwork(iFace) - res = startNetwork(iFace, 'configuration') - if res == -1: - msg = 'Could not start the network interface to configure the ' - msg += 'cloud node, manual configuration required.\n' - syslog.syslog(syslog.LOG_INFO, msg) - syslog.closelog() - sys.exit(1) - confDict = getConfigFromServer() - if confDict == -1: - msg = 'Could not connect to configuration server at 169.254.1.1 ' - msg += 'cloud node, manual configuration required.\n' - msg += 'This IP: 169.254.1.2\n' - syslog.syslog(syslog.LOG_INFO, msg) - syslog.closelog() - sys.exit(1) - removeConfNetworkSetting(iFace) - setupCloudNetwork(iFace) - res = configureNode(confDict) - if res == -1: - msg = 'Configuration failure. Manual configuration required.\n' - syslog.syslog(syslog.LOG_INFO, msg) - syslog.closelog() - sys.exit(1) - # Setup cloud network - res = startCloudNetwork() - if res == -1: - msg = 'Cloud network setup and start up failed. Manual configuration ' - msg += 'required\n' - syslog.syslog(syslog.LOG_INFO, msg) - syslog.closelog() - sys.exit(1) - # Register the node with the head node - res = registerNode() - if res == -1: - msg = 'Could not register the node. Manual registration on head node ' - msg += 'required. (dhcp and one)\n' - syslog.syslog(syslog.LOG_INFO, msg) - syslog.closelog() - sys.exit(1) - # Mount the oneadmin home directory - msg = 'Mount oneadmin home directory.\n' - syslog.syslog(syslog.LOG_INFO, msg) - res = os.system('mount /var/lib/one') - if res != 0: - msg = 'Mount of oneadmin home directory failed. Manual mount ' - msg += 'required.\n' + res = os.system('mount /var/lib/one') + if res != 0: + msg = 'Mount of oneadmin home directory failed. Manual mount ' + msg += 'required.\n' + syslog.syslog(syslog.LOG_INFO, msg) + syslog.closelog() + sys.exit(1) + # tmp dir for oned + if not os.path.exists('/var/tmp/one'): + if not os.path.exists('/var/tmp'): + os.mkdir('/var/tmp') + os.mkdir('/var/tmp/one') + os.system('chown oneadmin:cloud /var/tmp/one') + + msg = 'Cloud node configuration completed with success.\n' syslog.syslog(syslog.LOG_INFO, msg) syslog.closelog() - sys.exit(1) - # tmp dir for oned - if not os.path.exists('/var/tmp/one'): - if not os.path.exists('/var/tmp'): - os.mkdir('/var/tmp') - os.mkdir('/var/tmp/one') - os.system('chown oneadmin:cloud /var/tmp/one') - - msg = 'Cloud node configuration completed with success.\n' - syslog.syslog(syslog.LOG_INFO, msg) - syslog.closelog() diff --git a/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_guest/config.xml b/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_guest/config.xml index f72b15b68..846bfea06 100644 --- a/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_guest/config.xml +++ b/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_guest/config.xml @@ -1,44 +1,44 @@ - - Robert Schweikert - rjschwei@suse.com - openSUSE 12.3 virtual disk system - - - - 1.0.0 - zypper - false - true - en_US - us.map.gz - openSUSE - openSUSE - - - - - - - - - - - - - - - - - - - - - - - - - + + Robert Schweikert + rjschwei@suse.com + openSUSE 12.3 virtual disk system + + + + 1.0.0 + zypper + false + true + en_US + us.map.gz + openSUSE + openSUSE + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_guest/root/etc/init.d/boot b/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_guest/root/etc/init.d/boot index ae3d29845..98768a296 100755 --- a/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_guest/root/etc/init.d/boot +++ b/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_guest/root/etc/init.d/boot @@ -26,7 +26,7 @@ set +e # test -z "$CONSOLE" && CONSOLE=/dev/console set -- $(stty size < $CONSOLE) - LINES=$1 + LINES=$1 COLUMNS=$2 export LINES COLUMNS CONSOLE @@ -41,10 +41,10 @@ exec 0<> $CONSOLE 1>&0 2>&0 REDIRECT="`showconsole 2>/dev/null`" export REDIRECT if test $COLUMNS -eq 0 ; then - # Serial: columns and lines are not defined - LINES=24 - COLUMNS=80 - test "$TERM" = "linux" -o -z "$TERM" && TERM=vt102 + # Serial: columns and lines are not defined + LINES=24 + COLUMNS=80 + test "$TERM" = "linux" -o -z "$TERM" && TERM=vt102 fi # @@ -70,27 +70,27 @@ mount -n -t sysfs sysfs /sys rc_status -v -r if test -d /sys/kernel/debug ; then - while read dev type ; do - if test "$type" = "debugfs" ; then - echo -n "Mounting debugfs at /sys/kernel/debug" - mount -n -t debugfs debugfs /sys/kernel/debug - rc_status -v -r - fi - done < /proc/filesystems + while read dev type ; do + if test "$type" = "debugfs" ; then + echo -n "Mounting debugfs at /sys/kernel/debug" + mount -n -t debugfs debugfs /sys/kernel/debug + rc_status -v -r + fi + done < /proc/filesystems fi # # mount tmpfs on /dev if not already done by initramfs # while read dev dir type options; do - if test "$dir" = "/dev" -a "$type" = "tmpfs"; then - DEV_MOUNTED=1; - break; - fi + if test "$dir" = "/dev" -a "$type" = "tmpfs"; then + DEV_MOUNTED=1; + break; + fi done < /proc/mounts if test -z "$DEV_MOUNTED"; then - echo -n "Mounting tmpfs at /dev" - mount -n -t tmpfs -o mode=0755 udev /dev - rc_status -v -r + echo -n "Mounting tmpfs at /dev" + mount -n -t tmpfs -o mode=0755 udev /dev + rc_status -v -r fi # @@ -111,9 +111,9 @@ rc_status -v -r # otty=$(stty -g) if test "$FLOW_CONTROL" = "yes" ; then - stty -nl ixon ignbrk -brkint + stty -nl ixon ignbrk -brkint else - stty -nl -ixon ignbrk -brkint + stty -nl -ixon ignbrk -brkint fi # @@ -122,21 +122,21 @@ fi DO_CONFIRM="" read -t 2 check < /proc/cmdline 2> /dev/null case "$check" in - *confirm*) DO_CONFIRM=yes ;; + *confirm*) DO_CONFIRM=yes ;; esac test -z "$CONFIRM_PROMPT_TIMEOUT" && CONFIRM_PROMPT_TIMEOUT=5 if test "$PROMPT_FOR_CONFIRM" = "yes" -a "$DO_CONFIRM" != "yes" ; then - echo -en "${extd}Enter Interactive startup mode?${norm}" - rc_timer_on "$CONFIRM_PROMPT_TIMEOUT" 37 - read -t "$CONFIRM_PROMPT_TIMEOUT" -n 1 \ - -p " ${extd}y${norm}/[${extd}n${norm}]("${CONFIRM_PROMPT_TIMEOUT}s") " answer - rc_timer_off - case "$answer" in - [yYiI]) DO_CONFIRM=yes ;; - *) DO_CONFIRM= ;; - esac - unset answer - echo + echo -en "${extd}Enter Interactive startup mode?${norm}" + rc_timer_on "$CONFIRM_PROMPT_TIMEOUT" 37 + read -t "$CONFIRM_PROMPT_TIMEOUT" -n 1 \ + -p " ${extd}y${norm}/[${extd}n${norm}]("${CONFIRM_PROMPT_TIMEOUT}s") " answer + rc_timer_off + case "$answer" in + [yYiI]) DO_CONFIRM=yes ;; + *) DO_CONFIRM= ;; + esac + unset answer + echo fi export DO_CONFIRM @@ -146,11 +146,11 @@ export DO_CONFIRM # test -x /sbin/blogd -a -n "$REDIRECT" && /sbin/blogd $REDIRECT if test -z "$REDIRECT" ; then - if (echo -n > /dev/tty) 2>/dev/null ; then - REDIRECT=/dev/tty - else - REDIRECT=/dev/console - fi + if (echo -n > /dev/tty) 2>/dev/null ; then + REDIRECT=/dev/tty + else + REDIRECT=/dev/console + fi fi # @@ -182,60 +182,60 @@ startpar -v &> /dev/null || RUN_PARALLEL="no" # if test "$RUN_PARALLEL" = "yes" ; then - # - # Start scripts in parallel with make behaviour of startpar - # + # + # Start scripts in parallel with make behaviour of startpar + # - startopt="-p4 -t 30 -T 3 $(splashmake)" - eval $(startpar $startopt -M boot) - failed="${failed:+$failed }$failed_service" - skipped="${skipped:+$skipped }$skipped_service" + startopt="-p4 -t 30 -T 3 $(splashmake)" + eval $(startpar $startopt -M boot) + failed="${failed:+$failed }$failed_service" + skipped="${skipped:+$skipped }$skipped_service" - unset failed_service skipped_service startopt + unset failed_service skipped_service startopt elif test -d ${bootrc}/ ; then - # - # Start scripts in given link order - # - for i in ${bootrc}/S${rex}*; do - - test -f $i || continue - - B=${i##*/} - script=${B#*S$rex} - B=${B%$script} - - if test "$DO_CONFIRM" = "yes" ; then - rc_confirm -t $CONFIRM_PROMPT_TIMEOUT "Start bootup script ${script}" < $REDIRECT > $REDIRECT 2>&1 - case "$?" in - 0) true ;; - 1) continue ;; - 2) DO_CONFIRM="" - esac - fi - - blogger "$script start" - - if test -x "$i" ; then - $i start - else - echo Running $i - /bin/sh $i b - rc_status -v1 -r - fi - status=$? - echo -en "$rc_reset" - splashprogress "$script start" - - case $status in - [1-47]) failed="${failed:+$failed }$script" ;; - [56]) skipped="${skipped:+$skipped }$script" ;; - 0|*) ;; - esac - - blogger "'$script start' exits with status $status" - done + # + # Start scripts in given link order + # + for i in ${bootrc}/S${rex}*; do + + test -f $i || continue + + B=${i##*/} + script=${B#*S$rex} + B=${B%$script} + + if test "$DO_CONFIRM" = "yes" ; then + rc_confirm -t $CONFIRM_PROMPT_TIMEOUT "Start bootup script ${script}" < $REDIRECT > $REDIRECT 2>&1 + case "$?" in + 0) true ;; + 1) continue ;; + 2) DO_CONFIRM="" + esac + fi + + blogger "$script start" + + if test -x "$i" ; then + $i start + else + echo Running $i + /bin/sh $i b + rc_status -v1 -r + fi + status=$? + echo -en "$rc_reset" + splashprogress "$script start" + + case $status in + [1-47]) failed="${failed:+$failed }$script" ;; + [56]) skipped="${skipped:+$skipped }$script" ;; + 0|*) ;; + esac + + blogger "'$script start' exits with status $status" + done fi splashtrigger "rlreached B" @@ -246,27 +246,27 @@ splashtrigger "rlreached B" echo -n "System Boot Control: " echo -e "The system has been ${stat}${extd}set up${norm}" if test -n "$failed" ; then - n=$((${#failed} + 7)) - echo -n "Failed features: " - test $n -lt 47 && echo -en "\033[${COLUMNS}C\033[${n}D" - echo -e "${warn}${failed}${norm}" + n=$((${#failed} + 7)) + echo -n "Failed features: " + test $n -lt 47 && echo -en "\033[${COLUMNS}C\033[${n}D" + echo -e "${warn}${failed}${norm}" fi if test -n "$skipped" ; then - n=$((${#skipped} + 7)) - echo -n "Skipped features: " - test $n -lt 47 && echo -en "\033[${COLUMNS}C\033[${n}D" - echo -e "${attn}${skipped}${norm}" + n=$((${#skipped} + 7)) + echo -n "Skipped features: " + test $n -lt 47 && echo -en "\033[${COLUMNS}C\033[${n}D" + echo -e "${attn}${skipped}${norm}" fi # # Start user defined bootup script. # if test -f /etc/init.d/boot.local ; then - echo -n "System Boot Control: " - echo "Running /etc/init.d/boot.local" - /bin/sh /etc/init.d/boot.local - rc_status -v1 -r - splashtrigger "boot.local" + echo -n "System Boot Control: " + echo "Running /etc/init.d/boot.local" + /bin/sh /etc/init.d/boot.local + rc_status -v1 -r + splashtrigger "boot.local" fi # @@ -283,7 +283,7 @@ test -s /lib/bootcycle/stats && . /lib/bootcycle/stats # Remember for master resource script # if test "$DO_CONFIRM" = "yes" ; then - touch /var/run/do_confirm + touch /var/run/do_confirm fi # @@ -295,34 +295,34 @@ stty $otty # Let YaST2 finish its installation, if you installed with YaST2 # if test -f /var/lib/YaST2/runme_at_boot ; then - HOSTTYPE=$(uname -m) - splashtrigger "YaST" - exec 0<> $REDIRECT 1>&0 2>&0 - # if yast2 failed, this ensures proper system setup - #ulimit -c unlimited - touch /var/lib/YaST2/run_suseconfig - if test -x /usr/lib/YaST2/startup/YaST2.Second-Stage; then - /usr/lib/YaST2/startup/YaST2.Second-Stage - else - # oops, yast2 not installed - rm -f /var/lib/YaST2/runme_at_boot - fi + HOSTTYPE=$(uname -m) + splashtrigger "YaST" + exec 0<> $REDIRECT 1>&0 2>&0 + # if yast2 failed, this ensures proper system setup + #ulimit -c unlimited + touch /var/lib/YaST2/run_suseconfig + if test -x /usr/lib/YaST2/startup/YaST2.Second-Stage; then + /usr/lib/YaST2/startup/YaST2.Second-Stage + else + # oops, yast2 not installed + rm -f /var/lib/YaST2/runme_at_boot + fi fi if test -f /var/lib/YaST2/reconfig_system ; then - HOSTTYPE=$(uname -m) - splashtrigger "YaST" - exec 0<> $REDIRECT 1>&0 2>&0 - if test -x /usr/lib/YaST2/startup/YaST2.Firstboot; then - /usr/lib/YaST2/startup/YaST2.Firstboot - else - # oops, yast2-firstboot not installed - rm -f /var/lib/YaST2/reconfig_system - fi + HOSTTYPE=$(uname -m) + splashtrigger "YaST" + exec 0<> $REDIRECT 1>&0 2>&0 + if test -x /usr/lib/YaST2/startup/YaST2.Firstboot; then + /usr/lib/YaST2/startup/YaST2.Firstboot + else + # oops, yast2-firstboot not installed + rm -f /var/lib/YaST2/reconfig_system + fi fi # run SuSEconfig (with args) if needed if test -f /var/lib/YaST2/run_suseconfig ; then - /sbin/SuSEconfig `cat /var/lib/YaST2/run_suseconfig` - rm -f /var/lib/YaST2/run_suseconfig + /sbin/SuSEconfig `cat /var/lib/YaST2/run_suseconfig` + rm -f /var/lib/YaST2/run_suseconfig fi rc_reset diff --git a/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/config.xml b/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/config.xml index acd42acad..8ad6482b0 100644 --- a/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/config.xml +++ b/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/config.xml @@ -1,83 +1,83 @@ - - Robert Schweikert - rjschwei@suse.com - OpenNebula Head Node configuration - - - - - OpenNebula Head Node - true - true - 2048 - true - - - 1.5.0 - zypper - false - true - en_US - us.map.gz - openSUSE - openSUSE - - - - - - - - - - - - - - - - - - - - - - - - - - - + + Robert Schweikert + rjschwei@suse.com + OpenNebula Head Node configuration + + + + + OpenNebula Head Node + true + true + 2048 + true + + + 1.5.0 + zypper + false + true + en_US + us.map.gz + openSUSE + openSUSE + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/root/etc/YaST2/firstboot.xml b/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/root/etc/YaST2/firstboot.xml index b63dba6a0..32d75e190 100644 --- a/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/root/etc/YaST2/firstboot.xml +++ b/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/root/etc/YaST2/firstboot.xml @@ -1,58 +1,58 @@ + xmlns:config="http://www.suse.com/1.0/configns"> - firstboot + firstboot - - - - yes - yes - all - - firstboot - - installation - + + + + yes + yes + all + + firstboot + + installation + - - - firstboot_welcome - - - - true - firstboot_licenses - - - - true - firstboot_keyboard - - - - true - firstboot_timezone - - - - true - inst_root - - - - true - opennebula - - - - firstboot_write - no - no - - - - + + + firstboot_welcome + + + + true + firstboot_licenses + + + + true + firstboot_keyboard + + + + true + firstboot_timezone + + + + true + inst_root + + + + true + opennebula + + + + firstboot_write + no + no + + + + diff --git a/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/root/home/ctester/testVM.README b/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/root/home/ctester/testVM.README index d36decebc..fb16e3ee2 100644 --- a/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/root/home/ctester/testVM.README +++ b/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/root/home/ctester/testVM.README @@ -1,17 +1,17 @@ The startTestVM script is expected to be executed only once. It's sole purpose is to facilitate easy and quick verification that the images built using the OBS OpenNebula packages work as intended. The working condition is defined as: - - generated guest image can be registered - - registered image can be started - - it is possible to log into the running image (manual action) + - generated guest image can be registered + - registered image can be started + - it is possible to log into the running image (manual action) The script should only be run on initial setup of the cloud after the head node and at least one cloud node have been set up. Prior to executing the startTestVM script: - verify there is a registered host - # sudo -u oneadmin env ONE_AUTH=/var/lib/one/.one/one_auth onehost list + # sudo -u oneadmin env ONE_AUTH=/var/lib/one/.one/one_auth onehost list - make sure you have an image that matches the output of - # grep PATH testVM.one + # grep PATH testVM.one Then run the script as the oneadmin user diff --git a/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/root/home/ctester/testVM.vmd b/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/root/home/ctester/testVM.vmd index b8b3d0cb6..8be0f8405 100644 --- a/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/root/home/ctester/testVM.vmd +++ b/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/root/home/ctester/testVM.vmd @@ -3,15 +3,15 @@ MEMORY = 512 CPU = 1 OS = [ ARCH = x86_64, - BOOT = hd, - ROOT = sda1 ] + BOOT = hd, + ROOT = sda1 ] DISK = [ IMAGE_ID = 0, - DRIVER = qcow2 ] + DRIVER = qcow2 ] NIC = [ MAC = "00:16:3e:7e:18:26", - BRIDGE = br0 ] + BRIDGE = br0 ] GRAPHICS = [ TYPE = "vnc", - LISTEN = "0.0.0.0", - PORT = "5905" ] + LISTEN = "0.0.0.0", + PORT = "5905" ] diff --git a/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/root/usr/sbin/suseNebulaConfSrv b/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/root/usr/sbin/suseNebulaConfSrv index 53d66a14d..16f347085 100755 --- a/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/root/usr/sbin/suseNebulaConfSrv +++ b/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/root/usr/sbin/suseNebulaConfSrv @@ -22,166 +22,166 @@ macPat = re.compile(macPattern) #--------------------------------------------------------------------------- class CloudConfigService(SocketServer.StreamRequestHandler): - """Cloud head node information provider.""" - def __init__(self, request, client_address, server): - self.srvInfo = {} - # Collect the information we want to make propagate to the cloud node - # Keyboard layout - os.system('/sbin/yast2 keyboard summary >& /tmp/.kdb.info') - info = open('/tmp/.kdb.info', 'r').read() - os.remove('/tmp/.kdb.info') - self.srvInfo['keyLayout'] = info.split(':')[-1].strip() - # Timezone and HW clock setting (assume HW clock on nodes is set the - # same by default - os.system('/sbin/yast2 timezone summary >& /tmp/.tz.info') - info = open('/tmp/.tz.info', 'r').readlines() - os.remove('/tmp/.tz.info') - timezone = None - hwClockSet = None - for ln in info: - if ln.find('Current Time Zone') != -1: - timezone = ln.split(':')[-1].strip() - if ln.find('Hardware Clock') != -1: - hwClockSet = ln.split(':')[-1].strip() - self.srvInfo['timezone'] = timezone - self.srvInfo['hwclock'] = hwClockSet - # Root passwd - lines = open('/etc/shadow', 'r').readlines() - passWd = None - for ln in lines: - if ln[0:4] == 'root': - passWd = ln.split(':')[1] - self.srvInfo['rootpass'] = passWd - # IP address - lines = open('/etc/sysconfig/network/ifcfg-br0', 'r').readlines() - ipAddr = None - for ln in lines: - if ln[0:7] == 'IPADDR=': - # [1:] at end removes leading quote - ipAddr = ln.split('=')[-1].split('/')[0].strip()[1:] - self.srvInfo['serverIP'] = ipAddr - # DHCP feature identifier - lines = open('/etc/dhcpd.conf','r').readlines() - dhcpFeature = None - domainname = None - for ln in lines: - if ln.find('domain-name') != -1: - # [1:-2] remove leading and trailing quotes and ; - domainname = ln.split()[-1].strip()[1:-2] - # 239 is the assigned ID for the feature, hard coded in the YaST - # configuration module - if ln.find('code 239') != -1: - dhcpFeature = ln.split()[1].strip() - self.srvInfo['dhcpFeature'] = dhcpFeature - self.srvInfo['domainname'] = domainname - # Name resolution - self.srvInfo['resolve'] = open('/etc/resolv.conf', 'r').read() - # The configured routes - routes = open('/etc/sysconfig/network/routes', 'r').read() - self.srvInfo['routes'] = routes - # The one use ID - lines = open('/etc/passwd', 'r').readlines() - for ln in lines: - if ln.find('oneadmin') != -1: - self.srvInfo['userID'] = ('oneadmin', ln.split(':')[2], - ln.split(':')[1]) - break - # The cloud group ID - lines = open('/etc/group', 'r').readlines() - for ln in lines: - if ln.find('cloud') != -1: - self.srvInfo['groupID'] = ('cloud', ln.split(':')[2]) - break - SocketServer.StreamRequestHandler.__init__(self, request, - client_address, server) - - #---------------------------------------------------------------------- - def generateHostName(self): - """Generate a new host name""" - # Create a host name for the host requesting the information - while (os.path.exists('/var/lock/nebula-hostname.lock')): - # We have to wait another cloud node is being configured - pass - os.system('touch /var/lock/nebula-hostname.lock') - cntr = None - if not os.path.exists('/var/lib/one/.nodecnt'): - cntr = 1 - cntFl = open('/var/lib/one/.nodecnt', 'w') - cntFl.write('%d' %cntr) - cntFl.close() - if not cntr: - cntr = open('/var/lib/one/.nodecnt', 'r').read() - cntr = eval(cntr) - cntr += 1 - cntFl = open('/var/lib/one/.nodecnt', 'w') - cntFl.write('%d' %cntr) - cntFl.close() - hostname = self.srvInfo['dhcpFeature'] + '-%d' %cntr - os.remove('/var/lock/nebula-hostname.lock') - return hostname + """Cloud head node information provider.""" + def __init__(self, request, client_address, server): + self.srvInfo = {} + # Collect the information we want to make propagate to the cloud node + # Keyboard layout + os.system('/sbin/yast2 keyboard summary >& /tmp/.kdb.info') + info = open('/tmp/.kdb.info', 'r').read() + os.remove('/tmp/.kdb.info') + self.srvInfo['keyLayout'] = info.split(':')[-1].strip() + # Timezone and HW clock setting (assume HW clock on nodes is set the + # same by default + os.system('/sbin/yast2 timezone summary >& /tmp/.tz.info') + info = open('/tmp/.tz.info', 'r').readlines() + os.remove('/tmp/.tz.info') + timezone = None + hwClockSet = None + for ln in info: + if ln.find('Current Time Zone') != -1: + timezone = ln.split(':')[-1].strip() + if ln.find('Hardware Clock') != -1: + hwClockSet = ln.split(':')[-1].strip() + self.srvInfo['timezone'] = timezone + self.srvInfo['hwclock'] = hwClockSet + # Root passwd + lines = open('/etc/shadow', 'r').readlines() + passWd = None + for ln in lines: + if ln[0:4] == 'root': + passWd = ln.split(':')[1] + self.srvInfo['rootpass'] = passWd + # IP address + lines = open('/etc/sysconfig/network/ifcfg-br0', 'r').readlines() + ipAddr = None + for ln in lines: + if ln[0:7] == 'IPADDR=': + # [1:] at end removes leading quote + ipAddr = ln.split('=')[-1].split('/')[0].strip()[1:] + self.srvInfo['serverIP'] = ipAddr + # DHCP feature identifier + lines = open('/etc/dhcpd.conf','r').readlines() + dhcpFeature = None + domainname = None + for ln in lines: + if ln.find('domain-name') != -1: + # [1:-2] remove leading and trailing quotes and ; + domainname = ln.split()[-1].strip()[1:-2] + # 239 is the assigned ID for the feature, hard coded in the YaST + # configuration module + if ln.find('code 239') != -1: + dhcpFeature = ln.split()[1].strip() + self.srvInfo['dhcpFeature'] = dhcpFeature + self.srvInfo['domainname'] = domainname + # Name resolution + self.srvInfo['resolve'] = open('/etc/resolv.conf', 'r').read() + # The configured routes + routes = open('/etc/sysconfig/network/routes', 'r').read() + self.srvInfo['routes'] = routes + # The one use ID + lines = open('/etc/passwd', 'r').readlines() + for ln in lines: + if ln.find('oneadmin') != -1: + self.srvInfo['userID'] = ('oneadmin', ln.split(':')[2], + ln.split(':')[1]) + break + # The cloud group ID + lines = open('/etc/group', 'r').readlines() + for ln in lines: + if ln.find('cloud') != -1: + self.srvInfo['groupID'] = ('cloud', ln.split(':')[2]) + break + SocketServer.StreamRequestHandler.__init__(self, request, + client_address, server) + + #---------------------------------------------------------------------- + def generateHostName(self): + """Generate a new host name""" + # Create a host name for the host requesting the information + while (os.path.exists('/var/lock/nebula-hostname.lock')): + # We have to wait another cloud node is being configured + pass + os.system('touch /var/lock/nebula-hostname.lock') + cntr = None + if not os.path.exists('/var/lib/one/.nodecnt'): + cntr = 1 + cntFl = open('/var/lib/one/.nodecnt', 'w') + cntFl.write('%d' %cntr) + cntFl.close() + if not cntr: + cntr = open('/var/lib/one/.nodecnt', 'r').read() + cntr = eval(cntr) + cntr += 1 + cntFl = open('/var/lib/one/.nodecnt', 'w') + cntFl.write('%d' %cntr) + cntFl.close() + hostname = self.srvInfo['dhcpFeature'] + '-%d' %cntr + os.remove('/var/lock/nebula-hostname.lock') + return hostname - #---------------------------------------------------------------------- - def handle(self): - """Handle the information request""" - requestType = self.request.recv(512).strip() - if requestType == 'PROVIDE_CONFIG': - syslog.openlog('[CLOUD_INFO_SRV]',syslog.LOG_PID,syslog.LOG_DAEMON) - syslog.syslog(syslog.LOG_INFO, 'Provide cloud config info\n') - self.srvInfo['hostname'] = self.generateHostName() - for key in self.srvInfo.keys(): - # Send a key value pair for each entry - self.request.send('%s=%s;' %(key,self.srvInfo[key])) - self.request.send('COMPLETE=finished') - syslog.closelog() + #---------------------------------------------------------------------- + def handle(self): + """Handle the information request""" + requestType = self.request.recv(512).strip() + if requestType == 'PROVIDE_CONFIG': + syslog.openlog('[CLOUD_INFO_SRV]',syslog.LOG_PID,syslog.LOG_DAEMON) + syslog.syslog(syslog.LOG_INFO, 'Provide cloud config info\n') + self.srvInfo['hostname'] = self.generateHostName() + for key in self.srvInfo.keys(): + # Send a key value pair for each entry + self.request.send('%s=%s;' %(key,self.srvInfo[key])) + self.request.send('COMPLETE=finished') + syslog.closelog() #--------------------------------------------------------------------------- def sigHandler(signum, frame): - """Signal handler for termination""" - syslog.openlog('[CLOUD_INFO_SRV]',syslog.LOG_PID,syslog.LOG_DAEMON) - syslog.syslog(syslog.LOG_INFO, 'Terminating server on signal: %d' %signum) - syslog.closelog() - if os.path.exists('/var/lock/nebula-hostname.lock'): - os.remove('/var/lock/nebula-hostname.lock') - os.remove('/var/run/suseNebula/infoSrv.pid') - sys.exit(0) + """Signal handler for termination""" + syslog.openlog('[CLOUD_INFO_SRV]',syslog.LOG_PID,syslog.LOG_DAEMON) + syslog.syslog(syslog.LOG_INFO, 'Terminating server on signal: %d' %signum) + syslog.closelog() + if os.path.exists('/var/lock/nebula-hostname.lock'): + os.remove('/var/lock/nebula-hostname.lock') + os.remove('/var/run/suseNebula/infoSrv.pid') + sys.exit(0) #--------------------------------------------------------------------------- if __name__ == "__main__": - syslog.openlog('[CLOUD_INFO_SRV]', syslog.LOG_PID, syslog.LOG_DAEMON) - syslog.syslog(syslog.LOG_INFO, 'Cloud Info Server start\n') + syslog.openlog('[CLOUD_INFO_SRV]', syslog.LOG_PID, syslog.LOG_DAEMON) + syslog.syslog(syslog.LOG_INFO, 'Cloud Info Server start\n') - # Consistency check for pid file - if not os.path.exists('/var/run/suseNebula'): - os.system('mkdir -p /var/run/suseNebula') - if os.path.exists('/var/run/suseNebula/infoSrv.pid'): - msg = 'Found pid file, another server is running, not starting a ' - msg += 'new one.' - syslog.syslog(syslog.LOG_ERR, msg) - syslog.closelog() - sys.exit(1) - - server = SocketServer.TCPServer(('169.254.1.1', 8445), CloudConfigService) + # Consistency check for pid file + if not os.path.exists('/var/run/suseNebula'): + os.system('mkdir -p /var/run/suseNebula') + if os.path.exists('/var/run/suseNebula/infoSrv.pid'): + msg = 'Found pid file, another server is running, not starting a ' + msg += 'new one.' + syslog.syslog(syslog.LOG_ERR, msg) + syslog.closelog() + sys.exit(1) + + server = SocketServer.TCPServer(('169.254.1.1', 8445), CloudConfigService) - if not server: - syslog.syslog(syslog.LOG_ERR, 'Could not create server, exiting\n') - syslog.closelog() - sys.exit(1) + if not server: + syslog.syslog(syslog.LOG_ERR, 'Could not create server, exiting\n') + syslog.closelog() + sys.exit(1) - # Write pid to a file - pid = os.getpid() - if not os.path.exists('/var/run/suseNebula'): - os.mkdir('/var/run/suseNebula') - pidFl = open('/var/run/suseNebula/infoSrv.pid', 'w'); - pidFl.write('%d\n' %pid) - pidFl.close() + # Write pid to a file + pid = os.getpid() + if not os.path.exists('/var/run/suseNebula'): + os.mkdir('/var/run/suseNebula') + pidFl = open('/var/run/suseNebula/infoSrv.pid', 'w'); + pidFl.write('%d\n' %pid) + pidFl.close() - # Register signal handler - signal.signal(signal.SIGHUP, sigHandler) - signal.signal(signal.SIGTERM, sigHandler) - signal.signal(signal.SIGINT, sigHandler) + # Register signal handler + signal.signal(signal.SIGHUP, sigHandler) + signal.signal(signal.SIGTERM, sigHandler) + signal.signal(signal.SIGINT, sigHandler) - # No additional message will be printed, close the log - syslog.syslog(syslog.LOG_INFO, 'Cloud Info Server running\n') - syslog.closelog() - server.serve_forever() - + # No additional message will be printed, close the log + syslog.syslog(syslog.LOG_INFO, 'Cloud Info Server running\n') + syslog.closelog() + server.serve_forever() + diff --git a/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/root/usr/sbin/suseNebulaRegSrv b/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/root/usr/sbin/suseNebulaRegSrv index 6750aa28a..8c144b621 100755 --- a/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/root/usr/sbin/suseNebulaRegSrv +++ b/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/root/usr/sbin/suseNebulaRegSrv @@ -22,127 +22,127 @@ macPat = re.compile(macPattern) #------------------------------------------------------------------------------ class RegistrationHandler(SocketServer.BaseRequestHandler): - """Cloud head node registration request handler.""" - def handle(self): - syslog.openlog('[NOD_REG]',syslog.LOG_PID, syslog.LOG_DAEMON) - syslog.syslog(syslog.LOG_INFO, 'Cloud node registration\n') - # self.request is the TCP socket connected to the client - macAddr, ipAddr, name = self.request.recv(1024).strip().split(';') - # Verify proper MAC Address format - if not macPat.match(macAddr): - msg = 'Received improper data for MAC Address ' - msg += macAddr - msg += ' -> skip registration\n' - syslog.syslog(syslog.LOG_ERR, msg) - syslog.closelog() - return - # Verify the IP address format - if not ipPat.match(ipAddr): - msg = 'Received improper data for IP Adress ' - msg += ipAddr - msg += ' -> skip registration\n' - syslog.syslog(syslog.LOG_ERR, msg) - syslog.closelog() - return - syslog.syslog(syslog.LOG_INFO, 'MAC Address: %s\n' %macAddr) - syslog.syslog(syslog.LOG_INFO, 'IP Address: %s\n' %ipAddr) - syslog.syslog(syslog.LOG_INFO, 'Node name: %s\n' %name) - # Setup the dhcp server to make sure the node being registered - # always gets the same IP address - lines = open('/etc/dhcpd.conf', 'r').readlines() - processBlock = None - for ln in lines: - if ln.find(name) != -1: - processBlock = 1 - continue - if processBlock and ln.find('fixed-address') != -1: - setIP = ln.split()[-1].strip()[:-1] - if setIP != ipAddr: - msg = 'Host with name "%s" already registered with ' %name - msg += 'IP "%s". Cannot register node.\n' %ipAddr - syslog.syslog(syslog.LOG_INFO, msg) - syslog.closelog() - return - dhconf = open('/etc/dhcpd.conf', 'a') - dhconf.write('\n') - dhconf.write('host %s {\n' %name) - dhconf.write(' hardware ethernet %s;\n' %macAddr) - dhconf.write(' fixed-address %s;\n' %ipAddr) - dhconf.write('}\n') - dhconf.close() - # Restart the dhcp server as we just change the config - os.system('/bin/systemctl restart dhcpd.service >& /dev/null') - # Create hosts entry - hosts = open('/etc/hosts', 'a') - hosts.write('%s %s\n' %(ipAddr, name)) - hosts.close() - # Register node with Nebula infrastructure - cmd = '/usr/bin/sudo env ONE_AUTH=/var/lib/one/.one/one_auth ' - cmd += '/usr/bin/onehost create %s -i im_kvm -v vmm_kvm ' %ipAddr - cmd += '-n vnm_kvm' - res = os.system(cmd) - if res: - msg = 'Registration failed, onehost command with non zero status\n' - syslog.syslog(syslog.LOG_ERR, msg) - syslog.closelog() - return - syslog.syslog(syslog.LOG_ERR, 'Node registration succesful.\n') - syslog.closelog() + """Cloud head node registration request handler.""" + def handle(self): + syslog.openlog('[NOD_REG]',syslog.LOG_PID, syslog.LOG_DAEMON) + syslog.syslog(syslog.LOG_INFO, 'Cloud node registration\n') + # self.request is the TCP socket connected to the client + macAddr, ipAddr, name = self.request.recv(1024).strip().split(';') + # Verify proper MAC Address format + if not macPat.match(macAddr): + msg = 'Received improper data for MAC Address ' + msg += macAddr + msg += ' -> skip registration\n' + syslog.syslog(syslog.LOG_ERR, msg) + syslog.closelog() + return + # Verify the IP address format + if not ipPat.match(ipAddr): + msg = 'Received improper data for IP Adress ' + msg += ipAddr + msg += ' -> skip registration\n' + syslog.syslog(syslog.LOG_ERR, msg) + syslog.closelog() + return + syslog.syslog(syslog.LOG_INFO, 'MAC Address: %s\n' %macAddr) + syslog.syslog(syslog.LOG_INFO, 'IP Address: %s\n' %ipAddr) + syslog.syslog(syslog.LOG_INFO, 'Node name: %s\n' %name) + # Setup the dhcp server to make sure the node being registered + # always gets the same IP address + lines = open('/etc/dhcpd.conf', 'r').readlines() + processBlock = None + for ln in lines: + if ln.find(name) != -1: + processBlock = 1 + continue + if processBlock and ln.find('fixed-address') != -1: + setIP = ln.split()[-1].strip()[:-1] + if setIP != ipAddr: + msg = 'Host with name "%s" already registered with ' %name + msg += 'IP "%s". Cannot register node.\n' %ipAddr + syslog.syslog(syslog.LOG_INFO, msg) + syslog.closelog() + return + dhconf = open('/etc/dhcpd.conf', 'a') + dhconf.write('\n') + dhconf.write('host %s {\n' %name) + dhconf.write(' hardware ethernet %s;\n' %macAddr) + dhconf.write(' fixed-address %s;\n' %ipAddr) + dhconf.write('}\n') + dhconf.close() + # Restart the dhcp server as we just change the config + os.system('/bin/systemctl restart dhcpd.service >& /dev/null') + # Create hosts entry + hosts = open('/etc/hosts', 'a') + hosts.write('%s %s\n' %(ipAddr, name)) + hosts.close() + # Register node with Nebula infrastructure + cmd = '/usr/bin/sudo env ONE_AUTH=/var/lib/one/.one/one_auth ' + cmd += '/usr/bin/onehost create %s -i im_kvm -v vmm_kvm ' %ipAddr + cmd += '-n vnm_kvm' + res = os.system(cmd) + if res: + msg = 'Registration failed, onehost command with non zero status\n' + syslog.syslog(syslog.LOG_ERR, msg) + syslog.closelog() + return + syslog.syslog(syslog.LOG_ERR, 'Node registration succesful.\n') + syslog.closelog() #------------------------------------------------------------------------------ def sigHandler(signum, frame): - """Signal handler for termination""" - syslog.openlog('[NOD_REG]',syslog.LOG_PID,syslog.LOG_DAEMON) - syslog.syslog(syslog.LOG_INFO, 'Terminating server on signal: %d' %signum) - syslog.closelog() - os.remove('/var/run/suseNebula/regSrv.pid') - sys.exit(0) + """Signal handler for termination""" + syslog.openlog('[NOD_REG]',syslog.LOG_PID,syslog.LOG_DAEMON) + syslog.syslog(syslog.LOG_INFO, 'Terminating server on signal: %d' %signum) + syslog.closelog() + os.remove('/var/run/suseNebula/regSrv.pid') + sys.exit(0) #------------------------------------------------------------------------------ if __name__ == "__main__": - syslog.openlog('[NOD_REG]', syslog.LOG_PID, syslog.LOG_DAEMON) - syslog.syslog(syslog.LOG_INFO, 'Start node registration service\n') - # Determine the IP address of this host - inetInfo = os.popen('/sbin/ifconfig').readlines() - ipAddr = None - # Use the first IPv4 address found - for item in inetInfo: - if item.find('inet addr') != -1: - # Extract the IP address from line expected in following format - # inet addr:192.168.1.6 Bcast:192.168.1.255 Mask:255.255.255.0 - ipAddr = item.strip().split()[1].split(':')[-1] - if ipPat.match(ipAddr): - break + syslog.openlog('[NOD_REG]', syslog.LOG_PID, syslog.LOG_DAEMON) + syslog.syslog(syslog.LOG_INFO, 'Start node registration service\n') + # Determine the IP address of this host + inetInfo = os.popen('/sbin/ifconfig').readlines() + ipAddr = None + # Use the first IPv4 address found + for item in inetInfo: + if item.find('inet addr') != -1: + # Extract the IP address from line expected in following format + # inet addr:192.168.1.6 Bcast:192.168.1.255 Mask:255.255.255.0 + ipAddr = item.strip().split()[1].split(':')[-1] + if ipPat.match(ipAddr): + break - if not ipAddr: - # No IP address found. Print a message to syslog and exit - syslog.syslog(syslog.LOG_ERR, - 'Could not determine IP address, exiting\n') - syslog.closelog() - sys.exit(1) - - server = SocketServer.TCPServer((ipAddr, 8445), RegistrationHandler) + if not ipAddr: + # No IP address found. Print a message to syslog and exit + syslog.syslog(syslog.LOG_ERR, + 'Could not determine IP address, exiting\n') + syslog.closelog() + sys.exit(1) + + server = SocketServer.TCPServer((ipAddr, 8445), RegistrationHandler) - if not server: - syslog.syslog(syslog.LOG_ERR, 'Could not create server, exiting\n') - syslog.closelog() - sys.exit(1) + if not server: + syslog.syslog(syslog.LOG_ERR, 'Could not create server, exiting\n') + syslog.closelog() + sys.exit(1) - # Write pid to a file - pid = os.getpid() - if not os.path.exists('/var/run/suseNebula'): - os.mkdir('/var/run/suseNebula') - pidFl = open('/var/run/suseNebula/regSrv.pid', 'w'); - pidFl.write('%d\n' %pid) - pidFl.close() + # Write pid to a file + pid = os.getpid() + if not os.path.exists('/var/run/suseNebula'): + os.mkdir('/var/run/suseNebula') + pidFl = open('/var/run/suseNebula/regSrv.pid', 'w'); + pidFl.write('%d\n' %pid) + pidFl.close() - # Register signal handler - signal.signal(signal.SIGHUP, sigHandler) - signal.signal(signal.SIGTERM, sigHandler) - signal.signal(signal.SIGINT, sigHandler) + # Register signal handler + signal.signal(signal.SIGHUP, sigHandler) + signal.signal(signal.SIGTERM, sigHandler) + signal.signal(signal.SIGINT, sigHandler) - # No additional message will be printed, close the log - syslog.syslog(syslog.LOG_INFO, 'Cloud registration service running\n') - syslog.closelog() - server.serve_forever() - + # No additional message will be printed, close the log + syslog.syslog(syslog.LOG_INFO, 'Cloud registration service running\n') + syslog.closelog() + server.serve_forever() + diff --git a/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/root/usr/share/YaST2/clients/opennebula.ycp b/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/root/usr/share/YaST2/clients/opennebula.ycp index 742d1e459..3e06e25e1 100644 --- a/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/root/usr/share/YaST2/clients/opennebula.ycp +++ b/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/root/usr/share/YaST2/clients/opennebula.ycp @@ -9,178 +9,178 @@ */ { - textdomain "susenebula"; - - import "FileUtils"; - import "Hostname"; - import "IP"; - import "Label"; - import "Mode"; - import "Netmask"; - import "Popup"; - import "Report"; - import "Service"; - import "Wizard"; - - import "YaPI::NETWORK"; - - string hostname = "SUSENebula-Head"; - string domain = ""; - string ip = "192.168.1.2"; - string netmask = "255.255.255.0"; - string ip_min = ""; - string ip_max = ""; - string clustername = "SUSENebula"; - string route = ""; - string cadminp = "susenebula"; - list nameservers = []; - list searchdomains = []; - - // network export map - map network = $[]; - // dhcp server export map - map dhcp = $[]; - - // write entered settings to the system - boolean WriteSettings () { - - // 1. Write Network - map write_network = $[ - "hostname" : network["hostname"]:$[], - "dns" : network["dns"]:$[], - ]; - - write_network["hostname","domain"] = domain; - write_network["hostname","name"] = hostname; - - write_network["dns","nameservers"] = nameservers; - write_network["dns","searches"] = searchdomains; - - write_network["route"] = $[ - "default" : $[ - "via" : route - ] - ]; - - map interface = network["interfaces"]:$[]; - - // ip r|grep default|cut -d' ' -f5 - if (haskey (interface, "eth0")) - { - interface["eth0","bootproto"] = "static"; - interface["eth0","ipaddr"] = sformat ("%1/%2", ip, Netmask::ToBits (netmask)); - write_network["interface"] = interface; - } - y2internal ("network to write: %1", write_network); - map network_written = YaPI::NETWORK::Write (write_network); - - Service::Restart ("network"); - - // 2. Write DHCP server DhcpServer: settings/directives/range - // Min/Max IP -> set the IP address range for dhcp server. - - // Read DhcpServer after network is configured - /* - DhcpServer::Read (); - dhcp = DhcpServer::Export (); - y2internal ("dhcp: %1", dhcp); - */ - - string subnet_ip = IP::ComputeNetwork (ip, netmask); - - dhcp["allowed_interfaces"] = ["eth0"]; - dhcp["start_service"] = true; - dhcp["use_ldap"] = false; - dhcp["settings"] = [ - $[ - "children" : [], - "directives" : [ - $[ - "key" : "default-lease-time", - "type" : "directive", - "value" : "14400" - ], - $[ - "key" : "max-lease-time", - "type" : "directive", - "value" : "172800" - ], - $[ - "key" : "range", - "type" : "directive", - "value" : sformat ("%1 %2", ip_min, ip_max) - ] - ], - "id" : sformat ("%1 netmask %2", subnet_ip, netmask), - "options" : [], - "parent_id" : "", - "parent_type" : "", - "type" : "subnet" - ], - $[ - "children" : [ - $[ - "id" : sformat ("%1 netmask %2", subnet_ip, netmask), - "type" : "subnet" - ] - ], - "directives" : [ - $[ - "key" : "max-lease-time", - "type" : "directive", - "value" : "7200" - ], - $[ - "key" : "ddns-updates", - "type" : "directive", - "value" : "off" - ], - $[ - "key" : "ddns-update-style", - "type" : "directive", - "value" : "none" - ], - $[ - "key" : "log-facility", - "type" : "directive", - "value" : "local7" - ], - $[ - "key" : "default-lease-time", - "type" : "directive", - "value" : "600" - ], - ], - "options" : [ - $[ - "key" : "suse-nebula", - "type" : "option", - "value" : "code 239 = ip-address" - ], - $[ - "key" : "suse-nebula", - "type" : "option", - "value" : ip - ], - $[ - "key" : "domain-name", - "type" : "option", - "value" : sformat ("\"%1\"", domain), - ], - ], - "id" :"", - "parent_id" : "", - "parent_type" : "", - "type" : "" - ] - ]; - /* - y2internal ("importing dhcp settings: %1", dhcp); - DhcpServer::Import (dhcp); - DhcpServer::Write (); - */ - - string dhcpd_conf = sformat ( + textdomain "susenebula"; + + import "FileUtils"; + import "Hostname"; + import "IP"; + import "Label"; + import "Mode"; + import "Netmask"; + import "Popup"; + import "Report"; + import "Service"; + import "Wizard"; + + import "YaPI::NETWORK"; + + string hostname = "SUSENebula-Head"; + string domain = ""; + string ip = "192.168.1.2"; + string netmask = "255.255.255.0"; + string ip_min = ""; + string ip_max = ""; + string clustername = "SUSENebula"; + string route = ""; + string cadminp = "susenebula"; + list nameservers = []; + list searchdomains = []; + + // network export map + map network = $[]; + // dhcp server export map + map dhcp = $[]; + + // write entered settings to the system + boolean WriteSettings () { + + // 1. Write Network + map write_network = $[ + "hostname" : network["hostname"]:$[], + "dns" : network["dns"]:$[], + ]; + + write_network["hostname","domain"] = domain; + write_network["hostname","name"] = hostname; + + write_network["dns","nameservers"] = nameservers; + write_network["dns","searches"] = searchdomains; + + write_network["route"] = $[ + "default" : $[ + "via" : route + ] + ]; + + map interface = network["interfaces"]:$[]; + + // ip r|grep default|cut -d' ' -f5 + if (haskey (interface, "eth0")) + { + interface["eth0","bootproto"] = "static"; + interface["eth0","ipaddr"] = sformat ("%1/%2", ip, Netmask::ToBits (netmask)); + write_network["interface"] = interface; + } + y2internal ("network to write: %1", write_network); + map network_written = YaPI::NETWORK::Write (write_network); + + Service::Restart ("network"); + + // 2. Write DHCP server DhcpServer: settings/directives/range + // Min/Max IP -> set the IP address range for dhcp server. + + // Read DhcpServer after network is configured + /* + DhcpServer::Read (); + dhcp = DhcpServer::Export (); + y2internal ("dhcp: %1", dhcp); + */ + + string subnet_ip = IP::ComputeNetwork (ip, netmask); + + dhcp["allowed_interfaces"] = ["eth0"]; + dhcp["start_service"] = true; + dhcp["use_ldap"] = false; + dhcp["settings"] = [ + $[ + "children" : [], + "directives" : [ + $[ + "key" : "default-lease-time", + "type" : "directive", + "value" : "14400" + ], + $[ + "key" : "max-lease-time", + "type" : "directive", + "value" : "172800" + ], + $[ + "key" : "range", + "type" : "directive", + "value" : sformat ("%1 %2", ip_min, ip_max) + ] + ], + "id" : sformat ("%1 netmask %2", subnet_ip, netmask), + "options" : [], + "parent_id" : "", + "parent_type" : "", + "type" : "subnet" + ], + $[ + "children" : [ + $[ + "id" : sformat ("%1 netmask %2", subnet_ip, netmask), + "type" : "subnet" + ] + ], + "directives" : [ + $[ + "key" : "max-lease-time", + "type" : "directive", + "value" : "7200" + ], + $[ + "key" : "ddns-updates", + "type" : "directive", + "value" : "off" + ], + $[ + "key" : "ddns-update-style", + "type" : "directive", + "value" : "none" + ], + $[ + "key" : "log-facility", + "type" : "directive", + "value" : "local7" + ], + $[ + "key" : "default-lease-time", + "type" : "directive", + "value" : "600" + ], + ], + "options" : [ + $[ + "key" : "suse-nebula", + "type" : "option", + "value" : "code 239 = ip-address" + ], + $[ + "key" : "suse-nebula", + "type" : "option", + "value" : ip + ], + $[ + "key" : "domain-name", + "type" : "option", + "value" : sformat ("\"%1\"", domain), + ], + ], + "id" :"", + "parent_id" : "", + "parent_type" : "", + "type" : "" + ] + ]; + /* + y2internal ("importing dhcp settings: %1", dhcp); + DhcpServer::Import (dhcp); + DhcpServer::Write (); + */ + + string dhcpd_conf = sformat ( "option rfc3442-classless-static-routes code 121 = array of unsigned integer 8; option domain-name \"%1\"; max-lease-time 7200; @@ -191,175 +191,175 @@ option suse-nebula code 239 = ip-address; option suse-nebula %2; # Set the address range to be handed out. subnet %3 netmask %4 { - range %5 %6; - default-lease-time 86400000; - max-lease-time 1728000000000; + range %5 %6; + default-lease-time 86400000; + max-lease-time 1728000000000; }", domain, ip, subnet_ip, netmask, ip_min, ip_max); - SCR::Write (.target.string, "/etc/dhcpd.conf", dhcpd_conf); + SCR::Write (.target.string, "/etc/dhcpd.conf", dhcpd_conf); - SCR::Write (.sysconfig.dhcpd.DHCPD_INTERFACE, "eth0"); - SCR::Write (.sysconfig.dhcpd, nil); + SCR::Write (.sysconfig.dhcpd.DHCPD_INTERFACE, "eth0"); + SCR::Write (.sysconfig.dhcpd, nil); - Service::Enable ("dhcpd"); - Service::Start ("dhcpd"); + Service::Enable ("dhcpd"); + Service::Start ("dhcpd"); - // 3. Write onedamin authentication file - string oneauth = sformat ("oneadmin:%1", cadminp); - SCR::Write (.target.string, "/var/lib/one/.one/one_auth", oneauth); - - return true; - } - - // initialize network data - boolean ReadNetworkSettings () { - network = YaPI::NETWORK::Read (); - y2internal ("network: %1", network); - nameservers = network["dns","nameservers"]:[]; - searchdomains = network["dns","searches"]:[]; + // 3. Write onedamin authentication file + string oneauth = sformat ("oneadmin:%1", cadminp); + SCR::Write (.target.string, "/var/lib/one/.one/one_auth", oneauth); + return true; - } - - ReadNetworkSettings (); - - term contents = `HBox (`HSpacing (1), `VBox ( - `Frame (_("Network Configuration"), `VBox ( - // text entry label - `InputField (`id ("clustername"), `opt (`hstretch), _("C&luster Name"), clustername), - `HBox ( - // text entry label - `InputField (`id ("hostname"), `opt (`hstretch), _("&Hostname"), hostname), - // text entry label - `InputField (`id ("domain"), `opt (`hstretch), _("&Domain Name"), domain) - ), - `HBox ( - // text entry label - `InputField (`id ("ip"), `opt (`hstretch), _("&IP Address"), ip), - // text entry label - `InputField (`id ("netmask"), `opt (`hstretch), _("&Netmask"), netmask) - ), - // text entry label - `InputField (`id ("route"), `opt (`hstretch), _("Default Route"), route), - `HBox ( - // text entry label - `InputField (`id ("nameservers"), `opt (`hstretch), _("Name Servers"), mergestring (nameservers, " ")), - // text entry label - `InputField (`id ("searches"), `opt (`hstretch), _("Search Domains"), mergestring (searchdomains, " ")) - ) - )), - `VSpacing (2), - // frame label - `Frame (_("IP Address Range for Cloud Nodes"), `HBox ( - // text entry label - `InputField (`id ("ip_min"), `opt (`hstretch), _("Min IP Address"), ip_min), - // text entry label - `InputField (`id ("ip_max"), `opt (`hstretch), _("Max IP Address"), ip_max) - )), - `VSpacing (2), - // frame label - `Frame (_("Cloud Administrator"), `VBox ( - // text entry label - `InputField (`id ("cadminp"), `opt (`hstretch), _("Password for Cloud Administration"), cadminp), - `VSpacing (1), - `Label ("The password is stored in plain text in the file /var/lib/one/.one/one_auth and is used for cloud administration only. -This is not the password for the cloud administrator (oneadmin) user account. The oneadmin account has no password.") - )) - ), `HSpacing (1)); - - if (Mode::normal ()) - Wizard::OpenOKDialog (); - - string help_text = ""; - - // dialog caption - Wizard::SetContents (_("SUSENebula"), contents, help_text, true, true); - - UI::ChangeWidget (`id ("hostname"), `ValidChars, Hostname::ValidChars); - foreach (string key, ["ip", "ip_min", "ip_max"], { - UI::ChangeWidget (`id (key), `ValidChars, IP::ValidChars4); - }); - any ret = `back; - while (true) - { - ret = UI::UserInput (); - if (ret == `ok || ret == `next) - { - cadminp = (string) UI::QueryWidget (`id ("cadminp"), `Value); - clustername = (string) UI::QueryWidget (`id ("clustername"), `Value); - hostname = (string) UI::QueryWidget (`id ("hostname"), `Value); - domain = (string) UI::QueryWidget (`id ("domain"), `Value); - ip = (string) UI::QueryWidget (`id ("ip"), `Value); - ip_min = (string) UI::QueryWidget (`id ("ip_min"), `Value); - ip_max = (string) UI::QueryWidget (`id ("ip_max"), `Value); - netmask = (string) UI::QueryWidget (`id ("netmask"), `Value); - route = (string) UI::QueryWidget (`id ("route"), `Value); - string dns = (string) UI::QueryWidget (`id ("nameservers"), `Value); - nameservers = splitstring (dns, ", "); - string searches = (string) UI::QueryWidget (`id ("searches"), `Value); - searchdomains = splitstring (searches, ", "); - - if (!Hostname::Check (hostname)) - { - Report::Error (Hostname::ValidHost ()); - UI::SetFocus (`id ("hostname")); - continue; } - if (!Hostname::CheckDomain (domain)) - { - Report::Error (Hostname::ValidDomain ()); - UI::SetFocus (`id ("domain")); - continue; + + // initialize network data + boolean ReadNetworkSettings () { + network = YaPI::NETWORK::Read (); + y2internal ("network: %1", network); + nameservers = network["dns","nameservers"]:[]; + searchdomains = network["dns","searches"]:[]; + return true; } - if (!IP::Check (ip)) + + ReadNetworkSettings (); + + term contents = `HBox (`HSpacing (1), `VBox ( + `Frame (_("Network Configuration"), `VBox ( + // text entry label + `InputField (`id ("clustername"), `opt (`hstretch), _("C&luster Name"), clustername), + `HBox ( + // text entry label + `InputField (`id ("hostname"), `opt (`hstretch), _("&Hostname"), hostname), + // text entry label + `InputField (`id ("domain"), `opt (`hstretch), _("&Domain Name"), domain) + ), + `HBox ( + // text entry label + `InputField (`id ("ip"), `opt (`hstretch), _("&IP Address"), ip), + // text entry label + `InputField (`id ("netmask"), `opt (`hstretch), _("&Netmask"), netmask) + ), + // text entry label + `InputField (`id ("route"), `opt (`hstretch), _("Default Route"), route), + `HBox ( + // text entry label + `InputField (`id ("nameservers"), `opt (`hstretch), _("Name Servers"), mergestring (nameservers, " ")), + // text entry label + `InputField (`id ("searches"), `opt (`hstretch), _("Search Domains"), mergestring (searchdomains, " ")) + ) + )), + `VSpacing (2), + // frame label + `Frame (_("IP Address Range for Cloud Nodes"), `HBox ( + // text entry label + `InputField (`id ("ip_min"), `opt (`hstretch), _("Min IP Address"), ip_min), + // text entry label + `InputField (`id ("ip_max"), `opt (`hstretch), _("Max IP Address"), ip_max) + )), + `VSpacing (2), + // frame label + `Frame (_("Cloud Administrator"), `VBox ( + // text entry label + `InputField (`id ("cadminp"), `opt (`hstretch), _("Password for Cloud Administration"), cadminp), + `VSpacing (1), + `Label ("The password is stored in plain text in the file /var/lib/one/.one/one_auth and is used for cloud administration only. +This is not the password for the cloud administrator (oneadmin) user account. The oneadmin account has no password.") + )) + ), `HSpacing (1)); + + if (Mode::normal ()) + Wizard::OpenOKDialog (); + + string help_text = ""; + + // dialog caption + Wizard::SetContents (_("SUSENebula"), contents, help_text, true, true); + + UI::ChangeWidget (`id ("hostname"), `ValidChars, Hostname::ValidChars); + foreach (string key, ["ip", "ip_min", "ip_max"], { + UI::ChangeWidget (`id (key), `ValidChars, IP::ValidChars4); + }); + any ret = `back; + while (true) { - Report::Error (IP::Valid4 ()); - UI::SetFocus (`id ("ip")); - continue; - } - if (!IP::Check (ip_min)) + ret = UI::UserInput (); + if (ret == `ok || ret == `next) { - Report::Error (IP::Valid4 ()); - UI::SetFocus (`id ("ip_min")); - continue; + cadminp = (string) UI::QueryWidget (`id ("cadminp"), `Value); + clustername = (string) UI::QueryWidget (`id ("clustername"), `Value); + hostname = (string) UI::QueryWidget (`id ("hostname"), `Value); + domain = (string) UI::QueryWidget (`id ("domain"), `Value); + ip = (string) UI::QueryWidget (`id ("ip"), `Value); + ip_min = (string) UI::QueryWidget (`id ("ip_min"), `Value); + ip_max = (string) UI::QueryWidget (`id ("ip_max"), `Value); + netmask = (string) UI::QueryWidget (`id ("netmask"), `Value); + route = (string) UI::QueryWidget (`id ("route"), `Value); + string dns = (string) UI::QueryWidget (`id ("nameservers"), `Value); + nameservers = splitstring (dns, ", "); + string searches = (string) UI::QueryWidget (`id ("searches"), `Value); + searchdomains = splitstring (searches, ", "); + + if (!Hostname::Check (hostname)) + { + Report::Error (Hostname::ValidHost ()); + UI::SetFocus (`id ("hostname")); + continue; + } + if (!Hostname::CheckDomain (domain)) + { + Report::Error (Hostname::ValidDomain ()); + UI::SetFocus (`id ("domain")); + continue; + } + if (!IP::Check (ip)) + { + Report::Error (IP::Valid4 ()); + UI::SetFocus (`id ("ip")); + continue; + } + if (!IP::Check (ip_min)) + { + Report::Error (IP::Valid4 ()); + UI::SetFocus (`id ("ip_min")); + continue; + } + if (!IP::Check (ip_max)) + { + Report::Error (IP::Valid4 ()); + UI::SetFocus (`id ("ip_max")); + continue; + } + + if (IP::ToInteger (ip_min) <= IP::ToInteger (ip) && + IP::ToInteger (ip) <= IP::ToInteger (ip_max)) + { + // error message + Report::Error (_("IP Address is within the IP range that should be offered by DHCP server.")); + UI::SetFocus (`id ("ip_min")); + continue; + } + + if (IP::ToInteger (ip_min) > IP::ToInteger (ip_max)) + { + // error message + Popup::Message(_("The lowest address must be lower than the highest one.")); + UI::SetFocus (`id ("ip_min")); + continue; + } + + + WriteSettings (); + break; } - if (!IP::Check (ip_max)) + if (ret == `cancel || ret == `abort) { - Report::Error (IP::Valid4 ()); - UI::SetFocus (`id ("ip_max")); - continue; + break; } - - if (IP::ToInteger (ip_min) <= IP::ToInteger (ip) && - IP::ToInteger (ip) <= IP::ToInteger (ip_max)) + if (ret == `back) { - // error message - Report::Error (_("IP Address is within the IP range that should be offered by DHCP server.")); - UI::SetFocus (`id ("ip_min")); - continue; + break; } - - if (IP::ToInteger (ip_min) > IP::ToInteger (ip_max)) - { - // error message - Popup::Message(_("The lowest address must be lower than the highest one.")); - UI::SetFocus (`id ("ip_min")); - continue; } - - - WriteSettings (); - break; - } - if (ret == `cancel || ret == `abort) - { - break; - } - if (ret == `back) - { - break; - } - } - if (Mode::normal ()) - Wizard::CloseDialog (); - return ret; + if (Mode::normal ()) + Wizard::CloseDialog (); + return ret; } diff --git a/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/root/usr/share/firstboot/scripts/finalizeSetup b/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/root/usr/share/firstboot/scripts/finalizeSetup index 2e27be3ed..f99cb7108 100755 --- a/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/root/usr/share/firstboot/scripts/finalizeSetup +++ b/doc/examples/extras/suse-12.3/suse-nebula-cloud/cloud_head/root/usr/share/firstboot/scripts/finalizeSetup @@ -15,20 +15,20 @@ import time confFiles = glob.glob('/etc/sysconfig/network/ifcfg-eth*') numConfInterf = len(confFiles) if numConfInterf > 1: - syslog.openlog('[BR_SETUP]', syslog.LOG_PID, syslog.LOG_DAEMON) - syslog.syslog(syslog.LOG_INFO, 'Bridge setup\n') - msg = 'Multiple configured eth devices found, cannot resolve ambiguity\n' - syslog.syslog(syslog.LOG_ERR, msg) - syslog.closelog() - sys.exit(1) + syslog.openlog('[BR_SETUP]', syslog.LOG_PID, syslog.LOG_DAEMON) + syslog.syslog(syslog.LOG_INFO, 'Bridge setup\n') + msg = 'Multiple configured eth devices found, cannot resolve ambiguity\n' + syslog.syslog(syslog.LOG_ERR, msg) + syslog.closelog() + sys.exit(1) if numConfInterf < 1: - syslog.openlog('[BR_SETUP]', syslog.LOG_PID, syslog.LOG_DAEMON) - syslog.syslog(syslog.LOG_INFO, 'Bridge setup\n') - msg = 'No eth interface configured, cannot setup bridge\n' - syslog.syslog(syslog.LOG_ERR, msg) - syslog.closelog() - sys.exit(1) + syslog.openlog('[BR_SETUP]', syslog.LOG_PID, syslog.LOG_DAEMON) + syslog.syslog(syslog.LOG_INFO, 'Bridge setup\n') + msg = 'No eth interface configured, cannot setup bridge\n' + syslog.syslog(syslog.LOG_ERR, msg) + syslog.closelog() + sys.exit(1) # Get the configured IP address (includes the subnet mask) interfConf = confFiles[0] @@ -36,9 +36,9 @@ interfaceName = interfConf.split('-')[-1] lines = open(interfConf, 'r').readlines() ipAddr = None for ln in lines: - if ln.find('IPADDR') != -1: - ipAddr = ln.strip().split('=')[-1] - break + if ln.find('IPADDR') != -1: + ipAddr = ln.strip().split('=')[-1] + break # Stop the running network services os.system('/bin/systemctl stop dhcpd.service >& /dev/null') @@ -68,10 +68,10 @@ brCfg.close() lines = open('/etc/sysconfig/dhcpd', 'r').readlines() conf = open('/etc/sysconfig/dhcpd', 'w') for ln in lines: - if ln.find('DHCPD_INTERFACE') != -1: - conf.write('DHCPD_INTERFACE="br0"\n') - continue - conf.write(ln) + if ln.find('DHCPD_INTERFACE') != -1: + conf.write('DHCPD_INTERFACE="br0"\n') + continue + conf.write(ln) conf.close() # Remove the old network configuration file @@ -91,20 +91,20 @@ os.system('/sbin/SuSEconfig >& /dev/null') os.system('/bin/chown oneadmin:cloud /var/lib/one/.one/one_auth') if not os.path.exists('/var/lock/one'): - os.mkdir('/var/lock/one') + os.mkdir('/var/lock/one') os.system('/bin/chown -R oneadmin:cloud /var/lock/one') # Initial setup of the cloud service res = os.system('/usr/bin/sudo -u oneadmin /usr/bin/env ONE_AUTH=/var/lib/one/.one/one_auth /usr/sbin/onedsetup >& /var/log/one/onedsetup.log') if res: - if os.path.exists('/var/log/one/oned.log'): - os.rename('/var/log/one/oned.log','/var/log/one/oned.setup.log') - syslog.openlog('[ONED_INIT]', syslog.LOG_PID, syslog.LOG_DAEMON) - msg = 'Possible error with initialization of oned, check log files\n' - msg += 'in /var/log/one' - syslog.syslog(syslog.LOG_INFO, msg) - syslog.closelog() - + if os.path.exists('/var/log/one/oned.log'): + os.rename('/var/log/one/oned.log','/var/log/one/oned.setup.log') + syslog.openlog('[ONED_INIT]', syslog.LOG_PID, syslog.LOG_DAEMON) + msg = 'Possible error with initialization of oned, check log files\n' + msg += 'in /var/log/one' + syslog.syslog(syslog.LOG_INFO, msg) + syslog.closelog() + # Everything needs to catch up time.sleep(5) diff --git a/doc/examples/extras/suse-13.1/suse-vagrant-box/config.xml b/doc/examples/extras/suse-13.1/suse-vagrant-box/config.xml index 4459278ce..8e8c47dee 100644 --- a/doc/examples/extras/suse-13.1/suse-vagrant-box/config.xml +++ b/doc/examples/extras/suse-13.1/suse-vagrant-box/config.xml @@ -1,67 +1,67 @@ - - Marcus Schäfer - ms@suse.com - - openSUSE 13.1 vagrant base box - - - - - - - - 1.13.1 - zypper - en_US - us.map.gz - Europe/Berlin - utc - true - openSUSE - openSUSE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + Marcus Schäfer + ms@suse.com + + openSUSE 13.1 vagrant base box + + + + + + + + 1.13.1 + zypper + en_US + us.map.gz + Europe/Berlin + utc + true + openSUSE + openSUSE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/examples/extras/suse-SLES11/suse-min-gnome/config.xml b/doc/examples/extras/suse-SLES11/suse-min-gnome/config.xml index 2831c1246..43d7869c3 100644 --- a/doc/examples/extras/suse-SLES11/suse-min-gnome/config.xml +++ b/doc/examples/extras/suse-SLES11/suse-min-gnome/config.xml @@ -1,65 +1,65 @@ - - Robert Schweikert - rjschwei@suse.com - SUSE LE 11 Appliance using GNOME - - - - - - - - - 1.0.1 - zypper - false - true - en_US - us.map.gz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + Robert Schweikert + rjschwei@suse.com + SUSE LE 11 Appliance using GNOME + + + + + + + + + 1.0.1 + zypper + false + true + en_US + us.map.gz + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/examples/extras/suse-SLES11/suse-vagrant-box/config.xml b/doc/examples/extras/suse-SLES11/suse-vagrant-box/config.xml index 1624986bc..4ed539bd9 100644 --- a/doc/examples/extras/suse-SLES11/suse-vagrant-box/config.xml +++ b/doc/examples/extras/suse-SLES11/suse-vagrant-box/config.xml @@ -1,64 +1,64 @@ - - Thomas Bechtold - tbechtold@suse.com - - SLES11-SP3 vagrant base box - - - - - - - - 1.11.3 - zypper - en_US - us.map.gz - Europe/Berlin - utc - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + Thomas Bechtold + tbechtold@suse.com + + SLES11-SP3 vagrant base box + + + + + + + + 1.11.3 + zypper + en_US + us.map.gz + Europe/Berlin + utc + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/examples/suse-12.2/suse-ec2-guest/config.xml b/doc/examples/suse-12.2/suse-ec2-guest/config.xml index c0ed4f740..52d6f1b19 100644 --- a/doc/examples/suse-12.2/suse-ec2-guest/config.xml +++ b/doc/examples/suse-12.2/suse-ec2-guest/config.xml @@ -1,44 +1,44 @@ - - Marcus Schäfer - ms@novell.com - openSUSE 12.2 ec2 guest system - - - 1.1.2 - zypper - false - true - en_US - us.map.gz - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + Marcus Schäfer + ms@novell.com + openSUSE 12.2 ec2 guest system + + + 1.1.2 + zypper + false + true + en_US + us.map.gz + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/examples/suse-12.2/suse-live-iso/config-yast-firstboot.xml b/doc/examples/suse-12.2/suse-live-iso/config-yast-firstboot.xml index 46452765f..8f2c27928 100644 --- a/doc/examples/suse-12.2/suse-live-iso/config-yast-firstboot.xml +++ b/doc/examples/suse-12.2/suse-live-iso/config-yast-firstboot.xml @@ -1,130 +1,130 @@ + xmlns:config="http://www.suse.com/1.0/configns"> - + - firstboot + firstboot - - - firstboot_hardware - installation - firstboot - - - x11 - printer - sound - bluetooth - - - - firstboot_network - installation - firstboot - - - lan - - - - - - - yes - yes - all - - firstboot - - installation - - - - false - firstboot_language - - - - firstboot_welcome - - - - firstboot_license_novell - - - - firstboot_license - - - true - firstboot_ssh - - - - true - firstboot_timezone - - - - true - firstboot_keyboard - - - - true - inst_hostname - - - - inst_proposal - true - firstboot_network - - - - false - firstboot_desktop - - - - true - firstboot_network_write - - - - true - inst_root - - - - inst_proposal - true - firstboot_hardware - - - - firstboot_write - no - no - - - - inst_suseconfig - no - no - - - - inst_congratulate - - - - + + + firstboot_hardware + installation + firstboot + + + x11 + printer + sound + bluetooth + + + + firstboot_network + installation + firstboot + + + lan + + + + + + + yes + yes + all + + firstboot + + installation + + + + false + firstboot_language + + + + firstboot_welcome + + + + firstboot_license_novell + + + + firstboot_license + + + true + firstboot_ssh + + + + true + firstboot_timezone + + + + true + firstboot_keyboard + + + + true + inst_hostname + + + + inst_proposal + true + firstboot_network + + + + false + firstboot_desktop + + + + true + firstboot_network_write + + + + true + inst_root + + + + inst_proposal + true + firstboot_hardware + + + + firstboot_write + no + no + + + + inst_suseconfig + no + no + + + + inst_congratulate + + + + diff --git a/doc/examples/suse-12.2/suse-live-iso/config.xml b/doc/examples/suse-12.2/suse-live-iso/config.xml index 4069aa9fb..932988c96 100644 --- a/doc/examples/suse-12.2/suse-live-iso/config.xml +++ b/doc/examples/suse-12.2/suse-live-iso/config.xml @@ -1,42 +1,42 @@ - - Marcus Schäfer - ms@novell.com - openSUSE 12.2 Live system for CD/DVD and USB Stick - - - - 2.5.2 - zypper - false - true - en_US - us.map.gz - - - - - - - - - - - - - - - - - - - - - - - - - + + Marcus Schäfer + ms@novell.com + openSUSE 12.2 Live system for CD/DVD and USB Stick + + + + 2.5.2 + zypper + false + true + en_US + us.map.gz + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/examples/suse-12.2/suse-live-iso/root/etc/init.d/boot.local b/doc/examples/suse-12.2/suse-live-iso/root/etc/init.d/boot.local index 3a4b75bd6..95ad0a6a7 100755 --- a/doc/examples/suse-12.2/suse-live-iso/root/etc/init.d/boot.local +++ b/doc/examples/suse-12.2/suse-live-iso/root/etc/init.d/boot.local @@ -1,17 +1,17 @@ #!/bin/bash function dn { - local part=$1 - local part_new=$(echo $part | sed -e 's@\(^.*\)\(p.*$\)@\1@') - if [ $part = $part_new ];then - part_new=$(echo $part | sed -e 's@\(^.*\)\([0-9].*$\)@\1@') - fi - echo $part_new + local part=$1 + local part_new=$(echo $part | sed -e 's@\(^.*\)\(p.*$\)@\1@') + if [ $part = $part_new ];then + part_new=$(echo $part | sed -e 's@\(^.*\)\([0-9].*$\)@\1@') + fi + echo $part_new } bootdev=$(dn $(pvdisplay -c | cut -f1 -d:)) if [ ! -e ${bootdev}1 ];then - return + return fi mkdir -p /media/stickstorage diff --git a/doc/examples/suse-12.2/suse-live-usbstick/config-yast-firstboot.xml b/doc/examples/suse-12.2/suse-live-usbstick/config-yast-firstboot.xml index 46452765f..8f2c27928 100644 --- a/doc/examples/suse-12.2/suse-live-usbstick/config-yast-firstboot.xml +++ b/doc/examples/suse-12.2/suse-live-usbstick/config-yast-firstboot.xml @@ -1,130 +1,130 @@ + xmlns:config="http://www.suse.com/1.0/configns"> - + - firstboot + firstboot - - - firstboot_hardware - installation - firstboot - - - x11 - printer - sound - bluetooth - - - - firstboot_network - installation - firstboot - - - lan - - - - - - - yes - yes - all - - firstboot - - installation - - - - false - firstboot_language - - - - firstboot_welcome - - - - firstboot_license_novell - - - - firstboot_license - - - true - firstboot_ssh - - - - true - firstboot_timezone - - - - true - firstboot_keyboard - - - - true - inst_hostname - - - - inst_proposal - true - firstboot_network - - - - false - firstboot_desktop - - - - true - firstboot_network_write - - - - true - inst_root - - - - inst_proposal - true - firstboot_hardware - - - - firstboot_write - no - no - - - - inst_suseconfig - no - no - - - - inst_congratulate - - - - + + + firstboot_hardware + installation + firstboot + + + x11 + printer + sound + bluetooth + + + + firstboot_network + installation + firstboot + + + lan + + + + + + + yes + yes + all + + firstboot + + installation + + + + false + firstboot_language + + + + firstboot_welcome + + + + firstboot_license_novell + + + + firstboot_license + + + true + firstboot_ssh + + + + true + firstboot_timezone + + + + true + firstboot_keyboard + + + + true + inst_hostname + + + + inst_proposal + true + firstboot_network + + + + false + firstboot_desktop + + + + true + firstboot_network_write + + + + true + inst_root + + + + inst_proposal + true + firstboot_hardware + + + + firstboot_write + no + no + + + + inst_suseconfig + no + no + + + + inst_congratulate + + + + diff --git a/doc/examples/suse-12.2/suse-live-usbstick/config.xml b/doc/examples/suse-12.2/suse-live-usbstick/config.xml index aedc3552b..e816be28f 100644 --- a/doc/examples/suse-12.2/suse-live-usbstick/config.xml +++ b/doc/examples/suse-12.2/suse-live-usbstick/config.xml @@ -1,52 +1,52 @@ - - Marcus Schäfer - ms@novell.com - openSUSE 12.2 Live system for CD/DVD and USB Stick - - - - 3 - - 512 - true - true - - - - 2.5.2 - zypper - false - true - en_US - us.map.gz - - - - - - - - - - - - - - - - - - - - - - - - - - - + + Marcus Schäfer + ms@novell.com + openSUSE 12.2 Live system for CD/DVD and USB Stick + + + + 3 + + 512 + true + true + + + + 2.5.2 + zypper + false + true + en_US + us.map.gz + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/examples/suse-12.2/suse-live-usbstick/root/etc/init.d/boot.local b/doc/examples/suse-12.2/suse-live-usbstick/root/etc/init.d/boot.local index 3a4b75bd6..95ad0a6a7 100755 --- a/doc/examples/suse-12.2/suse-live-usbstick/root/etc/init.d/boot.local +++ b/doc/examples/suse-12.2/suse-live-usbstick/root/etc/init.d/boot.local @@ -1,17 +1,17 @@ #!/bin/bash function dn { - local part=$1 - local part_new=$(echo $part | sed -e 's@\(^.*\)\(p.*$\)@\1@') - if [ $part = $part_new ];then - part_new=$(echo $part | sed -e 's@\(^.*\)\([0-9].*$\)@\1@') - fi - echo $part_new + local part=$1 + local part_new=$(echo $part | sed -e 's@\(^.*\)\(p.*$\)@\1@') + if [ $part = $part_new ];then + part_new=$(echo $part | sed -e 's@\(^.*\)\([0-9].*$\)@\1@') + fi + echo $part_new } bootdev=$(dn $(pvdisplay -c | cut -f1 -d:)) if [ ! -e ${bootdev}1 ];then - return + return fi mkdir -p /media/stickstorage diff --git a/doc/examples/suse-12.2/suse-lxc-guest/config.xml b/doc/examples/suse-12.2/suse-lxc-guest/config.xml index 63c6b05e6..29efada7c 100644 --- a/doc/examples/suse-12.2/suse-lxc-guest/config.xml +++ b/doc/examples/suse-12.2/suse-lxc-guest/config.xml @@ -1,40 +1,40 @@ - - Robert Schweikert - rjschwei@suse.com - openSUSE 12.2 container image - - - - - - - - - 1.0.0 - zypper - false - true - en_US - us.map.gz - utc - US/Eastern - - - - - - - - - - - - - - - - + + Robert Schweikert + rjschwei@suse.com + openSUSE 12.2 container image + + + + + + + + + 1.0.0 + zypper + false + true + en_US + us.map.gz + utc + US/Eastern + + + + + + + + + + + + + + + + diff --git a/doc/examples/suse-12.2/suse-oem-preload/config.xml b/doc/examples/suse-12.2/suse-oem-preload/config.xml index 40321f6c9..e763bcdc3 100644 --- a/doc/examples/suse-12.2/suse-oem-preload/config.xml +++ b/doc/examples/suse-12.2/suse-oem-preload/config.xml @@ -1,41 +1,41 @@ - - Marcus Schäfer - ms@novell.com - openSUSE 12.2 oem preload system - - - - 1.1.2 - zypper - false - true - en_US - us.map.gz - - - - - - - - - - - - - - - - - - - - - - - - + + Marcus Schäfer + ms@novell.com + openSUSE 12.2 oem preload system + + + + 1.1.2 + zypper + false + true + en_US + us.map.gz + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/examples/suse-12.2/suse-pxe-client/config.xml b/doc/examples/suse-12.2/suse-pxe-client/config.xml index 4a5018735..595b658ad 100644 --- a/doc/examples/suse-12.2/suse-pxe-client/config.xml +++ b/doc/examples/suse-12.2/suse-pxe-client/config.xml @@ -1,70 +1,70 @@ - - Marcus Schäfer - ms@novell.com - openSUSE 12.2 Wyse VX0 terminal 128MB - - - - - - - - - - - - - 1.2.8 - zypper - false - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + Marcus Schäfer + ms@novell.com + openSUSE 12.2 Wyse VX0 terminal 128MB + + + + + + + + + + + + + 1.2.8 + zypper + false + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/examples/suse-12.2/suse-pxe-client/images.sh b/doc/examples/suse-12.2/suse-pxe-client/images.sh index 1bee9a00f..6a405486c 100755 --- a/doc/examples/suse-12.2/suse-pxe-client/images.sh +++ b/doc/examples/suse-12.2/suse-pxe-client/images.sh @@ -6,13 +6,13 @@ echo "Configure image: [$kiwi_iname]..." # remove unneeded packages #------------------------------------------ for i in \ - info smart python-xml perl-gettext perl-Bootloader openslp \ - rpm-python suse-build-key python perl xscreensaver \ - yast2-hardware-detection yast2-xml samba-client \ - yast2-pkg-bindings yast2 yast2-core docbook_4 docbook_3 \ - docbook-xsl-stylesheets docbook-dsssl-stylesheets avahi + info smart python-xml perl-gettext perl-Bootloader openslp \ + rpm-python suse-build-key python perl xscreensaver \ + yast2-hardware-detection yast2-xml samba-client \ + yast2-pkg-bindings yast2 yast2-core docbook_4 docbook_3 \ + docbook-xsl-stylesheets docbook-dsssl-stylesheets avahi do - rpm -e $i --nodeps + rpm -e $i --nodeps done #========================================== diff --git a/doc/examples/suse-12.2/suse-pxe-client/root/etc/asound.state b/doc/examples/suse-12.2/suse-pxe-client/root/etc/asound.state index 2c2f8d8f2..5b96be0ee 100644 --- a/doc/examples/suse-12.2/suse-pxe-client/root/etc/asound.state +++ b/doc/examples/suse-12.2/suse-pxe-client/root/etc/asound.state @@ -1,357 +1,357 @@ state.V8237 { - control.1 { - comment.access 'read write' - comment.type BOOLEAN - comment.count 1 - iface MIXER - name 'Master Playback Switch' - value true - } - control.2 { - comment.access 'read write' - comment.type INTEGER - comment.count 2 - comment.range '0 - 31' - iface MIXER - name 'Master Playback Volume' - value.0 30 - value.1 30 - } - control.3 { - comment.access 'read write' - comment.type BOOLEAN - comment.count 1 - iface MIXER - name 'Headphone Playback Switch' - value true - } - control.4 { - comment.access 'read write' - comment.type INTEGER - comment.count 2 - comment.range '0 - 31' - iface MIXER - name 'Headphone Playback Volume' - value.0 30 - value.1 30 - } - control.5 { - comment.access 'read write' - comment.type BOOLEAN - comment.count 1 - iface MIXER - name 'Master Mono Playback Switch' - value true - } - control.6 { - comment.access 'read write' - comment.type INTEGER - comment.count 1 - comment.range '0 - 31' - iface MIXER - name 'Master Mono Playback Volume' - value 31 - } - control.7 { - comment.access 'read write' - comment.type BOOLEAN - comment.count 1 - iface MIXER - name 'PC Speaker Playback Switch' - value true - } - control.8 { - comment.access 'read write' - comment.type INTEGER - comment.count 1 - comment.range '0 - 15' - iface MIXER - name 'PC Speaker Playback Volume' - value 15 - } - control.9 { - comment.access 'read write' - comment.type BOOLEAN - comment.count 1 - iface MIXER - name 'Phone Playback Switch' - value true - } - control.10 { - comment.access 'read write' - comment.type INTEGER - comment.count 1 - comment.range '0 - 31' - iface MIXER - name 'Phone Playback Volume' - value 31 - } - control.11 { - comment.access 'read write' - comment.type BOOLEAN - comment.count 1 - iface MIXER - name 'Mic Playback Switch' - value true - } - control.12 { - comment.access 'read write' - comment.type INTEGER - comment.count 1 - comment.range '0 - 31' - iface MIXER - name 'Mic Playback Volume' - value 31 - } - control.13 { - comment.access 'read write' - comment.type BOOLEAN - comment.count 1 - iface MIXER - name 'Mic Boost (+20dB)' - value true - } - control.14 { - comment.access 'read write' - comment.type BOOLEAN - comment.count 1 - iface MIXER - name 'Line Playback Switch' - value true - } - control.15 { - comment.access 'read write' - comment.type INTEGER - comment.count 2 - comment.range '0 - 31' - iface MIXER - name 'Line Playback Volume' - value.0 31 - value.1 31 - } - control.16 { - comment.access 'read write' - comment.type BOOLEAN - comment.count 1 - iface MIXER - name 'CD Playback Switch' - value true - } - control.17 { - comment.access 'read write' - comment.type INTEGER - comment.count 2 - comment.range '0 - 31' - iface MIXER - name 'CD Playback Volume' - value.0 29 - value.1 29 - } - control.18 { - comment.access 'read write' - comment.type BOOLEAN - comment.count 1 - iface MIXER - name 'Video Playback Switch' - value true - } - control.19 { - comment.access 'read write' - comment.type INTEGER - comment.count 2 - comment.range '0 - 31' - iface MIXER - name 'Video Playback Volume' - value.0 31 - value.1 31 - } - control.20 { - comment.access 'read write' - comment.type BOOLEAN - comment.count 1 - iface MIXER - name 'Aux Playback Switch' - value true - } - control.21 { - comment.access 'read write' - comment.type INTEGER - comment.count 2 - comment.range '0 - 31' - iface MIXER - name 'Aux Playback Volume' - value.0 31 - value.1 31 - } - control.22 { - comment.access 'read write' - comment.type BOOLEAN - comment.count 1 - iface MIXER - name 'PCM Playback Switch' - value true - } - control.23 { - comment.access 'read write' - comment.type INTEGER - comment.count 2 - comment.range '0 - 31' - iface MIXER - name 'PCM Playback Volume' - value.0 31 - value.1 31 - } - control.24 { - comment.access 'read write' - comment.type ENUMERATED - comment.count 2 - comment.item.0 Mic - comment.item.1 CD - comment.item.2 Video - comment.item.3 Aux - comment.item.4 Line - comment.item.5 Mix - comment.item.6 'Mix Mono' - comment.item.7 Phone - iface MIXER - name 'Capture Source' - value.0 Mic - value.1 Mic - } - control.25 { - comment.access 'read write' - comment.type BOOLEAN - comment.count 1 - iface MIXER - name 'Capture Switch' - value true - } - control.26 { - comment.access 'read write' - comment.type INTEGER - comment.count 2 - comment.range '0 - 15' - iface MIXER - name 'Capture Volume' - value.0 15 - value.1 15 - } - control.27 { - comment.access 'read write' - comment.type BOOLEAN - comment.count 1 - iface MIXER - name '3D Control - Switch' - value true - } - control.28 { - comment.access 'read write' - comment.type ENUMERATED - comment.count 1 - comment.item.0 Mix - comment.item.1 Mic - iface MIXER - name 'Mono Output Select' - value Mix - } - control.29 { - comment.access 'read write' - comment.type ENUMERATED - comment.count 1 - comment.item.0 Mic1 - comment.item.1 Mic2 - iface MIXER - name 'Mic Select' - value Mic1 - } - control.30 { - comment.access 'read write' - comment.type INTEGER - comment.count 1 - comment.range '0 - 15' - iface MIXER - name '3D Control - Center' - value 15 - } - control.31 { - comment.access 'read write' - comment.type INTEGER - comment.count 1 - comment.range '0 - 15' - iface MIXER - name '3D Control - Depth' - value 15 - } - control.32 { - comment.access 'read write' - comment.type BOOLEAN - comment.count 1 - iface MIXER - name 'External Amplifier' - value true - } - control.33 { - comment.access 'read write' - comment.type ENUMERATED - comment.count 1 - comment.item.0 Input1 - comment.item.1 Input2 - iface MIXER - name 'Input Source Select' - value Input1 - } - control.34 { - comment.access 'read write' - comment.type ENUMERATED - comment.count 1 - comment.item.0 Input1 - comment.item.1 Input2 - iface MIXER - name 'Input Source Select' - index 1 - value Input1 - } - control.35 { - comment.access 'read write' - comment.type INTEGER - comment.count 2 - comment.range '0 - 31' - iface MIXER - name 'VIA DXS Playback Volume' - value.0 31 - value.1 31 - } - control.36 { - comment.access 'read write' - comment.type INTEGER - comment.count 2 - comment.range '0 - 31' - iface MIXER - name 'VIA DXS Playback Volume' - index 1 - value.0 31 - value.1 31 - } - control.37 { - comment.access 'read write' - comment.type INTEGER - comment.count 2 - comment.range '0 - 31' - iface MIXER - name 'VIA DXS Playback Volume' - index 2 - value.0 31 - value.1 31 - } - control.38 { - comment.access 'read write' - comment.type INTEGER - comment.count 2 - comment.range '0 - 31' - iface MIXER - name 'VIA DXS Playback Volume' - index 3 - value.0 31 - value.1 31 - } + control.1 { + comment.access 'read write' + comment.type BOOLEAN + comment.count 1 + iface MIXER + name 'Master Playback Switch' + value true + } + control.2 { + comment.access 'read write' + comment.type INTEGER + comment.count 2 + comment.range '0 - 31' + iface MIXER + name 'Master Playback Volume' + value.0 30 + value.1 30 + } + control.3 { + comment.access 'read write' + comment.type BOOLEAN + comment.count 1 + iface MIXER + name 'Headphone Playback Switch' + value true + } + control.4 { + comment.access 'read write' + comment.type INTEGER + comment.count 2 + comment.range '0 - 31' + iface MIXER + name 'Headphone Playback Volume' + value.0 30 + value.1 30 + } + control.5 { + comment.access 'read write' + comment.type BOOLEAN + comment.count 1 + iface MIXER + name 'Master Mono Playback Switch' + value true + } + control.6 { + comment.access 'read write' + comment.type INTEGER + comment.count 1 + comment.range '0 - 31' + iface MIXER + name 'Master Mono Playback Volume' + value 31 + } + control.7 { + comment.access 'read write' + comment.type BOOLEAN + comment.count 1 + iface MIXER + name 'PC Speaker Playback Switch' + value true + } + control.8 { + comment.access 'read write' + comment.type INTEGER + comment.count 1 + comment.range '0 - 15' + iface MIXER + name 'PC Speaker Playback Volume' + value 15 + } + control.9 { + comment.access 'read write' + comment.type BOOLEAN + comment.count 1 + iface MIXER + name 'Phone Playback Switch' + value true + } + control.10 { + comment.access 'read write' + comment.type INTEGER + comment.count 1 + comment.range '0 - 31' + iface MIXER + name 'Phone Playback Volume' + value 31 + } + control.11 { + comment.access 'read write' + comment.type BOOLEAN + comment.count 1 + iface MIXER + name 'Mic Playback Switch' + value true + } + control.12 { + comment.access 'read write' + comment.type INTEGER + comment.count 1 + comment.range '0 - 31' + iface MIXER + name 'Mic Playback Volume' + value 31 + } + control.13 { + comment.access 'read write' + comment.type BOOLEAN + comment.count 1 + iface MIXER + name 'Mic Boost (+20dB)' + value true + } + control.14 { + comment.access 'read write' + comment.type BOOLEAN + comment.count 1 + iface MIXER + name 'Line Playback Switch' + value true + } + control.15 { + comment.access 'read write' + comment.type INTEGER + comment.count 2 + comment.range '0 - 31' + iface MIXER + name 'Line Playback Volume' + value.0 31 + value.1 31 + } + control.16 { + comment.access 'read write' + comment.type BOOLEAN + comment.count 1 + iface MIXER + name 'CD Playback Switch' + value true + } + control.17 { + comment.access 'read write' + comment.type INTEGER + comment.count 2 + comment.range '0 - 31' + iface MIXER + name 'CD Playback Volume' + value.0 29 + value.1 29 + } + control.18 { + comment.access 'read write' + comment.type BOOLEAN + comment.count 1 + iface MIXER + name 'Video Playback Switch' + value true + } + control.19 { + comment.access 'read write' + comment.type INTEGER + comment.count 2 + comment.range '0 - 31' + iface MIXER + name 'Video Playback Volume' + value.0 31 + value.1 31 + } + control.20 { + comment.access 'read write' + comment.type BOOLEAN + comment.count 1 + iface MIXER + name 'Aux Playback Switch' + value true + } + control.21 { + comment.access 'read write' + comment.type INTEGER + comment.count 2 + comment.range '0 - 31' + iface MIXER + name 'Aux Playback Volume' + value.0 31 + value.1 31 + } + control.22 { + comment.access 'read write' + comment.type BOOLEAN + comment.count 1 + iface MIXER + name 'PCM Playback Switch' + value true + } + control.23 { + comment.access 'read write' + comment.type INTEGER + comment.count 2 + comment.range '0 - 31' + iface MIXER + name 'PCM Playback Volume' + value.0 31 + value.1 31 + } + control.24 { + comment.access 'read write' + comment.type ENUMERATED + comment.count 2 + comment.item.0 Mic + comment.item.1 CD + comment.item.2 Video + comment.item.3 Aux + comment.item.4 Line + comment.item.5 Mix + comment.item.6 'Mix Mono' + comment.item.7 Phone + iface MIXER + name 'Capture Source' + value.0 Mic + value.1 Mic + } + control.25 { + comment.access 'read write' + comment.type BOOLEAN + comment.count 1 + iface MIXER + name 'Capture Switch' + value true + } + control.26 { + comment.access 'read write' + comment.type INTEGER + comment.count 2 + comment.range '0 - 15' + iface MIXER + name 'Capture Volume' + value.0 15 + value.1 15 + } + control.27 { + comment.access 'read write' + comment.type BOOLEAN + comment.count 1 + iface MIXER + name '3D Control - Switch' + value true + } + control.28 { + comment.access 'read write' + comment.type ENUMERATED + comment.count 1 + comment.item.0 Mix + comment.item.1 Mic + iface MIXER + name 'Mono Output Select' + value Mix + } + control.29 { + comment.access 'read write' + comment.type ENUMERATED + comment.count 1 + comment.item.0 Mic1 + comment.item.1 Mic2 + iface MIXER + name 'Mic Select' + value Mic1 + } + control.30 { + comment.access 'read write' + comment.type INTEGER + comment.count 1 + comment.range '0 - 15' + iface MIXER + name '3D Control - Center' + value 15 + } + control.31 { + comment.access 'read write' + comment.type INTEGER + comment.count 1 + comment.range '0 - 15' + iface MIXER + name '3D Control - Depth' + value 15 + } + control.32 { + comment.access 'read write' + comment.type BOOLEAN + comment.count 1 + iface MIXER + name 'External Amplifier' + value true + } + control.33 { + comment.access 'read write' + comment.type ENUMERATED + comment.count 1 + comment.item.0 Input1 + comment.item.1 Input2 + iface MIXER + name 'Input Source Select' + value Input1 + } + control.34 { + comment.access 'read write' + comment.type ENUMERATED + comment.count 1 + comment.item.0 Input1 + comment.item.1 Input2 + iface MIXER + name 'Input Source Select' + index 1 + value Input1 + } + control.35 { + comment.access 'read write' + comment.type INTEGER + comment.count 2 + comment.range '0 - 31' + iface MIXER + name 'VIA DXS Playback Volume' + value.0 31 + value.1 31 + } + control.36 { + comment.access 'read write' + comment.type INTEGER + comment.count 2 + comment.range '0 - 31' + iface MIXER + name 'VIA DXS Playback Volume' + index 1 + value.0 31 + value.1 31 + } + control.37 { + comment.access 'read write' + comment.type INTEGER + comment.count 2 + comment.range '0 - 31' + iface MIXER + name 'VIA DXS Playback Volume' + index 2 + value.0 31 + value.1 31 + } + control.38 { + comment.access 'read write' + comment.type INTEGER + comment.count 2 + comment.range '0 - 31' + iface MIXER + name 'VIA DXS Playback Volume' + index 3 + value.0 31 + value.1 31 + } } diff --git a/doc/examples/suse-12.2/suse-vm-guest/config.xml b/doc/examples/suse-12.2/suse-vm-guest/config.xml index 226340671..ef63331db 100644 --- a/doc/examples/suse-12.2/suse-vm-guest/config.xml +++ b/doc/examples/suse-12.2/suse-vm-guest/config.xml @@ -1,43 +1,43 @@ - - Marcus Schäfer - ms@novell.com - openSUSE 12.2 virtual disk system - - - - - - - - 1.1.2 - zypper - false - true - en_US - us.map.gz - - - - - - - - - - - - - - - - - - - - - - + + Marcus Schäfer + ms@novell.com + openSUSE 12.2 virtual disk system + + + + + + + + 1.1.2 + zypper + false + true + en_US + us.map.gz + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/examples/suse-12.2/suse-xen-guest/config.xml b/doc/examples/suse-12.2/suse-xen-guest/config.xml index 8ba6055df..4cb212cdc 100644 --- a/doc/examples/suse-12.2/suse-xen-guest/config.xml +++ b/doc/examples/suse-12.2/suse-xen-guest/config.xml @@ -1,45 +1,45 @@ - - Marcus Schäfer - ms@novell.com - openSUSE 12.2 xen guest system - - - 1.1.2 - zypper - false - true - en_US - us.map.gz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + Marcus Schäfer + ms@novell.com + openSUSE 12.2 xen guest system + + + 1.1.2 + zypper + false + true + en_US + us.map.gz + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/examples/suse-12.3/suse-ec2-guest/config.xml b/doc/examples/suse-12.3/suse-ec2-guest/config.xml index 40f2c6faa..48f4fa3d9 100644 --- a/doc/examples/suse-12.3/suse-ec2-guest/config.xml +++ b/doc/examples/suse-12.3/suse-ec2-guest/config.xml @@ -1,42 +1,42 @@ - - Marcus Schäfer - ms@novell.com - openSUSE 12.3 ec2 guest system - - - 1.1.2 - zypper - false - true - en_US - us.map.gz - - - - - - - - - - - - - - - - - - - - - - - - - - + + Marcus Schäfer + ms@novell.com + openSUSE 12.3 ec2 guest system + + + 1.1.2 + zypper + false + true + en_US + us.map.gz + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/examples/suse-12.3/suse-live-iso/config-yast-firstboot.xml b/doc/examples/suse-12.3/suse-live-iso/config-yast-firstboot.xml index 8e298fd1c..32ca512b4 100644 --- a/doc/examples/suse-12.3/suse-live-iso/config-yast-firstboot.xml +++ b/doc/examples/suse-12.3/suse-live-iso/config-yast-firstboot.xml @@ -1,124 +1,124 @@ + xmlns:config="http://www.suse.com/1.0/configns"> - + - firstboot + firstboot - - - firstboot_hardware - installation - firstboot - - - x11 - printer - sound - bluetooth - - - - firstboot_network - installation - firstboot - - - lan - - - - - - - yes - yes - all - - firstboot - - installation - - - - false - firstboot_language - - - - firstboot_welcome - - - - firstboot_license_novell - - - - firstboot_license - - - true - firstboot_ssh - - - - true - firstboot_timezone - - - - true - firstboot_keyboard - - - - true - inst_hostname - - - - inst_proposal - true - firstboot_network - - - - false - firstboot_desktop - - - - true - firstboot_network_write - - - - true - inst_root - - - - inst_proposal - true - firstboot_hardware - - - - firstboot_write - no - no - - - - inst_congratulate - - - - + + + firstboot_hardware + installation + firstboot + + + x11 + printer + sound + bluetooth + + + + firstboot_network + installation + firstboot + + + lan + + + + + + + yes + yes + all + + firstboot + + installation + + + + false + firstboot_language + + + + firstboot_welcome + + + + firstboot_license_novell + + + + firstboot_license + + + true + firstboot_ssh + + + + true + firstboot_timezone + + + + true + firstboot_keyboard + + + + true + inst_hostname + + + + inst_proposal + true + firstboot_network + + + + false + firstboot_desktop + + + + true + firstboot_network_write + + + + true + inst_root + + + + inst_proposal + true + firstboot_hardware + + + + firstboot_write + no + no + + + + inst_congratulate + + + + diff --git a/doc/examples/suse-12.3/suse-live-iso/config.xml b/doc/examples/suse-12.3/suse-live-iso/config.xml index 6e229dbf7..a3f9f9845 100644 --- a/doc/examples/suse-12.3/suse-live-iso/config.xml +++ b/doc/examples/suse-12.3/suse-live-iso/config.xml @@ -1,57 +1,57 @@ - - Marcus Schäfer - ms@novell.com - openSUSE 12.3 Live system for CD/DVD and USB Stick - - - - 2.5.2 - zypper - false - true - en_US - us.map.gz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + Marcus Schäfer + ms@novell.com + openSUSE 12.3 Live system for CD/DVD and USB Stick + + + + 2.5.2 + zypper + false + true + en_US + us.map.gz + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/examples/suse-12.3/suse-live-iso/root/etc/init.d/boot.local b/doc/examples/suse-12.3/suse-live-iso/root/etc/init.d/boot.local index 3a4b75bd6..95ad0a6a7 100755 --- a/doc/examples/suse-12.3/suse-live-iso/root/etc/init.d/boot.local +++ b/doc/examples/suse-12.3/suse-live-iso/root/etc/init.d/boot.local @@ -1,17 +1,17 @@ #!/bin/bash function dn { - local part=$1 - local part_new=$(echo $part | sed -e 's@\(^.*\)\(p.*$\)@\1@') - if [ $part = $part_new ];then - part_new=$(echo $part | sed -e 's@\(^.*\)\([0-9].*$\)@\1@') - fi - echo $part_new + local part=$1 + local part_new=$(echo $part | sed -e 's@\(^.*\)\(p.*$\)@\1@') + if [ $part = $part_new ];then + part_new=$(echo $part | sed -e 's@\(^.*\)\([0-9].*$\)@\1@') + fi + echo $part_new } bootdev=$(dn $(pvdisplay -c | cut -f1 -d:)) if [ ! -e ${bootdev}1 ];then - return + return fi mkdir -p /media/stickstorage diff --git a/doc/examples/suse-12.3/suse-live-usbstick/config-yast-firstboot.xml b/doc/examples/suse-12.3/suse-live-usbstick/config-yast-firstboot.xml index 46452765f..8f2c27928 100644 --- a/doc/examples/suse-12.3/suse-live-usbstick/config-yast-firstboot.xml +++ b/doc/examples/suse-12.3/suse-live-usbstick/config-yast-firstboot.xml @@ -1,130 +1,130 @@ + xmlns:config="http://www.suse.com/1.0/configns"> - + - firstboot + firstboot - - - firstboot_hardware - installation - firstboot - - - x11 - printer - sound - bluetooth - - - - firstboot_network - installation - firstboot - - - lan - - - - - - - yes - yes - all - - firstboot - - installation - - - - false - firstboot_language - - - - firstboot_welcome - - - - firstboot_license_novell - - - - firstboot_license - - - true - firstboot_ssh - - - - true - firstboot_timezone - - - - true - firstboot_keyboard - - - - true - inst_hostname - - - - inst_proposal - true - firstboot_network - - - - false - firstboot_desktop - - - - true - firstboot_network_write - - - - true - inst_root - - - - inst_proposal - true - firstboot_hardware - - - - firstboot_write - no - no - - - - inst_suseconfig - no - no - - - - inst_congratulate - - - - + + + firstboot_hardware + installation + firstboot + + + x11 + printer + sound + bluetooth + + + + firstboot_network + installation + firstboot + + + lan + + + + + + + yes + yes + all + + firstboot + + installation + + + + false + firstboot_language + + + + firstboot_welcome + + + + firstboot_license_novell + + + + firstboot_license + + + true + firstboot_ssh + + + + true + firstboot_timezone + + + + true + firstboot_keyboard + + + + true + inst_hostname + + + + inst_proposal + true + firstboot_network + + + + false + firstboot_desktop + + + + true + firstboot_network_write + + + + true + inst_root + + + + inst_proposal + true + firstboot_hardware + + + + firstboot_write + no + no + + + + inst_suseconfig + no + no + + + + inst_congratulate + + + + diff --git a/doc/examples/suse-12.3/suse-live-usbstick/config.xml b/doc/examples/suse-12.3/suse-live-usbstick/config.xml index 739ed4f18..a840c34ad 100644 --- a/doc/examples/suse-12.3/suse-live-usbstick/config.xml +++ b/doc/examples/suse-12.3/suse-live-usbstick/config.xml @@ -1,53 +1,53 @@ - - Marcus Schäfer - ms@novell.com - openSUSE 12.3 Live system for CD/DVD and USB Stick - - - - 3 - - 512 - true - true - - - - 2.5.3 - zypper - false - true - en_US - us.map.gz - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + Marcus Schäfer + ms@novell.com + openSUSE 12.3 Live system for CD/DVD and USB Stick + + + + 3 + + 512 + true + true + + + + 2.5.3 + zypper + false + true + en_US + us.map.gz + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/examples/suse-12.3/suse-live-usbstick/root/etc/init.d/boot.local b/doc/examples/suse-12.3/suse-live-usbstick/root/etc/init.d/boot.local index 3a4b75bd6..95ad0a6a7 100755 --- a/doc/examples/suse-12.3/suse-live-usbstick/root/etc/init.d/boot.local +++ b/doc/examples/suse-12.3/suse-live-usbstick/root/etc/init.d/boot.local @@ -1,17 +1,17 @@ #!/bin/bash function dn { - local part=$1 - local part_new=$(echo $part | sed -e 's@\(^.*\)\(p.*$\)@\1@') - if [ $part = $part_new ];then - part_new=$(echo $part | sed -e 's@\(^.*\)\([0-9].*$\)@\1@') - fi - echo $part_new + local part=$1 + local part_new=$(echo $part | sed -e 's@\(^.*\)\(p.*$\)@\1@') + if [ $part = $part_new ];then + part_new=$(echo $part | sed -e 's@\(^.*\)\([0-9].*$\)@\1@') + fi + echo $part_new } bootdev=$(dn $(pvdisplay -c | cut -f1 -d:)) if [ ! -e ${bootdev}1 ];then - return + return fi mkdir -p /media/stickstorage diff --git a/doc/examples/suse-12.3/suse-lxc-guest/config.xml b/doc/examples/suse-12.3/suse-lxc-guest/config.xml index 49ed225c8..a0b57b87c 100644 --- a/doc/examples/suse-12.3/suse-lxc-guest/config.xml +++ b/doc/examples/suse-12.3/suse-lxc-guest/config.xml @@ -1,41 +1,41 @@ - - Robert Schweikert - rjschwei@suse.com - openSUSE 12.3 container image - - - - - - - - - 1.0.0 - zypper - false - true - en_US - us.map.gz - utc - US/Eastern - - - - - - - - - - - - - - - - - + + Robert Schweikert + rjschwei@suse.com + openSUSE 12.3 container image + + + + + + + + + 1.0.0 + zypper + false + true + en_US + us.map.gz + utc + US/Eastern + + + + + + + + + + + + + + + + + diff --git a/doc/examples/suse-12.3/suse-oem-preload/config.xml b/doc/examples/suse-12.3/suse-oem-preload/config.xml index 9c1884550..4d3df370b 100644 --- a/doc/examples/suse-12.3/suse-oem-preload/config.xml +++ b/doc/examples/suse-12.3/suse-oem-preload/config.xml @@ -1,43 +1,43 @@ - - Marcus Schäfer - ms@novell.com - openSUSE 12.3 oem preload system - - - - 1.1.2 - zypper - false - true - en_US - us.map.gz - - - - - - - - - - - - - - - - - - - - - - - - - - + + Marcus Schäfer + ms@novell.com + openSUSE 12.3 oem preload system + + + + 1.1.2 + zypper + false + true + en_US + us.map.gz + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/examples/suse-12.3/suse-pxe-client/config.xml b/doc/examples/suse-12.3/suse-pxe-client/config.xml index 8d9f3d0c6..05a5b60ff 100644 --- a/doc/examples/suse-12.3/suse-pxe-client/config.xml +++ b/doc/examples/suse-12.3/suse-pxe-client/config.xml @@ -1,72 +1,72 @@ - - Marcus Schäfer - ms@novell.com - openSUSE 12.3 terminal - - - - - - - - - - - - - 1.2.8 - zypper - false - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + Marcus Schäfer + ms@novell.com + openSUSE 12.3 terminal + + + + + + + + + + + + + 1.2.8 + zypper + false + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/examples/suse-12.3/suse-pxe-client/images.sh b/doc/examples/suse-12.3/suse-pxe-client/images.sh index 1bee9a00f..6a405486c 100755 --- a/doc/examples/suse-12.3/suse-pxe-client/images.sh +++ b/doc/examples/suse-12.3/suse-pxe-client/images.sh @@ -6,13 +6,13 @@ echo "Configure image: [$kiwi_iname]..." # remove unneeded packages #------------------------------------------ for i in \ - info smart python-xml perl-gettext perl-Bootloader openslp \ - rpm-python suse-build-key python perl xscreensaver \ - yast2-hardware-detection yast2-xml samba-client \ - yast2-pkg-bindings yast2 yast2-core docbook_4 docbook_3 \ - docbook-xsl-stylesheets docbook-dsssl-stylesheets avahi + info smart python-xml perl-gettext perl-Bootloader openslp \ + rpm-python suse-build-key python perl xscreensaver \ + yast2-hardware-detection yast2-xml samba-client \ + yast2-pkg-bindings yast2 yast2-core docbook_4 docbook_3 \ + docbook-xsl-stylesheets docbook-dsssl-stylesheets avahi do - rpm -e $i --nodeps + rpm -e $i --nodeps done #========================================== diff --git a/doc/examples/suse-12.3/suse-pxe-client/root/etc/asound.state b/doc/examples/suse-12.3/suse-pxe-client/root/etc/asound.state index 2c2f8d8f2..5b96be0ee 100644 --- a/doc/examples/suse-12.3/suse-pxe-client/root/etc/asound.state +++ b/doc/examples/suse-12.3/suse-pxe-client/root/etc/asound.state @@ -1,357 +1,357 @@ state.V8237 { - control.1 { - comment.access 'read write' - comment.type BOOLEAN - comment.count 1 - iface MIXER - name 'Master Playback Switch' - value true - } - control.2 { - comment.access 'read write' - comment.type INTEGER - comment.count 2 - comment.range '0 - 31' - iface MIXER - name 'Master Playback Volume' - value.0 30 - value.1 30 - } - control.3 { - comment.access 'read write' - comment.type BOOLEAN - comment.count 1 - iface MIXER - name 'Headphone Playback Switch' - value true - } - control.4 { - comment.access 'read write' - comment.type INTEGER - comment.count 2 - comment.range '0 - 31' - iface MIXER - name 'Headphone Playback Volume' - value.0 30 - value.1 30 - } - control.5 { - comment.access 'read write' - comment.type BOOLEAN - comment.count 1 - iface MIXER - name 'Master Mono Playback Switch' - value true - } - control.6 { - comment.access 'read write' - comment.type INTEGER - comment.count 1 - comment.range '0 - 31' - iface MIXER - name 'Master Mono Playback Volume' - value 31 - } - control.7 { - comment.access 'read write' - comment.type BOOLEAN - comment.count 1 - iface MIXER - name 'PC Speaker Playback Switch' - value true - } - control.8 { - comment.access 'read write' - comment.type INTEGER - comment.count 1 - comment.range '0 - 15' - iface MIXER - name 'PC Speaker Playback Volume' - value 15 - } - control.9 { - comment.access 'read write' - comment.type BOOLEAN - comment.count 1 - iface MIXER - name 'Phone Playback Switch' - value true - } - control.10 { - comment.access 'read write' - comment.type INTEGER - comment.count 1 - comment.range '0 - 31' - iface MIXER - name 'Phone Playback Volume' - value 31 - } - control.11 { - comment.access 'read write' - comment.type BOOLEAN - comment.count 1 - iface MIXER - name 'Mic Playback Switch' - value true - } - control.12 { - comment.access 'read write' - comment.type INTEGER - comment.count 1 - comment.range '0 - 31' - iface MIXER - name 'Mic Playback Volume' - value 31 - } - control.13 { - comment.access 'read write' - comment.type BOOLEAN - comment.count 1 - iface MIXER - name 'Mic Boost (+20dB)' - value true - } - control.14 { - comment.access 'read write' - comment.type BOOLEAN - comment.count 1 - iface MIXER - name 'Line Playback Switch' - value true - } - control.15 { - comment.access 'read write' - comment.type INTEGER - comment.count 2 - comment.range '0 - 31' - iface MIXER - name 'Line Playback Volume' - value.0 31 - value.1 31 - } - control.16 { - comment.access 'read write' - comment.type BOOLEAN - comment.count 1 - iface MIXER - name 'CD Playback Switch' - value true - } - control.17 { - comment.access 'read write' - comment.type INTEGER - comment.count 2 - comment.range '0 - 31' - iface MIXER - name 'CD Playback Volume' - value.0 29 - value.1 29 - } - control.18 { - comment.access 'read write' - comment.type BOOLEAN - comment.count 1 - iface MIXER - name 'Video Playback Switch' - value true - } - control.19 { - comment.access 'read write' - comment.type INTEGER - comment.count 2 - comment.range '0 - 31' - iface MIXER - name 'Video Playback Volume' - value.0 31 - value.1 31 - } - control.20 { - comment.access 'read write' - comment.type BOOLEAN - comment.count 1 - iface MIXER - name 'Aux Playback Switch' - value true - } - control.21 { - comment.access 'read write' - comment.type INTEGER - comment.count 2 - comment.range '0 - 31' - iface MIXER - name 'Aux Playback Volume' - value.0 31 - value.1 31 - } - control.22 { - comment.access 'read write' - comment.type BOOLEAN - comment.count 1 - iface MIXER - name 'PCM Playback Switch' - value true - } - control.23 { - comment.access 'read write' - comment.type INTEGER - comment.count 2 - comment.range '0 - 31' - iface MIXER - name 'PCM Playback Volume' - value.0 31 - value.1 31 - } - control.24 { - comment.access 'read write' - comment.type ENUMERATED - comment.count 2 - comment.item.0 Mic - comment.item.1 CD - comment.item.2 Video - comment.item.3 Aux - comment.item.4 Line - comment.item.5 Mix - comment.item.6 'Mix Mono' - comment.item.7 Phone - iface MIXER - name 'Capture Source' - value.0 Mic - value.1 Mic - } - control.25 { - comment.access 'read write' - comment.type BOOLEAN - comment.count 1 - iface MIXER - name 'Capture Switch' - value true - } - control.26 { - comment.access 'read write' - comment.type INTEGER - comment.count 2 - comment.range '0 - 15' - iface MIXER - name 'Capture Volume' - value.0 15 - value.1 15 - } - control.27 { - comment.access 'read write' - comment.type BOOLEAN - comment.count 1 - iface MIXER - name '3D Control - Switch' - value true - } - control.28 { - comment.access 'read write' - comment.type ENUMERATED - comment.count 1 - comment.item.0 Mix - comment.item.1 Mic - iface MIXER - name 'Mono Output Select' - value Mix - } - control.29 { - comment.access 'read write' - comment.type ENUMERATED - comment.count 1 - comment.item.0 Mic1 - comment.item.1 Mic2 - iface MIXER - name 'Mic Select' - value Mic1 - } - control.30 { - comment.access 'read write' - comment.type INTEGER - comment.count 1 - comment.range '0 - 15' - iface MIXER - name '3D Control - Center' - value 15 - } - control.31 { - comment.access 'read write' - comment.type INTEGER - comment.count 1 - comment.range '0 - 15' - iface MIXER - name '3D Control - Depth' - value 15 - } - control.32 { - comment.access 'read write' - comment.type BOOLEAN - comment.count 1 - iface MIXER - name 'External Amplifier' - value true - } - control.33 { - comment.access 'read write' - comment.type ENUMERATED - comment.count 1 - comment.item.0 Input1 - comment.item.1 Input2 - iface MIXER - name 'Input Source Select' - value Input1 - } - control.34 { - comment.access 'read write' - comment.type ENUMERATED - comment.count 1 - comment.item.0 Input1 - comment.item.1 Input2 - iface MIXER - name 'Input Source Select' - index 1 - value Input1 - } - control.35 { - comment.access 'read write' - comment.type INTEGER - comment.count 2 - comment.range '0 - 31' - iface MIXER - name 'VIA DXS Playback Volume' - value.0 31 - value.1 31 - } - control.36 { - comment.access 'read write' - comment.type INTEGER - comment.count 2 - comment.range '0 - 31' - iface MIXER - name 'VIA DXS Playback Volume' - index 1 - value.0 31 - value.1 31 - } - control.37 { - comment.access 'read write' - comment.type INTEGER - comment.count 2 - comment.range '0 - 31' - iface MIXER - name 'VIA DXS Playback Volume' - index 2 - value.0 31 - value.1 31 - } - control.38 { - comment.access 'read write' - comment.type INTEGER - comment.count 2 - comment.range '0 - 31' - iface MIXER - name 'VIA DXS Playback Volume' - index 3 - value.0 31 - value.1 31 - } + control.1 { + comment.access 'read write' + comment.type BOOLEAN + comment.count 1 + iface MIXER + name 'Master Playback Switch' + value true + } + control.2 { + comment.access 'read write' + comment.type INTEGER + comment.count 2 + comment.range '0 - 31' + iface MIXER + name 'Master Playback Volume' + value.0 30 + value.1 30 + } + control.3 { + comment.access 'read write' + comment.type BOOLEAN + comment.count 1 + iface MIXER + name 'Headphone Playback Switch' + value true + } + control.4 { + comment.access 'read write' + comment.type INTEGER + comment.count 2 + comment.range '0 - 31' + iface MIXER + name 'Headphone Playback Volume' + value.0 30 + value.1 30 + } + control.5 { + comment.access 'read write' + comment.type BOOLEAN + comment.count 1 + iface MIXER + name 'Master Mono Playback Switch' + value true + } + control.6 { + comment.access 'read write' + comment.type INTEGER + comment.count 1 + comment.range '0 - 31' + iface MIXER + name 'Master Mono Playback Volume' + value 31 + } + control.7 { + comment.access 'read write' + comment.type BOOLEAN + comment.count 1 + iface MIXER + name 'PC Speaker Playback Switch' + value true + } + control.8 { + comment.access 'read write' + comment.type INTEGER + comment.count 1 + comment.range '0 - 15' + iface MIXER + name 'PC Speaker Playback Volume' + value 15 + } + control.9 { + comment.access 'read write' + comment.type BOOLEAN + comment.count 1 + iface MIXER + name 'Phone Playback Switch' + value true + } + control.10 { + comment.access 'read write' + comment.type INTEGER + comment.count 1 + comment.range '0 - 31' + iface MIXER + name 'Phone Playback Volume' + value 31 + } + control.11 { + comment.access 'read write' + comment.type BOOLEAN + comment.count 1 + iface MIXER + name 'Mic Playback Switch' + value true + } + control.12 { + comment.access 'read write' + comment.type INTEGER + comment.count 1 + comment.range '0 - 31' + iface MIXER + name 'Mic Playback Volume' + value 31 + } + control.13 { + comment.access 'read write' + comment.type BOOLEAN + comment.count 1 + iface MIXER + name 'Mic Boost (+20dB)' + value true + } + control.14 { + comment.access 'read write' + comment.type BOOLEAN + comment.count 1 + iface MIXER + name 'Line Playback Switch' + value true + } + control.15 { + comment.access 'read write' + comment.type INTEGER + comment.count 2 + comment.range '0 - 31' + iface MIXER + name 'Line Playback Volume' + value.0 31 + value.1 31 + } + control.16 { + comment.access 'read write' + comment.type BOOLEAN + comment.count 1 + iface MIXER + name 'CD Playback Switch' + value true + } + control.17 { + comment.access 'read write' + comment.type INTEGER + comment.count 2 + comment.range '0 - 31' + iface MIXER + name 'CD Playback Volume' + value.0 29 + value.1 29 + } + control.18 { + comment.access 'read write' + comment.type BOOLEAN + comment.count 1 + iface MIXER + name 'Video Playback Switch' + value true + } + control.19 { + comment.access 'read write' + comment.type INTEGER + comment.count 2 + comment.range '0 - 31' + iface MIXER + name 'Video Playback Volume' + value.0 31 + value.1 31 + } + control.20 { + comment.access 'read write' + comment.type BOOLEAN + comment.count 1 + iface MIXER + name 'Aux Playback Switch' + value true + } + control.21 { + comment.access 'read write' + comment.type INTEGER + comment.count 2 + comment.range '0 - 31' + iface MIXER + name 'Aux Playback Volume' + value.0 31 + value.1 31 + } + control.22 { + comment.access 'read write' + comment.type BOOLEAN + comment.count 1 + iface MIXER + name 'PCM Playback Switch' + value true + } + control.23 { + comment.access 'read write' + comment.type INTEGER + comment.count 2 + comment.range '0 - 31' + iface MIXER + name 'PCM Playback Volume' + value.0 31 + value.1 31 + } + control.24 { + comment.access 'read write' + comment.type ENUMERATED + comment.count 2 + comment.item.0 Mic + comment.item.1 CD + comment.item.2 Video + comment.item.3 Aux + comment.item.4 Line + comment.item.5 Mix + comment.item.6 'Mix Mono' + comment.item.7 Phone + iface MIXER + name 'Capture Source' + value.0 Mic + value.1 Mic + } + control.25 { + comment.access 'read write' + comment.type BOOLEAN + comment.count 1 + iface MIXER + name 'Capture Switch' + value true + } + control.26 { + comment.access 'read write' + comment.type INTEGER + comment.count 2 + comment.range '0 - 15' + iface MIXER + name 'Capture Volume' + value.0 15 + value.1 15 + } + control.27 { + comment.access 'read write' + comment.type BOOLEAN + comment.count 1 + iface MIXER + name '3D Control - Switch' + value true + } + control.28 { + comment.access 'read write' + comment.type ENUMERATED + comment.count 1 + comment.item.0 Mix + comment.item.1 Mic + iface MIXER + name 'Mono Output Select' + value Mix + } + control.29 { + comment.access 'read write' + comment.type ENUMERATED + comment.count 1 + comment.item.0 Mic1 + comment.item.1 Mic2 + iface MIXER + name 'Mic Select' + value Mic1 + } + control.30 { + comment.access 'read write' + comment.type INTEGER + comment.count 1 + comment.range '0 - 15' + iface MIXER + name '3D Control - Center' + value 15 + } + control.31 { + comment.access 'read write' + comment.type INTEGER + comment.count 1 + comment.range '0 - 15' + iface MIXER + name '3D Control - Depth' + value 15 + } + control.32 { + comment.access 'read write' + comment.type BOOLEAN + comment.count 1 + iface MIXER + name 'External Amplifier' + value true + } + control.33 { + comment.access 'read write' + comment.type ENUMERATED + comment.count 1 + comment.item.0 Input1 + comment.item.1 Input2 + iface MIXER + name 'Input Source Select' + value Input1 + } + control.34 { + comment.access 'read write' + comment.type ENUMERATED + comment.count 1 + comment.item.0 Input1 + comment.item.1 Input2 + iface MIXER + name 'Input Source Select' + index 1 + value Input1 + } + control.35 { + comment.access 'read write' + comment.type INTEGER + comment.count 2 + comment.range '0 - 31' + iface MIXER + name 'VIA DXS Playback Volume' + value.0 31 + value.1 31 + } + control.36 { + comment.access 'read write' + comment.type INTEGER + comment.count 2 + comment.range '0 - 31' + iface MIXER + name 'VIA DXS Playback Volume' + index 1 + value.0 31 + value.1 31 + } + control.37 { + comment.access 'read write' + comment.type INTEGER + comment.count 2 + comment.range '0 - 31' + iface MIXER + name 'VIA DXS Playback Volume' + index 2 + value.0 31 + value.1 31 + } + control.38 { + comment.access 'read write' + comment.type INTEGER + comment.count 2 + comment.range '0 - 31' + iface MIXER + name 'VIA DXS Playback Volume' + index 3 + value.0 31 + value.1 31 + } } diff --git a/doc/examples/suse-12.3/suse-vm-guest/config.xml b/doc/examples/suse-12.3/suse-vm-guest/config.xml index 0934d6b16..86489d81a 100644 --- a/doc/examples/suse-12.3/suse-vm-guest/config.xml +++ b/doc/examples/suse-12.3/suse-vm-guest/config.xml @@ -1,44 +1,44 @@ - - Marcus Schäfer - ms@novell.com - openSUSE 12.3 virtual disk system - - - - - - - - 1.1.2 - zypper - false - true - en_US - us.map.gz - - - - - - - - - - - - - - - - - - - - - - - + + Marcus Schäfer + ms@novell.com + openSUSE 12.3 virtual disk system + + + + + + + + 1.1.2 + zypper + false + true + en_US + us.map.gz + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/examples/suse-12.3/suse-xen-guest/config.xml b/doc/examples/suse-12.3/suse-xen-guest/config.xml index 42ddb2979..8dca41b23 100644 --- a/doc/examples/suse-12.3/suse-xen-guest/config.xml +++ b/doc/examples/suse-12.3/suse-xen-guest/config.xml @@ -1,46 +1,46 @@ - - Marcus Schäfer - ms@novell.com - openSUSE 12.3 xen guest system - - - 1.1.2 - zypper - false - true - en_US - us.map.gz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + Marcus Schäfer + ms@novell.com + openSUSE 12.3 xen guest system + + + 1.1.2 + zypper + false + true + en_US + us.map.gz + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/examples/suse-13.1/suse-docker-container/config.xml b/doc/examples/suse-13.1/suse-docker-container/config.xml index 69dc1834a..fe358665e 100644 --- a/doc/examples/suse-13.1/suse-docker-container/config.xml +++ b/doc/examples/suse-13.1/suse-docker-container/config.xml @@ -1,40 +1,40 @@ - - Flavio Castelli - fcastelli@suse.com - openSUSE 13.1 docker container - - - - - - - - - 1.0.0 - zypper - false - true - en_US - us.map.gz - utc - US/Eastern - - - - - - - - - - - - - - - - + + Flavio Castelli + fcastelli@suse.com + openSUSE 13.1 docker container + + + + + + + + + 1.0.0 + zypper + false + true + en_US + us.map.gz + utc + US/Eastern + + + + + + + + + + + + + + + + diff --git a/doc/examples/suse-13.1/suse-ec2-guest/config.xml b/doc/examples/suse-13.1/suse-ec2-guest/config.xml index 41345882e..b00af4637 100644 --- a/doc/examples/suse-13.1/suse-ec2-guest/config.xml +++ b/doc/examples/suse-13.1/suse-ec2-guest/config.xml @@ -1,42 +1,42 @@ - - Marcus Schäfer - ms@novell.com - openSUSE 13.1 ec2 guest system - - - 2.0.0 - zypper - false - true - en_US - us.map.gz - - - - - - - - - - - - - - - - - - - - - - - - - - + + Marcus Schäfer + ms@novell.com + openSUSE 13.1 ec2 guest system + + + 2.0.0 + zypper + false + true + en_US + us.map.gz + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/examples/suse-13.1/suse-live-iso/config-yast-firstboot.xml b/doc/examples/suse-13.1/suse-live-iso/config-yast-firstboot.xml index 8e298fd1c..32ca512b4 100644 --- a/doc/examples/suse-13.1/suse-live-iso/config-yast-firstboot.xml +++ b/doc/examples/suse-13.1/suse-live-iso/config-yast-firstboot.xml @@ -1,124 +1,124 @@ + xmlns:config="http://www.suse.com/1.0/configns"> - + - firstboot + firstboot - - - firstboot_hardware - installation - firstboot - - - x11 - printer - sound - bluetooth - - - - firstboot_network - installation - firstboot - - - lan - - - - - - - yes - yes - all - - firstboot - - installation - - - - false - firstboot_language - - - - firstboot_welcome - - - - firstboot_license_novell - - - - firstboot_license - - - true - firstboot_ssh - - - - true - firstboot_timezone - - - - true - firstboot_keyboard - - - - true - inst_hostname - - - - inst_proposal - true - firstboot_network - - - - false - firstboot_desktop - - - - true - firstboot_network_write - - - - true - inst_root - - - - inst_proposal - true - firstboot_hardware - - - - firstboot_write - no - no - - - - inst_congratulate - - - - + + + firstboot_hardware + installation + firstboot + + + x11 + printer + sound + bluetooth + + + + firstboot_network + installation + firstboot + + + lan + + + + + + + yes + yes + all + + firstboot + + installation + + + + false + firstboot_language + + + + firstboot_welcome + + + + firstboot_license_novell + + + + firstboot_license + + + true + firstboot_ssh + + + + true + firstboot_timezone + + + + true + firstboot_keyboard + + + + true + inst_hostname + + + + inst_proposal + true + firstboot_network + + + + false + firstboot_desktop + + + + true + firstboot_network_write + + + + true + inst_root + + + + inst_proposal + true + firstboot_hardware + + + + firstboot_write + no + no + + + + inst_congratulate + + + + diff --git a/doc/examples/suse-13.1/suse-live-iso/config.xml b/doc/examples/suse-13.1/suse-live-iso/config.xml index 364a5babd..a15153e6c 100644 --- a/doc/examples/suse-13.1/suse-live-iso/config.xml +++ b/doc/examples/suse-13.1/suse-live-iso/config.xml @@ -1,57 +1,57 @@ - - Marcus Schäfer - ms@novell.com - openSUSE 13.1 Live system for CD/DVD and USB Stick - - - - 2.5.2 - zypper - false - true - en_US - us.map.gz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + Marcus Schäfer + ms@novell.com + openSUSE 13.1 Live system for CD/DVD and USB Stick + + + + 2.5.2 + zypper + false + true + en_US + us.map.gz + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/examples/suse-13.1/suse-live-iso/root/etc/init.d/boot.local b/doc/examples/suse-13.1/suse-live-iso/root/etc/init.d/boot.local index 3a4b75bd6..95ad0a6a7 100755 --- a/doc/examples/suse-13.1/suse-live-iso/root/etc/init.d/boot.local +++ b/doc/examples/suse-13.1/suse-live-iso/root/etc/init.d/boot.local @@ -1,17 +1,17 @@ #!/bin/bash function dn { - local part=$1 - local part_new=$(echo $part | sed -e 's@\(^.*\)\(p.*$\)@\1@') - if [ $part = $part_new ];then - part_new=$(echo $part | sed -e 's@\(^.*\)\([0-9].*$\)@\1@') - fi - echo $part_new + local part=$1 + local part_new=$(echo $part | sed -e 's@\(^.*\)\(p.*$\)@\1@') + if [ $part = $part_new ];then + part_new=$(echo $part | sed -e 's@\(^.*\)\([0-9].*$\)@\1@') + fi + echo $part_new } bootdev=$(dn $(pvdisplay -c | cut -f1 -d:)) if [ ! -e ${bootdev}1 ];then - return + return fi mkdir -p /media/stickstorage diff --git a/doc/examples/suse-13.1/suse-live-usbstick/config-yast-firstboot.xml b/doc/examples/suse-13.1/suse-live-usbstick/config-yast-firstboot.xml index 57ef8f177..d85d72608 100644 --- a/doc/examples/suse-13.1/suse-live-usbstick/config-yast-firstboot.xml +++ b/doc/examples/suse-13.1/suse-live-usbstick/config-yast-firstboot.xml @@ -1,124 +1,124 @@ + xmlns:config="http://www.suse.com/1.0/configns"> - + - firstboot + firstboot - - - firstboot_hardware - installation - firstboot - - - x11 - printer - sound - bluetooth - - - - firstboot_network - installation - firstboot - - - lan - - - - - - - yes - yes - all - - firstboot - - installation - - - - false - firstboot_language - - - - firstboot_welcome - - - - firstboot_license_novell - - - - firstboot_license - - - true - firstboot_ssh - - - - true - firstboot_timezone - - - - true - firstboot_keyboard - - - - true - inst_hostname - - - - inst_proposal - true - firstboot_network - - - - false - firstboot_desktop - - - - true - firstboot_network_write - - - - true - inst_root - - - - inst_proposal - true - firstboot_hardware - - - - firstboot_write - no - no - - - - inst_congratulate - - - - + + + firstboot_hardware + installation + firstboot + + + x11 + printer + sound + bluetooth + + + + firstboot_network + installation + firstboot + + + lan + + + + + + + yes + yes + all + + firstboot + + installation + + + + false + firstboot_language + + + + firstboot_welcome + + + + firstboot_license_novell + + + + firstboot_license + + + true + firstboot_ssh + + + + true + firstboot_timezone + + + + true + firstboot_keyboard + + + + true + inst_hostname + + + + inst_proposal + true + firstboot_network + + + + false + firstboot_desktop + + + + true + firstboot_network_write + + + + true + inst_root + + + + inst_proposal + true + firstboot_hardware + + + + firstboot_write + no + no + + + + inst_congratulate + + + + diff --git a/doc/examples/suse-13.1/suse-live-usbstick/config.xml b/doc/examples/suse-13.1/suse-live-usbstick/config.xml index 010ffe896..269a56bfa 100644 --- a/doc/examples/suse-13.1/suse-live-usbstick/config.xml +++ b/doc/examples/suse-13.1/suse-live-usbstick/config.xml @@ -1,53 +1,53 @@ - - Marcus Schäfer - ms@novell.com - openSUSE 13.1 Live system for CD/DVD and USB Stick - - - - 3 - - 512 - true - true - - - - 2.5.3 - zypper - false - true - en_US - us.map.gz - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + Marcus Schäfer + ms@novell.com + openSUSE 13.1 Live system for CD/DVD and USB Stick + + + + 3 + + 512 + true + true + + + + 2.5.3 + zypper + false + true + en_US + us.map.gz + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/examples/suse-13.1/suse-live-usbstick/root/etc/init.d/boot.local b/doc/examples/suse-13.1/suse-live-usbstick/root/etc/init.d/boot.local index 3a4b75bd6..95ad0a6a7 100755 --- a/doc/examples/suse-13.1/suse-live-usbstick/root/etc/init.d/boot.local +++ b/doc/examples/suse-13.1/suse-live-usbstick/root/etc/init.d/boot.local @@ -1,17 +1,17 @@ #!/bin/bash function dn { - local part=$1 - local part_new=$(echo $part | sed -e 's@\(^.*\)\(p.*$\)@\1@') - if [ $part = $part_new ];then - part_new=$(echo $part | sed -e 's@\(^.*\)\([0-9].*$\)@\1@') - fi - echo $part_new + local part=$1 + local part_new=$(echo $part | sed -e 's@\(^.*\)\(p.*$\)@\1@') + if [ $part = $part_new ];then + part_new=$(echo $part | sed -e 's@\(^.*\)\([0-9].*$\)@\1@') + fi + echo $part_new } bootdev=$(dn $(pvdisplay -c | cut -f1 -d:)) if [ ! -e ${bootdev}1 ];then - return + return fi mkdir -p /media/stickstorage diff --git a/doc/examples/suse-13.1/suse-vm-guest/config.xml b/doc/examples/suse-13.1/suse-vm-guest/config.xml index d3f316dd4..6b4379e43 100644 --- a/doc/examples/suse-13.1/suse-vm-guest/config.xml +++ b/doc/examples/suse-13.1/suse-vm-guest/config.xml @@ -1,43 +1,43 @@ - - Marcus Schäfer - ms@novell.com - openSUSE 13.1 virtual disk system - - - - - - - - 1.1.2 - zypper - false - true - en_US - us.map.gz - - - - - - - - - - - - - - - - - - - - - - + + Marcus Schäfer + ms@novell.com + openSUSE 13.1 virtual disk system + + + + + + + + 1.1.2 + zypper + false + true + en_US + us.map.gz + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/examples/suse-13.2/suse-live-iso/config-yast-firstboot.xml b/doc/examples/suse-13.2/suse-live-iso/config-yast-firstboot.xml index 8e298fd1c..32ca512b4 100644 --- a/doc/examples/suse-13.2/suse-live-iso/config-yast-firstboot.xml +++ b/doc/examples/suse-13.2/suse-live-iso/config-yast-firstboot.xml @@ -1,124 +1,124 @@ + xmlns:config="http://www.suse.com/1.0/configns"> - + - firstboot + firstboot - - - firstboot_hardware - installation - firstboot - - - x11 - printer - sound - bluetooth - - - - firstboot_network - installation - firstboot - - - lan - - - - - - - yes - yes - all - - firstboot - - installation - - - - false - firstboot_language - - - - firstboot_welcome - - - - firstboot_license_novell - - - - firstboot_license - - - true - firstboot_ssh - - - - true - firstboot_timezone - - - - true - firstboot_keyboard - - - - true - inst_hostname - - - - inst_proposal - true - firstboot_network - - - - false - firstboot_desktop - - - - true - firstboot_network_write - - - - true - inst_root - - - - inst_proposal - true - firstboot_hardware - - - - firstboot_write - no - no - - - - inst_congratulate - - - - + + + firstboot_hardware + installation + firstboot + + + x11 + printer + sound + bluetooth + + + + firstboot_network + installation + firstboot + + + lan + + + + + + + yes + yes + all + + firstboot + + installation + + + + false + firstboot_language + + + + firstboot_welcome + + + + firstboot_license_novell + + + + firstboot_license + + + true + firstboot_ssh + + + + true + firstboot_timezone + + + + true + firstboot_keyboard + + + + true + inst_hostname + + + + inst_proposal + true + firstboot_network + + + + false + firstboot_desktop + + + + true + firstboot_network_write + + + + true + inst_root + + + + inst_proposal + true + firstboot_hardware + + + + firstboot_write + no + no + + + + inst_congratulate + + + + diff --git a/doc/examples/suse-13.2/suse-live-iso/config.xml b/doc/examples/suse-13.2/suse-live-iso/config.xml index 05dd44898..6de61d0a0 100644 --- a/doc/examples/suse-13.2/suse-live-iso/config.xml +++ b/doc/examples/suse-13.2/suse-live-iso/config.xml @@ -1,57 +1,57 @@ - - Marcus Schäfer - ms@novell.com - openSUSE 13.2 Live system for CD/DVD and USB Stick - - - - 2.5.2 - zypper - false - true - en_US - us.map.gz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + Marcus Schäfer + ms@novell.com + openSUSE 13.2 Live system for CD/DVD and USB Stick + + + + 2.5.2 + zypper + false + true + en_US + us.map.gz + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/schema/susesync b/doc/schema/susesync index 3e438df0b..6374e5130 100755 --- a/doc/schema/susesync +++ b/doc/schema/susesync @@ -1,3 +1,3 @@ rsync -rlvt images kiwi.html index.html \ - kiwi0.html kiwi1.html kiwi_indexList.html xsdDocHtml.css \ - community.opensuse.org:doc.opensuse.org/htdocs/projects/kiwi/schema-doc + kiwi0.html kiwi1.html kiwi_indexList.html xsdDocHtml.css \ + community.opensuse.org:doc.opensuse.org/htdocs/projects/kiwi/schema-doc diff --git a/doc/susebooks.css b/doc/susebooks.css index d288455cb..eb2d0213c 100644 --- a/doc/susebooks.css +++ b/doc/susebooks.css @@ -1,623 +1,623 @@ body { - -moz-border-radius:1em; - -moz-box-shadow:0 2px 20px rgba(0,0,0,0.15); - -webkit-border-radius:1em; - -webkit-box-shadow:0 2px 20px rgba(0,0,0,0.15); - background-color:#fff; - color:#333; - font-family:DejaVuSans,LiberationSans,FreeSans,Arial,Helvetica,sans; - line-height:1.65; - margin:2em auto; - padding:2em; - position:relative; + -moz-border-radius:1em; + -moz-box-shadow:0 2px 20px rgba(0,0,0,0.15); + -webkit-border-radius:1em; + -webkit-box-shadow:0 2px 20px rgba(0,0,0,0.15); + background-color:#fff; + color:#333; + font-family:DejaVuSans,LiberationSans,FreeSans,Arial,Helvetica,sans; + line-height:1.65; + margin:2em auto; + padding:2em; + position:relative; } body div.preface,body div.glossary,body div.appendix,body div.bibliography,body div.index,body div.chapter,body div.sect1,body div.sect2,body div.sect3 { - padding-left:5pt; - padding-right:5pt; - padding-top:20pt; + padding-left:5pt; + padding-right:5pt; + padding-top:20pt; } div.set div.titlepage .title { - background-color:#FFF; - color:#666; - font-size:300%; - font-style:normal; - font-weight:400; - text-align:center; + background-color:#FFF; + color:#666; + font-size:300%; + font-style:normal; + font-weight:400; + text-align:center; } div.preface div.sect1,div.glossary div.sect,div.appendix div.sect,div.bibliography div.sect1,div.chapter div.sect1,div.sect1 div.sect2,div.sect2 div.sect3 { - padding:0; + padding:0; } div.book div.titlepage { - margin-top:3em; + margin-top:3em; } div.book div.titlepage h1.title,div.book div.titlepage h1.productname,div.article div.titlepage h2.title { - color:#6a9d00; - font-size:300%; - font-style:normal; - font-weight:400; - margin-bottom:0; - margin-top:-.5em; - text-align:center; + color:#6a9d00; + font-size:300%; + font-style:normal; + font-weight:400; + margin-bottom:0; + margin-top:-.5em; + text-align:center; } div.book div.titlepage h2.subtitle,div.article div.titlepage h3.subtitle { - color:#6a9d00; - font-size:200%; - font-style:normal; - font-weight:400; - margin-top:0; - text-align:center; + color:#6a9d00; + font-size:200%; + font-style:normal; + font-weight:400; + margin-top:0; + text-align:center; } div.userfootercontent { - font-size:50%; + font-size:50%; } div.toc p { - font-size:100%; - margin-bottom:-.75em; + font-size:100%; + margin-bottom:-.75em; } div.set div.toc dt >.book *,div.set div.toc dt >.book em,div.set div.toc dt >.article * { - display:block; - font-size:larger; - font-style:normal; - margin-top:1.5em; + display:block; + font-size:larger; + font-style:normal; + margin-top:1.5em; } div.set div.toc dt >.article { - display:block; - margin-left:-1em; - padding-left:0; - text-indent:0; + display:block; + margin-left:-1em; + padding-left:0; + text-indent:0; } div.set div.toc dt >.part,div.book div.toc dt >.part { - display:block; - font-size:x-large; - margin-top:1.5em; + display:block; + font-size:x-large; + margin-top:1.5em; } div.book div.toc dt >.chapter,div.book div.toc dt >.preface,div.part div.toc dt >.chapter { - display:block; - font-size:larger; - margin-top:1.25em; + display:block; + font-size:larger; + margin-top:1.25em; } div.list-of-examples p,div.list-of-figures p,div.list-of-tables p { - margin-bottom:-.75em; + margin-bottom:-.75em; } div.preface div.titlepage .title,div.appendix div.titlepage .title,div.chapter div.titlepage .title,div.glossary div.titlepage .title,div.glossary div.titlepage .title,div.bibliography div.titlepage .title,div.index div.titlepage .title { - background-color:transparent; - color:#6a9d00; - font-size:180%; - text-align:center; + background-color:transparent; + color:#6a9d00; + font-size:180%; + text-align:center; } div.part div.titlepage h1.title { - color:#6a9d00; - font-size:300%; - text-align:center; + color:#6a9d00; + font-size:300%; + text-align:center; } div.abstract { - margin-left:5ex; - margin-right:5ex; + margin-left:5ex; + margin-right:5ex; } div.abstract p.title { - margin-bottom:-.5em; + margin-bottom:-.5em; } div.abstract p { - margin-top:.25em; + margin-top:.25em; } div.sect1 div.titlepage .title,div.sect2 div.titlepage .title,div.sect3 div.titlepage .title { - color:#6a9d00; - font-style:normal; - margin-bottom:-.75em; - margin-top:.5em; - text-align:left; + color:#6a9d00; + font-style:normal; + margin-bottom:-.75em; + margin-top:.5em; + text-align:left; } div.sect1 div.titlepage .title { - font-size:150%; + font-size:150%; } div.sect2 div.titlepage .title { - font-size:125%; + font-size:125%; } div.sect3 div.titlepage .title { - font-size:112%; + font-size:112%; } div.sect1 div.titlepage h4.title,div.sect2 div.titlepage h4.title,div.sect3 div.titlepage h4.title { - color:#6a9d00; - font-size:medium; + color:#6a9d00; + font-size:medium; } div.sect1 >em.remark { - display:block; - margin-top:1em; + display:block; + margin-top:1em; } div.figure .title,div.procedure .title,div.table .title { - border-style:none; - color:#000; - font-style:oblique; - font-weight:bolder; - margin-bottom:-.5em; + border-style:none; + color:#000; + font-style:oblique; + font-weight:bolder; + margin-bottom:-.5em; } div.example { - margin-bottom:1em; - margin-top:1em; + margin-bottom:1em; + margin-top:1em; } div.example-contents { - margin-top:-.75em; + margin-top:-.75em; } h2.title { - font-size:large; - font-style:normal; - font-weight:700; + font-size:large; + font-style:normal; + font-weight:700; } h1.title { - font-size:x-large; - font-style:normal; - font-weight:700; + font-size:x-large; + font-style:normal; + font-weight:700; } h2.subtitle { - font-size:large; + font-size:large; } .synopfragment { - display:block; + display:block; } .mediaobject { - margin-bottom:.5em; - margin-top:.5em; + margin-bottom:.5em; + margin-top:.5em; } div.important,div.warning,div.tip,div.caution,div.note { - margin-bottom:2ex; - margin-left:.5in; - margin-top:2ex; - overflow:auto; - width:70%; + margin-bottom:2ex; + margin-left:.5in; + margin-top:2ex; + overflow:auto; + width:70%; } div.note,div.tip { - border:1px solid #629900; + border:1px solid #629900; } div.important,div.warning { - border:1px solid #f60; + border:1px solid #f60; } div.important h3.title,div.note h3.title { - background-color:#f60; - color:#fff; - font-size:large; - font-style:oblique; - padding:3px; + background-color:#f60; + color:#fff; + font-size:large; + font-style:oblique; + padding:3px; } div.warning h3.title { - background-color:#C00000; - color:#fff; - font-style:oblique; - padding:3px; + background-color:#C00000; + color:#fff; + font-style:oblique; + padding:3px; } div.warning table tr.head td,div.warning table tr.head th { - background-color:#f60; - color:#fff; - padding:3px; - vertical-align:middle; + background-color:#f60; + color:#fff; + padding:3px; + vertical-align:middle; } div.important table tr.head td,div.important table tr.head th { - background-color:#ff8000; - color:#fff; - padding:3px; - vertical-align:middle; + background-color:#ff8000; + color:#fff; + padding:3px; + vertical-align:middle; } div.tip table tr.head td,div.tip table tr.head th,div.note table tr.head td,div.note table tr.head th { - background-color:#690; - color:#fff; - padding:3px; - vertical-align:middle; + background-color:#690; + color:#fff; + padding:3px; + vertical-align:middle; } td img { - border:0; + border:0; } .docstatus { - background-color:red; - border-top:1pt dotted #000; - color:#FFF; - margin-top:1em; - padding-bottom:.5em; - padding-top:.5em; + background-color:red; + border-top:1pt dotted #000; + color:#FFF; + margin-top:1em; + padding-bottom:.5em; + padding-top:.5em; } p.boxtext { - margin:10px; + margin:10px; } b.keycap,.keycap { - background-color:#eeeee6; - border:1px solid #999; - font-size:small; - margin:0; - padding:1px 5px; + background-color:#eeeee6; + border:1px solid #999; + font-size:small; + margin:0; + padding:1px 5px; } .guibutton { - border:1px outset #999; + border:1px outset #999; } .guilabel { - color:#80AA50; + color:#80AA50; } .permalink { - background-color:transparent; - color:transparent; - text-decoration:none; - font-size:smaller; - margin-left:0.25em; - margin-right:0.25em; - padding-left:0.5em; - padding-right:0.5em; + background-color:transparent; + color:transparent; + text-decoration:none; + font-size:smaller; + margin-left:0.25em; + margin-right:0.25em; + padding-left:0.5em; + padding-right:0.5em; } .permalink a:link { - background-color:transparent; - color:lightgray; - text-decoration:none; + background-color:transparent; + color:lightgray; + text-decoration:none; } .permalink a:visited { - background-color:transparent; - color:lightgray; - text-decoration:none; + background-color:transparent; + color:lightgray; + text-decoration:none; } .permalink a:hover { - background-color:transparent; - color:#6a9d00; - text-decoration:none; + background-color:transparent; + color:#6a9d00; + text-decoration:none; } .remark { - color:red; + color:red; } em .identifier { - color:#C30; - font-weight:700; + color:#C30; + font-weight:700; } .informaltable table thead th,.table table thead th { - background-color:#eeeee6; - border-top:1px solid #000; - padding:.25em; + background-color:#eeeee6; + border-top:1px solid #000; + padding:.25em; } .table table { - margin-top:.5em; + margin-top:.5em; } .informaltable table td,.table table td { - padding:.25em; + padding:.25em; } .table table .itemizedlist,.informaltable table .itemizedlist { - margin-left:0; - padding-left:.5em; + margin-left:0; + padding-left:.5em; } .table table,.informaltable table { - border:none; - border-bottom:1pt solid #000; - border-collapse:collapse; - border-top:1pt solid #000; + border:none; + border-bottom:1pt solid #000; + border-collapse:collapse; + border-top:1pt solid #000; } .table td,.informaltable td { - border-color:#000; - border-left:none; - border-right:none; - border-style:dotted; - border-width:1.5pt; + border-color:#000; + border-left:none; + border-right:none; + border-style:dotted; + border-width:1.5pt; } span.profarch { - font-weight:700; + font-weight:700; } .variablelist dt { - margin-bottom:0; + margin-bottom:0; } .variablelist dd { - margin-bottom:1.5em; - margin-top:-.75em; + margin-bottom:1.5em; + margin-top:-.75em; } div.calloutlist table td { - line-height:1.5; + line-height:1.5; } .navheader { - -moz-border-radius:.65em; - -webkit-border-radius:.65em; - background-color:#fff); - border-bottom:none; - margin:-1.5em!important; - padding:0 1em; + -moz-border-radius:.65em; + -webkit-border-radius:.65em; + background-color:#fff); + border-bottom:none; + margin:-1.5em!important; + padding:0 1em; } .navfooter { - background-color:#f9f9f9; - border-top:2px groove #fff; + background-color:#f9f9f9; + border-top:2px groove #fff; } :link { - color:#6a9d00; + color:#6a9d00; } :visited { - color:#444; + color:#444; } .filename,.systemitem,.envar,.command,.option,.replaceable { - font-family:DejaVuSansMono,LiberationMono,FreeMono,monospace; + font-family:DejaVuSansMono,LiberationMono,FreeMono,monospace; } div.breadcrumbs { - display:inline; - font-size:normal; - line-height:1.5em; - margin-left:2em; + display:inline; + font-size:normal; + line-height:1.5em; + margin-left:2em; } div.breadcrumbs strong { - display:block; - font-style:normal; - font-weight:400; - padding-bottom:2pt; + display:block; + font-style:normal; + font-weight:400; + padding-bottom:2pt; } div.breadcrumbs strong a { - background-color:#6a9d00; - border:groove 2pt #000; - color:#FFF; - margin-right:.25em; - min-width:5em; - padding-left:4pt; - padding-right:4pt; - text-align:center; - text-decoration:none; + background-color:#6a9d00; + border:groove 2pt #000; + color:#FFF; + margin-right:.25em; + min-width:5em; + padding-left:4pt; + padding-right:4pt; + text-align:center; + text-decoration:none; } div.bgnavi { - border-left:inset 1.25pt #000; - padding-left:1em; + border-left:inset 1.25pt #000; + padding-left:1em; } div.bgnavi p { - margin-bottom:.1em; + margin-bottom:.1em; } span.bg-part,span.bg-chapter,span.bg-appendix { - border:dotted 1pt #000; - padding:1pt 3pt; + border:dotted 1pt #000; + padding:1pt 3pt; } span.bg-part-current,span.bg-chapter-current,span.bg-appendix-current,span.bg-article-current,span.bg-sect1-current { - background-color:#6a9d00; - color:#FFF; - padding:1pt 3pt; + background-color:#6a9d00; + color:#FFF; + padding:1pt 3pt; } .sgmltag-attribute { - background-color:transparent; - color: navy; + background-color:transparent; + color: navy; } .sgmltag-attvalue { - background-color:transparent; - color: brown; + background-color:transparent; + color: brown; } .sgmltag-sgmlcomment { - background-color:transparent; - color: orange; + background-color:transparent; + color: orange; } div.navheader table td,div.navfooter table td { - text-align:left; + text-align:left; } .screen { - font-size:larger; + font-size:larger; } body,img { - font-family:"liberation sans",arial,helvetica,sans-serif; - font-size:100%; - max-width:50em; + font-family:"liberation sans",arial,helvetica,sans-serif; + font-size:100%; + max-width:50em; } p { - line-height:1.4em; + line-height:1.4em; } img { - -moz-box-shadow:0 2px 8px rgba(0,0,0,0.2); - -webkit-box-shadow:0 2px 8px rgba(0,0,0,0.2); - border:1px solid rgba(0,0,0,0.2)!important; - padding:8px; + -moz-box-shadow:0 2px 8px rgba(0,0,0,0.2); + -webkit-box-shadow:0 2px 8px rgba(0,0,0,0.2); + border:1px solid rgba(0,0,0,0.2)!important; + padding:8px; } table img { - -moz-box-shadow:none; - -webkit-box-shadow:none; - border:none!important; - padding:0; + -moz-box-shadow:none; + -webkit-box-shadow:none; + border:none!important; + padding:0; } pre.screen { - -moz-border-radius:.5em; - -webkit-border-radius:.5em; - background-color:rgba(0,0,0,0.6); - color:#fff; - font-family:"droid mono",monospace; - font-size:smaller; - overflow:auto; - padding:.5em 1em; + -moz-border-radius:.5em; + -webkit-border-radius:.5em; + background-color:rgba(0,0,0,0.6); + color:#fff; + font-family:"droid mono",monospace; + font-size:smaller; + overflow:auto; + padding:.5em 1em; } .abstract { - border:.2em solid #ccc; - border-style:solid none; - margin:2em 0!important; - padding:.5em 2em; + border:.2em solid #ccc; + border-style:solid none; + margin:2em 0!important; + padding:.5em 2em; } .abstract .title { - padding-bottom:1em; + padding-bottom:1em; } .toc a { - padding-left:2em; - text-decoration:none; + padding-left:2em; + text-decoration:none; } .navheader a,div.breadcrumbs a { - -moz-border-radius:.5em; - -moz-box-shadow:0 1px 3px rgba(0,0,0,0.2); - -webkit-border-radius:1em; - -webkit-box-shadow:0 1px 3px rgba(0,0,0,0.2); - background-color:#777; - background-image:0 0 rgba(255,255,255,0.35) 100%; - border:1px solid rgba(0,0,0,0.1)!important; - border-style:none!important; - color:#fff; - float:left; - margin-bottom:1em; - margin-right:1em; - padding:.5em 1em; - text-decoration:none; - text-shadow:0 -1px 0 rgba(0,0,0,0.25); + -moz-border-radius:.5em; + -moz-box-shadow:0 1px 3px rgba(0,0,0,0.2); + -webkit-border-radius:1em; + -webkit-box-shadow:0 1px 3px rgba(0,0,0,0.2); + background-color:#777; + background-image:0 0 rgba(255,255,255,0.35) 100%; + border:1px solid rgba(0,0,0,0.1)!important; + border-style:none!important; + color:#fff; + float:left; + margin-bottom:1em; + margin-right:1em; + padding:.5em 1em; + text-decoration:none; + text-shadow:0 -1px 0 rgba(0,0,0,0.25); background-image:-webkit-gradient( linear, left bottom, left top, color-stop(0,rgba(255,255,255,0)), color-stop(1,rgba(255,255,255,0.35))); background-image:-moz-linear-gradient( center bottom, rgba(255,255,255,0.0) 0%, rgba(255,255,255,0.35) 100%); @@ -626,18 +626,18 @@ background-image:-moz-linear-gradient( center bottom, rgba(255,255,255,0.0) 0%, .breadcrumbs a:hover { - background-color:#ccc; - color:#000; - text-shadow:0 1px rgba(255,255,255,0.35); + background-color:#ccc; + color:#000; + text-shadow:0 1px rgba(255,255,255,0.35); } .breadcrumbs a:focus, .breadcrumbs a:active { - -moz-box-shadow:none; - -webkit-box-shadow:none; - background-color:#666 !important; - color:#fff; - text-shadow:0 -1px rgba(0,0,0,0.25); + -moz-box-shadow:none; + -webkit-box-shadow:none; + background-color:#666 !important; + color:#fff; + text-shadow:0 -1px rgba(0,0,0,0.25); background-image:-webkit-gradient( linear, left bottom, left top, color-stop(0,rgba(0,0,0,0)), color-stop(1,rgba(0,0,0,0.35))) !important; background-image:-moz-linear-gradient( center bottom, rgba(0,0,0,0.0) 0%, rgba(0,0,0,0.35) 100%) !important; @@ -648,31 +648,31 @@ background-image:-moz-linear-gradient( center bottom, rgba(0,0,0,0.0) 0%, rgba(0 .warning,.tip,.note,.caution { - -moz-border-radius:.4em; - -moz-box-shadow:0 2px 17px rgba(0,0,0,0.4); - -webkit-border-radius:.4em; - margin:1em 0em!important; - width:100%!important; + -moz-border-radius:.4em; + -moz-box-shadow:0 2px 17px rgba(0,0,0,0.4); + -webkit-border-radius:.4em; + margin:1em 0em!important; + width:100%!important; } div.authorgroup,div p.edition { - color:#000; + color:#000; } .guimenu,.guisubmenu,.replaceable { - font-style:italic; + font-style:italic; } div.logo,.bgnavi,.breadcrumbs-sep { - display:none; + display:none; } div.bgnavi p.bg-part,div.bgnavi p.bg-chapter { - margin-top:.5em; + margin-top:.5em; } diff --git a/doc/susesync b/doc/susesync index 8ee75062a..fc5f1c34c 100755 --- a/doc/susesync +++ b/doc/susesync @@ -1,2 +1,2 @@ rsync -rlvt images kiwi.html index.html susebooks.css \ - community.opensuse.org:doc.opensuse.org/htdocs/projects/kiwi/doc + community.opensuse.org:doc.opensuse.org/htdocs/projects/kiwi/doc diff --git a/editing/kiwi.sh b/editing/kiwi.sh index 577c53303..d21f09273 100644 --- a/editing/kiwi.sh +++ b/editing/kiwi.sh @@ -1,302 +1,302 @@ # kiwi bash completion script _kiwi() { - #======================================== - # Init completion - #---------------------------------------- - local cur prev opts - _get_comp_words_by_ref cur prev + #======================================== + # Init completion + #---------------------------------------- + local cur prev opts + _get_comp_words_by_ref cur prev - #======================================== - # Current base mode - #---------------------------------------- - local cmd=$(echo $COMP_LINE | cut -f2 -d " " | tr -d -) + #======================================== + # Current base mode + #---------------------------------------- + local cmd=$(echo $COMP_LINE | cut -f2 -d " " | tr -d -) - #======================================== - # Items to complete - #---------------------------------------- - __kiwi_descriptions - __kiwi_types + #======================================== + # Items to complete + #---------------------------------------- + __kiwi_descriptions + __kiwi_types - #======================================== - # Global options - #---------------------------------------- - opt_global=" - --logfile - --debug - --yes - --nocolor - --version - --help - " - #======================================== - # Basic commands - #---------------------------------------- - opts="$opt_global - --bootcd - --bootusb - --bootvm - --build - --bundle-build - --clone - --convert - --create - --createhash - --createpassword - --info - --list - --installcd - --installstick - --installpxe - --prepare - --test-image - --check-config - --upgrade - --describe - --init-cache - --setup-splash - " - #======================================== - # Command specific options to complete - #---------------------------------------- - opt_bootcd=" - " - opt_bootusb=" - " - opt_bootvm=" - --bootvm-system - --bootvm-disksize - " - opt_build=" - --recycle-root - --force-bootstrap - --cache - --add-profile - --set-repo - --set-repotype - --set-repoalias - --set-repoprio - --add-repo - --add-repotype - --add-repoalias - --add-repoprio - --ignore-repos - --package-manager - --check-kernel - --destdir - --type - --strip - --prebuiltbootimage - --archive-image - --isocheck - --lvm - --fs-blocksize - --fs-journalsize - --fs-inodesize - --fs-inoderatio - --fs-max-mount-count - --fs-check-interval - --fat-storage - --partitioner - --check-kernel - --mbrid - --gzip-cmd - --disk-start-sector - --disk-sector-size - --disk-alignment - --add-package - --add-pattern - --del-package - --edit-bootconfig - --edit-bootinstall - --grub-chainload - --targetdevice - --targetstudio - " - opt_bundlebuild=" - --bundle-id - --destdir - " - opt_clone=" - " - opt_convert=" - --format - " - opt_create=" - --targetdevice - --targetstudio - --recycle-root - --force-bootstrap - --check-kernel - --destdir - --type - --strip - --prebuiltbootimage - --archive-image - --isocheck - --lvm - --fs-blocksize - --fs-journalsize - --fs-inodesize - --fs-inoderatio - --fs-max-mount-count - --fs-check-interval - --fat-storage - --partitioner - --check-kernel - --mbrid - --cache - --gzip-cmd - --disk-start-sector - --disk-sector-size - --disk-alignment - --add-profile - --edit-bootconfig - --edit-bootinstall - --grub-chainload - " - opt_createhash=" - " - opt_createpassword=" - " - opt_info=" - --select - --add-profile - --ignore-repos - --package-manager - --set-repo - --set-repotype - --set-repoalias - --set-repoprio - --add-repo - --add-repotype - --add-repoalias - --add-repoprio - " - opt_list=" - " - opt_installcd=" - --installcd-system - " - opt_installstick=" - --installstick-system - " - opt_installpxe=" - --installpxe-system - " - opt_prepare=" - --force-new-root - --root - --recycle-root - --force-bootstrap - --cache - --add-profile - --set-repo - --set-repotype - --set-repoalias - --set-repoprio - --add-repo - --add-repotype - --add-repoalias - --add-repoprio - --ignore-repos - --package-manager - --del-package - --add-package - --add-pattern - " - opt_testimage=" - --test-case - --type - " - opt_checkconfig=" - " - opt_upgrade=" - --add-package - --add-pattern - --del-package - --set-repo - --set-repotype - --set-repoalias - --set-repoprio - --add-repo - --add-repotype - --add-repoalias - --add-repoprio - --ignore-repos - " - opt_describe=" - " - opt_initcache=" - " - opt_setupsplash=" - " - eval cmd_options=\$opt_$cmd - if [ ! -z "$cmd_options" ];then - opts=$cmd_options - fi + #======================================== + # Global options + #---------------------------------------- + opt_global=" + --logfile + --debug + --yes + --nocolor + --version + --help + " + #======================================== + # Basic commands + #---------------------------------------- + opts="$opt_global + --bootcd + --bootusb + --bootvm + --build + --bundle-build + --clone + --convert + --create + --createhash + --createpassword + --info + --list + --installcd + --installstick + --installpxe + --prepare + --test-image + --check-config + --upgrade + --describe + --init-cache + --setup-splash + " + #======================================== + # Command specific options to complete + #---------------------------------------- + opt_bootcd=" + " + opt_bootusb=" + " + opt_bootvm=" + --bootvm-system + --bootvm-disksize + " + opt_build=" + --recycle-root + --force-bootstrap + --cache + --add-profile + --set-repo + --set-repotype + --set-repoalias + --set-repoprio + --add-repo + --add-repotype + --add-repoalias + --add-repoprio + --ignore-repos + --package-manager + --check-kernel + --destdir + --type + --strip + --prebuiltbootimage + --archive-image + --isocheck + --lvm + --fs-blocksize + --fs-journalsize + --fs-inodesize + --fs-inoderatio + --fs-max-mount-count + --fs-check-interval + --fat-storage + --partitioner + --check-kernel + --mbrid + --gzip-cmd + --disk-start-sector + --disk-sector-size + --disk-alignment + --add-package + --add-pattern + --del-package + --edit-bootconfig + --edit-bootinstall + --grub-chainload + --targetdevice + --targetstudio + " + opt_bundlebuild=" + --bundle-id + --destdir + " + opt_clone=" + " + opt_convert=" + --format + " + opt_create=" + --targetdevice + --targetstudio + --recycle-root + --force-bootstrap + --check-kernel + --destdir + --type + --strip + --prebuiltbootimage + --archive-image + --isocheck + --lvm + --fs-blocksize + --fs-journalsize + --fs-inodesize + --fs-inoderatio + --fs-max-mount-count + --fs-check-interval + --fat-storage + --partitioner + --check-kernel + --mbrid + --cache + --gzip-cmd + --disk-start-sector + --disk-sector-size + --disk-alignment + --add-profile + --edit-bootconfig + --edit-bootinstall + --grub-chainload + " + opt_createhash=" + " + opt_createpassword=" + " + opt_info=" + --select + --add-profile + --ignore-repos + --package-manager + --set-repo + --set-repotype + --set-repoalias + --set-repoprio + --add-repo + --add-repotype + --add-repoalias + --add-repoprio + " + opt_list=" + " + opt_installcd=" + --installcd-system + " + opt_installstick=" + --installstick-system + " + opt_installpxe=" + --installpxe-system + " + opt_prepare=" + --force-new-root + --root + --recycle-root + --force-bootstrap + --cache + --add-profile + --set-repo + --set-repotype + --set-repoalias + --set-repoprio + --add-repo + --add-repotype + --add-repoalias + --add-repoprio + --ignore-repos + --package-manager + --del-package + --add-package + --add-pattern + " + opt_testimage=" + --test-case + --type + " + opt_checkconfig=" + " + opt_upgrade=" + --add-package + --add-pattern + --del-package + --set-repo + --set-repotype + --set-repoalias + --set-repoprio + --add-repo + --add-repotype + --add-repoalias + --add-repoprio + --ignore-repos + " + opt_describe=" + " + opt_initcache=" + " + opt_setupsplash=" + " + eval cmd_options=\$opt_$cmd + if [ ! -z "$cmd_options" ];then + opts=$cmd_options + fi - #======================================== - # Command option parameters completion - #---------------------------------------- - case "${prev}" in - --build|--prepare|--clone|--info|--test-image|--init-cache) - __comp_reply "$descriptions" - __warn_no_description - return 0 - ;; - --type) - __comp_reply "$types" - return 0 - ;; - *) - ;; - esac - #======================================== - # Command option completion - #---------------------------------------- - __comp_reply "$opts" - return 0 + #======================================== + # Command option parameters completion + #---------------------------------------- + case "${prev}" in + --build|--prepare|--clone|--info|--test-image|--init-cache) + __comp_reply "$descriptions" + __warn_no_description + return 0 + ;; + --type) + __comp_reply "$types" + return 0 + ;; + *) + ;; + esac + #======================================== + # Command option completion + #---------------------------------------- + __comp_reply "$opts" + return 0 } #======================================== # kiwi_types #---------------------------------------- function __kiwi_types { - local schema=/usr/share/kiwi/modules/KIWISchema.rnc - types=$(for i in $(cat $schema |\ - grep -A 3 "attribute image {");do echo $i;done|\ - grep ^\" | cut -f2 -d "\"") + local schema=/usr/share/kiwi/modules/KIWISchema.rnc + types=$(for i in $(cat $schema |\ + grep -A 3 "attribute image {");do echo $i;done|\ + grep ^\" | cut -f2 -d "\"") } #======================================== # kiwi_descriptions #---------------------------------------- function __kiwi_descriptions { - local name - for name in /usr/share/kiwi/image/*;do - if [[ $name =~ boot ]];then - continue - fi - descriptions="$descriptions $(basename $name)" - done + local name + for name in /usr/share/kiwi/image/*;do + if [[ $name =~ boot ]];then + continue + fi + descriptions="$descriptions $(basename $name)" + done } #======================================== # warn_no_description #---------------------------------------- function __warn_no_description { - if [ -z "$descriptions" ]; then - echo -en "\n ==> no descriptions found\n$COMP_LINE" - fi + if [ -z "$descriptions" ]; then + echo -en "\n ==> no descriptions found\n$COMP_LINE" + fi } #======================================== # comp_reply #---------------------------------------- function __comp_reply { - word_list=$@ - COMPREPLY=($(compgen -W "$word_list" -- ${cur})) + word_list=$@ + COMPREPLY=($(compgen -W "$word_list" -- ${cur})) } complete -F _kiwi -o default kiwi diff --git a/editing/suse-start-kiwi-mode.el b/editing/suse-start-kiwi-mode.el index fcb8d9c90..36a2e2787 100644 --- a/editing/suse-start-kiwi-mode.el +++ b/editing/suse-start-kiwi-mode.el @@ -2,6 +2,6 @@ ;; and locate the schemas in kiwi editing directory (progn - (add-to-list 'auto-mode-alist '("\\.kiwi" . nxml-mode)) - (eval-after-load 'rng-loc - '(add-to-list 'rng-schema-locating-files "/usr/share/kiwi/editing/suse-start-kiwi-xmllocator.xml"))) + (add-to-list 'auto-mode-alist '("\\.kiwi" . nxml-mode)) + (eval-after-load 'rng-loc + '(add-to-list 'rng-schema-locating-files "/usr/share/kiwi/editing/suse-start-kiwi-xmllocator.xml"))) diff --git a/editing/suse-start-kiwi-xmllocator.xml b/editing/suse-start-kiwi-xmllocator.xml index 93443c332..d7a08ed2f 100644 --- a/editing/suse-start-kiwi-xmllocator.xml +++ b/editing/suse-start-kiwi-xmllocator.xml @@ -1,6 +1,6 @@ - + - - + + diff --git a/kiwi b/kiwi index 814215ae6..ee6a2d7e7 100755 --- a/kiwi +++ b/kiwi @@ -6,18 +6,18 @@ callpath=$(dirname $0) pushd $callpath &>/dev/null if [ ! -s ".revision" ];then - ./.version > .revision + ./.version > .revision fi if [ ! -s ".kiwirc" ];then cat > .kiwirc << EOF - use File::Spec; - my \$arch = qx(uname -m); - chomp \$arch; - if (\$arch =~ /i.86/) { - \$arch = 'ix86'; - } - our \$BasePath = File::Spec->rel2abs ("."); - our \$System = File::Spec->rel2abs ("./system/boot/\$arch"); + use File::Spec; + my \$arch = qx(uname -m); + chomp \$arch; + if (\$arch =~ /i.86/) { + \$arch = 'ix86'; + } + our \$BasePath = File::Spec->rel2abs ("."); + our \$System = File::Spec->rel2abs ("./system/boot/\$arch"); EOF fi diff --git a/kiwi.pl b/kiwi.pl index 3e1a15240..320dab8c8 100755 --- a/kiwi.pl +++ b/kiwi.pl @@ -93,2184 +93,2184 @@ # main #------------------------------------------ sub main { - # ... - # This is the KIWI project to prepare and build operating - # system images from a given installation source. The system - # will create a chroot environment representing the needs - # of a XML control file. Once prepared KIWI can create several - # OS image types. - # --- - #======================================== - # store caller information - #---------------------------------------- - $kiwi -> loginfo ("kiwi @ARGV\n"); - $kiwi -> loginfo ("kiwi revision: ".revision()."\n"); - #========================================== - # Initialize and check options - #------------------------------------------ - init(); - #========================================== - # Setup logging location - #------------------------------------------ - my $logFile = $cmdL -> getLogFile(); - if (defined $logFile) { - $kiwi -> info ("Setting log file to: $logFile\n"); - if (! $kiwi -> setLogFile ( $logFile )) { - kiwiExit (1); - } - } - #========================================== - # Check for nocolor option - #------------------------------------------ - if ($cmdL -> getNoColor()) { - $kiwi -> info ("Switching off colored output\n"); - if (! $kiwi -> setColorOff ()) { - kiwiExit (1); - } - } - #========================================== - # remove pre-defined smart channels - #------------------------------------------ - if (glob ("/etc/smart/channels/*")) { - KIWIQX::qxx ( "rm -f /etc/smart/channels/*" ); - } - #======================================== - # Bundle user relevant build results - #---------------------------------------- - if ($cmdL->getOperationMode("bundle")) { - my $bundle = KIWIResult -> new ( - $cmdL -> getOperationMode("bundle"), - $cmdL -> getImageTargetDir(), - $cmdL -> getBuildNumber() - ); - if (! $bundle) { - kiwiExit (1); - } - if (! $bundle -> buildRelease()) { - kiwiExit (1); - } - if (! $bundle -> populateRelease()) { - kiwiExit (1); - } - kiwiExit (0); - } - - #======================================== - # Prepare and Create in one step - #---------------------------------------- - if ($cmdL->getOperationMode("build")) { + # ... + # This is the KIWI project to prepare and build operating + # system images from a given installation source. The system + # will create a chroot environment representing the needs + # of a XML control file. Once prepared KIWI can create several + # OS image types. + # --- + #======================================== + # store caller information + #---------------------------------------- + $kiwi -> loginfo ("kiwi @ARGV\n"); + $kiwi -> loginfo ("kiwi revision: ".revision()."\n"); #========================================== - # Create destdir if needed + # Initialize and check options #------------------------------------------ - $cmdL -> setDefaultAnswer ("yes"); - my $dirCreated = $global -> createDirInteractive( - $cmdL->getImageTargetDir()."/build", $cmdL->getDefaultAnswer() - ); - if (! defined $dirCreated) { - kiwiExit (1); - } + init(); #========================================== - # Setup prepare + # Setup logging location #------------------------------------------ - my $imageTarget = $cmdL -> getImageTargetDir(); - my $rootTarget = $imageTarget.'/build/image-root'; - $cmdL -> setForceNewRoot (1); - $cmdL -> setRootTargetDir ($rootTarget); - $cmdL -> setOperationMode ("prepare", $cmdL->getConfigDir()); - mkdir $imageTarget; - $kic = KIWIImageCreator -> new ($cmdL); - if (! $kic) { - kiwiExit (1); - } - my $selectedType = $kic -> getSelectedBuildType(); - if ($selectedType && $selectedType eq 'cpio') { - if (! $kic -> prepareBootImage( - $kic-> getSystemXML(),$rootTarget,$rootTarget - )) { - kiwiExit (1); - } - } else { - if (! $kic -> prepareImage()) { - kiwiExit (1); - } + my $logFile = $cmdL -> getLogFile(); + if (defined $logFile) { + $kiwi -> info ("Setting log file to: $logFile\n"); + if (! $kiwi -> setLogFile ( $logFile )) { + kiwiExit (1); + } } #========================================== - # Setup create - #------------------------------------------ - $cmdL -> setConfigDir ($rootTarget); - $cmdL -> setOperationMode ("create",$rootTarget); - $cmdL -> setForceNewRoot (0); - $cmdL -> unsetRecycleRootDir(); - $kic -> initialize(); - if ($selectedType && $selectedType eq 'cpio') { - if (! $kic -> createBootImage( - $kic-> getSystemXML(),$rootTarget,$imageTarget - )) { - kiwiExit (1); - } - } else { - if (! $kic -> createImage()) { - kiwiExit (1); - } - } - kiwiExit (0); - } - - #======================================== - # Create image cache(s) - #---------------------------------------- - if ($cmdL->getOperationMode("initCache")) { - #========================================== - # Process system image description + # Check for nocolor option #------------------------------------------ - $kiwi -> info ("Reading image description [Cache]...\n"); - my $xml = KIWIXML -> new ( - $cmdL->getOperationMode("initCache"), - undef,$cmdL->getBuildProfiles(),$cmdL,undef - ); - if (! defined $xml) { - kiwiExit (1); - } - my $pkgMgr = $cmdL -> getPackageManager(); - if ($pkgMgr) { - $xml -> setPackageManager($pkgMgr); + if ($cmdL -> getNoColor()) { + $kiwi -> info ("Switching off colored output\n"); + if (! $kiwi -> setColorOff ()) { + kiwiExit (1); + } } #========================================== - # Create cache(s)... + # remove pre-defined smart channels #------------------------------------------ - my $gdata = $global -> getKiwiConfig(); - my $cdir = $cmdL->getCacheDir(); - if (! $cdir) { - $cdir = $locator -> getDefaultCacheDir(); - } - $icache = KIWICache -> new ( - $xml,$cdir,$gdata->{BasePath}, - $cmdL->getBuildProfiles(), - $cmdL->getOperationMode("initCache"), - $cmdL - ); - if (! $icache) { - kiwiExit (1); - } - my $cacheInit = $icache -> initializeCache ( - $cmdL,"create-cache" - ); - if (! $cacheInit) { - kiwiExit (1); + if (glob ("/etc/smart/channels/*")) { + KIWIQX::qxx ( "rm -f /etc/smart/channels/*" ); + } + #======================================== + # Bundle user relevant build results + #---------------------------------------- + if ($cmdL->getOperationMode("bundle")) { + my $bundle = KIWIResult -> new ( + $cmdL -> getOperationMode("bundle"), + $cmdL -> getImageTargetDir(), + $cmdL -> getBuildNumber() + ); + if (! $bundle) { + kiwiExit (1); + } + if (! $bundle -> buildRelease()) { + kiwiExit (1); + } + if (! $bundle -> populateRelease()) { + kiwiExit (1); + } + kiwiExit (0); } - if (! $icache -> createCache ($cacheInit)) { - kiwiExit (1); + + #======================================== + # Prepare and Create in one step + #---------------------------------------- + if ($cmdL->getOperationMode("build")) { + #========================================== + # Create destdir if needed + #------------------------------------------ + $cmdL -> setDefaultAnswer ("yes"); + my $dirCreated = $global -> createDirInteractive( + $cmdL->getImageTargetDir()."/build", $cmdL->getDefaultAnswer() + ); + if (! defined $dirCreated) { + kiwiExit (1); + } + #========================================== + # Setup prepare + #------------------------------------------ + my $imageTarget = $cmdL -> getImageTargetDir(); + my $rootTarget = $imageTarget.'/build/image-root'; + $cmdL -> setForceNewRoot (1); + $cmdL -> setRootTargetDir ($rootTarget); + $cmdL -> setOperationMode ("prepare", $cmdL->getConfigDir()); + mkdir $imageTarget; + $kic = KIWIImageCreator -> new ($cmdL); + if (! $kic) { + kiwiExit (1); + } + my $selectedType = $kic -> getSelectedBuildType(); + if ($selectedType && $selectedType eq 'cpio') { + if (! $kic -> prepareBootImage( + $kic-> getSystemXML(),$rootTarget,$rootTarget + )) { + kiwiExit (1); + } + } else { + if (! $kic -> prepareImage()) { + kiwiExit (1); + } + } + #========================================== + # Setup create + #------------------------------------------ + $cmdL -> setConfigDir ($rootTarget); + $cmdL -> setOperationMode ("create",$rootTarget); + $cmdL -> setForceNewRoot (0); + $cmdL -> unsetRecycleRootDir(); + $kic -> initialize(); + if ($selectedType && $selectedType eq 'cpio') { + if (! $kic -> createBootImage( + $kic-> getSystemXML(),$rootTarget,$imageTarget + )) { + kiwiExit (1); + } + } else { + if (! $kic -> createImage()) { + kiwiExit (1); + } + } + kiwiExit (0); } - kiwiExit (0); - } - #======================================== - # Prepare image and build chroot system - #---------------------------------------- - if ($cmdL->getOperationMode("prepare")) { - $kic = KIWIImageCreator -> new ($cmdL); - if (! $kic) { - kiwiExit (1); - } - my $selectedType = $kic -> getSelectedBuildType(); - if ($selectedType && $selectedType eq 'cpio') { - if (! $kic -> prepareBootImage( - $kic -> getSystemXML(), - $cmdL-> getRootTargetDir(),$cmdL-> getRootTargetDir() - )) { - kiwiExit (1); - } - } else { - if (! $kic -> prepareImage()) { - kiwiExit (1); - } + #======================================== + # Create image cache(s) + #---------------------------------------- + if ($cmdL->getOperationMode("initCache")) { + #========================================== + # Process system image description + #------------------------------------------ + $kiwi -> info ("Reading image description [Cache]...\n"); + my $xml = KIWIXML -> new ( + $cmdL->getOperationMode("initCache"), + undef,$cmdL->getBuildProfiles(),$cmdL,undef + ); + if (! defined $xml) { + kiwiExit (1); + } + my $pkgMgr = $cmdL -> getPackageManager(); + if ($pkgMgr) { + $xml -> setPackageManager($pkgMgr); + } + #========================================== + # Create cache(s)... + #------------------------------------------ + my $gdata = $global -> getKiwiConfig(); + my $cdir = $cmdL->getCacheDir(); + if (! $cdir) { + $cdir = $locator -> getDefaultCacheDir(); + } + $icache = KIWICache -> new ( + $xml,$cdir,$gdata->{BasePath}, + $cmdL->getBuildProfiles(), + $cmdL->getOperationMode("initCache"), + $cmdL + ); + if (! $icache) { + kiwiExit (1); + } + my $cacheInit = $icache -> initializeCache ( + $cmdL,"create-cache" + ); + if (! $cacheInit) { + kiwiExit (1); + } + if (! $icache -> createCache ($cacheInit)) { + kiwiExit (1); + } + kiwiExit (0); } - kiwiExit (0); - } - #========================================== - # Create image from chroot system - #------------------------------------------ - if ($cmdL->getOperationMode("create")) { - $kic = KIWIImageCreator -> new ($cmdL); - if (! $kic) { - kiwiExit (1); - } - my $selectedType = $kic -> getSelectedBuildType(); - if ($selectedType && $selectedType eq 'cpio') { - if (! $kic -> createBootImage( - $kic -> getSystemXML(), - $cmdL-> getConfigDir(),$cmdL-> getImageTargetDir() - )) { - kiwiExit (1); - } - } else { - if (! $kic -> createImage()) { - kiwiExit (1); - } + #======================================== + # Prepare image and build chroot system + #---------------------------------------- + if ($cmdL->getOperationMode("prepare")) { + $kic = KIWIImageCreator -> new ($cmdL); + if (! $kic) { + kiwiExit (1); + } + my $selectedType = $kic -> getSelectedBuildType(); + if ($selectedType && $selectedType eq 'cpio') { + if (! $kic -> prepareBootImage( + $kic -> getSystemXML(), + $cmdL-> getRootTargetDir(),$cmdL-> getRootTargetDir() + )) { + kiwiExit (1); + } + } else { + if (! $kic -> prepareImage()) { + kiwiExit (1); + } + } + kiwiExit (0); } - kiwiExit (0); - } - #========================================== - # Upgrade image in chroot system - #------------------------------------------ - if ($cmdL->getOperationMode("upgrade")) { - $kic = KIWIImageCreator -> new ($cmdL); - if (! $kic) { - kiwiExit (1); + #========================================== + # Create image from chroot system + #------------------------------------------ + if ($cmdL->getOperationMode("create")) { + $kic = KIWIImageCreator -> new ($cmdL); + if (! $kic) { + kiwiExit (1); + } + my $selectedType = $kic -> getSelectedBuildType(); + if ($selectedType && $selectedType eq 'cpio') { + if (! $kic -> createBootImage( + $kic -> getSystemXML(), + $cmdL-> getConfigDir(),$cmdL-> getImageTargetDir() + )) { + kiwiExit (1); + } + } else { + if (! $kic -> createImage()) { + kiwiExit (1); + } + } + kiwiExit (0); } - if (! $kic -> upgradeImage()) { - kiwiExit (1); + + #========================================== + # Upgrade image in chroot system + #------------------------------------------ + if ($cmdL->getOperationMode("upgrade")) { + $kic = KIWIImageCreator -> new ($cmdL); + if (! $kic) { + kiwiExit (1); + } + if (! $kic -> upgradeImage()) { + kiwiExit (1); + } + kiwiExit (0); } - kiwiExit (0); - } - #========================================== - # Analyse system and create description - #------------------------------------------ - if ($cmdL->getOperationMode("analyse")) { - $kiwi -> info ("Starting system analysis\n"); - my $destination = $cmdL->getOperationMode("analyse"); - $destination = "/tmp/".$destination; - my $system = KIWIAnalyseSystem -> new ( - $destination,$cmdL + #========================================== + # Analyse system and create description + #------------------------------------------ + if ($cmdL->getOperationMode("analyse")) { + $kiwi -> info ("Starting system analysis\n"); + my $destination = $cmdL->getOperationMode("analyse"); + $destination = "/tmp/".$destination; + my $system = KIWIAnalyseSystem -> new ( + $destination,$cmdL + ); + if (! $system) { + return; + } + if (! $system -> createCustomDataSyncReference()) { + return; + } + if (! $system -> syncCustomData()) { + return; + } + $kiwi -> info ("Creating base description files\n"); + my $software = KIWIAnalyseSoftware -> new ( + $system,$cmdL ); - if (! $system) { - return; - } - if (! $system -> createCustomDataSyncReference()) { - return; - } - if (! $system -> syncCustomData()) { - return; - } - $kiwi -> info ("Creating base description files\n"); - my $software = KIWIAnalyseSoftware -> new ( - $system,$cmdL - ); - if (! $software) { - return; - } - my $template = KIWIAnalyseTemplate -> new ( - $destination,$cmdL,$system,$software - ); - if (! $template) { - return; - } - $template -> writeKIWIXMLConfiguration(); - $template -> writeKIWIScripts(); - $kiwi -> info ("Creating system report\n"); - my $report = KIWIAnalyseReport -> new ( - $destination,$cmdL,$system,$software - ); - if (! $report) { - return; - } - $report -> createReport(); - if (! $system -> commitTransaction()) { - return; + if (! $software) { + return; + } + my $template = KIWIAnalyseTemplate -> new ( + $destination,$cmdL,$system,$software + ); + if (! $template) { + return; + } + $template -> writeKIWIXMLConfiguration(); + $template -> writeKIWIScripts(); + $kiwi -> info ("Creating system report\n"); + my $report = KIWIAnalyseReport -> new ( + $destination,$cmdL,$system,$software + ); + if (! $report) { + return; + } + $report -> createReport(); + if (! $system -> commitTransaction()) { + return; + } } - } - #========================================== - # setup a splash initrd - #------------------------------------------ - if ($cmdL->getOperationMode("setupSplash")) { - $kic = KIWIImageCreator -> new ($cmdL); - if (! $kic) { - kiwiExit (1); - } - if (! $kic -> createSplash()) { - kiwiExit (1); + #========================================== + # setup a splash initrd + #------------------------------------------ + if ($cmdL->getOperationMode("setupSplash")) { + $kic = KIWIImageCreator -> new ($cmdL); + if (! $kic) { + kiwiExit (1); + } + if (! $kic -> createSplash()) { + kiwiExit (1); + } + kiwiExit (0); } - kiwiExit (0); - } - #========================================== - # Create a boot Stick (USB) - #------------------------------------------ - if ($cmdL->getOperationMode("bootUSB")) { - $kic = KIWIImageCreator -> new ($cmdL); - if (! $kic) { - kiwiExit (1); + #========================================== + # Create a boot Stick (USB) + #------------------------------------------ + if ($cmdL->getOperationMode("bootUSB")) { + $kic = KIWIImageCreator -> new ($cmdL); + if (! $kic) { + kiwiExit (1); + } + if (! $kic -> createImageBootUSB()) { + kiwiExit (1); + } + kiwiExit (0); } - if (! $kic -> createImageBootUSB()) { - kiwiExit (1); + + #========================================== + # Create a boot CD (ISO) + #------------------------------------------ + if ($cmdL->getOperationMode("bootCD")) { + $kic = KIWIImageCreator -> new ($cmdL); + if (! $kic) { + kiwiExit (1); + } + if (! $kic -> createImageBootCD()) { + kiwiExit (1); + } + kiwiExit (0); } - kiwiExit (0); - } - #========================================== - # Create a boot CD (ISO) - #------------------------------------------ - if ($cmdL->getOperationMode("bootCD")) { - $kic = KIWIImageCreator -> new ($cmdL); - if (! $kic) { - kiwiExit (1); + #========================================== + # Create an install CD (ISO) + #------------------------------------------ + if ($cmdL->getOperationMode("installCD")) { + $kic = KIWIImageCreator -> new ($cmdL); + if (! $kic) { + kiwiExit (1); + } + if (! $kic -> createImageInstallCD()) { + kiwiExit (1); + } + kiwiExit (0); } - if (! $kic -> createImageBootCD()) { - kiwiExit (1); + + #========================================== + # Create an install USB stick + #------------------------------------------ + if ($cmdL->getOperationMode("installStick")) { + $kic = KIWIImageCreator -> new ($cmdL); + if (! $kic) { + kiwiExit (1); + } + if (! $kic -> createImageInstallStick()) { + kiwiExit (1); + } + kiwiExit (0); } - kiwiExit (0); - } - #========================================== - # Create an install CD (ISO) - #------------------------------------------ - if ($cmdL->getOperationMode("installCD")) { - $kic = KIWIImageCreator -> new ($cmdL); - if (! $kic) { - kiwiExit (1); + #========================================== + # Create an install PXE data set + #------------------------------------------ + if ($cmdL->getOperationMode("installPXE")) { + $kic = KIWIImageCreator -> new ($cmdL); + if (! $kic) { + kiwiExit (1); + } + if (! $kic -> createImageInstallPXE()) { + kiwiExit (1); + } + kiwiExit (0); } - if (! $kic -> createImageInstallCD()) { - kiwiExit (1); + + #========================================== + # Create a virtual disk image + #------------------------------------------ + if ($cmdL->getOperationMode("bootVMDisk")) { + $kic = KIWIImageCreator -> new ($cmdL); + if (! $kic) { + kiwiExit (1); + } + if (! $kic -> createImageDisk()) { + kiwiExit (1); + } + kiwiExit (0); } - kiwiExit (0); - } - #========================================== - # Create an install USB stick - #------------------------------------------ - if ($cmdL->getOperationMode("installStick")) { - $kic = KIWIImageCreator -> new ($cmdL); - if (! $kic) { - kiwiExit (1); + #========================================== + # Convert image into format/configuration + #------------------------------------------ + if ($cmdL->getOperationMode("convert")) { + $kic = KIWIImageCreator -> new ($cmdL); + if (! $kic) { + kiwiExit (1); + } + if (! $kic -> createImageFormat()) { + kiwiExit (1); + } + kiwiExit (0); } - if (! $kic -> createImageInstallStick()) { - kiwiExit (1); + + #========================================== + # List XML and repo information + #------------------------------------------ + if ($cmdL->getOperationMode("listXMLInfo")) { + $cmdL -> setConfigDir( + $cmdL->getOperationMode("listXMLInfo") + ); + my $info = KIWIXMLInfo -> new ($cmdL); + if (! $info) { + kiwiExit (1); + } + my $res = $info -> printXMLInfo ( + $cmdL -> getXMLInfoSelection() + ); + if (! $res) { + kiwiExit (1); + } + kiwiExit (0); } - kiwiExit (0); - } - #========================================== - # Create an install PXE data set - #------------------------------------------ - if ($cmdL->getOperationMode("installPXE")) { - $kic = KIWIImageCreator -> new ($cmdL); - if (! $kic) { - kiwiExit (1); + #========================================== + # Test suite + #------------------------------------------ + if ($cmdL->getOperationMode("testImage")) { + $kiwi -> info ("Starting image test run..."); + my $suite = "/usr/lib/os-autoinst"; + my $distri = "kiwi-$$"; + my $type = $cmdL -> getBuildType(); + my $image = $cmdL -> getOperationMode("testImage"); + my $tcase = $cmdL -> getTestCase(); + #========================================== + # Check pre-conditions + #------------------------------------------ + if (! -d $suite) { + $kiwi -> failed (); + $kiwi -> error ("Required os-autoinst test-suite not installed"); + $kiwi -> failed (); + kiwiExit (1); + } + if (! -f $image) { + $kiwi -> failed (); + $kiwi -> error ("Test image $image doesn't exist"); + $kiwi -> failed (); + kiwiExit (1); + } + if (! defined $type) { + $kiwi -> failed (); + $kiwi -> error ("No test image type specified"); + $kiwi -> failed (); + kiwiExit (1); + } + if (! defined $tcase) { + $kiwi -> failed (); + $kiwi -> error ("No test test case specified"); + $kiwi -> failed (); + kiwiExit (1); + } + if (! -d $tcase."/".$type) { + $kiwi -> failed (); + $kiwi -> error ("Test case for type $type does not exist"); + $kiwi -> failed (); + kiwiExit (1); + } + if (! -f $tcase."/env.sh") { + $kiwi -> failed (); + $kiwi -> error ("Can't find environment for this test"); + $kiwi -> failed (); + kiwiExit (1); + } + #========================================== + # Turn parameters into absolute pathes + #------------------------------------------ + $image = File::Spec->rel2abs ($image); + $tcase = File::Spec->rel2abs ($tcase); + #========================================== + # Create distri link for os-autoinst + #------------------------------------------ + my $test = $tcase."/".$type; + my $data = KIWIQX::qxx ("ln -s $test $suite/distri/$distri 2>&1"); + my $code = $? >> 8; + if ($code != 0) { + $kiwi -> failed (); + $kiwi -> error ("Can't create distri link: $data"); + $kiwi -> failed (); + kiwiExit (1); + } + #========================================== + # Create result mktemp directory + #------------------------------------------ + my $out = KIWIQX::qxx ("mktemp -q -d /tmp/kiwi-testrun-XXXXXX 2>&1"); + $code = $? >> 8; chomp $out; + if ($code != 0) { + $kiwi -> error ("Couldn't create result directory: $out: $!"); + $kiwi -> failed (); + KIWIQX::qxx ("rm -f $suite/distri/$distri"); + kiwiExit (1); + } + KIWIQX::qxx ("chmod 755 $out 2>&1"); + #========================================== + # Copy environment to result directory + #------------------------------------------ + $data = KIWIQX::qxx ("cp $tcase/env.sh $out"); + $code = $? >> 8; + if ($code != 0) { + $kiwi -> failed (); + $kiwi -> error ("Failed to copy test environment: $data"); + $kiwi -> failed (); + KIWIQX::qxx ("rm -f $suite/distri/$distri"); + KIWIQX::qxx ("rm -rf $out"); + kiwiExit (1); + } + #========================================== + # Create call file + #------------------------------------------ + if (open my $FD,'>',"$out/run.sh") { + print $FD "cd $out\n"; + print $FD "export DISTRI=$distri"."\n"; + print $FD "export ISO=$image"."\n"; + print $FD 'isotovideo $ISO'."\n"; + close $FD; + } else { + $kiwi -> failed (); + $kiwi -> error ("Failed to create run test script: $!"); + $kiwi -> failed (); + KIWIQX::qxx ("rm -f $suite/distri/$distri"); + KIWIQX::qxx ("rm -rf $out"); + kiwiExit (1); + } + #========================================== + # Create screen ctrl file + #------------------------------------------ + if (open my $FD,'>',"$out/run.ctrl") { + print $FD "logfile /dev/null\n"; + close $FD; + } else { + $kiwi -> failed (); + $kiwi -> error ("Failed to create screen ctrl file: $!"); + $kiwi -> failed (); + KIWIQX::qxx ("rm -f $suite/distri/$distri"); + KIWIQX::qxx ("rm -rf $out"); + kiwiExit (1); + } + #========================================== + # Call the test + #------------------------------------------ + $kiwi -> done (); + $kiwi -> info ("Calling isotovideo, this can take some time...\n"); + $kiwi -> info ("watch the screen session by: 'screen -r'"); + KIWIQX::qxx ("chmod u+x $out/run.sh"); + KIWIQX::qxx ("screen -L -D -m -c $out/run.ctrl $out/run.sh"); + $code = $? >> 8; + KIWIQX::qxx ("rm -f $suite/distri/$distri"); + if ($code == 0) { + $kiwi -> done (); + } else { + $kiwi -> failed (); + } + $kiwi -> info ("Find test results in $out"); + $kiwi -> done (); + #========================================== + # Read result + #------------------------------------------ + my $json; + foreach my $result (glob ("$out/testresults/*/results.json")) { + my $json_fd = FileHandle -> new(); + if ($json_fd -> open ($result)) { + local $/; + my $json_text = <$json_fd>; + $json = from_json( + $json_text, { utf8 => 1 } + ); + $json_fd -> close(); + } + last; + } + #========================================== + # Exit according to test result + #------------------------------------------ + if ($json) { + my $status = $json->{overall}; + if ($status eq 'fail') { + $kiwi -> info ("Test Failed"); + $kiwi -> done(); + kiwiExit (1); + } else { + $kiwi -> info ("Test Succeeded"); + $kiwi -> failed(); + kiwiExit (0); + } + } + } + return 1; +} + +#========================================== +# init +#------------------------------------------ +sub init { + # ... + # initialize, check privilege and options. KIWI + # requires you to perform at least one action. + # An action is either to prepare or create an image + # --- + #========================================== + # Option variables + #------------------------------------------ + my $Help; + my $ArchiveImage; # archive image results into a tarball + my $FSBlockSize; # filesystem block size + my $FSInodeSize; # filesystem inode size + my $FSJournalSize; # filesystem journal size + my $FSMaxMountCount; # filesystem (ext) max mount count between checks + my $FSCheckInterval; # filesystem (ext) max interval between fs checks + my $FSInodeRatio; # filesystem bytes/inode ratio + my $SetImageType; # set image type to use, default is primary type + my $Build; # run prepare and create in one step + my $Prepare; # control XML file for building chroot extend + my $Create; # image description for building image extend + my $InitCache; # create image cache(s) from given description + my $Upgrade; # upgrade physical extend + my $BootVMDisk; # deploy initrd booting from a VM + my $InstallCD; # Installation initrd booting from CD + my $BootCD; # Boot initrd booting from CD + my $BootUSB; # Boot initrd booting from Stick + my $TestImage; # call end-to-end testsuite if installed + my $InstallStick; # Installation initrd booting from USB stick + my $SetupSplash; # setup kernel splash screen + my $Analyse; # inspect running system and create a description + my $Convert; # convert image into given format/configuration + my $MBRID; # custom mbrid value + my @RemovePackage; # remove pack by adding them to the remove list + my $IgnoreRepos; # ignore repositories specified so far + my $SetRepository; # set first repo for building physical extend + my $SetRepositoryType; # set firt repository type + my $SetRepositoryAlias; # alias name for the repository + my $SetRepositoryPriority; # priority for the repository + my @AddRepository; # add repository for building physical extend + my @AddRepositoryType; # add repository type + my @AddRepositoryAlias; # alias name for the repository + my @AddRepositoryPriority; # priority for the repository + my @AddPackage; # add packages to the image package list + my @AddPattern; # add patterns to the image package list + my $Partitioner; # default partitioner + my $ListXMLInfo; # list XML information + my $CheckConfig; # Configuration file to check + my $CreateInstSource; # create installation source from meta packages + my $CreateHash; # create .checksum.md5 for given description + my $CreatePassword; # create crypted password + my $Clone; # clone existing image description + my $InstallCDSystem; # disk system image to be installed on disk + my $TestCase; # path to image description including test/ case + my $InstallStickSystem; # disk system image to be installed on disk + my $InstallPXE; # Installation initrd booting via network + my $InstallPXESystem; # disk system image to be installed on disk + my @Profiles; # list of profiles to include in image + my $ForceBootstrap; # force bootstrap, checked for recycle-root mode + my $ForceNewRoot; # force creation of new root directory + my $NoColor; # don't use colored output (done/failed messages) + my $GzipCmd; # command to run to gzip things + my $TargetStudio; # command to run to create on demand storage + my $Verbosity; # control the verbosity level + my $TargetArch; # target architecture -> writes zypp.conf + my $Debug; # activates the internal stack trace output + my $Format; # format to convert to, vmdk, ovf, etc... + my $defaultAnswer; # default answer to any questions + my $targetDevice; # alternative device instead of a loop device + my $ImageCache; # build an image cache for later re-use + my $RecycleRoot; # use existing root directory incl. contents + my $Destination; # destination directory for logical extends + my $LogFile; # optional file name for logging + my @ListXMLInfoSelection; # info selection for listXMLInfo + my $RootTree; # optional root tree destination + my $BootVMSystem; # system image to be copied on a VM disk + my $BootVMSize; # size of virtual disk + my $BundleBuild; # bundle user relevant build results + my $BundleID; # bundle/build id used in bundle-build + my $StripImage; # strip shared objects and binaries + my $PrebuiltBootImage; # dir. where a prepared boot image may be found + my $ISOCheck; # create checkmedia boot entry + my $CheckKernel; # check if kernel matches in boot and system img + my $LVM; # use LVM partition setup for virtual disk + my $GrubChainload; # install grub loader in first partition not MBR + my $FatStorage; # size of fat partition if syslinux is used + my $DiskStartSector; # location of start sector (default is 2048) + my $EditBootConfig; # allow to run script before bootloader install + my $EditBootInstall; # allow to run script after bootloader install + my $PackageManager; # package manager to use + my $DiskAlignment; # partition alignment, default is 4096 KB + my $DiskBIOSSectorSize; # sector size default is 512 bytes + my $Version; # version information + #========================================== + # create logger and cmdline object + #------------------------------------------ + $cmdL = KIWICommandLine -> new (); + if (! $cmdL) { + kiwiExit (1); } - if (! $kic -> createImageInstallPXE()) { - kiwiExit (1); + my $gdata = $global -> getKiwiConfig(); + #========================================== + # get options and call non-root tasks + #------------------------------------------ + my $result = GetOptions( + "archive-image" => \$ArchiveImage, + "add-package=s" => \@AddPackage, + "add-pattern=s" => \@AddPattern, + "add-profile=s" => \@Profiles, + "add-repo=s" => \@AddRepository, + "add-repoalias=s" => \@AddRepositoryAlias, + "add-repopriority=i" => \@AddRepositoryPriority, + "add-repotype=s" => \@AddRepositoryType, + "bundle-build=s" => \$BundleBuild, + "bundle-id=s" => \$BundleID, + "bootcd=s" => \$BootCD, + "bootusb=s" => \$BootUSB, + "bootvm=s" => \$BootVMDisk, + "bootvm-disksize=s" => \$BootVMSize, + "bootvm-system=s" => \$BootVMSystem, + "build|b=s" => \$Build, + "cache=s" => \$ImageCache, + "check-config=s" => \$CheckConfig, + "check-kernel" => \$CheckKernel, + "clone|o=s" => \$Clone, + "convert=s" => \$Convert, + "create|c=s" => \$Create, + "create-instsource=s" => \$CreateInstSource, + "createhash=s" => \$CreateHash, + "createpassword" => \$CreatePassword, + "debug" => \$Debug, + "del-package=s" => \@RemovePackage, + "destdir|d=s" => \$Destination, + "fat-storage=i" => \$FatStorage, + "force-bootstrap" => \$ForceBootstrap, + "force-new-root" => \$ForceNewRoot, + "format|f=s" => \$Format, + "fs-blocksize=i" => \$FSBlockSize, + "fs-check-interval=i" => \$FSCheckInterval, + "fs-inoderatio=i" => \$FSInodeRatio, + "fs-inodesize=i" => \$FSInodeSize, + "fs-journalsize=i" => \$FSJournalSize, + "fs-max-mount-count=i" => \$FSMaxMountCount, + "edit-bootconfig=s" => \$EditBootConfig, + "edit-bootinstall=s" => \$EditBootInstall, + "grub-chainload" => \$GrubChainload, + "gzip-cmd=s" => \$GzipCmd, + "help|h" => \$Help, + "ignore-repos" => \$IgnoreRepos, + "info|i=s" => \$ListXMLInfo, + "init-cache=s" => \$InitCache, + "installcd=s" => \$InstallCD, + "installcd-system=s" => \$InstallCDSystem, + "installstick=s" => \$InstallStick, + "installstick-system=s" => \$InstallStickSystem, + "installpxe=s" => \$InstallPXE, + "installpxe-system=s" => \$InstallPXESystem, + "isocheck" => \$ISOCheck, + "list|l" => \&listImage, + "logfile=s" => \$LogFile, + "lvm" => \$LVM, + "mbrid=o" => \$MBRID, + "describe=s" => \$Analyse, + "nocolor" => \$NoColor, + "package-manager=s" => \$PackageManager, + "partitioner=s" => \$Partitioner, + "prebuiltbootimage=s" => \$PrebuiltBootImage, + "prepare|p=s" => \$Prepare, + "recycle-root" => \$RecycleRoot, + "root|r=s" => \$RootTree, + "select=s" => \@ListXMLInfoSelection, + "set-repo=s" => \$SetRepository, + "set-repoalias=s" => \$SetRepositoryAlias, + "set-repopriority=i" => \$SetRepositoryPriority, + "set-repotype=s" => \$SetRepositoryType, + "setup-splash=s" => \$SetupSplash, + "strip|s" => \$StripImage, + "target-arch=s" => \$TargetArch, + "targetdevice=s" => \$targetDevice, + "targetstudio=s" => \$TargetStudio, + "type|t=s" => \$SetImageType, + "upgrade|u=s" => \$Upgrade, + "test-image=s" => \$TestImage, + "test-case=s" => \$TestCase, + "disk-start-sector=i" => \$DiskStartSector, + "disk-alignment=i" => \$DiskAlignment, + "disk-sector-size=i" => \$DiskBIOSSectorSize, + "verbose|v=i" => \$Verbosity, + "version" => \$Version, + "yes|y" => \$defaultAnswer, + ); + #========================================== + # Check result of options parsing + #------------------------------------------ + if ( $result != 1 ) { + usage(1); + } + #======================================== + # set logfile if defined at the cmdline + #---------------------------------------- + if ($LogFile) { + if ($InitCache) { + $cmdL -> setLogFile("terminal"); + } else { + $cmdL -> setLogFile($LogFile); + } + } + #======================================== + # set sector size for alignment + #---------------------------------------- + $cmdL -> setDiskBIOSSectorSize ( + $DiskBIOSSectorSize + ); + #======================================== + # set partition alignment + #---------------------------------------- + $cmdL -> setDiskAlignment ( + $DiskAlignment + ); + #======================================== + # set start sector for disk images + #---------------------------------------- + if (! $DiskStartSector) { + $DiskStartSector = int ( + $cmdL -> getDiskAlignment * 1024 / $cmdL -> getDiskBIOSSectorSize() + ); + my $defaultStartSector = $gdata -> {DiskStartSector}; + if ($DiskStartSector < $defaultStartSector) { + $DiskStartSector = $defaultStartSector; + } } - kiwiExit (0); - } - - #========================================== - # Create a virtual disk image - #------------------------------------------ - if ($cmdL->getOperationMode("bootVMDisk")) { - $kic = KIWIImageCreator -> new ($cmdL); - if (! $kic) { - kiwiExit (1); + $cmdL -> setDiskStartSector ( + $DiskStartSector + ); + #======================================== + # set list of filesystem options + #---------------------------------------- + my %init = ( + blocksize => $FSBlockSize, + checkinterval => $FSCheckInterval, + inodesize => $FSInodeSize, + inoderatio => $FSInodeRatio, + journalsize => $FSJournalSize, + maxmountcnt => $FSMaxMountCount + ); + my $fsOpts = KIWIFilesystemOptions -> new(\%init); + if (! $fsOpts) { + kiwiExit (1); } - if (! $kic -> createImageDisk()) { - kiwiExit (1); + my $status = $cmdL -> setFilesystemOptions ($fsOpts); + if (! $status) { + kiwiExit (1); } - kiwiExit (0); - } - - #========================================== - # Convert image into format/configuration - #------------------------------------------ - if ($cmdL->getOperationMode("convert")) { - $kic = KIWIImageCreator -> new ($cmdL); - if (! $kic) { - kiwiExit (1); + #======================================== + # check if bundle-build option is set + #---------------------------------------- + if (defined $BundleID) { + $cmdL -> setBuildNumber ($BundleID); + } + #======================================== + # check if archive-image option is set + #---------------------------------------- + if (defined $ArchiveImage) { + $cmdL -> setArchiveImage ($ArchiveImage); + } + #======================================== + # check if edit-bootconfig option is set + #---------------------------------------- + if (defined $EditBootConfig) { + $cmdL -> setEditBootConfig ($EditBootConfig); + } + #======================================== + # check if edit-bootinstall option is set + #---------------------------------------- + if (defined $EditBootInstall) { + $cmdL -> setEditBootInstall ($EditBootInstall); + } + #======================================== + # check if fat-storage option is set + #---------------------------------------- + if (defined $FatStorage) { + $cmdL -> setFatStorage ($FatStorage); + } + #======================================== + # check if grub-chainload option is set + #---------------------------------------- + if (defined $GrubChainload) { + $cmdL -> setGrubChainload ($GrubChainload); + } + #======================================== + # check if lvm option is set + #---------------------------------------- + if (defined $LVM) { + $cmdL -> setLVM ($LVM); + } + #======================================== + # check if check-kernel option is set + #---------------------------------------- + if (defined $CheckKernel) { + $cmdL -> setCheckKernel ($CheckKernel); + } + #======================================== + # check if isocheck option is set + #---------------------------------------- + if (defined $ISOCheck) { + $cmdL -> setISOCheck ($ISOCheck); + } + #======================================== + # check if prebuilt boot path is set + #---------------------------------------- + if (defined $PrebuiltBootImage) { + $cmdL -> setPrebuiltBootImagePath ($PrebuiltBootImage); + } + #======================================== + # check if strip image option is set + #---------------------------------------- + if (defined $StripImage) { + $cmdL -> setStripImage ($StripImage); + } + #======================================== + # check if XML Info Selection is set + #---------------------------------------- + if (@ListXMLInfoSelection) { + $cmdL -> setXMLInfoSelection (\@ListXMLInfoSelection); + } + #======================================== + # check if TestCase is specified + #---------------------------------------- + if (defined $TestCase) { + $cmdL -> setTestCase ($TestCase); + } + #======================================== + # check if Debug is specified + #---------------------------------------- + if (defined $Debug) { + $cmdL -> setDebug ($Debug); + } + #======================================== + # check if NoColor is specified + #---------------------------------------- + if (defined $NoColor) { + $cmdL -> setNoColor ($NoColor); + } + #======================================== + # check if MBRID is specified + #---------------------------------------- + if (defined $MBRID) { + if ($MBRID < 0 || $MBRID > 0xffffffff) { + $kiwi -> error ("Invalid mbrid"); + $kiwi -> failed (); + kiwiExit (1); + } + $cmdL -> setMBRID (sprintf ("0x%08x", $MBRID)); + } + #======================================== + # check if default answer is specified + #---------------------------------------- + if (defined $defaultAnswer) { + $cmdL -> setDefaultAnswer ($defaultAnswer); + } + #======================================== + # check if initrd needs to be stored + #---------------------------------------- + if (defined $SetupSplash) { + $cmdL -> setInitrdFile ($SetupSplash); + } + if (defined $BootUSB) { + $cmdL -> setInitrdFile ($BootUSB); + } + if (defined $BootCD) { + $cmdL -> setInitrdFile ($BootCD); + } + if (defined $InstallCD) { + $cmdL -> setInitrdFile ($InstallCD); + } + if (defined $InstallStick) { + $cmdL -> setInitrdFile ($InstallStick); + } + if (defined $InstallPXE) { + $cmdL -> setInitrdFile ($InstallPXE); + } + if (defined $BootVMDisk) { + $cmdL -> setInitrdFile ($BootVMDisk); + } + #======================================== + # check if system loc. needs to be stored + #---------------------------------------- + if (defined $InstallCDSystem) { + $cmdL -> setSystemLocation ($InstallCDSystem); + } + if (defined $InstallStickSystem) { + $cmdL -> setSystemLocation ($InstallStickSystem); + } + if (defined $InstallPXESystem) { + $cmdL -> setSystemLocation ($InstallPXESystem); + } + if (defined $BootVMSystem) { + $cmdL -> setSystemLocation ($BootVMSystem); + } + if (defined $Convert) { + $cmdL -> setSystemLocation ($Convert); + } + #======================================== + # check if image format is specified + #---------------------------------------- + if (defined $Format) { + $cmdL -> setImageFormat ($Format); + } + #======================================== + # check if disk size needs to be stored + #---------------------------------------- + if (defined $BootVMSize) { + $cmdL -> setImageDiskSize ($BootVMSize); + } + #======================================== + # check if targetdevice is specified + #---------------------------------------- + if (defined $targetDevice) { + my $status = $cmdL -> setImageTargetDevice ($targetDevice); + if (! $status) { + kiwiExit(1); + } + } + #======================================== + # check if packages are to be added + #---------------------------------------- + if (@AddPackage) { + $cmdL -> setAdditionalPackages (\@AddPackage); + } + #======================================== + # check if patterns are to be added + #---------------------------------------- + if (@AddPattern) { + $cmdL -> setAdditionalPatterns (\@AddPattern); + } + #======================================== + # check if packs are marked for removal + #---------------------------------------- + if (@RemovePackage) { + $cmdL -> setPackagesToRemove (\@RemovePackage) + } + #======================================== + # check if repositories are to be added + #---------------------------------------- + if (@AddRepository) { + my $numRepos = scalar @AddRepository; + my $numTypes = scalar @AddRepositoryType; + my $numAlia = scalar @AddRepositoryAlias; + my $numPrio = scalar @AddRepositoryPriority; + my $msg; + if (($numAlia) && ($numRepos != $numAlia)) { + $msg = 'Must specify repository alias for each given '; + $msg.= 'repository. Mismatch number of arguments.'; + } + if (($numPrio) && ($numRepos != $numPrio)) { + $msg = 'Must specify repository priority for each given '; + $msg.= 'repository. Mismatch number of arguments.'; + } + if (($numTypes) && ($numRepos != $numTypes)) { + $msg = 'Must specify repository type for each given '; + $msg.= 'repository. Mismatch number of arguments.'; + } + if ($msg) { + $kiwi -> error($msg); + $kiwi -> failed(); + kiwiExit (1); + } + my $idx = 0; + my @reposToAdd; + while ($idx < $numRepos) { + my %init = ( + path => $AddRepository[$idx], + type => $AddRepositoryType[$idx] + ); + if ($idx < $numAlia) { + $init{alias} = $AddRepositoryAlias[$idx]; + } + if ($idx < $numPrio) { + $init{priority} = $AddRepositoryPriority[$idx]; + } + my $repo = KIWIXMLRepositoryData -> new (\%init); + if (! $repo) { + kiwiExit (1); + } + push @reposToAdd, $repo; + $idx += 1; + } + my $res = $cmdL -> setAdditionalRepos(\@reposToAdd); + if (! $res) { + kiwiExit (1); + } + } + #======================================== + # check if force-bootstrap is set + #---------------------------------------- + if (defined $ForceBootstrap) { + $cmdL -> setForceBootstrap ($ForceBootstrap); + } + #======================================== + # check if force-new-root is set + #---------------------------------------- + if (defined $ForceNewRoot) { + $cmdL -> setForceNewRoot ($ForceNewRoot); + } + #======================================== + # check if repositories are to be ignored + #---------------------------------------- + if (defined $IgnoreRepos) { + $cmdL -> setIgnoreRepos(1); + } + #======================================== + # check for specified cache location + #---------------------------------------- + if (defined $ImageCache) { + $cmdL -> setCacheDir($ImageCache); + } + #======================================== + # check if a package manager is specified + #---------------------------------------- + if (defined $PackageManager) { + my $result = $cmdL -> setPackageManager ($PackageManager); + if (! $result) { + kiwiExit (1); + } + } + #======================================== + # check replacement repo information + #---------------------------------------- + if ($SetRepository) { + my %init = ( + alias => $SetRepositoryAlias, + path => $SetRepository, + priority => $SetRepositoryPriority, + type => $SetRepositoryType + ); + my $repo = KIWIXMLRepositoryData -> new(\%init); + if (! $repo) { + kiwiExit (1); + } + my $result = $cmdL -> setReplacementRepo($repo); + if (! $result) { + kiwiExit (1); + } + } + #======================================== + # check if recycle-root is used + #---------------------------------------- + if (defined $RecycleRoot) { + $cmdL -> setRootRecycle(); + } + #============================================ + # check if a target arch is defined + #-------------------------------------------- + if (defined $TargetArch) { + $cmdL -> setImageArchitecture ($TargetArch); + $kiwi -> warning ("--target-arch option set:\n". + " This option influences the behavior of zypper\n". + " Thus it has no effect on other package managers !\n". + " This option is used to force the installation of packages\n". + " for a specific architecture and is not the right choice when\n". + " a complete image should be build for a specific architecture\n". + " Building 32bit images on a 64bit host should be done by\n". + " prefixing the kiwi call with 'linux32'. Cross building\n". + " images for other architectures requires a build root\n". + " environment of the target architecture and a virtualization\n". + " layer handling the binary format. The qemu-binfmt-conf.sh\n". + " and the openSUSE buildservice tool osc helps you here\n" + ); } - if (! $kic -> createImageFormat()) { - kiwiExit (1); + #============================================ + # check if a partitioner is used + #-------------------------------------------- + if ($Partitioner) { + if (($Partitioner ne "parted") &&($Partitioner ne "fdasd")) { + $kiwi -> error ("Invalid partitioner, expected parted|fdasd"); + $kiwi -> failed (); + kiwiExit (1); + } + $cmdL -> setPartitioner ($Partitioner); + } + #============================================ + # check Partitioner according to device + #----------------------------------------- + if (($targetDevice) && ($targetDevice =~ /\/dev\/dasd/)) { + $cmdL -> setPartitioner ("fdasd"); + } + #======================================== + # turn destdir into absolute path + #---------------------------------------- + if (defined $Destination) { + $Destination = File::Spec->rel2abs ($Destination); + $cmdL -> setImageTargetDir ($Destination); + } + if (defined $Prepare) { + if (($Prepare !~ /^\//) && (! -d $Prepare)) { + $Prepare = $gdata->{System}."/".$Prepare; + } + $Prepare =~ s/\/$//; + } + if (defined $Create) { + if (($Create !~ /^\//) && (! -d $Create)) { + $Create = $gdata->{System}."/".$Create; + } + $Create =~ s/\/$//; + } + if (defined $Build) { + if (($Build !~ /^\//) && (! -d $Build)) { + $Build = $gdata->{System}."/".$Build; + } + $Build =~ s/\/$//; + } + if (defined $InitCache) { + if (($InitCache !~ /^\//) && (! -d $InitCache)) { + $InitCache = $gdata->{System}."/".$InitCache; + } + $InitCache =~ s/\/$//; + } + if (defined $ListXMLInfo) { + if (($ListXMLInfo !~ /^\//) && (! -d $ListXMLInfo)) { + $ListXMLInfo = $gdata->{System}."/".$ListXMLInfo; + } + $ListXMLInfo =~ s/\/$//; + } + #======================================== + # store uniq path to image description + #---------------------------------------- + if (defined $Prepare) { + $cmdL -> setConfigDir ($Prepare); + } + if (defined $Upgrade) { + $cmdL -> setConfigDir ($Upgrade); + } + if (defined $Create) { + $cmdL -> setConfigDir ($Create); + } + if (defined $Build) { + $cmdL -> setConfigDir ($Build); + } + if (defined $InitCache) { + $cmdL -> setConfigDir ($InitCache); + } + #======================================== + # store operation modes + #---------------------------------------- + if (defined $BundleBuild) { + $cmdL -> setOperationMode ("bundle",$BundleBuild); + } + if (defined $Build) { + $cmdL -> setOperationMode ("build",$Build); + } + if (defined $Prepare) { + $cmdL -> setOperationMode ("prepare",$Prepare); + } + if (defined $Upgrade) { + $cmdL -> setOperationMode ("upgrade",$Upgrade); + } + if (defined $Create) { + $cmdL -> setOperationMode ("create",$Create); + } + if (defined $InitCache) { + $cmdL -> setOperationMode ("initCache",$InitCache); + } + if (defined $Analyse) { + $cmdL -> setOperationMode ("analyse",$Analyse); + } + if (defined $SetupSplash) { + $cmdL -> setOperationMode ("setupSplash",$SetupSplash); + } + if (defined $BootUSB) { + $cmdL -> setOperationMode ("bootUSB",$BootUSB); + } + if (defined $BootCD) { + $cmdL -> setOperationMode ("bootCD",$BootCD); + } + if (defined $InstallCD) { + $cmdL -> setOperationMode ("installCD",$InstallCD); + } + if (defined $InstallStick) { + $cmdL -> setOperationMode ("installStick",$InstallStick); + } + if (defined $InstallPXE) { + $cmdL -> setOperationMode ("installPXE",$InstallPXE); + } + if (defined $BootVMDisk) { + $cmdL -> setOperationMode ("bootVMDisk",$BootVMDisk); + } + if (defined $Convert) { + $cmdL -> setOperationMode ("convert",$Convert); + } + if (defined $TestImage) { + $cmdL -> setOperationMode ("testImage",$TestImage); + } + if (defined $ListXMLInfo) { + $cmdL -> setOperationMode ("listXMLInfo",$ListXMLInfo); + } + #======================================== + # store original value of Profiles + #---------------------------------------- + $cmdL -> setBuildProfiles (\@Profiles); + #======================================== + # set root target directory if given + #---------------------------------------- + if (defined $RootTree) { + $cmdL -> setRootTargetDir($RootTree) } - kiwiExit (0); - } - - #========================================== - # List XML and repo information - #------------------------------------------ - if ($cmdL->getOperationMode("listXMLInfo")) { - $cmdL -> setConfigDir( - $cmdL->getOperationMode("listXMLInfo") - ); - my $info = KIWIXMLInfo -> new ($cmdL); - if (! $info) { - kiwiExit (1); + #======================================== + # set default inode ratio for ext2/3 + #---------------------------------------- + if (! defined $FSInodeRatio) { + $FSInodeRatio = 16384; } - my $res = $info -> printXMLInfo ( - $cmdL -> getXMLInfoSelection() - ); - if (! $res) { - kiwiExit (1); + #======================================== + # set default inode size for ext2/3 + #---------------------------------------- + if (! defined $FSInodeSize) { + $FSInodeSize = 256; } - kiwiExit (0); - } - - #========================================== - # Test suite - #------------------------------------------ - if ($cmdL->getOperationMode("testImage")) { - $kiwi -> info ("Starting image test run..."); - my $suite = "/usr/lib/os-autoinst"; - my $distri = "kiwi-$$"; - my $type = $cmdL -> getBuildType(); - my $image = $cmdL -> getOperationMode("testImage"); - my $tcase = $cmdL -> getTestCase(); - #========================================== - # Check pre-conditions - #------------------------------------------ - if (! -d $suite) { - $kiwi -> failed (); - $kiwi -> error ("Required os-autoinst test-suite not installed"); - $kiwi -> failed (); - kiwiExit (1); - } - if (! -f $image) { - $kiwi -> failed (); - $kiwi -> error ("Test image $image doesn't exist"); - $kiwi -> failed (); - kiwiExit (1); - } - if (! defined $type) { - $kiwi -> failed (); - $kiwi -> error ("No test image type specified"); - $kiwi -> failed (); - kiwiExit (1); - } - if (! defined $tcase) { - $kiwi -> failed (); - $kiwi -> error ("No test test case specified"); - $kiwi -> failed (); - kiwiExit (1); - } - if (! -d $tcase."/".$type) { - $kiwi -> failed (); - $kiwi -> error ("Test case for type $type does not exist"); - $kiwi -> failed (); - kiwiExit (1); - } - if (! -f $tcase."/env.sh") { - $kiwi -> failed (); - $kiwi -> error ("Can't find environment for this test"); - $kiwi -> failed (); - kiwiExit (1); + #======================================== + # set build type from commandline + #---------------------------------------- + if (defined $SetImageType) { + $cmdL -> setBuildType($SetImageType); } #========================================== - # Turn parameters into absolute pathes + # non root task: Check XML configuration #------------------------------------------ - $image = File::Spec->rel2abs ($image); - $tcase = File::Spec->rel2abs ($tcase); + if (defined $CheckConfig) { + checkConfig ($CheckConfig); + } #========================================== - # Create distri link for os-autoinst + # non root task: Create crypted password #------------------------------------------ - my $test = $tcase."/".$type; - my $data = KIWIQX::qxx ("ln -s $test $suite/distri/$distri 2>&1"); - my $code = $? >> 8; - if ($code != 0) { - $kiwi -> failed (); - $kiwi -> error ("Can't create distri link: $data"); - $kiwi -> failed (); - kiwiExit (1); + if (defined $CreatePassword) { + createPassword(); + } + #======================================== + # non root task: create inst source + #---------------------------------------- + if (defined $CreateInstSource) { + createInstSource ($CreateInstSource,$Verbosity); } #========================================== - # Create result mktemp directory + # non root task: create md5 hash #------------------------------------------ - my $out = KIWIQX::qxx ("mktemp -q -d /tmp/kiwi-testrun-XXXXXX 2>&1"); - $code = $? >> 8; chomp $out; - if ($code != 0) { - $kiwi -> error ("Couldn't create result directory: $out: $!"); - $kiwi -> failed (); - KIWIQX::qxx ("rm -f $suite/distri/$distri"); - kiwiExit (1); + if (defined $CreateHash) { + createHash ($CreateHash); } - KIWIQX::qxx ("chmod 755 $out 2>&1"); #========================================== - # Copy environment to result directory + # non root task: Clone image #------------------------------------------ - $data = KIWIQX::qxx ("cp $tcase/env.sh $out"); - $code = $? >> 8; - if ($code != 0) { - $kiwi -> failed (); - $kiwi -> error ("Failed to copy test environment: $data"); - $kiwi -> failed (); - KIWIQX::qxx ("rm -f $suite/distri/$distri"); - KIWIQX::qxx ("rm -rf $out"); - kiwiExit (1); + if (defined $Clone) { + cloneImage ($Clone); } #========================================== - # Create call file + # non root task: Help #------------------------------------------ - if (open my $FD,'>',"$out/run.sh") { - print $FD "cd $out\n"; - print $FD "export DISTRI=$distri"."\n"; - print $FD "export ISO=$image"."\n"; - print $FD 'isotovideo $ISO'."\n"; - close $FD; - } else { - $kiwi -> failed (); - $kiwi -> error ("Failed to create run test script: $!"); - $kiwi -> failed (); - KIWIQX::qxx ("rm -f $suite/distri/$distri"); - KIWIQX::qxx ("rm -rf $out"); - kiwiExit (1); + if (defined $Help) { + usage(0); } #========================================== - # Create screen ctrl file + # non root task: Version #------------------------------------------ - if (open my $FD,'>',"$out/run.ctrl") { - print $FD "logfile /dev/null\n"; - close $FD; - } else { - $kiwi -> failed (); - $kiwi -> error ("Failed to create screen ctrl file: $!"); - $kiwi -> failed (); - KIWIQX::qxx ("rm -f $suite/distri/$distri"); - KIWIQX::qxx ("rm -rf $out"); - kiwiExit (1); + if (defined $Version) { + version(0); } #========================================== - # Call the test + # Check for root privileges #------------------------------------------ - $kiwi -> done (); - $kiwi -> info ("Calling isotovideo, this can take some time...\n"); - $kiwi -> info ("watch the screen session by: 'screen -r'"); - KIWIQX::qxx ("chmod u+x $out/run.sh"); - KIWIQX::qxx ("screen -L -D -m -c $out/run.ctrl $out/run.sh"); - $code = $? >> 8; - KIWIQX::qxx ("rm -f $suite/distri/$distri"); - if ($code == 0) { - $kiwi -> done (); - } else { - $kiwi -> failed (); + if ($< != 0) { + $kiwi -> error ("Only root can do this"); + $kiwi -> failed (); + kiwiExit (1); } - $kiwi -> info ("Find test results in $out"); - $kiwi -> done (); #========================================== - # Read result + # Check option combination/values #------------------------------------------ - my $json; - foreach my $result (glob ("$out/testresults/*/results.json")) { - my $json_fd = FileHandle -> new(); - if ($json_fd -> open ($result)) { - local $/; - my $json_text = <$json_fd>; - $json = from_json( - $json_text, { utf8 => 1 } + if ( + (! defined $Build) && + (! defined $BundleBuild) && + (! defined $Prepare) && + (! defined $Create) && + (! defined $InitCache) && + (! defined $InstallCD) && + (! defined $Upgrade) && + (! defined $SetupSplash) && + (! defined $BootVMDisk) && + (! defined $Analyse) && + (! defined $InstallStick) && + (! defined $InstallPXE) && + (! defined $ListXMLInfo) && + (! defined $CreatePassword) && + (! defined $BootCD) && + (! defined $BootUSB) && + (! defined $Clone) && + (! defined $CheckConfig) && + (! defined $TestImage) && + (! defined $Convert) + ) { + $kiwi -> warning ("No operation specified"); + $kiwi -> skipped (); + $kiwi -> info ("--> For building call:\n"); + $kiwi -> note ("\n\tkiwi --build