Hello community, here is the log from the commit of package mkinitrd for openSUSE:Factory checked in at 2012-11-13 10:08:39 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/mkinitrd (Old) and /work/SRC/openSUSE:Factory/.mkinitrd.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "mkinitrd", Maintainer is "MMarek@suse.com" Changes: -------- --- /work/SRC/openSUSE:Factory/mkinitrd/mkinitrd.changes 2012-11-05 15:32:42.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.mkinitrd.new/mkinitrd.changes 2012-11-13 10:09:28.000000000 +0100 @@ -2 +2 @@ -Mon Nov 5 09:16:19 UTC 2012 - fcrozat@suse.com +Fri Nov 9 18:37:49 CET 2012 - ohering@suse.de @@ -4,2 +4 @@ -- Update 0001-Handle-lib-udev-being-a-symlink-to-usr-lib-udev.patch - to correctly handle udev from systemd 195. +- Version 2.7.2. @@ -8 +7 @@ -Fri Nov 2 10:39:06 UTC 2012 - idonmez@suse.com +Fri Nov 9 18:35:28 CET 2012 - ohering@suse.de @@ -10,2 +9,13 @@ -- Add mkinitrd-get_kernel_version.patch to fix path for - get_kernel_version command. +- put udev related files into /usr/lib/udev + create /lib/udev as symlink + +------------------------------------------------------------------- +Thu Nov 8 15:51:38 CET 2012 - ohering@suse.de + +- wrap "_unitdir" file list entry in a suse_version check + +------------------------------------------------------------------- +Thu Nov 8 15:41:34 CET 2012 - ohering@suse.de + +- remove blkid handling from setup-udev.sh + it is already handled in boot-udev.sh @@ -22,2 +32,49 @@ -- Add 0001-Handle-lib-udev-being-a-symlink-to-usr-lib-udev.patch: - handle /lib/udev being a symlink. +- handle udev from systemd 195. + +------------------------------------------------------------------- +Mon Oct 1 15:05:46 CEST 2012 - ohering@suse.de + +- install ipconfig.sh as ipconfig, so that only one copy gets + installed into the initrd + +------------------------------------------------------------------- +Mon Oct 1 14:40:31 CEST 2012 - ohering@suse.de + +- remove true(1) from program tags, functionality is provided by a script + +------------------------------------------------------------------- +Mon Oct 1 10:05:20 CEST 2012 - ohering@suse.de + +- replace cp_bin usage in setup-network.sh with programs tags + +------------------------------------------------------------------- +Sat Sep 29 23:33:58 CEST 2012 - ohering@suse.de + +- move some programs tags from boot-start.sh to boot-shell.sh +- list all programs from linuxrc+ipconfig.sh in boot-start.sh + +------------------------------------------------------------------- +Sat Sep 29 23:22:23 CEST 2012 - ohering@suse.de + +- remove usage of absolute paths in programs tags + +------------------------------------------------------------------- +Sat Sep 29 22:34:07 CEST 2012 - ohering@suse.de + +- list all tools in boot-* scripts in a programs tag + +------------------------------------------------------------------- +Sat Sep 29 21:41:09 CEST 2012 - ohering@suse.de + +- remove usage of absolute paths for executables + +------------------------------------------------------------------- +Fri Sep 28 23:20:23 CEST 2012 - ohering@suse.de + +- update cp_bin to handle symlinks properly (bnc#778149) + +------------------------------------------------------------------- +Fri Sep 28 17:58:01 CEST 2012 - ohering@suse.de + +- remove suid/sgid from binaries right before creating the initrd +- make binaries in all four bin directories executable Old: ---- 0001-Handle-lib-udev-being-a-symlink-to-usr-lib-udev.patch mkinitrd-2.7.1-cmdinitrd.patch mkinitrd-get_kernel_version.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ mkinitrd.spec ++++++ --- /var/tmp/diff_new_pack.clP1PE/_old 2012-11-13 10:09:32.000000000 +0100 +++ /var/tmp/diff_new_pack.clP1PE/_new 2012-11-13 10:09:32.000000000 +0100 @@ -41,7 +41,7 @@ %else Requires: sysvinit %endif -Version: 2.7.1 +Version: 2.7.2 Release: 0 Conflicts: udev < 118 Requires: dhcpcd @@ -51,12 +51,6 @@ Group: System/Base BuildRoot: %{_tmppath}/%{name}-%{version}-build Source0: mkinitrd.tar.bz2 -# PATCH-FIX-UPSTREAM 0001-Handle-lib-udev-being-a-symlink-to-usr-lib-udev.patch fcrozat@suse.com -- handle /lib/udev being a symlink -Patch0: 0001-Handle-lib-udev-being-a-symlink-to-usr-lib-udev.patch -# PATCH-FIX-UPSTREAM mkinitrd-2.7.1-cmdinitrd.patch werner@suse.com -- add cmdinitrd to run commands on files in an initrd -Patch1: mkinitrd-2.7.1-cmdinitrd.patch -# Hack for 12.3-M1 -Patch2: mkinitrd-get_kernel_version.patch # Note: the whole package is maintained in this git repository, please # don't change it in the build service without sending the author a # pull request or patch first. Otherwise, you risk that your changes will be @@ -91,15 +85,11 @@ %prep %setup -%patch0 -p1 -%patch1 -p1 -%patch2 -p1 %build %__cc $RPM_OPT_FLAGS -Wall -Os -o lib/mkinitrd/bin/run-init src/run-init.c %__cc $RPM_OPT_FLAGS -Wall -Os -o lib/mkinitrd/bin/warpclock src/warpclock.c make -C man -make -C man cmdinitrd.8 sed -i "s/@BUILD_DAY@/`env LC_ALL=C date -ud yesterday '+%Y%m%d'`/" sbin/mkinitrd echo "Checking scripts:" if ! bash -n sbin/mkinitrd; then @@ -118,16 +108,21 @@ mkdir -p $RPM_BUILD_ROOT/lib/mkinitrd/scripts mkdir -p $RPM_BUILD_ROOT/lib/mkinitrd/setup mkdir -p $RPM_BUILD_ROOT/lib/mkinitrd/boot +mkdir -p $RPM_BUILD_ROOT/lib/mkinitrd/bin mkdir -p $RPM_BUILD_ROOT/etc/init.d mkdir -p $RPM_BUILD_ROOT/var/adm/fillup-templates cp -a scripts/*.sh $RPM_BUILD_ROOT/lib/mkinitrd/scripts/ -cp -a lib/mkinitrd/bin $RPM_BUILD_ROOT/lib/mkinitrd/bin +for i in lib/mkinitrd/bin/* +do + n=`echo $i | sed 's@.sh$@@'` + cp -a $i $RPM_BUILD_ROOT/$n +done make -C sbin DESTDIR=$RPM_BUILD_ROOT install chmod -R 755 $RPM_BUILD_ROOT/lib/mkinitrd install -D -m 644 man/mkinitrd.5 $RPM_BUILD_ROOT/%{_mandir}/man5/mkinitrd.5 -install -D -m 644 man/mkinitrd.8 $RPM_BUILD_ROOT/%{_mandir}/man8/mkinitrd.8 -install -D -m 644 man/lsinitrd.8 $RPM_BUILD_ROOT/%{_mandir}/man8/lsinitrd.8 install -D -m 644 man/cmdinitrd.8 $RPM_BUILD_ROOT/%{_mandir}/man8/cmdinitrd.8 +install -D -m 644 man/lsinitrd.8 $RPM_BUILD_ROOT/%{_mandir}/man8/lsinitrd.8 +install -D -m 644 man/mkinitrd.8 $RPM_BUILD_ROOT/%{_mandir}/man8/mkinitrd.8 mkdir -p $RPM_BUILD_ROOT/etc/rpm cat > $RPM_BUILD_ROOT/etc/rpm/macros.mkinitrd <<EOF # @@ -185,11 +180,13 @@ %config /etc/rpm/macros.mkinitrd /etc/init.d/boot.loadmodules /etc/init.d/purge-kernels +%if 0%{?suse_version} >= 1210 %_unitdir/purge-kernels.service +%endif /lib/mkinitrd/scripts/*.sh /lib/mkinitrd/bin/* -/bin/lsinitrd /bin/cmdinitrd +/bin/lsinitrd /sbin/mkinitrd /sbin/mkinitrd_setup /sbin/module_upgrade @@ -197,8 +194,8 @@ /sbin/purge-kernels /var/adm/fillup-templates/sysconfig.kernel-%name %doc %{_mandir}/man5/mkinitrd.5.gz +%doc %{_mandir}/man8/cmdinitrd.8.gz %doc %{_mandir}/man8/lsinitrd.8.gz %doc %{_mandir}/man8/mkinitrd.8.gz -%doc %{_mandir}/man8/cmdinitrd.8.gz %changelog ++++++ mkinitrd.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/etc/purge-kernels.init new/mkinitrd-2.7.2/etc/purge-kernels.init --- old/mkinitrd-2.7.1/etc/purge-kernels.init 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/etc/purge-kernels.init 2012-11-09 18:38:03.000000000 +0100 @@ -30,6 +30,6 @@ . /etc/rc.status echo "Removing old kernel packages..." rm -f /boot/do_purge_kernels -/sbin/purge-kernels +purge-kernels rc_status -v rc_exit diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/lib/mkinitrd/bin/ipconfig.sh new/mkinitrd-2.7.2/lib/mkinitrd/bin/ipconfig.sh --- old/mkinitrd-2.7.1/lib/mkinitrd/bin/ipconfig.sh 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/lib/mkinitrd/bin/ipconfig.sh 2012-11-09 18:38:03.000000000 +0100 @@ -73,12 +73,12 @@ # Configure the interface if [ "$peer" ] ; then - /sbin/ip addr add ${client} peer ${peer}/$prefix dev $dev + ip addr add ${client} peer ${peer}/$prefix dev $dev else - /sbin/ip addr add ${client}/${prefix} dev $dev + ip addr add ${client}/${prefix} dev $dev fi -/sbin/ip link set $dev up +ip link set $dev up if [ "$gateway" ]; then - /sbin/ip route add to default via ${gateway} + ip route add to default via ${gateway} fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/man/Makefile new/mkinitrd-2.7.2/man/Makefile --- old/mkinitrd-2.7.1/man/Makefile 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/man/Makefile 2012-11-09 18:38:03.000000000 +0100 @@ -1,11 +1,14 @@ A2X = a2x A2X_OPTIONS = --doctype=manpage --format=manpage -all: lsinitrd.8 mkinitrd.5 mkinitrd.8 +all: cmdinitrd.8 lsinitrd.8 mkinitrd.5 mkinitrd.8 lsinitrd.8: lsinitrd.8.txt $(A2X) $(A2X_OPTIONS) $< +cmdinitrd.8: cmdinitrd.8.txt + $(A2X) $(A2X_OPTIONS) $< + mkinitrd.5: mkinitrd.5.txt $(A2X) $(A2X_OPTIONS) $< diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/man/cmdinitrd.8.txt new/mkinitrd-2.7.2/man/cmdinitrd.8.txt --- old/mkinitrd-2.7.1/man/cmdinitrd.8.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/mkinitrd-2.7.2/man/cmdinitrd.8.txt 2012-11-09 18:38:03.000000000 +0100 @@ -0,0 +1,64 @@ +//{{{ Copyright (c) 2012, SUSE LINUX Products GmbH +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// Neither the name of the Novell nor the names of its contributors may be used +// to endorse or promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ONANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +//}}} + +cmdinitrd(8) +=========== +:man source: cmdinitrd +:man manual: User Manuals +Werner Fink <werner@suse.de> + +Name +---- +cmdinitrd - run command on a file of an initrd disk image + +Synopsis +-------- +cmdinitrd _initrd file_ _command_ [_options_] _file_ [_local file_] + +Description +----------- +*cmdinitrd* executes a command on the content of a file of an initial ramdisk images for booting Linux as +created by *mkinitrd*(8). + +Examples +-------- + cmdinitrd /boot/initrd diff -u etc/adjtime /etc/adjtime + +Authors +------- +Werner Fink <werner@suse.de> + +SEE ALSO +-------- +*mkinitrd*(8), *mkinitrd*(5) + + +// vim: set sw=4 ts=4 et tw=80 fdm=marker: :collapseFolds=1: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/mkinitrd.changes new/mkinitrd-2.7.2/mkinitrd.changes --- old/mkinitrd-2.7.1/mkinitrd.changes 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/mkinitrd.changes 2012-11-09 18:38:03.000000000 +0100 @@ -1,4 +1,85 @@ ------------------------------------------------------------------- +Fri Nov 9 18:37:49 CET 2012 - ohering@suse.de + +- Version 2.7.2. + +------------------------------------------------------------------- +Fri Nov 9 18:35:28 CET 2012 - ohering@suse.de + +- put udev related files into /usr/lib/udev + create /lib/udev as symlink + +------------------------------------------------------------------- +Thu Nov 8 15:51:38 CET 2012 - ohering@suse.de + +- wrap "_unitdir" file list entry in a suse_version check + +------------------------------------------------------------------- +Thu Nov 8 15:41:34 CET 2012 - ohering@suse.de + +- remove blkid handling from setup-udev.sh + it is already handled in boot-udev.sh + +------------------------------------------------------------------- +Thu Oct 18 12:36:10 UTC 2012 - werner@suse.de + +- Add a new utility for running a command like diff or less on a + file in the initrd boot image + +------------------------------------------------------------------- +Tue Oct 16 13:46:06 UTC 2012 - fcrozat@suse.com + +- handle udev from systemd 195. + +------------------------------------------------------------------- +Mon Oct 1 15:05:46 CEST 2012 - ohering@suse.de + +- install ipconfig.sh as ipconfig, so that only one copy gets + installed into the initrd + +------------------------------------------------------------------- +Mon Oct 1 14:40:31 CEST 2012 - ohering@suse.de + +- remove true(1) from program tags, functionality is provided by a script + +------------------------------------------------------------------- +Mon Oct 1 10:05:20 CEST 2012 - ohering@suse.de + +- replace cp_bin usage in setup-network.sh with programs tags + +------------------------------------------------------------------- +Sat Sep 29 23:33:58 CEST 2012 - ohering@suse.de + +- move some programs tags from boot-start.sh to boot-shell.sh +- list all programs from linuxrc+ipconfig.sh in boot-start.sh + +------------------------------------------------------------------- +Sat Sep 29 23:22:23 CEST 2012 - ohering@suse.de + +- remove usage of absolute paths in programs tags + +------------------------------------------------------------------- +Sat Sep 29 22:34:07 CEST 2012 - ohering@suse.de + +- list all tools in boot-* scripts in a programs tag + +------------------------------------------------------------------- +Sat Sep 29 21:41:09 CEST 2012 - ohering@suse.de + +- remove usage of absolute paths for executables + +------------------------------------------------------------------- +Fri Sep 28 23:20:23 CEST 2012 - ohering@suse.de + +- update cp_bin to handle symlinks properly (bnc#778149) + +------------------------------------------------------------------- +Fri Sep 28 17:58:01 CEST 2012 - ohering@suse.de + +- remove suid/sgid from binaries right before creating the initrd +- make binaries in all four bin directories executable + +------------------------------------------------------------------- Mon Jul 30 23:12:39 UTC 2012 - jeffm@suse.com - Version 2.7.1. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/mkinitrd.spec new/mkinitrd-2.7.2/mkinitrd.spec --- old/mkinitrd-2.7.1/mkinitrd.spec 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/mkinitrd.spec 2012-11-09 18:38:03.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package mkinitrd # -# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -15,32 +15,40 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # -# norootforbuild - Name: mkinitrd -License: GPL-2.0+ -Group: System/Base #!BuildIgnore: module-init-tools e2fsprogs udev reiserfs fop -BuildRequires: asciidoc libxslt +BuildRequires: asciidoc +BuildRequires: libxslt %if 0%{?suse_version} >= 1210 -BuildRequires: systemd +BuildRequires: systemd %{?systemd_requires} %endif -Requires: coreutils modutils util-linux grep gzip sed cpio udev file perl-Bootloader +Requires: coreutils +Requires: cpio +Requires: file +Requires: grep +Requires: gzip +Requires: modutils +Requires: perl-Bootloader +Requires: sed +Requires: udev +Requires: util-linux Requires: xz %if 0%{?suse_version} > 1120 -Requires: sysvinit-tools sbin_init +Requires: sbin_init +Requires: sysvinit-tools %else Requires: sysvinit %endif -AutoReqProv: on Version: @@VERSION@@ -Release: 3 +Release: 0 Conflicts: udev < 118 Requires: dhcpcd PreReq: %fillup_prereq Summary: Creates an Initial RAM Disk Image for Preloading Modules +License: GPL-2.0+ +Group: System/Base BuildRoot: %{_tmppath}/%{name}-%{version}-build Source0: mkinitrd.tar.bz2 # Note: the whole package is maintained in this git repository, please @@ -100,15 +108,21 @@ mkdir -p $RPM_BUILD_ROOT/lib/mkinitrd/scripts mkdir -p $RPM_BUILD_ROOT/lib/mkinitrd/setup mkdir -p $RPM_BUILD_ROOT/lib/mkinitrd/boot +mkdir -p $RPM_BUILD_ROOT/lib/mkinitrd/bin mkdir -p $RPM_BUILD_ROOT/etc/init.d mkdir -p $RPM_BUILD_ROOT/var/adm/fillup-templates cp -a scripts/*.sh $RPM_BUILD_ROOT/lib/mkinitrd/scripts/ -cp -a lib/mkinitrd/bin $RPM_BUILD_ROOT/lib/mkinitrd/bin +for i in lib/mkinitrd/bin/* +do + n=`echo $i | sed 's@.sh$@@'` + cp -a $i $RPM_BUILD_ROOT/$n +done make -C sbin DESTDIR=$RPM_BUILD_ROOT install chmod -R 755 $RPM_BUILD_ROOT/lib/mkinitrd install -D -m 644 man/mkinitrd.5 $RPM_BUILD_ROOT/%{_mandir}/man5/mkinitrd.5 -install -D -m 644 man/mkinitrd.8 $RPM_BUILD_ROOT/%{_mandir}/man8/mkinitrd.8 +install -D -m 644 man/cmdinitrd.8 $RPM_BUILD_ROOT/%{_mandir}/man8/cmdinitrd.8 install -D -m 644 man/lsinitrd.8 $RPM_BUILD_ROOT/%{_mandir}/man8/lsinitrd.8 +install -D -m 644 man/mkinitrd.8 $RPM_BUILD_ROOT/%{_mandir}/man8/mkinitrd.8 mkdir -p $RPM_BUILD_ROOT/etc/rpm cat > $RPM_BUILD_ROOT/etc/rpm/macros.mkinitrd <<EOF # @@ -166,9 +180,12 @@ %config /etc/rpm/macros.mkinitrd /etc/init.d/boot.loadmodules /etc/init.d/purge-kernels +%if 0%{?suse_version} >= 1210 %_unitdir/purge-kernels.service +%endif /lib/mkinitrd/scripts/*.sh /lib/mkinitrd/bin/* +/bin/cmdinitrd /bin/lsinitrd /sbin/mkinitrd /sbin/mkinitrd_setup @@ -177,7 +194,8 @@ /sbin/purge-kernels /var/adm/fillup-templates/sysconfig.kernel-%name %doc %{_mandir}/man5/mkinitrd.5.gz -%doc %{_mandir}/man8/mkinitrd.8.gz +%doc %{_mandir}/man8/cmdinitrd.8.gz %doc %{_mandir}/man8/lsinitrd.8.gz +%doc %{_mandir}/man8/mkinitrd.8.gz %changelog diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/sbin/Makefile new/mkinitrd-2.7.2/sbin/Makefile --- old/mkinitrd-2.7.1/sbin/Makefile 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/sbin/Makefile 2012-11-09 18:38:03.000000000 +0100 @@ -6,7 +6,7 @@ bindir = /bin PRGS = mkinitrd installkernel module_upgrade mkinitrd_setup purge-kernels -UPRGS = lsinitrd +UPRGS = lsinitrd cmdinitrd all: install install: install_prgs install_uprgs diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/sbin/cmdinitrd new/mkinitrd-2.7.2/sbin/cmdinitrd --- old/mkinitrd-2.7.1/sbin/cmdinitrd 1970-01-01 01:00:00.000000000 +0100 +++ new/mkinitrd-2.7.2/sbin/cmdinitrd 2012-11-09 18:38:03.000000000 +0100 @@ -0,0 +1,91 @@ +#!/bin/bash +# +# cmdinitrd - use command on contents of an initrd image +# +# Copyright (C) 2012 SuSE Linux Products GmbH, Nuernberg, Germany +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# This file is kept in the following git repository: +# +# git://git.opensuse.org/projects/mkinitrd.git +# + +usage() { + echo "Usage: cmdinitrd <initrd> <cmd> [<opt>] <file> [<local>]" +} + +initrd="${1}" +infile= +typeset -a argv=() +typeset -i argc=0 +shift + +while [ "$1" ] ; do + case $1 in + -*) + argv[$argc]="$1" + let argc++; + shift + ;; + *) if ((argc == 0)) ; then + argv[0]="$1" + let argc++; + shift + else + infile="$1" + shift + break + fi + esac +done + +if [ -z "$initrd" ] ; then + echo "No initrd file specified" + usage + exit 1 +fi + +if [ ! -e "$initrd" ] ; then + echo "No initrd file `$initrd' found" + usage + exit 1 +fi + +if [ -z "$infile" ] ; then + echo "No file of the initrd image specified" + usage + exit 1 +fi + +if ! type -p ${argv[0]} &> /dev/null ; then + echo "No command `${argv[0]}' found" + usage + exit 1 +fi + +uncomp() +{ + local uncompress="gzip" + case $(file -bL "$1") in + gzip\ *) uncompress="gzip" ;; + bzip2\ *) uncompress="bzip2" ;; + LZMA\ *) uncompress="lzma" ;; + XZ\ *) uncompress="xz" ;; + esac + command $uncompress -cdfq < "$1" +} + +case "${argv[0]##*/}" in + diff) test -n "$1" || set -- $infile ;; +esac + +uncomp "$initrd" | exec cpio --quiet -i --to-stdout "${infile#/}" | exec ${argv[@]} - ${1+"$@"} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/sbin/lsinitrd new/mkinitrd-2.7.2/sbin/lsinitrd --- old/mkinitrd-2.7.1/sbin/lsinitrd 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/sbin/lsinitrd 2012-11-09 18:38:03.000000000 +0100 @@ -13,11 +13,6 @@ # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, -# USA. # This file is kept in the following git repository: # @@ -54,14 +49,16 @@ esac done -use_gzip=true uncomp() { - if $use_gzip && gzip -cd "$1" 2>/dev/null; then - return - fi - use_gzip=false - xz -cd "$1" + local uncompress="gzip" + case $(file -bL "$1") in + gzip\ *) uncompress="gzip" ;; + bzip2\ *) uncompress="bzip2" ;; + LZMA\ *) uncompress="lzma" ;; + XZ\ *) uncompress="xz" ;; + esac + command $uncompress -cdfq < "$1" } @@ -81,11 +78,11 @@ if [ "$config" -eq 1 ] ; then # yes, that's snow, but doesn't use any temporary files :) - for configfile in $(uncomp $initrd | cpio $args --quiet | grep '^config/') ; do + for configfile in $(uncomp $initrd | exec cpio --quiet -t | exec grep '^config/') ; do echo "=========> $configfile <============" - uncomp $initrd | cpio --quiet -i --to-stdout $configfile + uncomp $initrd | exec cpio --quiet -i --to-stdout $configfile echo done else - uncomp $initrd | cpio --quiet $args + uncomp $initrd | exec cpio --quiet $args fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/sbin/mkinitrd new/mkinitrd-2.7.2/sbin/mkinitrd --- old/mkinitrd-2.7.1/sbin/mkinitrd 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/sbin/mkinitrd 2012-11-09 18:38:03.000000000 +0100 @@ -14,20 +14,16 @@ # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, -# USA. # This file is kept in the following git repository: # # git://git.opensuse.org/projects/mkinitrd.git # -VERSION=2.7.1 +VERSION=2.7.2 LOGDIR=/var/log/YaST2 LOGFILE=$LOGDIR/mkinitrd.log +PATH=/sbin:/usr/sbin:$PATH declare -a cmd_option declare cmd_option_name cmd_option_desc cmd_option_param cmd_param_desc cmd_param_name cmd_param_is_array shopt -s nullglob @@ -102,7 +98,8 @@ fi } -[ -x /usr/bin/nroff -a -t 1 ] && nroff=1 +nroff=$(type -p nroff) +[ -n "$nroff" -a -t 1 ] && nroff=1 usage() { @@ -144,10 +141,10 @@ kernel_version_from_image() { local kernel_image=$1 kernel_image_gz=${1//uImage/vmlinux}.gz - if /sbin/get_kernel_version "$kernel_image" 2>/dev/null; then + if get_kernel_version "$kernel_image" 2>/dev/null; then return fi - /sbin/get_kernel_version "$kernel_image_gz" 2>/dev/null + get_kernel_version "$kernel_image_gz" 2>/dev/null } default_kernel_images() { @@ -399,9 +396,6 @@ default_kernel_images fi -initrd_insmod=/sbin/insmod -initrd_modprobe=/sbin/modprobe - # maximum initrd size image_blocks=40960 image_inodes=2048 @@ -409,8 +403,6 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # should be nothing to change below... -PATH=/sbin:/usr/sbin:$PATH - # Fixup old installations unset CDPATH @@ -526,7 +518,7 @@ setup_mtime=${setup_mtime%.*} boot_mtime=${boot_mtime%.*} if [ "$scripts_mtime" -gt "$setup_mtime" ] || [ "$scripts_mtime" -gt "$boot_mtime" ] ; then - /sbin/mkinitrd_setup + mkinitrd_setup fi #boot_modules="$modules" @@ -566,13 +558,13 @@ cleanup_finish -if [ ! -x /sbin/update-bootloader ] ; then +if [ -z "$(type -p update-bootloader)" ] ; then no_bootloader_update=1 fi if [ "$exit_code" -eq 0 ] ; then if [ -z "$no_bootloader_update" ] ; then - /sbin/update-bootloader --refresh + update-bootloader --refresh exit_code=$? else echo 2>&1 "Don't refresh the bootloader. You may have to do " \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/scripts/boot-boot.sh new/mkinitrd-2.7.2/scripts/boot-boot.sh --- old/mkinitrd-2.7.1/scripts/boot-boot.sh 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/scripts/boot-boot.sh 2012-11-09 18:38:03.000000000 +0100 @@ -3,6 +3,10 @@ #%stage: setup #%depends: killprogs #%programs: chroot +#%programs: fsck +#%programs: mount +#%programs: sleep +#%programs: umount #%modules: #%dontshow # @@ -78,19 +82,19 @@ # Mount the /usr filesystem if possible # XXX: handle journaldev for the /usr device separately if test -n "$usrdev"; then - if /sbin/fsck -t $usrfstype $fsckopts $usrdev; then + if fsck -t $usrfstype $fsckopts $usrdev; then echo "Mounting /usr" fsoptions=$(get_options_from_fstab "/usr") if [ "$fsoptions" ]; then fsoptions="-o $fsoptions" fi - /bin/mount -t $usrfstype $fsoptions $usrdev /root/usr + mount -t $usrfstype $fsoptions $usrdev /root/usr fi fi # Move device nodes -/bin/mount --move /dev /root/dev -/bin/mount -t proc proc /root/proc +mount --move /dev /root/dev +mount -t proc proc /root/proc if [ -d /root/run ]; then mount --move /run /root/run else @@ -112,6 +116,6 @@ ROOTFS_BLKDEV="$rootdev" export ROOTFS_BLKDEV -exec /bin/run-init -c ./dev/console /root $init ${kernel_cmdline[@]} +exec run-init -c ./dev/console /root $init ${kernel_cmdline[@]} echo could not exec run-init! die 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/scripts/boot-clock.sh new/mkinitrd-2.7.2/scripts/boot-clock.sh --- old/mkinitrd-2.7.1/scripts/boot-clock.sh 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/scripts/boot-clock.sh 2012-11-09 18:38:03.000000000 +0100 @@ -12,7 +12,7 @@ while read line do if test "$line" = LOCAL then - /bin/warpclock + warpclock > /dev/shm/warpclock fi done < /etc/adjtime @@ -20,7 +20,7 @@ then . /etc/sysconfig/clock case "$HWCLOCK" in - *-l*) /bin/warpclock + *-l*) warpclock > /dev/shm/warpclock esac fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/scripts/boot-createfb.sh new/mkinitrd-2.7.2/scripts/boot-createfb.sh --- old/mkinitrd-2.7.1/scripts/boot-createfb.sh 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/scripts/boot-createfb.sh 2012-11-09 18:38:03.000000000 +0100 @@ -1,5 +1,6 @@ #!/bin/bash #%stage: setup +#%programs: mknod #%dontshow # ##### framebuffer device node creator diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/scripts/boot-devfunctions.sh new/mkinitrd-2.7.2/scripts/boot-devfunctions.sh --- old/mkinitrd-2.7.1/scripts/boot-devfunctions.sh 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/scripts/boot-devfunctions.sh 2012-11-09 18:38:03.000000000 +0100 @@ -2,6 +2,10 @@ # #%stage: boot #%programs: usleep +# the following tools will be copied by other boot-*.sh scripts +# multipath +# vgchange +# vgscan #%dontshow # ##### Device functions @@ -72,7 +76,7 @@ echo " ok" retval=0 break; - elif [ -x /sbin/multipath ] ; then + elif [ -n "$(type -p multipath)" ] ; then if [ -n "$vg_root" -a -n "$vg_roots" ] ; then vgchange --sysinit -a n fi @@ -103,7 +107,7 @@ fi done fi - if [ -x /sbin/multipath ] && [ -n "$vg_root" -a -n "$vg_roots" ] ; then + if [ -n "$(type -p multipath)" ] && [ -n "$vg_root" -a -n "$vg_roots" ] ; then echo "Resetting LVM for multipath" vgchange --sysinit -a n multipath -v 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/scripts/boot-ibft.sh new/mkinitrd-2.7.2/scripts/boot-ibft.sh --- old/mkinitrd-2.7.1/scripts/boot-ibft.sh 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/scripts/boot-ibft.sh 2012-11-09 18:38:03.000000000 +0100 @@ -1,6 +1,7 @@ #!/bin/bash #%stage: device #%modules: iscsi_ibft +#%programs: cat #%if: "$ibft_available" #: ${ibft_nic:=/sys/firmware/ibft/ethernet0} # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/scripts/boot-killudev.sh new/mkinitrd-2.7.2/scripts/boot-killudev.sh --- old/mkinitrd-2.7.1/scripts/boot-killudev.sh 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/scripts/boot-killudev.sh 2012-11-09 18:38:03.000000000 +0100 @@ -2,6 +2,8 @@ # #%stage: setup #%provides: killprogs +#%programs: kill +#%programs: pidof # #%dontshow # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/scripts/boot-kms.sh new/mkinitrd-2.7.2/scripts/boot-kms.sh --- old/mkinitrd-2.7.1/scripts/boot-kms.sh 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/scripts/boot-kms.sh 2012-11-09 18:38:03.000000000 +0100 @@ -5,6 +5,7 @@ #%depends: start udev # #%modules: $kms_modules +#%programs: cat # #%if: "$kms_modules" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/scripts/boot-mount.sh new/mkinitrd-2.7.2/scripts/boot-mount.sh --- old/mkinitrd-2.7.1/scripts/boot-mount.sh 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/scripts/boot-mount.sh 2012-11-09 18:38:03.000000000 +0100 @@ -3,7 +3,16 @@ #%stage: filesystem #%depends: resume # -#%programs: /sbin/fsck $rootfsck $usrfsck +#%programs: fsck +#%programs: $rootfsck +#%programs: $usrfsck +#%programs: mkdir +#%programs: mount +#%programs: on_ac_power +#%programs: reboot +#%programs: showconsole +#%programs: sed +#%programs: udevadm #%if: ! "$root_already_mounted" #%dontshow # @@ -60,10 +69,10 @@ if ! discover_root ; then echo "not found -- exiting to /bin/sh" cd / - PATH=$PATH PS1='$ ' /bin/sh -i + PATH=$PATH PS1='$ ' sh -i fi -sysdev=$(/sbin/udevadm info -q path -n $rootdev) +sysdev=$(udevadm info -q path -n $rootdev) # Fallback if rootdev is not controlled by udev if [ $? -ne 0 ] && [ -b "$rootdev" ] ; then devn=$(devnumber $rootdev) @@ -76,20 +85,21 @@ unset maj unset min fi -if [ -z "$rootfstype" -a -x /sbin/udevadm -a -n "$sysdev" ]; then - eval $(/sbin/udevadm info -q env -p $sysdev | sed -n '/ID_FS_TYPE/p') +if [ -z "$rootfstype" -a -n "$(type -p udevadm)" -a -n "$sysdev" ]; then + eval $(udevadm info -q env -p $sysdev | sed -n '/ID_FS_TYPE/p') rootfstype=$ID_FS_TYPE [ -n "$rootfstype" ] && [ "$rootfstype" = "unknown" ] && rootfstype= ID_FS_TYPE= fi +oacp=$(type -p on_ac_power) # check filesystem if possible if [ -z "$rootfstype" ]; then echo "invalid root filesystem -- exiting to /bin/sh" cd / - PATH=$PATH PS1='$ ' /bin/sh -i + PATH=$PATH PS1='$ ' sh -i # skip fsck if running on battery -elif [ -x /usr/bin/on_ac_power ] && ! /usr/bin/on_ac_power -q ; then +elif [ -n "${oacp}" ] && ! ${oacp} -q ; then echo skipping fsck because running on batteries # don't run fsck in the kdump kernel elif [ -x "$rootfsck" ] && ! [ -s /proc/vmcore ] ; then @@ -98,7 +108,7 @@ # Display progress bar if possible fsckopts="-V -a" [ "$forcefsck" ] && fsckopts="$fsckopts -f" - console=`/sbin/showconsole` + console=`showconsole` [ "${console##*/}" = "tty1" ] && fsckopts="$fsckopts -C" # Check external journal for reiserfs [ "$rootfstype" = "reiserfs" -a -n "$journaldev" ] && fsckopts="-j $journaldev $fsckopts" @@ -114,7 +124,7 @@ # reboot needed echo "fsck succeeded, but reboot is required." echo "Rebooting system." - /bin/reboot -d -f + reboot -d -f elif [ $ROOTFS_FSCK -gt 3 ] ; then echo "fsck failed. Mounting root device read-only." read_only=1 @@ -152,7 +162,7 @@ if [ $? -ne 0 ] ; then echo "could not mount root filesystem -- exiting to /bin/sh" cd / - PATH=$PATH PS1='$ ' /bin/sh -i + PATH=$PATH PS1='$ ' sh -i fi unset discover_root diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/scripts/boot-netconsole.sh new/mkinitrd-2.7.2/scripts/boot-netconsole.sh --- old/mkinitrd-2.7.1/scripts/boot-netconsole.sh 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/scripts/boot-netconsole.sh 2012-11-09 18:38:03.000000000 +0100 @@ -4,7 +4,8 @@ #%depends: network # #%modules: netconsole -#%programs: ping arp +#%programs: arp +#%programs: ping #%if: "$interface" -a "$NETCONSOLE" # ##### network console diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/scripts/boot-network.sh new/mkinitrd-2.7.2/scripts/boot-network.sh --- old/mkinitrd-2.7.1/scripts/boot-network.sh 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/scripts/boot-network.sh 2012-11-09 18:38:03.000000000 +0100 @@ -1,7 +1,14 @@ #!/bin/bash #%stage: device #%depends: ibft -#%programs: /sbin/dhcpcd /sbin/ip +#%programs: dhcpcd +#%programs: ifup +#%programs: ip +# tools used by ifup +#%programs: awk +#%programs: grep +#%programs: logger +#%programs: touch # dhcpcd reqires the af_packet module #%modules: af_packet $bonding_module #%udevmodules: $drvlink @@ -27,7 +34,7 @@ { local ip=$1 - /bin/ipconfig $ip + ipconfig $ip # dhcp information emulation IPADDR="${ip%%:*}" ip="${ip#*:}" # first entry => peeraddr @@ -54,7 +61,7 @@ else echo "no response from dhcp server -- exiting to /bin/sh" cd / - PATH=$PATH PS1='$ ' /bin/sh -i + PATH=$PATH PS1='$ ' sh -i fi [ -e "/var/run/dhcpcd-$interface.pid" ] && kill -9 $(cat /var/run/dhcpcd-$interface.pid) if [ -n "$DNS" ]; then diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/scripts/boot-remount.sh new/mkinitrd-2.7.2/scripts/boot-remount.sh --- old/mkinitrd-2.7.1/scripts/boot-remount.sh 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/scripts/boot-remount.sh 2012-11-09 18:38:03.000000000 +0100 @@ -2,6 +2,7 @@ # #%stage: filesystem #%depends: mount +#%programs: mount # #%dontshow # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/scripts/boot-rtc.sh new/mkinitrd-2.7.2/scripts/boot-rtc.sh --- old/mkinitrd-2.7.1/scripts/boot-rtc.sh 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/scripts/boot-rtc.sh 2012-11-09 18:38:03.000000000 +0100 @@ -4,7 +4,7 @@ #%depends: start #%modules: rtc_cmos #%provides: rtc -#%programs: /sbin/modprobe usleep +#%programs: usleep #%if: -n "$(modprobe -C /dev/null --set-version $kernel_version --ignore-install --show-depends rtc_cmos 2>/dev/null)" #%dontshow diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/scripts/boot-shell.sh new/mkinitrd-2.7.2/scripts/boot-shell.sh --- old/mkinitrd-2.7.1/scripts/boot-shell.sh 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/scripts/boot-shell.sh 2012-11-09 18:38:03.000000000 +0100 @@ -1,6 +1,17 @@ #!/bin/bash # #%stage: setup +#%programs: chmod +#%programs: cp +#%programs: dmesg +#%programs: halt +#%programs: kill +#%programs: killall5 +#%programs: ls +#%programs: mv +#%programs: pidof +#%programs: reboot +#%programs: rm # #%dontshow # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/scripts/boot-start.sh new/mkinitrd-2.7.2/scripts/boot-start.sh --- old/mkinitrd-2.7.1/scripts/boot-start.sh 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/scripts/boot-start.sh 2012-11-09 18:38:03.000000000 +0100 @@ -2,7 +2,28 @@ # #%stage: boot #%depends: devfunctions -#%programs: /bin/bash /bin/umount /bin/mount /bin/mknod /bin/mkdir /bin/ln /bin/date /bin/sleep /bin/cat /bin/sed /sbin/insmod /sbin/modprobe /bin/kill /sbin/killall5 /sbin/halt /sbin/reboot /sbin/showconsole /bin/cp /sbin/pidof /bin/mv /bin/chmod /bin/rm /bin/true /bin/ls /lib/mkinitrd/bin/* /bin/dmesg + +#%programs: /lib/mkinitrd/bin/* +#%programs: bash +#%programs: cat +#%programs: date +#%programs: ln +#%programs: mkdir +#%programs: mknod +#%programs: mount +#%programs: showconsole +#%programs: sleep +#%programs: umount + +# tools used by linuxrc/init +#%programs: insmod +#%programs: modprobe +#%programs: sed + +# tools used by ipconfig.sh +#%programs: ip +#%programs: sed + #%modules: $RESOLVED_INITRD_MODULES #%udevmodules: $RESOLVED_INITRD_MODULES_UDEV #%dontshow diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/scripts/boot-udev.sh new/mkinitrd-2.7.2/scripts/boot-udev.sh --- old/mkinitrd-2.7.1/scripts/boot-udev.sh 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/scripts/boot-udev.sh 2012-11-09 18:38:03.000000000 +0100 @@ -1,7 +1,10 @@ #!/bin/bash #%stage: boot #%depends: start dm -#%programs: /sbin/udevd /sbin/udevadm /bin/uname /sbin/blkid +#%programs: blkid +#%programs: udevadm +#%programs: udevd +#%programs: uname #%dontshow # ##### udev initialization @@ -14,7 +17,7 @@ ## wait_for_events() { - /sbin/udevadm settle --timeout=$udev_timeout + udevadm settle --timeout=$udev_timeout } # Check for debugging @@ -26,7 +29,7 @@ # Start udev echo "Creating device nodes with udev" -/sbin/udevd --daemon -/sbin/udevadm trigger --action=add -/sbin/udevadm trigger --type=subsystems --action=add +udevd --daemon +udevadm trigger --action=add +udevadm trigger --type=subsystems --action=add wait_for_events diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/scripts/setup-done.sh new/mkinitrd-2.7.2/scripts/setup-done.sh --- old/mkinitrd-2.7.1/scripts/setup-done.sh 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/scripts/setup-done.sh 2012-11-09 18:38:03.000000000 +0100 @@ -12,7 +12,9 @@ fi pushd . > /dev/null 2>&1 cd $tmp_mnt -find bin sbin -type f -print0 | xargs -0 chmod 0755 +# suid mount will fail if mkinitrd was called as user +find . -type f ( -perm -4000 -o -perm -2000 ) -exec chmod 755 {} ; +find *bin usr/*bin -type f -exec chmod 755 {} ; if ! find . ! -name "*~" | cpio --quiet -H newc --create | $COMPRESS > $tmp_initrd then oops 8 "Failed to build initrd" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/scripts/setup-kms.sh new/mkinitrd-2.7.2/scripts/setup-kms.sh --- old/mkinitrd-2.7.1/scripts/setup-kms.sh 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/scripts/setup-kms.sh 2012-11-09 18:38:03.000000000 +0100 @@ -78,9 +78,9 @@ local IFS=" " - [ -d /sys/bus/pci ] && [ -x /sbin/lspci ] || return 1 + [ -d /sys/bus/pci ] && [ -n "$(type -p lspci)" ] || return 1 - for line in $(/sbin/lspci -mn 2>/dev/null | tr "[:lower:]" "[:upper:]") + for line in $(lspci -mn 2>/dev/null | tr "[:lower:]" "[:upper:]") do unset entries ret=0 @@ -132,7 +132,7 @@ local level=0 local thislevel unset vendor device subvendor subdevice intf class - local pcilist=$(/sbin/modinfo -F alias -k $kernel_version $driver \ + local pcilist=$(modinfo -F alias -k $kernel_version $driver \ | sed -n "s/pci:v([0-9A-F*]+)d([0-9A-F*]+)sv([0-9A-F*]+)sd([0-9A-F*]+)bc([0-9A-F*]+)sc([0-9A-F*]+)i([0-9A-F*]+).*/v=\1 d=\2 sv=\3 sd=\4 bc=\5 sc=\6 ii=\7/p") parse_pciids_from_driver "$pcilist" shopt -s nocasematch diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/scripts/setup-modules.sh new/mkinitrd-2.7.2/scripts/setup-modules.sh --- old/mkinitrd-2.7.1/scripts/setup-modules.sh 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/scripts/setup-modules.sh 2012-11-09 18:38:03.000000000 +0100 @@ -224,7 +224,7 @@ seen="$seen $module" # don't use a modprobe.conf to get rid of the install lines - module_list=$(/sbin/modprobe \ + module_list=$(modprobe \ -C /dev/null \ --set-version $kernel_version --ignore-install \ --show-depends $module \ @@ -356,7 +356,7 @@ if test -e "/lib/modules/$kernel_version/modules.builtin"; then cp "$_" "$tmp_mnt/lib/modules/$kernel_version/" fi - /sbin/depmod -b $tmp_mnt -e -F $map $kernel_version + depmod -b $tmp_mnt -e -F $map $kernel_version fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/scripts/setup-mount.sh new/mkinitrd-2.7.2/scripts/setup-mount.sh --- old/mkinitrd-2.7.1/scripts/setup-mount.sh 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/scripts/setup-mount.sh 2012-11-09 18:38:03.000000000 +0100 @@ -4,27 +4,22 @@ # # don't include a non-existant fsck -rootfsck="/sbin/fsck.${rootfstype}" -if [ ! -x "$rootfsck" ]; then - rootfsck= +rootfsck="$(type -p fsck.${rootfstype})" +if [ -z "$rootfsck" ]; then if [ "$rootfstype" != "nfs" -a "$rootfstype" != "xfs" -a "$rootfstype" != "cifs" ]; then echo "****************************" echo "* WARNING " echo "* No fsck for your rootfs " echo "* could be found. " echo "* This might be bad! " - echo "* Please install: /sbin/fsck.$rootfstype" + echo "* Please install: fsck.$rootfstype" echo "****************************" fi fi verbose "[MOUNT] Root:\t$rootdev" -usrfsck="/sbin/fsck.${usrfstype}" -if [ ! -x "$usrfsck" ]; then - # just ignore it - we'll see later what happens - usrfsck= -fi +usrfsck="$(type -p fsck.${usrfstype})" for file in {/usr,}/bin/on_ac_power; do if test -e $file; then diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/scripts/setup-network.sh new/mkinitrd-2.7.2/scripts/setup-network.sh --- old/mkinitrd-2.7.1/scripts/setup-network.sh 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/scripts/setup-network.sh 2012-11-09 18:38:03.000000000 +0100 @@ -104,7 +104,7 @@ fi # No nfsroot interface description if [ -z "$ifname" ]; then - ifname=$(/sbin/ip route | sed -n 's/default .* dev ([[:alnum:]]*) *.*/\1/p') + ifname=$(ip route | sed -n 's/default .* dev ([[:alnum:]]*) *.*/\1/p') if [ $(ps -A -o cmd= | sed -n "/.*dhcp.*$ifname.*/p" | wc --lines) -eq 2 ] ; then BOOTPROTO=dhcp else @@ -298,7 +298,7 @@ mkdir -p $tmp_mnt/var/lib/dhcpcd mkdir -p $tmp_mnt/var/run -cp_bin /lib/mkinitrd/bin/ipconfig.sh $tmp_mnt/bin/ipconfig +cp_bin /lib/mkinitrd/bin/ipconfig $tmp_mnt/bin/ipconfig if [ -f /etc/udev/rules.d/70-persistent-net.rules ] ; then cp /etc/udev/rules.d/70-persistent-net.rules $tmp_mnt/etc/udev/rules.d fi @@ -308,13 +308,6 @@ fi cp --parents "$f" $tmp_mnt/ done -# awk points to alternatives, need the directory -mkdir -p $tmp_mnt/etc/alternatives -cp_bin /bin/awk $tmp_mnt/bin/awk -cp_bin /bin/grep $tmp_mnt/bin/grep -cp_bin /sbin/ifup $tmp_mnt/sbin/ifup -cp_bin /bin/logger $tmp_mnt/bin/logger -cp_bin /bin/touch $tmp_mnt/bin/touch test -n "$static_interfaces" && verbose "[NETWORK]\tstatic: $static_interfaces" test -n "$dhcp_interfaces" && verbose "[NETWORK]\tdynamic: $dhcp_interfaces" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/scripts/setup-prepare.sh new/mkinitrd-2.7.2/scripts/setup-prepare.sh --- old/mkinitrd-2.7.1/scripts/setup-prepare.sh 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/scripts/setup-prepare.sh 2012-11-09 18:38:03.000000000 +0100 @@ -23,57 +23,72 @@ ## # Install a binary file -cp_link() { - # Copy the target of the given link $1 to the destination $2 - # spaces and special characters in file names will break things - if [ -h "$1" ]; then - lnkTarget=$(readlink $1) - if [ -e $lnkTarget ];then - cp -a $lnkTarget $2/$lnkTarget - else - # This link points to something in the same directory - lnkSrc="$1" - # Get the base bath of the link origin - lnkSrcBase=${lnkSrc%/*} - cp -a $lnkSrcBase/$lnkTarget $2/$lnkSrcBase/$lnkTarget - fi - return 1 +# cp_bin file target_filename +# cp_bin file target_directory +# cp_bin file file target_directory +# file is either a regular file or a symlink. symlinks and all paths they point to will be copied +# the "root" of target is $tmp_mnt, which is required to copy symlinks properly +cp_bin() { + local -a files + local target + local file + + # need at least two parameters, source and destination + if test $# -lt 2; then + return 0 fi - return 0 -} + # store source filenames + # (assigning array from $@ and setting target= from it does not work) + until test $# -eq 1; do + files=( ${files[@]} $1 ) + shift + done + # store target, either file or directory + target=$1 -cp_bin() { - cp -a "$@" \ - || exit_code=1 + # if more than two parameters, last entry must be a directory + if test ${#files[@]} -gt 1; then + if ! test -d ${target}; then + return 0 + fi + fi - if [ -h "$1" ]; then - lnkTarget=$1 - # Determine the base bath of the target - targetPath="$2" - targetBase=${targetPath%$1*} + # copy all source files + for file in ${files[@]}; do + local src dst + src=${file} + dst=${target} + # copy requested soure file as is to requested destination + cp -a --remove-destination ${src} ${dst} + # copy symlinks recursivly while [ 1 ]; do - cp_link $lnkTarget $targetBase - lnkCopied=$? - if [ $lnkCopied = 0 ]; then - if [ -e $lnkTarget ]; then - initrd_bins[${#initrd_bins[@]}]=$lnkTarget - fi - break + local tmp_src + if test -L ${src}; then + # read link target + tmp_src=$(readlink ${src}) + if test "${tmp_src:0:1}" = "/"; then + # reuse absolute paths + src=${tmp_src} + else + # symlink is relative to current source + src=${src%/*}/${tmp_src} + fi + cp -a --remove-destination --parents ${src} $tmp_mnt + # if link target exists, proceed to next symlink target + if test -e "${src}"; then + continue + fi fi - done - else - # Remember the binaries installed. We need the list for checking - # for dynamic libraries. - while [ $# -gt 1 ]; do - initrd_bins[${#initrd_bins[@]}]=$1 - shift + # exit loop in case of dead symlink or if final target of symlink was reached + break done - # file may print '^setuid ELF ...' - # suid mount will fail if mkinitrd was called as user - if [ -d "$1" -o -f "$1" ]; then - find "$1" -type f -print0 | xargs -0 chmod 0755 + + # if source file exists, add it to list of binaries + # use source instead of target to avoid referencing symlinks + if test -e "${src}"; then + initrd_bins[${#initrd_bins[@]}]=${src} fi - fi + done } # check if we should use script or feature $1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/scripts/setup-progs.sh new/mkinitrd-2.7.2/scripts/setup-progs.sh --- old/mkinitrd-2.7.1/scripts/setup-progs.sh 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/scripts/setup-progs.sh 2012-11-09 18:38:03.000000000 +0100 @@ -38,27 +38,16 @@ elif [ "${file:0:1}" = "/" ]; then # absolute path files have to stay alive SOURCE=$file [ ! -e $file -a -e /usr$file ] && SOURCE="/usr$file" - DEST=".$file" + DEST=".$SOURCE" else case "$(type -t "$file")" in builtin) continue esac SOURCE=$(type -p "$file") - DEST="./bin/" + DEST=".$SOURCE" fi cp_bin "$SOURCE" "$DEST" - - # if we're given a symlink, always copy the linked file too - if [ -L "$SOURCE" ]; then - LINK=$(readlink -e "$SOURCE") - if [ -e "$LINK" ]; then - mkdir -p .$(dirname "$LINK") - cp_bin "$LINK" ."$LINK" - else - echo 2>&1 "WARNING: $LINK is a dangling symlink" - fi - fi done done fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/scripts/setup-storage.sh new/mkinitrd-2.7.2/scripts/setup-storage.sh --- old/mkinitrd-2.7.1/scripts/setup-storage.sh 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/scripts/setup-storage.sh 2012-11-09 18:38:03.000000000 +0100 @@ -76,7 +76,7 @@ return esac # search for udev information - udevdevs=$(/sbin/udevadm info -q symlink --name=$olddev) + udevdevs=$(udevadm info -q symlink --name=$olddev) # look up ata device links for dev in $udevdevs; do if [ "$(echo $dev | grep /ata-)" ] ; then @@ -104,7 +104,7 @@ done # get pretty name from device-mapper - if [ -x /sbin/dmsetup -a "$blockdriver" = "device-mapper" ]; then + if [ -n "$(type -p dmsetup)" -a "$blockdriver" = "device-mapper" ]; then dm_name=$(dmsetup info -c --noheadings -o name -j $blockmajor -m $blockminor) if [ "$dm_name" ] ; then echo "/dev/mapper/$dm_name" @@ -223,10 +223,10 @@ echo "Could not expand $x to real device" >&2 exit 1 fi - realrootdev=$(/usr/bin/readlink -m $realrootdev) + realrootdev=$(readlink -m $realrootdev) ;; /dev/disk/*) - realrootdev=$(/usr/bin/readlink -m $realrootdev) + realrootdev=$(readlink -m $realrootdev) ;; *:*|//*) [ "$type" = "Root" ] && x="$rootfstype-root" @@ -264,7 +264,7 @@ local cpio major minor x1 local fstab_device fstab_mountpoint fstab_type fstab_options dummy - cpio=`echo "$mountpoint" | /bin/cpio --quiet -o -H newc` + cpio=`echo "$mountpoint" | cpio --quiet -o -H newc` major="$(echo $(( 0x${cpio:62:8} )) )" minor="$(echo $(( 0x${cpio:70:8} )) )" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mkinitrd-2.7.1/scripts/setup-udev.sh new/mkinitrd-2.7.2/scripts/setup-udev.sh --- old/mkinitrd-2.7.1/scripts/setup-udev.sh 2012-07-31 01:12:51.000000000 +0200 +++ new/mkinitrd-2.7.2/scripts/setup-udev.sh 2012-11-09 18:38:03.000000000 +0100 @@ -7,8 +7,21 @@ # Default udev timeout is 30 seconds udev_timeout=30 -mkdir -p $tmp_mnt/lib/udev/rules.d mkdir -p $tmp_mnt/etc/udev/rules.d +mkdir -p $tmp_mnt/usr/lib/udev/rules.d +mkdir -p $tmp_mnt/usr/lib/systemd +mkdir -p $tmp_mnt/lib +ln -sfn ../usr/lib/udev $tmp_mnt/lib/udev + +# copy helper +for script in /usr/lib/udev/* /lib/udev/* /sbin/*_id ; do + if [ ! -d "$script" ] && [ -x "$script" ] ; then + cp_bin $script ${tmp_mnt}${script} + elif [ -f "$script" ] ; then + cp -pL $script ${tmp_mnt}${script} + fi +done + # copy needed rules for rule in \ 05-udev-early.rules \ @@ -22,24 +35,13 @@ 64-md-raid.rules \ 79-kms.rules \ 80-drivers.rules; do - if [ -f /lib/udev/rules.d/$rule ]; then + if [ -f /usr/lib/udev/rules.d/$rule ]; then + cp /usr/lib/udev/rules.d/$rule $tmp_mnt/usr/lib/udev/rules.d + elif [ -f /lib/udev/rules.d/$rule ]; then cp /lib/udev/rules.d/$rule $tmp_mnt/lib/udev/rules.d elif [ -f /etc/udev/rules.d/$rule ]; then cp /etc/udev/rules.d/$rule $tmp_mnt/etc/udev/rules.d fi done -# copy helper -mkdir -p $tmp_mnt/lib/udev -for script in /lib/udev/* /sbin/*_id ; do - if [ ! -d "$script" ] && [ -x "$script" ] ; then - cp_bin $script ${tmp_mnt}${script} - elif [ -f "$script" ] ; then - cp -pL $script ${tmp_mnt}${script} - fi -done - -for bin in /sbin/blkid; do - cp_bin $bin ${tmp_mnt}${bin} -done save_var udev_timeout -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org