commit mksusecd for openSUSE:Factory
Hello community, here is the log from the commit of package mksusecd for openSUSE:Factory checked in at 2017-04-29 10:53:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/mksusecd (Old) and /work/SRC/openSUSE:Factory/.mksusecd.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "mksusecd" Sat Apr 29 10:53:41 2017 rev:36 rq:491813 version:1.51 Changes: -------- --- /work/SRC/openSUSE:Factory/mksusecd/mksusecd.changes 2017-04-12 18:14:58.580476963 +0200 +++ /work/SRC/openSUSE:Factory/.mksusecd.new/mksusecd.changes 2017-04-29 10:54:09.526850026 +0200 @@ -1,0 +2,9 @@ +Fri Apr 28 11:19:44 UTC 2017 - wfeldt@opensuse.org + +- fix getopt config +- enhanced README.md +- merge gh#openSUSE/mksusecd#22 +- document all functions +- 1.51 + +-------------------------------------------------------------------- Old: ---- mksusecd-1.50.tar.xz New: ---- mksusecd-1.51.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ mksusecd.spec ++++++ --- /var/tmp/diff_new_pack.bM5n6N/_old 2017-04-29 10:54:10.090770362 +0200 +++ /var/tmp/diff_new_pack.bM5n6N/_new 2017-04-29 10:54:10.090770362 +0200 @@ -18,7 +18,7 @@ Name: mksusecd -Version: 1.50 +Version: 1.51 Release: 0 Summary: Create SUSE Linux installation ISOs License: GPL-3.0+ ++++++ mksusecd-1.50.tar.xz -> mksusecd-1.51.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mksusecd-1.50/README.md new/mksusecd-1.51/README.md --- old/mksusecd-1.50/README.md 2017-04-11 12:49:14.000000000 +0200 +++ new/mksusecd-1.51/README.md 2017-04-28 13:19:44.000000000 +0200 @@ -1,8 +1,22 @@ # mksusecd -This is a tool to create SUSE Linux installation ISOs, either from scratch or -by modifying existing ISOs. A simple use case is to regenerate a ISO to -include fixes, see below. +This is a tool to create (open)SUSE Linux installation ISOs - either from scratch or +by modifying existing ISOs. It is **not** intended to create an installation repository or +completely new product media. For this, use [kiwi](https://suse.github.io/kiwi). + +mksusecd makes it easy to apply modifications to existing install media, like: + +- integrate driver updates ([DUD](http://ftp.suse.com/pub/people/hvogel/Update-Media-HOWTO/html)) +- modify the installation system +- replace kernel and modules used during installation +- add boot options +- create and integrate add-on repositories +- change the default repositories used during installation +- create a mini ('network') boot iso from a regular dvd + +The images mksusecd creates can be put both on a cd/dvd or a (usb-)disk. For this mksusecd creates +so-called 'isohybrid' images. If you are interested in the technical details, +you can read more about it [here](layout.md). ## Installation @@ -16,33 +30,95 @@ [1]: https://github.com/openSUSE/mkdud -## Simple use case +## Simple use cases + +> **Note** +> +> _In all the examples below, when you use an iso image as source (and not a directory with the unpacked iso), +you must run mksusecd with root permissions as it will need to mount the iso image temporarily._ + +### 1. Update a package that is used in the installation system We have a patch for yast2-core that is needed during installation and the final system, e.g. for an AutoYaST installation. The patch is included in yast2-core-3.1.12-0.x86_64.rpm. -1. Login as root since mksusecd needs root permissions for temporary mounting of - file systems. +- Create a Driver Update Disk (DUD) from yast2-core.rpm: -2. Create a Driver Update Disk (DUD) from yast2-core.rpm: - ``` + ```sh mkdud --create bug-free.dud --dist 13.2 yast2-core-3.1.12-0.x86_64.rpm ``` -3. Create a new ISO from the original openSUSE 13.2 ISO and the DUD: - ``` - mksusecd --create bug-free.iso --initrd bug-free.dud openSUSE-13.2-DVD-x86_64.iso - ``` +- Create a new ISO from the original openSUSE 13.2 ISO and the DUD: + + ```sh + mksusecd --create bug-free.iso --initrd bug-free.dud openSUSE-13.2-DVD-x86_64.iso + ``` Now you can use bug-free.iso as a replacement for openSUSE-13.2-DVD-x86_64.iso. +### 2 .Create a network install iso + +Say, you need to walk around and install a lot from `http://foo/bar`, then do + +```sh +mksusecd --create foo.iso --nano --net=http://foo/bar openSUSE-13.2-DVD-x86_64.iso +``` + +`--nano` puts only the necessary files for booting on the media (not the installer itself, for example). + +### 3. Add some boot options + +If you need to repeatedly enter the same boot options, create an iso that already has them: + +```sh +mksusecd --create foo.iso --boot "sshd=1 password=*****" openSUSE-13.2-DVD-x86_64.iso +``` + +This would start an ssh daemon you can login to during installation. + +### 4. Modify some other things on the install iso + +- Unpack the iso into some temporary directory: + + ```sh + mount -oloop,ro openSUSE-13.2-DVD-x86_64.iso /mnt + mkdir /tmp/foo + cp -a /mnt/* /tmp/foo + chmod -R u+w /tmp/foo + umount /mnt + ``` + +- Do any changes you like in `/tmp/foo` + +- Build a new iso + + ```sh + mksusecd --create foo.iso /tmp/foo + ``` + ## openSUSE Development -The package is automatically submitted from the `master` branch to -[system:install:head](https://build.opensuse.org/package/show/system:install:head/mksusecd) -OBS project. From that place it is forwarded to -[openSUSE Factory](https://build.opensuse.org/project/show/openSUSE:Factory). +To build, simply run `make`. Install with `make install`. + +Basically every new commit into the master branch of the repository will be auto-submitted +to all current SUSE products. No further action is needed except accepting the pull request. + +Submissions are managed by a SUSE internal [jenkins](https://jenkins.io) node in the InstallTools tab. + +Each time a new commit is integrated into the master branch of the repository, +a new submit request is created to the openSUSE Build Service. The devel project +is [system:install:head](https://build.opensuse.org/package/show/system:install:head/mksusecd). + +`*.changes` and version numbers are auto-generated from git commits, you don't have to worry about this. + +The spec file is maintained in the Build Service only. If you need to change it for the `master` branch, +submit to the +[devel project](https://build.opensuse.org/package/show/system:install:head/mksusecd) +in the build service directly. + +Development happens exclusively in the `master` branch. The branch is used for all current products. -You can find more information about this workflow in the [linuxrc-devtools +You can find more information about the changes auto-generation and the +tools used for jenkis submissions in the [linuxrc-devtools documentation](https://github.com/openSUSE/linuxrc-devtools#opensuse-development). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mksusecd-1.50/VERSION new/mksusecd-1.51/VERSION --- old/mksusecd-1.50/VERSION 2017-04-11 12:49:14.000000000 +0200 +++ new/mksusecd-1.51/VERSION 2017-04-28 13:19:44.000000000 +0200 @@ -1 +1 @@ -1.50 +1.51 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mksusecd-1.50/changelog new/mksusecd-1.51/changelog --- old/mksusecd-1.50/changelog 2017-04-11 12:49:14.000000000 +0200 +++ new/mksusecd-1.51/changelog 2017-04-28 13:19:44.000000000 +0200 @@ -1,3 +1,8 @@ +2017-04-28: 1.51 + - document all functions + - enhanced README.md + - fix getopt config + 2017-04-11: 1.50 - fix typo in help text - distinguish between repomd/classical repo types and allow to specify the default repo location diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mksusecd-1.50/mksusecd new/mksusecd-1.51/mksusecd --- old/mksusecd-1.50/mksusecd 2017-04-11 12:49:14.000000000 +0200 +++ new/mksusecd-1.51/mksusecd 2017-04-28 13:19:44.000000000 +0200 @@ -285,8 +285,8 @@ 'nano' => sub { $opt_type = 'nano' }, 'pico' => sub { $opt_type = 'pico' }, 'net=s' => \$opt_net, - 'instsys' => \$opt_instsys, - 'defaultrepo' => \$opt_defaultrepo, + 'instsys=s' => \$opt_instsys, + 'defaultrepo=s' => \$opt_defaultrepo, 'volume=s' => \$opt_volume, 'vendor=s' => \$opt_vendor, 'preparer=s' => \$opt_preparer, @@ -540,9 +540,9 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# usage($exit_code) +# usage(exit_code) # -# Print help text and exit. +# Print help text and exit with exit_code. # sub usage { @@ -784,6 +784,12 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# check_root(msg) +# +# Checks if we can get root privileges if required. +# +# - msg: message to show to user if things fail +# sub check_root { my $p; @@ -807,6 +813,12 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# susystem(cmd) +# +# Run command with root privileges. +# +# - cmd: command to run +# sub susystem { system $sudo . $_[0]; @@ -814,6 +826,12 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# show_progress(percent) +# +# Helper function to update progress indicator. +# +# - percent: percentage to show +# sub show_progress { my $p = shift; @@ -830,6 +848,20 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# fname(name) +# +# Get full file name. +# +# - name: file name +# +# Returns full file name including path. +# +# We keep track of files and their locations as they can come from different +# sources (directories). For mkisofs it's necessary to ensure file names are +# unique. +# +# The function returns the current instance of the file. +# sub fname { if(exists $files->{$_[0]}) { @@ -874,6 +906,11 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# analyze_boot() +# +# Scan sources and determne boot configuration. The result is put into the +# global $boot var. +# sub analyze_boot { my $boot; @@ -944,6 +981,12 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# todo = build_todo() +# +# Build list of boot configurations the new image should have and return it. +# +# This list is later used contructing the mkisofs/isohybrid calls. +# sub build_todo { my $todo; @@ -1111,6 +1154,14 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# prepare_mkisofs() +# +# Gather information needed to build the mkisofs command line. +# +# The result is stored in the global $mkisofs var. +# +# This uses the todo list from build_todo() to setup the boot config. +# sub prepare_mkisofs { my $iso_catalog; @@ -1195,6 +1246,10 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# run_mkisofs() +# +# Build actual mkisofs command line and run it. +# sub run_mkisofs { my $log; @@ -1254,6 +1309,14 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# buf = read_sector(nr) +# +# Read 2k sector from iso image. +# +# - nr: sector number +# +# Uses global file handle $iso_fh. +# sub read_sector { my $buf; @@ -1266,6 +1329,15 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# write_sector(nr, buf) +# +# Write 2k sector to iso image. +# +# - nr: sector number +# - buf: data to write +# +# Uses global file handle $iso_fh. +# sub write_sector { die "$iso_file: seek error\n" unless seek($iso_fh, $_[0] * 0x800, 0); @@ -1274,6 +1346,13 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# fix_catalog() +# +# Fixes el torito boot catalog. +# +# mkisofs writes a booot catalog that's not exactly standard conform. This +# function fixes it. +# sub fix_catalog { return unless $mkisofs->{fix_catalog}; @@ -1337,6 +1416,20 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# relocate_catalog() +# +# Relocate boot catalog. +# +# Some hardware has problems booting from dvd when the boot catalog is not +# near the beginning of the iso image. +# +# The catalog can actually be nearly in any place in the iso image but +# mkisofs doesn't let you influence it (much). +# +# But mkisofs puts a 'comment' block near the start of the iso image. So, we +# take the somewhat drastic step to relocate the catalog into this 'comment' +# block and have the catalog as much at the top of the image as possible. +# sub relocate_catalog { return unless $mkisofs->{fix_catalog}; @@ -1930,6 +2023,13 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# create_initrd() +# +# Combine the various initrd parts into the new one. +# +# This will only _append_ the new parts to the original unless +# $opt_rebuild_initrd is set. +# sub create_initrd { return undef if !@opt_initrds; @@ -1973,6 +2073,7 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# get_kernel_initrd() # # Return hash with kernel/initrd pair used for booting. # @@ -2017,6 +2118,10 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# update_kernel_initrd() +# +# Put new kernel/initrd into the image (at the correct location). +# sub update_kernel_initrd { my $x = get_kernel_initrd; @@ -2075,6 +2180,14 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# get_initrd_format() +# +# Analyze original initrd parts and remember compression type. +# +# Raise an error if you are about the combine initrd parts with different +# compression types. While it _would_ technically be ok for the kernel to do +# this, this is really a nightmare on the user level side. +# sub get_initrd_format { my $f; @@ -2104,6 +2217,10 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# unpack_orig_initrd() +# +# Locate original initrd and unpack it into a temporary directory. +# sub unpack_orig_initrd { if(my $x = get_kernel_initrd) { @@ -2130,6 +2247,17 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# extract_installkeys() +# +# Get 'installkey.gpg' from the ooriginal initrd. +# +# Older SUSE install initrds has the gpg keys in a file installkey.gpg. To +# be able to add keys we have to extract the file first, add the keys, and +# then write the new file. +# +# Current SUSE initrds don't have this file and use keys in +# /usr/lib/rpm/gnupg/keys directly. +# sub extract_installkeys { return if !$opt_sign; @@ -2146,6 +2274,10 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# create_cd_ikr() +# +# Needed to handle s390x systems. +# sub create_cd_ikr { local $_; @@ -2205,6 +2337,10 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# isolinux_add_option() +# +# Add new boot option to isolinux.cfg. +# sub isolinux_add_option { my $n = shift; @@ -2275,6 +2411,10 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# grub2_add_option() +# +# Add new boot option to grub.cfg. +# sub grub2_add_option { my $n = shift; @@ -2323,6 +2463,10 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# yaboot_add_option() +# +# Add new boot option to yaboot.txt. +# sub yaboot_add_option { my $n = shift; @@ -2387,6 +2531,10 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# update_boot_options() +# +# Add new booot option. Modifies files according to used boot loader. +# sub update_boot_options { return unless defined $opt_boot_options || $opt_new_boot_entry; @@ -2431,7 +2579,10 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# wipe files we really don't want +# prepare_normal() +# +# Wipe files we really don't want to see in our image. +# sub prepare_normal { # cleaning up KIWI isos a bit @@ -2467,6 +2618,11 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# prepare_micro() +# +# Remove all files not needed to run the installer itself. Basicallly whis removes +# the rpms from the repository in the image. +# sub prepare_micro { exclude_files [ @@ -2487,6 +2643,11 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# prepare_nano() +# +# Remove all files not needed to run linuxrc. This will also remove the +# installation system (as for the network iso). +# sub prepare_nano { prepare_micro; @@ -2516,6 +2677,11 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# prepare_pico() +# +# Remove all files not needed to run the boot loader. This makes only sense +# for testing. +# sub prepare_pico { prepare_nano; @@ -2538,6 +2704,11 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# set_mkisofs_metadata() +# +# Construct iso metadata from existing iso and product files found in the +# source image. +# sub set_mkisofs_metadata { my $media; @@ -2728,6 +2899,11 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# create_sign_key() +# +# Create a temporary gpg keyring and either add the provided gpg key or +# create a temporary key. +# sub create_sign_key { my $gpg_dir = $tmp->dir(); @@ -2808,6 +2984,10 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# add_sign_key() +# +# Add public part of mksusecd sign key to image so it's used by the installer. +# sub add_sign_key { return if !$sign_key_pub; @@ -2833,6 +3013,10 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# sign_content() +# +# Re-sign 'content' file with our own key if we modified it. +# sub sign_content { return if !$sign_key_dir; @@ -3148,6 +3332,10 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# get_initrd_modules() +# +# Get list of modules that are in the initrd. +# sub get_initrd_modules { my $unpack_dir = $tmp->dir(); @@ -3187,6 +3375,10 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# unpack_kernel_rpms() +# +# Unpack al provided kernel packaged in a temporary location. +# sub unpack_kernel_rpms { $kernel->{dir} = $tmp->dir(); @@ -3227,6 +3419,13 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# build_module_list() +# +# Build list of modules to include in the new initrd. +# +# This is based on the list of modules in the original initrd minus modules +# no longer exist plus modules needed to fulfill all module dependencies. +# sub build_module_list { my %mods_remove; @@ -3352,6 +3551,10 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# add_modules_to_initrd() +# +# Add new modules to initrd. +# sub add_modules_to_initrd { my $tmp_dir; @@ -3412,6 +3615,13 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# replace_kernel_mods() +# +# Replace kernel modules. +# +# Includes getting the list of modules in the original initrd, unpacking the +# kernel packages, and including the new modules to the new initrd. +# sub replace_kernel_mods { my @modules;
participants (1)
-
root@hilbert.suse.de