Accepting request 397949 from home:cbosdonnat:branches:Virtualization
- Update to version 1.32.4 - Backported commits (fate#316274): * f5a9cdf: api: add mountable_device and mountable_subvolume * 1c30c23: fish: fix btrfs subvolumes display in error case * 1f24364: v2v: win <= 7: reduce registry patch * f0dce24: v2v: win >= 8: reduce registry patch * 9a441b0: v2v: win >= 8: simplify registry patching * e07459d: v2v: win: factor out common bits in registry patching * 47aa64a: v2v: add support for virtio-scsi * bba9ea9: v2v: also search for windows virtio drivers in symlinks * 3bf7d30: Update packagelist for SLES and openSUSE * 89ae53e: appliance: skip /etc/mtab creation is already existing * ee78c06: customize: add support for pvvxsvc * 25848b5: v2v: document SUSE's Xen as a working input hypervisor * e9082ea: v2v: rename RHEL 5 Xen input section into Xen in man * 75fe93e: v2v: improve initrd search * 536ef6f: customize: change windows firstboot path * 07f7bfa: customize: fix windows firstboot script * c466d4c: v2v: add support for SUSE VMDP drivers * 9de9300: v2v: handle subfolders in ova files - Removed patches: * 1000-force-virtio_blk-in-old-guest-kernel.patch * libguestfs.mkinitrd.1110.patch * libguestfs.mkinitrd.1115.patch * libguestfs.mkinitrd.1140.patch * libguestfs.mkinitrd.1210.patch * libguestfs.mkinitrd.1220.patch * libguestfs.mkinitrd.1230.patch * libguestfs.mkinitrd.1310.patch * libguestfs.mkinitrd.boot-btrfs.sh OBS-URL: https://build.opensuse.org/request/show/397949 OBS-URL: https://build.opensuse.org/package/show/Virtualization/libguestfs?expand=0&rev=354
This commit is contained in:
parent
5a672661e5
commit
cf1f1108f4
1454
0000-hotfix.patch
1454
0000-hotfix.patch
File diff suppressed because it is too large
Load Diff
@ -1,126 +0,0 @@
|
||||
From 91563687c1f1b3544c71f2f53c387c86d95b246c Mon Sep 17 00:00:00 2001
|
||||
From: Olaf Hering <olaf@aepfle.de>
|
||||
Date: Mon, 3 Sep 2012 19:50:44 +0200
|
||||
Subject: force virtio_blk in old guest kernel
|
||||
|
||||
Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
||||
---
|
||||
fish/options.c | 7 +++++--
|
||||
src/guestfs-internal.h | 1 +
|
||||
src/handle.c | 16 ++++++++++++++++
|
||||
src/inspect-fs-unix.c | 4 ++--
|
||||
src/launch-direct.c | 2 ++
|
||||
test-tool/test-tool.c | 1 +
|
||||
6 files changed, 27 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/fish/options.c b/fish/options.c
|
||||
index 5e6eb73..2c1a48a 100644
|
||||
--- a/fish/options.c
|
||||
+++ b/fish/options.c
|
||||
@@ -101,7 +101,10 @@ add_drives_handle (guestfs_h *g, struct drv *drv, char next_drive)
|
||||
{
|
||||
int r;
|
||||
struct guestfs_add_drive_opts_argv ad_optargs;
|
||||
-
|
||||
+ int use_virtio_blk = 0;
|
||||
+#ifdef GUESTFS_QEMU_NO_VIRTIO_BLK
|
||||
+ use_virtio_blk = 1;
|
||||
+#endif
|
||||
if (next_drive > 'z') {
|
||||
fprintf (stderr,
|
||||
_("%s: too many drives added on the command line\n"),
|
||||
@@ -115,7 +118,7 @@ add_drives_handle (guestfs_h *g, struct drv *drv, char next_drive)
|
||||
free (drv->device);
|
||||
drv->device = NULL;
|
||||
|
||||
- if (asprintf (&drv->device, "/dev/sd%c", next_drive) == -1) {
|
||||
+ if (asprintf (&drv->device, "/dev/%s%c", use_virtio_blk ? "vd" : "sd", next_drive) == -1) {
|
||||
perror ("asprintf");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h
|
||||
index 648f005..fd99253 100644
|
||||
--- a/src/guestfs-internal.h
|
||||
+++ b/src/guestfs-internal.h
|
||||
@@ -501,6 +501,7 @@ struct guestfs_h
|
||||
unsigned int nr_requested_credentials;
|
||||
virConnectCredentialPtr requested_credentials;
|
||||
#endif
|
||||
+ int use_virtio_blk;
|
||||
};
|
||||
|
||||
/* Per-filesystem data stored for inspect_os. */
|
||||
diff --git a/src/handle.c b/src/handle.c
|
||||
index 393ac1e..1806570 100644
|
||||
--- a/src/handle.c
|
||||
+++ b/src/handle.c
|
||||
@@ -259,6 +259,22 @@ parse_environment (guestfs_h *g,
|
||||
return -1;
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * Currently virtio_scsi is forced if qemu in the host supports this
|
||||
+ * feature. This test does however not take the capabilities of the started
|
||||
+ * guest into account. As a result no disks will be found if the guest
|
||||
+ * kernel is older than 3.4.
|
||||
+ */
|
||||
+#ifdef GUESTFS_QEMU_NO_VIRTIO_BLK
|
||||
+ static const char env_string[] = "GUESTFS_QEMU_NO_VIRTIO_BLK";
|
||||
+ str = getenv(env_string);
|
||||
+ g->use_virtio_blk = str == NULL;
|
||||
+ if (str)
|
||||
+ debug (g, "SuSE: %s in environment, preserving virtio-scsi setting.", env_string);
|
||||
+ else
|
||||
+ debug (g, "SuSE: %s not in environment, preventing virtio-scsi usage in old guest kernel.", env_string);
|
||||
+#endif
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
diff --git a/src/inspect-fs-unix.c b/src/inspect-fs-unix.c
|
||||
index 7221f24..9045f13 100644
|
||||
--- a/src/inspect-fs-unix.c
|
||||
+++ b/src/inspect-fs-unix.c
|
||||
@@ -1433,7 +1433,7 @@ resolve_fstab_device_diskbyid (guestfs_h *g, const char *part,
|
||||
return 0;
|
||||
|
||||
/* Make the partition name and check it exists. */
|
||||
- device = safe_asprintf (g, "/dev/sda%s", part);
|
||||
+ device = safe_asprintf (g, "/dev/%sa%s", g->use_virtio_blk ? "vd" : "sd", part);
|
||||
if (!is_partition (g, device)) {
|
||||
free (device);
|
||||
return 0;
|
||||
@@ -1526,7 +1526,7 @@ resolve_fstab_device (guestfs_h *g, const char *spec, Hash_table *md_map)
|
||||
if (disk_i != -1 && disk_i <= 26 &&
|
||||
slice_i > 0 && slice_i <= 1 /* > 4 .. see comment above */ &&
|
||||
part_i >= 0 && part_i < 26) {
|
||||
- device = safe_asprintf (g, "/dev/sd%c%d", disk_i + 'a', part_i + 5);
|
||||
+ device = safe_asprintf (g, "/dev/%s%c%d", g->use_virtio_blk ? "vd" : "sd", disk_i + 'a', part_i + 5);
|
||||
}
|
||||
}
|
||||
else if ((part = match1 (g, spec, re_diskbyid)) != NULL) {
|
||||
diff --git a/src/launch-direct.c b/src/launch-direct.c
|
||||
index eab3e89..ee286a5 100644
|
||||
--- a/src/launch-direct.c
|
||||
+++ b/src/launch-direct.c
|
||||
@@ -1184,6 +1184,8 @@ qemu_supports_virtio_scsi (guestfs_h *g, struct backend_direct_data *data)
|
||||
data->virtio_scsi = 3;
|
||||
}
|
||||
}
|
||||
+ if (g->use_virtio_blk)
|
||||
+ data->virtio_scsi = 2;
|
||||
|
||||
return data->virtio_scsi == 1;
|
||||
}
|
||||
diff --git a/test-tool/test-tool.c b/test-tool/test-tool.c
|
||||
index 7e8d88e..8d5ae34 100644
|
||||
--- a/test-tool/test-tool.c
|
||||
+++ b/test-tool/test-tool.c
|
||||
@@ -187,6 +187,7 @@ main (int argc, char *argv[])
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
guestfs_set_verbose (g, 1);
|
||||
+ guestfs_set_trace (g, 1);
|
||||
|
||||
if (qemu)
|
||||
set_qemu (g, qemu, qemu_use_wrapper);
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6d9950647f8316ef0c397c2b82652dc268a8a82baa43046af393239800a05620
|
||||
size 5015800
|
3
libguestfs-1.32.4.tar.xz
Normal file
3
libguestfs-1.32.4.tar.xz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b0cf71c773bb51d0a3dd992e931becc1791a40846818043d70bc94ccf32cc092
|
||||
size 7606468
|
@ -1,3 +1,49 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Mar 14 08:41:08 UTC 2016 - cbosdonnat@suse.com
|
||||
|
||||
- Update to version 1.32.4
|
||||
- Backported commits (fate#316274):
|
||||
* f5a9cdf: api: add mountable_device and mountable_subvolume
|
||||
* 1c30c23: fish: fix btrfs subvolumes display in error case
|
||||
* 1f24364: v2v: win <= 7: reduce registry patch
|
||||
* f0dce24: v2v: win >= 8: reduce registry patch
|
||||
* 9a441b0: v2v: win >= 8: simplify registry patching
|
||||
* e07459d: v2v: win: factor out common bits in registry patching
|
||||
* 47aa64a: v2v: add support for virtio-scsi
|
||||
* bba9ea9: v2v: also search for windows virtio drivers in symlinks
|
||||
* 3bf7d30: Update packagelist for SLES and openSUSE
|
||||
* 89ae53e: appliance: skip /etc/mtab creation is already existing
|
||||
* ee78c06: customize: add support for pvvxsvc
|
||||
* 25848b5: v2v: document SUSE's Xen as a working input hypervisor
|
||||
* e9082ea: v2v: rename RHEL 5 Xen input section into Xen in man
|
||||
* 75fe93e: v2v: improve initrd search
|
||||
* 536ef6f: customize: change windows firstboot path
|
||||
* 07f7bfa: customize: fix windows firstboot script
|
||||
* c466d4c: v2v: add support for SUSE VMDP drivers
|
||||
* 9de9300: v2v: handle subfolders in ova files
|
||||
- Removed patches:
|
||||
* 1000-force-virtio_blk-in-old-guest-kernel.patch
|
||||
* libguestfs.mkinitrd.1110.patch
|
||||
* libguestfs.mkinitrd.1115.patch
|
||||
* libguestfs.mkinitrd.1140.patch
|
||||
* libguestfs.mkinitrd.1210.patch
|
||||
* libguestfs.mkinitrd.1220.patch
|
||||
* libguestfs.mkinitrd.1230.patch
|
||||
* libguestfs.mkinitrd.1310.patch
|
||||
* libguestfs.mkinitrd.boot-btrfs.sh
|
||||
* libguestfs.mkinitrd.boot-dm.sh
|
||||
* libguestfs.mkinitrd.boot-lvm2.sh
|
||||
* libguestfs.mkinitrd.boot-md.sh
|
||||
* libguestfs.mkinitrd.boot-nfs.sh
|
||||
* libguestfs.mkinitrd.boot.sh
|
||||
* libguestfs.mkinitrd.setup-btrfs.sh
|
||||
* libguestfs.mkinitrd.setup-dm.sh
|
||||
* libguestfs.mkinitrd.setup-lvm2.sh
|
||||
* libguestfs.mkinitrd.setup-md.sh
|
||||
* libguestfs.mkinitrd.setup-nfs.sh
|
||||
* libguestfs.mkinitrd.setup.sh
|
||||
* libguestfs.mkinitrd.tar.bz2
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Oct 1 12:09:22 UTC 2015 - cbosdonnat@suse.com
|
||||
|
||||
|
@ -1,385 +0,0 @@
|
||||
---
|
||||
mkinitrd/scripts/setup-ibft.sh | 2
|
||||
mkinitrd/scripts/setup-network.sh | 11 +++-
|
||||
mkinitrd/scripts/setup-prepare.sh | 94 ++++++++++++++++++++++++++++-------
|
||||
mkinitrd/scripts/setup-progs.sh | 4 -
|
||||
mkinitrd/scripts/setup-scsi_dh.sh | 2
|
||||
mkinitrd/scripts/setup-sharedlibs.sh | 60 +++++++++++++---------
|
||||
6 files changed, 126 insertions(+), 47 deletions(-)
|
||||
|
||||
Index: 1110/mkinitrd/scripts/setup-ibft.sh
|
||||
===================================================================
|
||||
--- 1110.orig/mkinitrd/scripts/setup-ibft.sh
|
||||
+++ 1110/mkinitrd/scripts/setup-ibft.sh
|
||||
@@ -21,22 +21,22 @@ ibft_set_iface() {
|
||||
interface=$iface
|
||||
drvlink=$(get_network_module $interface)
|
||||
if [ ! "$nettype" -a -e $ibft_nic/dhcp ]; then
|
||||
nettype=dhcp
|
||||
read ibft_dhcp < $ibft_nic/dhcp
|
||||
[ "$ibft_dhcp" = "0.0.0.0" ] && nettype=static
|
||||
else
|
||||
nettype=static
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
ibft_nic=/sys/firmware/ibft/ethernet0
|
||||
-ibft_hostname=$(hostname)
|
||||
+ibft_hostname=localhost
|
||||
|
||||
if [ "$root_iscsi" = 1 -a -d $ibft_nic ]; then
|
||||
ibft_available=1
|
||||
ibft_set_iface
|
||||
fi
|
||||
save_var ibft_available
|
||||
save_var ibft_hostname
|
||||
save_var ibft_nic
|
||||
Index: 1110/mkinitrd/scripts/setup-network.sh
|
||||
===================================================================
|
||||
--- 1110.orig/mkinitrd/scripts/setup-network.sh
|
||||
+++ 1110/mkinitrd/scripts/setup-network.sh
|
||||
@@ -291,27 +291,36 @@ if [ "$nettype" = "ifup" ] ; then
|
||||
verbose "[NETWORK]\tifup: $interface"
|
||||
fi
|
||||
done
|
||||
interface=
|
||||
fi
|
||||
|
||||
# Copy the /etc/resolv.conf when the IP is static
|
||||
if test -n "$static_interfaces"; then
|
||||
verbose "[NETWORK]\tUsing /etc/resolv.conf from the system in the initrd"
|
||||
cp /etc/resolv.conf $tmp_mnt/etc
|
||||
fi
|
||||
|
||||
# Copy netcfg files (bnc#468090, bnc#714945)
|
||||
-cp /etc/{hosts,protocols,services,netconfig} $tmp_mnt/etc
|
||||
+cp /etc/{protocols,services,netconfig} $tmp_mnt/etc
|
||||
+cat > $tmp_mnt/etc/hosts <<_EOH_
|
||||
+127.0.0.1 localhost
|
||||
+::1 localhost ipv6-localhost ipv6-loopback
|
||||
+fe00::0 ipv6-localnet
|
||||
+ff00::0 ipv6-mcastprefix
|
||||
+ff02::1 ipv6-allnodes
|
||||
+ff02::2 ipv6-allrouters
|
||||
+ff02::3 ipv6-allhosts
|
||||
+_EOH_
|
||||
|
||||
# Get static IP configuration if requested
|
||||
for iface in $static_interfaces; do
|
||||
static_ips="$static_ips $(get_ip_config $iface)"
|
||||
done
|
||||
|
||||
mkdir -p $tmp_mnt/var/lib/dhcpcd
|
||||
mkdir -p $tmp_mnt/var/run
|
||||
|
||||
cp_bin /lib/mkinitrd/bin/ipconfig.sh $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
|
||||
Index: 1110/mkinitrd/scripts/setup-prepare.sh
|
||||
===================================================================
|
||||
--- 1110.orig/mkinitrd/scripts/setup-prepare.sh
|
||||
+++ 1110/mkinitrd/scripts/setup-prepare.sh
|
||||
@@ -13,43 +13,103 @@
|
||||
#%param_v: "Verbose mode."
|
||||
#%param_L: "Disable logging."
|
||||
#%param_h: "This help screen."
|
||||
#
|
||||
###### Additional options
|
||||
##
|
||||
## Script inclusion may be overriden by
|
||||
## 1) creating a monster-initrd
|
||||
## 2) including the wanted module in the configuration option ADDITIONAL_FEATURES in /etc/sysconfig/initrd
|
||||
## 3) definition using the -f command line switch
|
||||
##
|
||||
|
||||
# Install a binary file
|
||||
+# 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() {
|
||||
- cp -a "$@" \
|
||||
- || exit_code=1
|
||||
-
|
||||
- # Remember the binaries installed. We need the list for checking
|
||||
- # for dynamic libraries.
|
||||
- while [ $# -gt 1 ]; do
|
||||
- initrd_bins[${#initrd_bins[@]}]=$1
|
||||
- shift
|
||||
- done
|
||||
- # file may print '^setuid ELF ...'
|
||||
- # suid mount will fail if mkinitrd was called as user
|
||||
- if [ -L "$1" ]; then
|
||||
- : do nothing with symlinks
|
||||
- elif [ -d "$1" -o -f "$1" ]; then
|
||||
- find "$1" -type f -print0 | xargs -0 chmod 0755
|
||||
- fi
|
||||
+ local -a files
|
||||
+ local target
|
||||
+ local target_dirname
|
||||
+ local file
|
||||
+
|
||||
+ # need at least two parameters, source and destination
|
||||
+ if test $# -lt 2
|
||||
+ then
|
||||
+ return 0
|
||||
+ fi
|
||||
+ # store source filenames
|
||||
+ until test $# -eq 1
|
||||
+ do
|
||||
+ files=( ${files[@]} $1 )
|
||||
+ shift
|
||||
+ done
|
||||
+ # store target, either file or directory
|
||||
+ target=$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
|
||||
+ target_dirname=${target}
|
||||
+ else
|
||||
+ # simplify symlink resolving for sinlge filename
|
||||
+ target_dirname=${target%/*}
|
||||
+ fi
|
||||
+
|
||||
+ for file in ${files[@]}
|
||||
+ do
|
||||
+ local src dst
|
||||
+ src=${file}
|
||||
+ dst=${target}
|
||||
+ # copy requested soure file as is to requested destination
|
||||
+ cp -a -v --remove-destination ${src} ${dst}
|
||||
+ # copy symlinks recursivly
|
||||
+ while [ 1 ]
|
||||
+ do
|
||||
+ local tmp_src
|
||||
+ if test -L ${src}
|
||||
+ then
|
||||
+ tmp_src=$(readlink ${src})
|
||||
+ if test "${tmp_src:0:1}" = "/"
|
||||
+ then
|
||||
+ src=${tmp_src}
|
||||
+ else
|
||||
+ # relative symlink
|
||||
+ src=${src%/*}/${tmp_src}
|
||||
+ fi
|
||||
+ cp -a -v --remove-destination --parents ${src} $tmp_mnt
|
||||
+ # if link target exists, proceed to next symlink target
|
||||
+ if test -e "${src}"
|
||||
+ then
|
||||
+ continue
|
||||
+ fi
|
||||
+ fi
|
||||
+ # exit loop in case of dead symlink or if target of symlink was reached
|
||||
+ break
|
||||
+ done
|
||||
+ # if source file exists, add it to list of binaries
|
||||
+ if test -e "${src}"
|
||||
+ then
|
||||
+ # file may print '^setuid ELF ...'
|
||||
+ # suid mount will fail if mkinitrd was called as user
|
||||
+ chmod -v 0755 $tmp_mnt/${src}
|
||||
+ initrd_bins[${#initrd_bins[@]}]=${src}
|
||||
+ fi
|
||||
+ done
|
||||
}
|
||||
|
||||
# check if we should use script or feature $1
|
||||
use_script() {
|
||||
local condition feature script file
|
||||
|
||||
# always use when creating monster initrd
|
||||
[ "$create_monster_initrd" ] && return 0
|
||||
|
||||
# Normalize to feature name
|
||||
feature="${1##*/}"
|
||||
feature="${feature#*-}"
|
||||
feature="${feature%.sh}"
|
||||
@@ -146,27 +206,27 @@ fi
|
||||
for feature in $ADDITIONAL_FEATURES ; do
|
||||
feature_exists "$feature" || echo "[WARNING] Feature \"$feature\" not found. A typo?"
|
||||
done
|
||||
|
||||
# create an empty initrd
|
||||
if ! mkdir $tmp_mnt ; then
|
||||
error 1 "could not create temporary directory"
|
||||
fi
|
||||
|
||||
# fill the initrd
|
||||
cp $INITRD_PATH/bin/linuxrc $linuxrc
|
||||
mkdir "$tmp_mnt/boot"
|
||||
|
||||
-mkdir -p $tmp_mnt/{sbin,bin,etc,dev,proc,sys,root,config}
|
||||
+mkdir -p $tmp_mnt/{sbin,bin,etc,dev,proc,sys,root,config,usr/bin,usr/sbin}
|
||||
|
||||
mkdir -p -m 4777 $tmp_mnt/tmp
|
||||
|
||||
# Create a dummy /etc/mtab for mount/umount
|
||||
echo -n > $tmp_mnt/etc/mtab
|
||||
|
||||
# Add modprobe, modprobe.conf*, and a version of /bin/true: modprobe.conf
|
||||
# might use it.
|
||||
cp -r $root_dir/etc/modprobe.conf $root_dir/etc/modprobe.conf.local \
|
||||
$root_dir/etc/modprobe.d $tmp_mnt/etc
|
||||
cat > $tmp_mnt/bin/true <<-EOF
|
||||
#! /bin/sh
|
||||
:
|
||||
Index: 1110/mkinitrd/scripts/setup-progs.sh
|
||||
===================================================================
|
||||
--- 1110.orig/mkinitrd/scripts/setup-progs.sh
|
||||
+++ 1110/mkinitrd/scripts/setup-progs.sh
|
||||
@@ -28,29 +28,29 @@ for script in $INITRD_PATH/boot/*.sh; do
|
||||
echo "[ \"\$debug\" ] && echo running $file
|
||||
source boot/$file
|
||||
[ \"\$modules\" ] && load_modules" >> run_all.sh
|
||||
[ "$condition" ] && echo "fi" >> run_all.sh
|
||||
# and all programs it needs
|
||||
for files in $(cat $script | grep '%programs: ' | sed 's/^#%programs: \(.*\)$/\1/'); do
|
||||
for file in $(eval echo $files); do
|
||||
if [ "${file:0:17}" = "/lib/mkinitrd/bin" ]; then
|
||||
SOURCE=$file
|
||||
DEST="./bin/"
|
||||
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
|
||||
SOURCE=$(which "$file")
|
||||
- DEST="./bin/"
|
||||
+ DEST=".$SOURCE"
|
||||
fi
|
||||
cp_bin "$SOURCE" "$DEST"
|
||||
done
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
echo -ne "Features: "
|
||||
echo $features
|
||||
|
||||
[ -e "bin/sh" ] || ln -s /bin/bash bin/sh
|
||||
|
||||
Index: 1110/mkinitrd/scripts/setup-scsi_dh.sh
|
||||
===================================================================
|
||||
--- 1110.orig/mkinitrd/scripts/setup-scsi_dh.sh
|
||||
+++ 1110/mkinitrd/scripts/setup-scsi_dh.sh
|
||||
@@ -1,13 +1,13 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
#%stage: device
|
||||
#
|
||||
# Include all scsi_dh_* modules and load them on boot (bnc#727428 et al)
|
||||
|
||||
scsi_dh_modules=
|
||||
-for i in $(find $root_dir/lib/modules/$kernel_version/kernel/drivers/scsi/device_handler -name "scsi[-_]dh[_-]*.ko"); do
|
||||
+for i in $(find $root_dir/lib/modules/$kernel_version/kernel/drivers/scsi/device_handler -name "scsi[-_]dh[_-]*.ko" | sort); do
|
||||
i=${i%.ko}
|
||||
scsi_dh_modules="$scsi_dh_modules ${i##*/}"
|
||||
done
|
||||
|
||||
save_var scsi_dh_modules
|
||||
Index: 1110/mkinitrd/scripts/setup-sharedlibs.sh
|
||||
===================================================================
|
||||
--- 1110.orig/mkinitrd/scripts/setup-sharedlibs.sh
|
||||
+++ 1110/mkinitrd/scripts/setup-sharedlibs.sh
|
||||
@@ -54,58 +54,68 @@ shared_object_files() {
|
||||
while [ -L "/$lib" ]; do
|
||||
echo $lib
|
||||
link="$(readlink "/$lib")"
|
||||
if [ x"${link:0:1}" == x"/" ]; then
|
||||
lib=${link#/}
|
||||
else
|
||||
lib="${lib%/*}/$link"
|
||||
fi
|
||||
done
|
||||
echo $lib
|
||||
done
|
||||
}
|
||||
|
||||
-verbose -ne "Shared libs:\t"
|
||||
-# Copy all required shared libraries and the symlinks that
|
||||
-# refer to them.
|
||||
-lib_files=$(shared_object_files "${initrd_bins[@]}")
|
||||
-[ $? -eq 0 ] || return 1
|
||||
-if [ -n "$lib_files" ]; then
|
||||
- for lib in $lib_files; do
|
||||
- [ -L $root_dir/$lib ] || verbose -n "$lib "
|
||||
- ( cd ${root_dir:-/} ; cp -dp --parents $lib $tmp_mnt )
|
||||
- done
|
||||
- lib_files=
|
||||
+copy_shared_libs() {
|
||||
+ local bins=( "$@" )
|
||||
+ local extra_lib_files lib_files lib i
|
||||
+
|
||||
+ # First see what nss and other libs are required. This can be 64bit or 32bit,
|
||||
+ # depending on the host and the already copied binaries.
|
||||
case "$(uname -m)" in
|
||||
alpha|ia64)
|
||||
+ # this is a known location
|
||||
mkdir -p $tmp_mnt/lib
|
||||
- lib_files="$lib_files `echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/lib{gcc_s,unwind}.so*`"
|
||||
+ extra_lib_files="`echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/lib{gcc_s,unwind}.so*`"
|
||||
;;
|
||||
*)
|
||||
- # no symlinks, most point into the running system
|
||||
- for i in `LANG=C LC_ALL=C file -b $tmp_mnt/{,usr/}{lib*/udev/,{,s}bin}/* | sed -n 's/^ELF \([0-9][0-9]-bit\) .*/\1/p' | sort -u`
|
||||
+ # Skip symlinks, they may point into the running system instead of $tmp_mnt
|
||||
+ for i in `LANG=C LC_ALL=C file -b $tmp_mnt/{,usr/}{lib*/udev,{,s}bin}/* | sed -n 's/^ELF \([0-9][0-9]-bit\) .*/\1/p' | sort -u`
|
||||
do
|
||||
case "$i" in
|
||||
32-bit)
|
||||
mkdir -p $tmp_mnt/lib
|
||||
- lib_files="$lib_files `echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/libgcc_s.so*`"
|
||||
+ extra_lib_files="$extra_lib_files `echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/libgcc_s.so*`"
|
||||
;;
|
||||
64-bit)
|
||||
mkdir -p $tmp_mnt/lib64
|
||||
- lib_files="$lib_files `echo $root_dir/lib64/libnss_{dns,files}* $root_dir/lib64/libgcc_s.so*`"
|
||||
+ extra_lib_files="$extra_lib_files `echo $root_dir/lib64/libnss_{dns,files}* $root_dir/lib64/libgcc_s.so*`"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
||||
- for lib in $lib_files ; do
|
||||
- if [ -f $lib ] ; then
|
||||
- verbose -n "${lib##$root_dir/} "
|
||||
- cp -dp --parents $lib $tmp_mnt
|
||||
+ verbose -ne "Shared libs:\t"
|
||||
+
|
||||
+ # Now collect a list of libraries on which the binaries and extra libs depend on
|
||||
+ lib_files=$( shared_object_files ${bins[@]} $extra_lib_files )
|
||||
+ if [ $? -eq 0 ]
|
||||
+ then
|
||||
+ if [ -n "$lib_files" ]
|
||||
+ then
|
||||
+ # Finally copy dependencies and extra libs
|
||||
+ for lib in $lib_files $extra_lib_files
|
||||
+ do
|
||||
+ [ -L $root_dir/$lib ] || verbose -n "$lib "
|
||||
+ ( cd ${root_dir:-/} ; cp -dp --parents $lib $tmp_mnt )
|
||||
+ done
|
||||
+ verbose
|
||||
+ else
|
||||
+ verbose "none"
|
||||
fi
|
||||
- done
|
||||
- verbose
|
||||
-else
|
||||
- verbose "none"
|
||||
-fi
|
||||
+ else
|
||||
+ return 1
|
||||
+ fi
|
||||
+}
|
||||
|
||||
+# Copy all required shared libraries and the symlinks that refer to them.
|
||||
+copy_shared_libs "${initrd_bins[@]}"
|
@ -1,356 +0,0 @@
|
||||
---
|
||||
mkinitrd/scripts/setup-ibft.sh | 2
|
||||
mkinitrd/scripts/setup-network.sh | 11 +++-
|
||||
mkinitrd/scripts/setup-prepare.sh | 90 +++++++++++++++++++++++++++++------
|
||||
mkinitrd/scripts/setup-progs.sh | 4 -
|
||||
mkinitrd/scripts/setup-scsi_dh.sh | 2
|
||||
mkinitrd/scripts/setup-sharedlibs.sh | 60 +++++++++++++----------
|
||||
6 files changed, 124 insertions(+), 45 deletions(-)
|
||||
|
||||
Index: 1115/mkinitrd/scripts/setup-ibft.sh
|
||||
===================================================================
|
||||
--- 1115.orig/mkinitrd/scripts/setup-ibft.sh
|
||||
+++ 1115/mkinitrd/scripts/setup-ibft.sh
|
||||
@@ -22,23 +22,23 @@ ibft_set_iface() {
|
||||
drvlink="$drvlink $(get_network_module $interface)"
|
||||
if [ ! "$nettype" -a -e $ibft_nic/dhcp ]; then
|
||||
nettype=dhcp
|
||||
read ibft_dhcp < $ibft_nic/dhcp
|
||||
[ "$ibft_dhcp" = "0.0.0.0" ] && nettype=static
|
||||
else
|
||||
nettype=static
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
ibft_nic=/sys/firmware/ibft/ethernet0
|
||||
ibft_nic2=/sys/firmware/ibft/ethernet1
|
||||
-ibft_hostname=$(hostname)
|
||||
+ibft_hostname=localhost
|
||||
|
||||
if [ "$root_iscsi" = 1 -a -d $ibft_nic ]; then
|
||||
ibft_available=1
|
||||
ibft_set_iface
|
||||
fi
|
||||
save_var ibft_available
|
||||
save_var ibft_hostname
|
||||
save_var ibft_nic
|
||||
save_var ibft_nic2
|
||||
Index: 1115/mkinitrd/scripts/setup-network.sh
|
||||
===================================================================
|
||||
--- 1115.orig/mkinitrd/scripts/setup-network.sh
|
||||
+++ 1115/mkinitrd/scripts/setup-network.sh
|
||||
@@ -287,27 +287,36 @@ if [ "$nettype" = "ifup" ] ; then
|
||||
verbose "[NETWORK]\tifup: $interface"
|
||||
fi
|
||||
done
|
||||
interface=
|
||||
fi
|
||||
|
||||
# Copy the /etc/resolv.conf when the IP is static
|
||||
if test -n "$static_interfaces"; then
|
||||
verbose "[NETWORK]\tUsing /etc/resolv.conf from the system in the initrd"
|
||||
cp /etc/resolv.conf $tmp_mnt/etc
|
||||
fi
|
||||
|
||||
# Copy netcfg files (bnc#468090, bnc#714945)
|
||||
-cp /etc/{hosts,protocols,services,netconfig} $tmp_mnt/etc
|
||||
+cp /etc/{protocols,services,netconfig} $tmp_mnt/etc
|
||||
+cat > $tmp_mnt/etc/hosts <<_EOH_
|
||||
+127.0.0.1 localhost
|
||||
+::1 localhost ipv6-localhost ipv6-loopback
|
||||
+fe00::0 ipv6-localnet
|
||||
+ff00::0 ipv6-mcastprefix
|
||||
+ff02::1 ipv6-allnodes
|
||||
+ff02::2 ipv6-allrouters
|
||||
+ff02::3 ipv6-allhosts
|
||||
+_EOH_
|
||||
|
||||
mkdir -p $tmp_mnt/var/lib/dhcpcd
|
||||
mkdir -p $tmp_mnt/var/run
|
||||
|
||||
cp_bin /lib/mkinitrd/bin/ipconfig.sh $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
|
||||
# XXX: This belongs to the if [ "$nettype" = "ifup" ] branch above, but we
|
||||
# are being bug-compatible with previous versions of mkinitrd, which
|
||||
# included these files unconditionally (bnc#891573).
|
||||
if [ -f /etc/udev/rules.d/77-network.rules ] ; then
|
||||
cp /etc/udev/rules.d/77-network.rules $tmp_mnt/etc/udev/rules.d
|
||||
Index: 1115/mkinitrd/scripts/setup-prepare.sh
|
||||
===================================================================
|
||||
--- 1115.orig/mkinitrd/scripts/setup-prepare.sh
|
||||
+++ 1115/mkinitrd/scripts/setup-prepare.sh
|
||||
@@ -13,43 +13,103 @@
|
||||
#%param_v: "Verbose mode."
|
||||
#%param_L: "Disable logging."
|
||||
#%param_h: "This help screen."
|
||||
#
|
||||
###### Additional options
|
||||
##
|
||||
## Script inclusion may be overriden by
|
||||
## 1) creating a monster-initrd
|
||||
## 2) including the wanted module in the configuration option ADDITIONAL_FEATURES in /etc/sysconfig/initrd
|
||||
## 3) definition using the -f command line switch
|
||||
##
|
||||
|
||||
# Install a binary file
|
||||
+# 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() {
|
||||
- cp -a "$@" \
|
||||
- || exit_code=1
|
||||
+ local -a files
|
||||
+ local target
|
||||
+ local target_dirname
|
||||
+ local file
|
||||
|
||||
- # Remember the binaries installed. We need the list for checking
|
||||
- # for dynamic libraries.
|
||||
- while [ $# -gt 1 ]; do
|
||||
- initrd_bins[${#initrd_bins[@]}]=$1
|
||||
- shift
|
||||
- done
|
||||
- # file may print '^setuid ELF ...'
|
||||
- # suid mount will fail if mkinitrd was called as user
|
||||
- if [ -L "$1" ]; then
|
||||
- : do nothing with symlinks
|
||||
- elif [ -d "$1" -o -f "$1" ]; then
|
||||
- find "$1" -type f -print0 | xargs -0 chmod 0755
|
||||
- fi
|
||||
+ # need at least two parameters, source and destination
|
||||
+ if test $# -lt 2
|
||||
+ then
|
||||
+ return 0
|
||||
+ fi
|
||||
+ # store source filenames
|
||||
+ until test $# -eq 1
|
||||
+ do
|
||||
+ files=( ${files[@]} $1 )
|
||||
+ shift
|
||||
+ done
|
||||
+ # store target, either file or directory
|
||||
+ target=$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
|
||||
+ target_dirname=${target}
|
||||
+ else
|
||||
+ # simplify symlink resolving for sinlge filename
|
||||
+ target_dirname=${target%/*}
|
||||
+ fi
|
||||
+
|
||||
+ for file in ${files[@]}
|
||||
+ do
|
||||
+ local src dst
|
||||
+ src=${file}
|
||||
+ dst=${target}
|
||||
+ # copy requested soure file as is to requested destination
|
||||
+ cp -a -v --remove-destination ${src} ${dst}
|
||||
+ # copy symlinks recursivly
|
||||
+ while [ 1 ]
|
||||
+ do
|
||||
+ local tmp_src
|
||||
+ if test -L ${src}
|
||||
+ then
|
||||
+ tmp_src=$(readlink ${src})
|
||||
+ if test "${tmp_src:0:1}" = "/"
|
||||
+ then
|
||||
+ src=${tmp_src}
|
||||
+ else
|
||||
+ # relative symlink
|
||||
+ src=${src%/*}/${tmp_src}
|
||||
+ fi
|
||||
+ cp -a -v --remove-destination --parents ${src} $tmp_mnt
|
||||
+ # if link target exists, proceed to next symlink target
|
||||
+ if test -e "${src}"
|
||||
+ then
|
||||
+ continue
|
||||
+ fi
|
||||
+ fi
|
||||
+ # exit loop in case of dead symlink or if target of symlink was reached
|
||||
+ break
|
||||
+ done
|
||||
+ # if source file exists, add it to list of binaries
|
||||
+ if test -e "${src}"
|
||||
+ then
|
||||
+ # file may print '^setuid ELF ...'
|
||||
+ # suid mount will fail if mkinitrd was called as user
|
||||
+ chmod -v 0755 $tmp_mnt/${src}
|
||||
+ initrd_bins[${#initrd_bins[@]}]=${src}
|
||||
+ fi
|
||||
+ done
|
||||
}
|
||||
|
||||
# check if we should use script or feature $1
|
||||
use_script() {
|
||||
local condition feature script file
|
||||
|
||||
# always use when creating monster initrd
|
||||
[ "$create_monster_initrd" ] && return 0
|
||||
|
||||
# Normalize to feature name
|
||||
feature="${1##*/}"
|
||||
feature="${feature#*-}"
|
||||
feature="${feature%.sh}"
|
||||
Index: 1115/mkinitrd/scripts/setup-progs.sh
|
||||
===================================================================
|
||||
--- 1115.orig/mkinitrd/scripts/setup-progs.sh
|
||||
+++ 1115/mkinitrd/scripts/setup-progs.sh
|
||||
@@ -28,29 +28,29 @@ for script in $INITRD_PATH/boot/*.sh; do
|
||||
echo "[ \"\$debug\" ] && echo running $file
|
||||
source boot/$file
|
||||
[ \"\$modules\" ] && load_modules" >> run_all.sh
|
||||
[ "$condition" ] && echo "fi" >> run_all.sh
|
||||
# and all programs it needs
|
||||
for files in $(cat $script | grep '%programs: ' | sed 's/^#%programs: \(.*\)$/\1/'); do
|
||||
for file in $(eval echo $files); do
|
||||
if [ "${file:0:17}" = "/lib/mkinitrd/bin" ]; then
|
||||
SOURCE=$file
|
||||
DEST="./bin/"
|
||||
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
|
||||
SOURCE=$(which "$file")
|
||||
- DEST="./bin/"
|
||||
+ DEST=".$SOURCE"
|
||||
fi
|
||||
cp_bin "$SOURCE" "$DEST"
|
||||
done
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
echo -ne "Features: "
|
||||
echo $features
|
||||
|
||||
[ -e "bin/sh" ] || ln -s /bin/bash bin/sh
|
||||
|
||||
Index: 1115/mkinitrd/scripts/setup-scsi_dh.sh
|
||||
===================================================================
|
||||
--- 1115.orig/mkinitrd/scripts/setup-scsi_dh.sh
|
||||
+++ 1115/mkinitrd/scripts/setup-scsi_dh.sh
|
||||
@@ -1,13 +1,13 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
#%stage: device
|
||||
#
|
||||
# Include all scsi_dh_* modules and load them on boot (bnc#727428 et al)
|
||||
|
||||
scsi_dh_modules=
|
||||
-for i in $(find $root_dir/lib/modules/$kernel_version/kernel/drivers/scsi/device_handler -name "scsi[-_]dh[_-]*.ko"); do
|
||||
+for i in $(find $root_dir/lib/modules/$kernel_version/kernel/drivers/scsi/device_handler -name "scsi[-_]dh[_-]*.ko" | sort); do
|
||||
i=${i%.ko}
|
||||
scsi_dh_modules="$scsi_dh_modules ${i##*/}"
|
||||
done
|
||||
|
||||
save_var scsi_dh_modules
|
||||
Index: 1115/mkinitrd/scripts/setup-sharedlibs.sh
|
||||
===================================================================
|
||||
--- 1115.orig/mkinitrd/scripts/setup-sharedlibs.sh
|
||||
+++ 1115/mkinitrd/scripts/setup-sharedlibs.sh
|
||||
@@ -54,58 +54,68 @@ shared_object_files() {
|
||||
while [ -L "/$lib" ]; do
|
||||
echo $lib
|
||||
link="$(readlink "/$lib")"
|
||||
if [ x"${link:0:1}" == x"/" ]; then
|
||||
lib=${link#/}
|
||||
else
|
||||
lib="${lib%/*}/$link"
|
||||
fi
|
||||
done
|
||||
echo $lib
|
||||
done
|
||||
}
|
||||
|
||||
-verbose -ne "Shared libs:\t"
|
||||
-# Copy all required shared libraries and the symlinks that
|
||||
-# refer to them.
|
||||
-lib_files=$(shared_object_files "${initrd_bins[@]}")
|
||||
-[ $? -eq 0 ] || return 1
|
||||
-if [ -n "$lib_files" ]; then
|
||||
- for lib in $lib_files; do
|
||||
- [ -L $root_dir/$lib ] || verbose -n "$lib "
|
||||
- ( cd ${root_dir:-/} ; cp -dp --parents $lib $tmp_mnt )
|
||||
- done
|
||||
- lib_files=
|
||||
+copy_shared_libs() {
|
||||
+ local bins=( "$@" )
|
||||
+ local extra_lib_files lib_files lib i
|
||||
+
|
||||
+ # First see what nss and other libs are required. This can be 64bit or 32bit,
|
||||
+ # depending on the host and the already copied binaries.
|
||||
case "$(uname -m)" in
|
||||
alpha|ia64)
|
||||
+ # this is a known location
|
||||
mkdir -p $tmp_mnt/lib
|
||||
- lib_files="$lib_files `echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/lib{gcc_s,unwind}.so*`"
|
||||
+ extra_lib_files="`echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/lib{gcc_s,unwind}.so*`"
|
||||
;;
|
||||
*)
|
||||
- # no symlinks, most point into the running system
|
||||
- for i in `LANG=C LC_ALL=C file -b $tmp_mnt/{,usr/}{lib*/udev/,{,s}bin}/* | sed -n 's/^ELF \([0-9][0-9]-bit\) .*/\1/p' | sort -u`
|
||||
+ # Skip symlinks, they may point into the running system instead of $tmp_mnt
|
||||
+ for i in `LANG=C LC_ALL=C file -b $tmp_mnt/{,usr/}{lib*/udev,{,s}bin}/* | sed -n 's/^ELF \([0-9][0-9]-bit\) .*/\1/p' | sort -u`
|
||||
do
|
||||
case "$i" in
|
||||
32-bit)
|
||||
mkdir -p $tmp_mnt/lib
|
||||
- lib_files="$lib_files `echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/libgcc_s.so*`"
|
||||
+ extra_lib_files="$extra_lib_files `echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/libgcc_s.so*`"
|
||||
;;
|
||||
64-bit)
|
||||
mkdir -p $tmp_mnt/lib64
|
||||
- lib_files="$lib_files `echo $root_dir/lib64/libnss_{dns,files}* $root_dir/lib64/libgcc_s.so*`"
|
||||
+ extra_lib_files="$extra_lib_files `echo $root_dir/lib64/libnss_{dns,files}* $root_dir/lib64/libgcc_s.so*`"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
||||
- for lib in $lib_files ; do
|
||||
- if [ -f $lib ] ; then
|
||||
- verbose -n "${lib##$root_dir/} "
|
||||
- cp -dp --parents $lib $tmp_mnt
|
||||
+ verbose -ne "Shared libs:\t"
|
||||
+
|
||||
+ # Now collect a list of libraries on which the binaries and extra libs depend on
|
||||
+ lib_files=$( shared_object_files ${bins[@]} $extra_lib_files )
|
||||
+ if [ $? -eq 0 ]
|
||||
+ then
|
||||
+ if [ -n "$lib_files" ]
|
||||
+ then
|
||||
+ # Finally copy dependencies and extra libs
|
||||
+ for lib in $lib_files $extra_lib_files
|
||||
+ do
|
||||
+ [ -L $root_dir/$lib ] || verbose -n "$lib "
|
||||
+ ( cd ${root_dir:-/} ; cp -dp --parents $lib $tmp_mnt )
|
||||
+ done
|
||||
+ verbose
|
||||
+ else
|
||||
+ verbose "none"
|
||||
fi
|
||||
- done
|
||||
- verbose
|
||||
-else
|
||||
- verbose "none"
|
||||
-fi
|
||||
+ else
|
||||
+ return 1
|
||||
+ fi
|
||||
+}
|
||||
|
||||
+# Copy all required shared libraries and the symlinks that refer to them.
|
||||
+copy_shared_libs "${initrd_bins[@]}"
|
@ -1,388 +0,0 @@
|
||||
---
|
||||
mkinitrd/scripts/setup-ibft.sh | 2
|
||||
mkinitrd/scripts/setup-network.sh | 14 ++++-
|
||||
mkinitrd/scripts/setup-prepare.sh | 94 ++++++++++++++++++++++++++++-------
|
||||
mkinitrd/scripts/setup-progs.sh | 17 +-----
|
||||
mkinitrd/scripts/setup-sharedlibs.sh | 60 +++++++++++++---------
|
||||
5 files changed, 127 insertions(+), 60 deletions(-)
|
||||
|
||||
Index: 1140/mkinitrd/scripts/setup-ibft.sh
|
||||
===================================================================
|
||||
--- 1140.orig/mkinitrd/scripts/setup-ibft.sh
|
||||
+++ 1140/mkinitrd/scripts/setup-ibft.sh
|
||||
@@ -9,22 +9,22 @@ ibft_set_iface() {
|
||||
interface=$if
|
||||
drvlink=$(get_network_module $interface)
|
||||
if [ ! "$nettype" -a -e $ibft_nic/dhcp ]; then
|
||||
nettype=dhcp
|
||||
read ibft_dhcp < $ibft_nic/dhcp
|
||||
[ "$ibft_dhcp" = "0.0.0.0" ] && nettype=static
|
||||
else
|
||||
nettype=static
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
ibft_nic=/sys/firmware/ibft/ethernet0
|
||||
-ibft_hostname=$(hostname)
|
||||
+ibft_hostname=localhost
|
||||
|
||||
if [ "$root_iscsi" = 1 -a -d $ibft_nic ]; then
|
||||
ibft_available=1
|
||||
ibft_set_iface
|
||||
fi
|
||||
save_var ibft_available
|
||||
save_var ibft_hostname
|
||||
save_var ibft_nic
|
||||
Index: 1140/mkinitrd/scripts/setup-network.sh
|
||||
===================================================================
|
||||
--- 1140.orig/mkinitrd/scripts/setup-network.sh
|
||||
+++ 1140/mkinitrd/scripts/setup-network.sh
|
||||
@@ -231,29 +231,37 @@ if [ "$nettype" = "ifup" ] ; then
|
||||
drvlink="$drvlink $mod"
|
||||
verbose "[NETWORK]\t$interface ($nettype)"
|
||||
fi
|
||||
done
|
||||
interface=
|
||||
fi
|
||||
|
||||
# Copy the /etc/resolv.conf when the IP is static
|
||||
if [ "$interface" -a "$nettype" = "static" -a -f /etc/resolv.conf ] ; then
|
||||
verbose "[NETWORK]\tUsing /etc/resolv.conf from the system in the initrd"
|
||||
cp /etc/resolv.conf $tmp_mnt/etc
|
||||
fi
|
||||
|
||||
-# Copy /etc/hosts in any case to be able to resolve static host names in the
|
||||
-# initrd (bnc #468090)
|
||||
-cp /etc/hosts $tmp_mnt/etc
|
||||
+# Copy netcfg files (bnc#468090, bnc#714945)
|
||||
+cp /etc/{protocols,services,netconfig} $tmp_mnt/etc
|
||||
+cat > $tmp_mnt/etc/hosts <<_EOH_
|
||||
+127.0.0.1 localhost
|
||||
+::1 localhost ipv6-localhost ipv6-loopback
|
||||
+fe00::0 ipv6-localnet
|
||||
+ff00::0 ipv6-mcastprefix
|
||||
+ff02::1 ipv6-allnodes
|
||||
+ff02::2 ipv6-allrouters
|
||||
+ff02::3 ipv6-allhosts
|
||||
+_EOH_
|
||||
|
||||
# Get static IP configuration if requested
|
||||
if [ "$interface" -a "$nettype" = "static" ] ; then
|
||||
ip=$(get_ip_config $interface)
|
||||
fi
|
||||
|
||||
mkdir -p $tmp_mnt/var/lib/dhcpcd
|
||||
mkdir -p $tmp_mnt/var/run
|
||||
|
||||
cp_bin /lib/mkinitrd/bin/ipconfig.sh $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
|
||||
Index: 1140/mkinitrd/scripts/setup-prepare.sh
|
||||
===================================================================
|
||||
--- 1140.orig/mkinitrd/scripts/setup-prepare.sh
|
||||
+++ 1140/mkinitrd/scripts/setup-prepare.sh
|
||||
@@ -13,43 +13,103 @@
|
||||
#%param_R: "Print release (version)."
|
||||
#%param_L: "Disable logging."
|
||||
#%param_h: "This help screen."
|
||||
#
|
||||
###### Additional options
|
||||
##
|
||||
## Script inclusion may be overriden by
|
||||
## 1) creating a monster-initrd
|
||||
## 2) including the wanted module in the configuration option ADDITIONAL_FEATURES in /etc/sysconfig/initrd
|
||||
## 3) definition using the -f command line switch
|
||||
##
|
||||
|
||||
# Install a binary file
|
||||
+# 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() {
|
||||
- cp -a "$@" \
|
||||
- || exit_code=1
|
||||
-
|
||||
- # Remember the binaries installed. We need the list for checking
|
||||
- # for dynamic libraries.
|
||||
- while [ $# -gt 1 ]; do
|
||||
- initrd_bins[${#initrd_bins[@]}]=$1
|
||||
- shift
|
||||
- done
|
||||
- # file may print '^setuid ELF ...'
|
||||
- # suid mount will fail if mkinitrd was called as user
|
||||
- if [ -L "$1" ]; then
|
||||
- : do nothing with symlinks
|
||||
- elif [ -d "$1" -o -f "$1" ]; then
|
||||
- find "$1" -type f -print0 | xargs -0 chmod 0755
|
||||
- fi
|
||||
+ local -a files
|
||||
+ local target
|
||||
+ local target_dirname
|
||||
+ local file
|
||||
+
|
||||
+ # need at least two parameters, source and destination
|
||||
+ if test $# -lt 2
|
||||
+ then
|
||||
+ return 0
|
||||
+ fi
|
||||
+ # store source filenames
|
||||
+ until test $# -eq 1
|
||||
+ do
|
||||
+ files=( ${files[@]} $1 )
|
||||
+ shift
|
||||
+ done
|
||||
+ # store target, either file or directory
|
||||
+ target=$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
|
||||
+ target_dirname=${target}
|
||||
+ else
|
||||
+ # simplify symlink resolving for sinlge filename
|
||||
+ target_dirname=${target%/*}
|
||||
+ fi
|
||||
+
|
||||
+ for file in ${files[@]}
|
||||
+ do
|
||||
+ local src dst
|
||||
+ src=${file}
|
||||
+ dst=${target}
|
||||
+ # copy requested soure file as is to requested destination
|
||||
+ cp -a -v --remove-destination ${src} ${dst}
|
||||
+ # copy symlinks recursivly
|
||||
+ while [ 1 ]
|
||||
+ do
|
||||
+ local tmp_src
|
||||
+ if test -L ${src}
|
||||
+ then
|
||||
+ tmp_src=$(readlink ${src})
|
||||
+ if test "${tmp_src:0:1}" = "/"
|
||||
+ then
|
||||
+ src=${tmp_src}
|
||||
+ else
|
||||
+ # relative symlink
|
||||
+ src=${src%/*}/${tmp_src}
|
||||
+ fi
|
||||
+ cp -a -v --remove-destination --parents ${src} $tmp_mnt
|
||||
+ # if link target exists, proceed to next symlink target
|
||||
+ if test -e "${src}"
|
||||
+ then
|
||||
+ continue
|
||||
+ fi
|
||||
+ fi
|
||||
+ # exit loop in case of dead symlink or if target of symlink was reached
|
||||
+ break
|
||||
+ done
|
||||
+ # if source file exists, add it to list of binaries
|
||||
+ if test -e "${src}"
|
||||
+ then
|
||||
+ # file may print '^setuid ELF ...'
|
||||
+ # suid mount will fail if mkinitrd was called as user
|
||||
+ chmod -v 0755 $tmp_mnt/${src}
|
||||
+ initrd_bins[${#initrd_bins[@]}]=${src}
|
||||
+ fi
|
||||
+ done
|
||||
}
|
||||
|
||||
# check if we should use script or feature $1
|
||||
use_script() {
|
||||
local condition feature script file
|
||||
|
||||
# always use when creating monster initrd
|
||||
[ "$create_monster_initrd" ] && return 0
|
||||
|
||||
# Normalize to feature name
|
||||
feature="${1##*/}"
|
||||
feature="${feature#*-}"
|
||||
feature="${feature%.sh}"
|
||||
@@ -143,27 +203,27 @@ fi
|
||||
for feature in $ADDITIONAL_FEATURES ; do
|
||||
feature_exists "$feature" || echo "[WARNING] Feature \"$feature\" not found. A typo?"
|
||||
done
|
||||
|
||||
# create an empty initrd
|
||||
if ! mkdir $tmp_mnt ; then
|
||||
error 1 "could not create temporary directory"
|
||||
fi
|
||||
|
||||
# fill the initrd
|
||||
cp $INITRD_PATH/bin/linuxrc $linuxrc
|
||||
mkdir "$tmp_mnt/boot"
|
||||
|
||||
-mkdir -p $tmp_mnt/{sbin,bin,etc,dev,proc,sys,root,config}
|
||||
+mkdir -p $tmp_mnt/{sbin,bin,etc,dev,proc,sys,root,config,usr/bin,usr/sbin}
|
||||
|
||||
mkdir -p -m 4777 $tmp_mnt/tmp
|
||||
|
||||
# Create a dummy /etc/mtab for mount/umount
|
||||
echo -n > $tmp_mnt/etc/mtab
|
||||
|
||||
# Add modprobe, modprobe.conf*, and a version of /bin/true: modprobe.conf
|
||||
# might use it.
|
||||
for mod in $root_dir/etc/modprobe.conf $root_dir/etc/modprobe.conf.local \
|
||||
$root_dir/etc/modprobe.d ; do
|
||||
test -e $mod && cp -r $mod $tmp_mnt/etc
|
||||
done
|
||||
cat > $tmp_mnt/bin/true <<-EOF
|
||||
Index: 1140/mkinitrd/scripts/setup-progs.sh
|
||||
===================================================================
|
||||
--- 1140.orig/mkinitrd/scripts/setup-progs.sh
|
||||
+++ 1140/mkinitrd/scripts/setup-progs.sh
|
||||
@@ -24,48 +24,37 @@ for script in $INITRD_PATH/boot/*.sh; do
|
||||
condition="$(sed -rn 's/^#[[:blank:]]*%if:[[:blank:]]*(.*)$/if [ \1 ]; then/p' < "$script")"
|
||||
echo "$condition" >> run_all.sh
|
||||
# -- remember dependent modules
|
||||
sed -rn 's/^#[[:blank:]]*%modules:[[:blank:]]*(.*)$/modules="\1"/p' < $script >> run_all.sh
|
||||
echo "[ \"\$debug\" ] && echo running $file
|
||||
source boot/$file
|
||||
[ \"\$modules\" ] && load_modules" >> run_all.sh
|
||||
[ "$condition" ] && echo "fi" >> run_all.sh
|
||||
# and all programs it needs
|
||||
for files in $(sed -rn 's/^#[[:blank:]]*%programs:[[:blank:]]*(.*)$/\1/p' < "$script"); do
|
||||
for file in $(eval echo $files); do
|
||||
if [ "${file:0:17}" = "/lib/mkinitrd/bin" ]; then
|
||||
SOURCE=$file
|
||||
- DEST="./bin/"
|
||||
+ DEST="${tmp_mnt}/bin/"
|
||||
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="${tmp_mnt}$SOURCE"
|
||||
else
|
||||
case "$(type -t "$file")" in
|
||||
builtin) continue
|
||||
esac
|
||||
SOURCE=$(type -p "$file")
|
||||
- DEST="./bin/"
|
||||
+ DEST="${tmp_mnt}$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
|
||||
done
|
||||
|
||||
echo -ne "Features: "
|
||||
echo $features
|
||||
|
||||
[ -e "bin/sh" ] || ln -s /bin/bash bin/sh
|
||||
|
||||
Index: 1140/mkinitrd/scripts/setup-sharedlibs.sh
|
||||
===================================================================
|
||||
--- 1140.orig/mkinitrd/scripts/setup-sharedlibs.sh
|
||||
+++ 1140/mkinitrd/scripts/setup-sharedlibs.sh
|
||||
@@ -54,58 +54,68 @@ shared_object_files() {
|
||||
while [ -L "/$lib" ]; do
|
||||
echo $lib
|
||||
link="$(readlink "/$lib")"
|
||||
if [ x"${link:0:1}" == x"/" ]; then
|
||||
lib=${link#/}
|
||||
else
|
||||
lib="${lib%/*}/$link"
|
||||
fi
|
||||
done
|
||||
echo $lib
|
||||
done
|
||||
}
|
||||
|
||||
-verbose -ne "Shared libs:\t"
|
||||
-# Copy all required shared libraries and the symlinks that
|
||||
-# refer to them.
|
||||
-lib_files=$(shared_object_files "${initrd_bins[@]}")
|
||||
-[ $? -eq 0 ] || return 1
|
||||
-if [ -n "$lib_files" ]; then
|
||||
- for lib in $lib_files; do
|
||||
- [ -L $root_dir/$lib ] || verbose -n "$lib "
|
||||
- ( cd ${root_dir:-/} ; cp -dp --parents $lib $tmp_mnt )
|
||||
- done
|
||||
- lib_files=
|
||||
+copy_shared_libs() {
|
||||
+ local bins=( "$@" )
|
||||
+ local extra_lib_files lib_files lib i
|
||||
+
|
||||
+ # First see what nss and other libs are required. This can be 64bit or 32bit,
|
||||
+ # depending on the host and the already copied binaries.
|
||||
case "$(uname -m)" in
|
||||
ia64)
|
||||
+ # this is a known location
|
||||
mkdir -p $tmp_mnt/lib
|
||||
- lib_files="$lib_files `echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/lib{gcc_s,unwind}.so*`"
|
||||
+ extra_lib_files="`echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/lib{gcc_s,unwind}.so*`"
|
||||
;;
|
||||
*)
|
||||
- # no symlinks, most point into the running system
|
||||
- for i in `LANG=C LC_ALL=C file -b $tmp_mnt/{,usr/}{lib*/udev/,{,s}bin}/* | sed -n 's/^ELF \([0-9][0-9]-bit\) .*/\1/p' | sort -u`
|
||||
+ # Skip symlinks, they may point into the running system instead of $tmp_mnt
|
||||
+ for i in `LANG=C LC_ALL=C file -b $tmp_mnt/{,usr/}{lib*/udev,{,s}bin}/* | sed -n 's/^ELF \([0-9][0-9]-bit\) .*/\1/p' | sort -u`
|
||||
do
|
||||
case "$i" in
|
||||
32-bit)
|
||||
mkdir -p $tmp_mnt/lib
|
||||
- lib_files="$lib_files `echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/libgcc_s.so*`"
|
||||
+ extra_lib_files="$extra_lib_files `echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/libgcc_s.so*`"
|
||||
;;
|
||||
64-bit)
|
||||
mkdir -p $tmp_mnt/lib64
|
||||
- lib_files="$lib_files `echo $root_dir/lib64/libnss_{dns,files}* $root_dir/lib64/libgcc_s.so*`"
|
||||
+ extra_lib_files="$extra_lib_files `echo $root_dir/lib64/libnss_{dns,files}* $root_dir/lib64/libgcc_s.so*`"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
||||
- for lib in $lib_files ; do
|
||||
- if [ -f $lib ] ; then
|
||||
- verbose -n "${lib##$root_dir/} "
|
||||
- cp -dp --parents $lib $tmp_mnt
|
||||
+ verbose -ne "Shared libs:\t"
|
||||
+
|
||||
+ # Now collect a list of libraries on which the binaries and extra libs depend on
|
||||
+ lib_files=$( shared_object_files ${bins[@]} $extra_lib_files )
|
||||
+ if [ $? -eq 0 ]
|
||||
+ then
|
||||
+ if [ -n "$lib_files" ]
|
||||
+ then
|
||||
+ # Finally copy dependencies and extra libs
|
||||
+ for lib in $lib_files $extra_lib_files
|
||||
+ do
|
||||
+ [ -L $root_dir/$lib ] || verbose -n "$lib "
|
||||
+ ( cd ${root_dir:-/} ; cp -dp --parents $lib $tmp_mnt )
|
||||
+ done
|
||||
+ verbose
|
||||
+ else
|
||||
+ verbose "none"
|
||||
fi
|
||||
- done
|
||||
- verbose
|
||||
-else
|
||||
- verbose "none"
|
||||
-fi
|
||||
+ else
|
||||
+ return 1
|
||||
+ fi
|
||||
+}
|
||||
|
||||
+# Copy all required shared libraries and the symlinks that refer to them.
|
||||
+copy_shared_libs "${initrd_bins[@]}"
|
@ -1,385 +0,0 @@
|
||||
---
|
||||
mkinitrd/scripts/setup-ibft.sh | 2
|
||||
mkinitrd/scripts/setup-network.sh | 11 +++-
|
||||
mkinitrd/scripts/setup-prepare.sh | 94 ++++++++++++++++++++++++++++-------
|
||||
mkinitrd/scripts/setup-progs.sh | 17 +-----
|
||||
mkinitrd/scripts/setup-sharedlibs.sh | 60 +++++++++++++---------
|
||||
5 files changed, 126 insertions(+), 58 deletions(-)
|
||||
|
||||
Index: 1210/mkinitrd/scripts/setup-ibft.sh
|
||||
===================================================================
|
||||
--- 1210.orig/mkinitrd/scripts/setup-ibft.sh
|
||||
+++ 1210/mkinitrd/scripts/setup-ibft.sh
|
||||
@@ -9,22 +9,22 @@ ibft_set_iface() {
|
||||
interface=$if
|
||||
drvlink=$(get_network_module $interface)
|
||||
if [ ! "$nettype" -a -e $ibft_nic/dhcp ]; then
|
||||
nettype=dhcp
|
||||
read ibft_dhcp < $ibft_nic/dhcp
|
||||
[ "$ibft_dhcp" = "0.0.0.0" ] && nettype=static
|
||||
else
|
||||
nettype=static
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
ibft_nic=/sys/firmware/ibft/ethernet0
|
||||
-ibft_hostname=$(hostname)
|
||||
+ibft_hostname=localhost
|
||||
|
||||
if [ "$root_iscsi" = 1 -a -d $ibft_nic ]; then
|
||||
ibft_available=1
|
||||
ibft_set_iface
|
||||
fi
|
||||
save_var ibft_available
|
||||
save_var ibft_hostname
|
||||
save_var ibft_nic
|
||||
Index: 1210/mkinitrd/scripts/setup-network.sh
|
||||
===================================================================
|
||||
--- 1210.orig/mkinitrd/scripts/setup-network.sh
|
||||
+++ 1210/mkinitrd/scripts/setup-network.sh
|
||||
@@ -277,27 +277,36 @@ if [ "$nettype" = "ifup" ] ; then
|
||||
verbose "[NETWORK]\tifup: $interface"
|
||||
fi
|
||||
done
|
||||
interface=
|
||||
fi
|
||||
|
||||
# Copy the /etc/resolv.conf when the IP is static
|
||||
if test -n "$static_interfaces"; then
|
||||
verbose "[NETWORK]\tUsing /etc/resolv.conf from the system in the initrd"
|
||||
cp /etc/resolv.conf $tmp_mnt/etc
|
||||
fi
|
||||
|
||||
# Copy netcfg files (bnc#468090, bnc#714945)
|
||||
-cp /etc/{hosts,protocols,services,netconfig} $tmp_mnt/etc
|
||||
+cp /etc/{protocols,services,netconfig} $tmp_mnt/etc
|
||||
+cat > $tmp_mnt/etc/hosts <<_EOH_
|
||||
+127.0.0.1 localhost
|
||||
+::1 localhost ipv6-localhost ipv6-loopback
|
||||
+fe00::0 ipv6-localnet
|
||||
+ff00::0 ipv6-mcastprefix
|
||||
+ff02::1 ipv6-allnodes
|
||||
+ff02::2 ipv6-allrouters
|
||||
+ff02::3 ipv6-allhosts
|
||||
+_EOH_
|
||||
|
||||
# Get static IP configuration if requested
|
||||
for iface in $static_interfaces; do
|
||||
static_ips="$static_ips $(get_ip_config $iface)"
|
||||
done
|
||||
|
||||
mkdir -p $tmp_mnt/var/lib/dhcpcd
|
||||
mkdir -p $tmp_mnt/var/run
|
||||
|
||||
cp_bin /lib/mkinitrd/bin/ipconfig.sh $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
|
||||
Index: 1210/mkinitrd/scripts/setup-prepare.sh
|
||||
===================================================================
|
||||
--- 1210.orig/mkinitrd/scripts/setup-prepare.sh
|
||||
+++ 1210/mkinitrd/scripts/setup-prepare.sh
|
||||
@@ -13,43 +13,103 @@
|
||||
#%param_R: "Print release (version)."
|
||||
#%param_L: "Disable logging."
|
||||
#%param_h: "This help screen."
|
||||
#
|
||||
###### Additional options
|
||||
##
|
||||
## Script inclusion may be overriden by
|
||||
## 1) creating a monster-initrd
|
||||
## 2) including the wanted module in the configuration option ADDITIONAL_FEATURES in /etc/sysconfig/initrd
|
||||
## 3) definition using the -f command line switch
|
||||
##
|
||||
|
||||
# Install a binary file
|
||||
+# 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() {
|
||||
- cp -a "$@" \
|
||||
- || exit_code=1
|
||||
-
|
||||
- # Remember the binaries installed. We need the list for checking
|
||||
- # for dynamic libraries.
|
||||
- while [ $# -gt 1 ]; do
|
||||
- initrd_bins[${#initrd_bins[@]}]=$1
|
||||
- shift
|
||||
- done
|
||||
- # file may print '^setuid ELF ...'
|
||||
- # suid mount will fail if mkinitrd was called as user
|
||||
- if [ -L "$1" ]; then
|
||||
- : do nothing with symlinks
|
||||
- elif [ -d "$1" -o -f "$1" ]; then
|
||||
- find "$1" -type f -print0 | xargs -0 chmod 0755
|
||||
- fi
|
||||
+ local -a files
|
||||
+ local target
|
||||
+ local target_dirname
|
||||
+ local file
|
||||
+
|
||||
+ # need at least two parameters, source and destination
|
||||
+ if test $# -lt 2
|
||||
+ then
|
||||
+ return 0
|
||||
+ fi
|
||||
+ # store source filenames
|
||||
+ until test $# -eq 1
|
||||
+ do
|
||||
+ files=( ${files[@]} $1 )
|
||||
+ shift
|
||||
+ done
|
||||
+ # store target, either file or directory
|
||||
+ target=$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
|
||||
+ target_dirname=${target}
|
||||
+ else
|
||||
+ # simplify symlink resolving for sinlge filename
|
||||
+ target_dirname=${target%/*}
|
||||
+ fi
|
||||
+
|
||||
+ for file in ${files[@]}
|
||||
+ do
|
||||
+ local src dst
|
||||
+ src=${file}
|
||||
+ dst=${target}
|
||||
+ # copy requested soure file as is to requested destination
|
||||
+ cp -a -v --remove-destination ${src} ${dst}
|
||||
+ # copy symlinks recursivly
|
||||
+ while [ 1 ]
|
||||
+ do
|
||||
+ local tmp_src
|
||||
+ if test -L ${src}
|
||||
+ then
|
||||
+ tmp_src=$(readlink ${src})
|
||||
+ if test "${tmp_src:0:1}" = "/"
|
||||
+ then
|
||||
+ src=${tmp_src}
|
||||
+ else
|
||||
+ # relative symlink
|
||||
+ src=${src%/*}/${tmp_src}
|
||||
+ fi
|
||||
+ cp -a -v --remove-destination --parents ${src} $tmp_mnt
|
||||
+ # if link target exists, proceed to next symlink target
|
||||
+ if test -e "${src}"
|
||||
+ then
|
||||
+ continue
|
||||
+ fi
|
||||
+ fi
|
||||
+ # exit loop in case of dead symlink or if target of symlink was reached
|
||||
+ break
|
||||
+ done
|
||||
+ # if source file exists, add it to list of binaries
|
||||
+ if test -e "${src}"
|
||||
+ then
|
||||
+ # file may print '^setuid ELF ...'
|
||||
+ # suid mount will fail if mkinitrd was called as user
|
||||
+ chmod -v 0755 $tmp_mnt/${src}
|
||||
+ initrd_bins[${#initrd_bins[@]}]=${src}
|
||||
+ fi
|
||||
+ done
|
||||
}
|
||||
|
||||
# check if we should use script or feature $1
|
||||
use_script() {
|
||||
local condition feature script file
|
||||
|
||||
# always use when creating monster initrd
|
||||
[ "$create_monster_initrd" ] && return 0
|
||||
|
||||
# Normalize to feature name
|
||||
feature="${1##*/}"
|
||||
feature="${feature#*-}"
|
||||
feature="${feature%.sh}"
|
||||
@@ -143,27 +203,27 @@ fi
|
||||
for feature in $ADDITIONAL_FEATURES ; do
|
||||
feature_exists "$feature" || echo "[WARNING] Feature \"$feature\" not found. A typo?"
|
||||
done
|
||||
|
||||
# create an empty initrd
|
||||
if ! mkdir $tmp_mnt ; then
|
||||
error 1 "could not create temporary directory"
|
||||
fi
|
||||
|
||||
# fill the initrd
|
||||
cp $INITRD_PATH/bin/linuxrc $linuxrc
|
||||
mkdir "$tmp_mnt/boot"
|
||||
|
||||
-mkdir -p $tmp_mnt/{sbin,bin,etc,dev,proc,sys,root,config}
|
||||
+mkdir -p $tmp_mnt/{sbin,bin,etc,dev,proc,sys,root,config,usr/bin,usr/sbin}
|
||||
|
||||
mkdir -p -m 4777 $tmp_mnt/tmp
|
||||
|
||||
# Create a dummy /etc/mtab for mount/umount
|
||||
echo -n > $tmp_mnt/etc/mtab
|
||||
|
||||
# Add modprobe, modprobe.conf*, and a version of /bin/true: modprobe.conf
|
||||
# might use it.
|
||||
for mod in $root_dir/etc/modprobe.conf $root_dir/etc/modprobe.conf.local \
|
||||
$root_dir/etc/modprobe.d ; do
|
||||
test -e $mod && cp -r $mod $tmp_mnt/etc
|
||||
done
|
||||
cat > $tmp_mnt/bin/true <<-EOF
|
||||
Index: 1210/mkinitrd/scripts/setup-progs.sh
|
||||
===================================================================
|
||||
--- 1210.orig/mkinitrd/scripts/setup-progs.sh
|
||||
+++ 1210/mkinitrd/scripts/setup-progs.sh
|
||||
@@ -24,48 +24,37 @@ for script in $INITRD_PATH/boot/*.sh; do
|
||||
condition="$(sed -rn 's/^#[[:blank:]]*%if:[[:blank:]]*(.*)$/if [ \1 ]; then/p' < "$script")"
|
||||
echo "$condition" >> run_all.sh
|
||||
# -- remember dependent modules
|
||||
sed -rn 's/^#[[:blank:]]*%modules:[[:blank:]]*(.*)$/modules="\1"/p' < $script >> run_all.sh
|
||||
echo "[ \"\$debug\" ] && echo running $file
|
||||
source boot/$file
|
||||
[ \"\$modules\" ] && load_modules" >> run_all.sh
|
||||
[ "$condition" ] && echo "fi" >> run_all.sh
|
||||
# and all programs it needs
|
||||
for files in $(sed -rn 's/^#[[:blank:]]*%programs:[[:blank:]]*(.*)$/\1/p' < "$script"); do
|
||||
for file in $(eval echo $files); do
|
||||
if [ "${file:0:17}" = "/lib/mkinitrd/bin" ]; then
|
||||
SOURCE=$file
|
||||
- DEST="./bin/"
|
||||
+ DEST="${tmp_mnt}/bin/"
|
||||
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="${tmp_mnt}$SOURCE"
|
||||
else
|
||||
case "$(type -t "$file")" in
|
||||
builtin) continue
|
||||
esac
|
||||
SOURCE=$(type -p "$file")
|
||||
- DEST="./bin/"
|
||||
+ DEST="${tmp_mnt}$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
|
||||
done
|
||||
|
||||
echo -ne "Features: "
|
||||
echo $features
|
||||
|
||||
[ -e "bin/sh" ] || ln -s /bin/bash bin/sh
|
||||
|
||||
Index: 1210/mkinitrd/scripts/setup-sharedlibs.sh
|
||||
===================================================================
|
||||
--- 1210.orig/mkinitrd/scripts/setup-sharedlibs.sh
|
||||
+++ 1210/mkinitrd/scripts/setup-sharedlibs.sh
|
||||
@@ -54,58 +54,68 @@ shared_object_files() {
|
||||
while [ -L "/$lib" ]; do
|
||||
echo $lib
|
||||
link="$(readlink "/$lib")"
|
||||
if [ x"${link:0:1}" == x"/" ]; then
|
||||
lib=${link#/}
|
||||
else
|
||||
lib="${lib%/*}/$link"
|
||||
fi
|
||||
done
|
||||
echo $lib
|
||||
done
|
||||
}
|
||||
|
||||
-verbose -ne "Shared libs:\t"
|
||||
-# Copy all required shared libraries and the symlinks that
|
||||
-# refer to them.
|
||||
-lib_files=$(shared_object_files "${initrd_bins[@]}")
|
||||
-[ $? -eq 0 ] || return 1
|
||||
-if [ -n "$lib_files" ]; then
|
||||
- for lib in $lib_files; do
|
||||
- [ -L $root_dir/$lib ] || verbose -n "$lib "
|
||||
- ( cd ${root_dir:-/} ; cp -dp --parents $lib $tmp_mnt )
|
||||
- done
|
||||
- lib_files=
|
||||
+copy_shared_libs() {
|
||||
+ local bins=( "$@" )
|
||||
+ local extra_lib_files lib_files lib i
|
||||
+
|
||||
+ # First see what nss and other libs are required. This can be 64bit or 32bit,
|
||||
+ # depending on the host and the already copied binaries.
|
||||
case "$(uname -m)" in
|
||||
ia64)
|
||||
+ # this is a known location
|
||||
mkdir -p $tmp_mnt/lib
|
||||
- lib_files="$lib_files `echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/lib{gcc_s,unwind}.so*`"
|
||||
+ extra_lib_files="`echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/lib{gcc_s,unwind}.so*`"
|
||||
;;
|
||||
*)
|
||||
- # no symlinks, most point into the running system
|
||||
- for i in `LANG=C LC_ALL=C file -b $tmp_mnt/{,usr/}{lib*/udev/,{,s}bin}/* | sed -n 's/^ELF \([0-9][0-9]-bit\) .*/\1/p' | sort -u`
|
||||
+ # Skip symlinks, they may point into the running system instead of $tmp_mnt
|
||||
+ for i in `LANG=C LC_ALL=C file -b $tmp_mnt/{,usr/}{lib*/udev,{,s}bin}/* | sed -n 's/^ELF \([0-9][0-9]-bit\) .*/\1/p' | sort -u`
|
||||
do
|
||||
case "$i" in
|
||||
32-bit)
|
||||
mkdir -p $tmp_mnt/lib
|
||||
- lib_files="$lib_files `echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/libgcc_s.so*`"
|
||||
+ extra_lib_files="$extra_lib_files `echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/libgcc_s.so*`"
|
||||
;;
|
||||
64-bit)
|
||||
mkdir -p $tmp_mnt/lib64
|
||||
- lib_files="$lib_files `echo $root_dir/lib64/libnss_{dns,files}* $root_dir/lib64/libgcc_s.so*`"
|
||||
+ extra_lib_files="$extra_lib_files `echo $root_dir/lib64/libnss_{dns,files}* $root_dir/lib64/libgcc_s.so*`"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
||||
- for lib in $lib_files ; do
|
||||
- if [ -f $lib ] ; then
|
||||
- verbose -n "${lib##$root_dir/} "
|
||||
- cp -dp --parents $lib $tmp_mnt
|
||||
+ verbose -ne "Shared libs:\t"
|
||||
+
|
||||
+ # Now collect a list of libraries on which the binaries and extra libs depend on
|
||||
+ lib_files=$( shared_object_files ${bins[@]} $extra_lib_files )
|
||||
+ if [ $? -eq 0 ]
|
||||
+ then
|
||||
+ if [ -n "$lib_files" ]
|
||||
+ then
|
||||
+ # Finally copy dependencies and extra libs
|
||||
+ for lib in $lib_files $extra_lib_files
|
||||
+ do
|
||||
+ [ -L $root_dir/$lib ] || verbose -n "$lib "
|
||||
+ ( cd ${root_dir:-/} ; cp -dp --parents $lib $tmp_mnt )
|
||||
+ done
|
||||
+ verbose
|
||||
+ else
|
||||
+ verbose "none"
|
||||
fi
|
||||
- done
|
||||
- verbose
|
||||
-else
|
||||
- verbose "none"
|
||||
-fi
|
||||
+ else
|
||||
+ return 1
|
||||
+ fi
|
||||
+}
|
||||
|
||||
+# Copy all required shared libraries and the symlinks that refer to them.
|
||||
+copy_shared_libs "${initrd_bins[@]}"
|
@ -1,410 +0,0 @@
|
||||
---
|
||||
mkinitrd/scripts/setup-ibft.sh | 2
|
||||
mkinitrd/scripts/setup-network.sh | 11 ++-
|
||||
mkinitrd/scripts/setup-prepare.sh | 126 +++++++++++++++++++++--------------
|
||||
mkinitrd/scripts/setup-progs.sh | 17 ----
|
||||
mkinitrd/scripts/setup-scsi_dh.sh | 2
|
||||
mkinitrd/scripts/setup-sharedlibs.sh | 60 +++++++++-------
|
||||
6 files changed, 126 insertions(+), 92 deletions(-)
|
||||
|
||||
Index: 1220/mkinitrd/scripts/setup-ibft.sh
|
||||
===================================================================
|
||||
--- 1220.orig/mkinitrd/scripts/setup-ibft.sh
|
||||
+++ 1220/mkinitrd/scripts/setup-ibft.sh
|
||||
@@ -21,22 +21,22 @@ ibft_set_iface() {
|
||||
interface=$iface
|
||||
drvlink=$(get_network_module $interface)
|
||||
if [ ! "$nettype" -a -e $ibft_nic/dhcp ]; then
|
||||
nettype=dhcp
|
||||
read ibft_dhcp < $ibft_nic/dhcp
|
||||
[ "$ibft_dhcp" = "0.0.0.0" ] && nettype=static
|
||||
else
|
||||
nettype=static
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
ibft_nic=/sys/firmware/ibft/ethernet0
|
||||
-ibft_hostname=$(hostname)
|
||||
+ibft_hostname=localhost
|
||||
|
||||
if [ "$root_iscsi" = 1 -a -d $ibft_nic ]; then
|
||||
ibft_available=1
|
||||
ibft_set_iface
|
||||
fi
|
||||
save_var ibft_available
|
||||
save_var ibft_hostname
|
||||
save_var ibft_nic
|
||||
Index: 1220/mkinitrd/scripts/setup-network.sh
|
||||
===================================================================
|
||||
--- 1220.orig/mkinitrd/scripts/setup-network.sh
|
||||
+++ 1220/mkinitrd/scripts/setup-network.sh
|
||||
@@ -278,27 +278,36 @@ if [ "$nettype" = "ifup" ] ; then
|
||||
verbose "[NETWORK]\tifup: $interface"
|
||||
fi
|
||||
done
|
||||
interface=
|
||||
fi
|
||||
|
||||
# Copy the /etc/resolv.conf when the IP is static
|
||||
if test -n "$static_interfaces"; then
|
||||
verbose "[NETWORK]\tUsing /etc/resolv.conf from the system in the initrd"
|
||||
cp /etc/resolv.conf $tmp_mnt/etc
|
||||
fi
|
||||
|
||||
# Copy netcfg files (bnc#468090, bnc#714945)
|
||||
-cp /etc/{hosts,protocols,services,netconfig} $tmp_mnt/etc
|
||||
+cp /etc/{protocols,services,netconfig} $tmp_mnt/etc
|
||||
+cat > $tmp_mnt/etc/hosts <<_EOH_
|
||||
+127.0.0.1 localhost
|
||||
+::1 localhost ipv6-localhost ipv6-loopback
|
||||
+fe00::0 ipv6-localnet
|
||||
+ff00::0 ipv6-mcastprefix
|
||||
+ff02::1 ipv6-allnodes
|
||||
+ff02::2 ipv6-allrouters
|
||||
+ff02::3 ipv6-allhosts
|
||||
+_EOH_
|
||||
|
||||
# Get static IP configuration if requested
|
||||
for iface in $static_interfaces; do
|
||||
static_ips="$static_ips $(get_ip_config $iface)"
|
||||
done
|
||||
|
||||
mkdir -p $tmp_mnt/var/lib/dhcpcd
|
||||
mkdir -p $tmp_mnt/var/run
|
||||
|
||||
cp_bin /lib/mkinitrd/bin/ipconfig.sh $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
|
||||
Index: 1220/mkinitrd/scripts/setup-prepare.sh
|
||||
===================================================================
|
||||
--- 1220.orig/mkinitrd/scripts/setup-prepare.sh
|
||||
+++ 1220/mkinitrd/scripts/setup-prepare.sh
|
||||
@@ -13,77 +13,103 @@
|
||||
#%param_R: "Print release (version)."
|
||||
#%param_L: "Disable logging."
|
||||
#%param_h: "This help screen."
|
||||
#
|
||||
###### Additional options
|
||||
##
|
||||
## Script inclusion may be overriden by
|
||||
## 1) creating a monster-initrd
|
||||
## 2) including the wanted module in the configuration option ADDITIONAL_FEATURES in /etc/sysconfig/initrd
|
||||
## 3) definition using the -f command line switch
|
||||
##
|
||||
|
||||
# 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
|
||||
- fi
|
||||
- return 0
|
||||
-}
|
||||
-
|
||||
+# 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() {
|
||||
- cp -a "$@" \
|
||||
- || exit_code=1
|
||||
-
|
||||
- if [ -h "$1" ]; then
|
||||
- lnkTarget=$1
|
||||
- # Determine the base bath of the target
|
||||
- targetPath="$2"
|
||||
- targetBase=${targetPath%$1*}
|
||||
- while [ 1 ]; do
|
||||
- cp_link $lnkTarget $targetBase
|
||||
- lnkCopied=$?
|
||||
- if [ $lnkCopied = 0 ]; then
|
||||
- if [ -e $lnkTarget ]; then
|
||||
- initrd_bins[${#initrd_bins[@]}]=$lnkTarget
|
||||
- fi
|
||||
- break
|
||||
- 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
|
||||
- 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
|
||||
- fi
|
||||
- fi
|
||||
+ local -a files
|
||||
+ local target
|
||||
+ local target_dirname
|
||||
+ local file
|
||||
+
|
||||
+ # need at least two parameters, source and destination
|
||||
+ if test $# -lt 2
|
||||
+ then
|
||||
+ return 0
|
||||
+ fi
|
||||
+ # store source filenames
|
||||
+ until test $# -eq 1
|
||||
+ do
|
||||
+ files=( ${files[@]} $1 )
|
||||
+ shift
|
||||
+ done
|
||||
+ # store target, either file or directory
|
||||
+ target=$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
|
||||
+ target_dirname=${target}
|
||||
+ else
|
||||
+ # simplify symlink resolving for sinlge filename
|
||||
+ target_dirname=${target%/*}
|
||||
+ fi
|
||||
+
|
||||
+ for file in ${files[@]}
|
||||
+ do
|
||||
+ local src dst
|
||||
+ src=${file}
|
||||
+ dst=${target}
|
||||
+ # copy requested soure file as is to requested destination
|
||||
+ cp -a -v --remove-destination ${src} ${dst}
|
||||
+ # copy symlinks recursivly
|
||||
+ while [ 1 ]
|
||||
+ do
|
||||
+ local tmp_src
|
||||
+ if test -L ${src}
|
||||
+ then
|
||||
+ tmp_src=$(readlink ${src})
|
||||
+ if test "${tmp_src:0:1}" = "/"
|
||||
+ then
|
||||
+ src=${tmp_src}
|
||||
+ else
|
||||
+ # relative symlink
|
||||
+ src=${src%/*}/${tmp_src}
|
||||
+ fi
|
||||
+ cp -a -v --remove-destination --parents ${src} $tmp_mnt
|
||||
+ # if link target exists, proceed to next symlink target
|
||||
+ if test -e "${src}"
|
||||
+ then
|
||||
+ continue
|
||||
+ fi
|
||||
+ fi
|
||||
+ # exit loop in case of dead symlink or if target of symlink was reached
|
||||
+ break
|
||||
+ done
|
||||
+ # if source file exists, add it to list of binaries
|
||||
+ if test -e "${src}"
|
||||
+ then
|
||||
+ # file may print '^setuid ELF ...'
|
||||
+ # suid mount will fail if mkinitrd was called as user
|
||||
+ chmod -v 0755 $tmp_mnt/${src}
|
||||
+ initrd_bins[${#initrd_bins[@]}]=${src}
|
||||
+ fi
|
||||
+ done
|
||||
}
|
||||
|
||||
# check if we should use script or feature $1
|
||||
use_script() {
|
||||
local condition feature script file
|
||||
|
||||
# always use when creating monster initrd
|
||||
[ "$create_monster_initrd" ] && return 0
|
||||
|
||||
# Normalize to feature name
|
||||
feature="${1##*/}"
|
||||
feature="${feature#*-}"
|
||||
feature="${feature%.sh}"
|
||||
Index: 1220/mkinitrd/scripts/setup-progs.sh
|
||||
===================================================================
|
||||
--- 1220.orig/mkinitrd/scripts/setup-progs.sh
|
||||
+++ 1220/mkinitrd/scripts/setup-progs.sh
|
||||
@@ -24,48 +24,37 @@ for script in $INITRD_PATH/boot/*.sh; do
|
||||
condition="$(sed -rn 's/^#[[:blank:]]*%if:[[:blank:]]*(.*)$/if [ \1 ]; then/p' < "$script")"
|
||||
echo "$condition" >> run_all.sh
|
||||
# -- remember dependent modules
|
||||
sed -rn 's/^#[[:blank:]]*%modules:[[:blank:]]*(.*)$/modules="\1"/p' < $script >> run_all.sh
|
||||
echo "[ \"\$debug\" ] && echo running $file
|
||||
source boot/$file
|
||||
[ \"\$modules\" ] && load_modules" >> run_all.sh
|
||||
[ "$condition" ] && echo "fi" >> run_all.sh
|
||||
# and all programs it needs
|
||||
for files in $(sed -rn 's/^#[[:blank:]]*%programs:[[:blank:]]*(.*)$/\1/p' < "$script"); do
|
||||
for file in $(eval echo $files); do
|
||||
if [ "${file:0:17}" = "/lib/mkinitrd/bin" ]; then
|
||||
SOURCE=$file
|
||||
- DEST="./bin/"
|
||||
+ DEST="${tmp_mnt}/bin/"
|
||||
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="${tmp_mnt}$SOURCE"
|
||||
else
|
||||
case "$(type -t "$file")" in
|
||||
builtin) continue
|
||||
esac
|
||||
SOURCE=$(type -p "$file")
|
||||
- DEST="./bin/"
|
||||
+ DEST="${tmp_mnt}$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
|
||||
done
|
||||
|
||||
echo -ne "Features: "
|
||||
echo $features
|
||||
|
||||
[ -e "bin/sh" ] || ln -s /bin/bash bin/sh
|
||||
|
||||
Index: 1220/mkinitrd/scripts/setup-scsi_dh.sh
|
||||
===================================================================
|
||||
--- 1220.orig/mkinitrd/scripts/setup-scsi_dh.sh
|
||||
+++ 1220/mkinitrd/scripts/setup-scsi_dh.sh
|
||||
@@ -1,13 +1,13 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
#%stage: device
|
||||
#
|
||||
# Include all scsi_dh_* modules and load them on boot (bnc#727428 et al)
|
||||
|
||||
scsi_dh_modules=
|
||||
-for i in $(find $root_dir/lib/modules/$kernel_version/kernel/drivers/scsi/device_handler -name "scsi[-_]dh[_-]*.ko"); do
|
||||
+for i in $(find $root_dir/lib/modules/$kernel_version/kernel/drivers/scsi/device_handler -name "scsi[-_]dh[_-]*.ko"| sort); do
|
||||
i=${i%.ko}
|
||||
scsi_dh_modules="$scsi_dh_modules ${i##*/}"
|
||||
done
|
||||
|
||||
save_var scsi_dh_modules
|
||||
Index: 1220/mkinitrd/scripts/setup-sharedlibs.sh
|
||||
===================================================================
|
||||
--- 1220.orig/mkinitrd/scripts/setup-sharedlibs.sh
|
||||
+++ 1220/mkinitrd/scripts/setup-sharedlibs.sh
|
||||
@@ -54,58 +54,68 @@ shared_object_files() {
|
||||
while [ -L "/$lib" ]; do
|
||||
echo $lib
|
||||
link="$(readlink "/$lib")"
|
||||
if [ x"${link:0:1}" == x"/" ]; then
|
||||
lib=${link#/}
|
||||
else
|
||||
lib="${lib%/*}/$link"
|
||||
fi
|
||||
done
|
||||
echo $lib
|
||||
done
|
||||
}
|
||||
|
||||
-verbose -ne "Shared libs:\t"
|
||||
-# Copy all required shared libraries and the symlinks that
|
||||
-# refer to them.
|
||||
-lib_files=$(shared_object_files "${initrd_bins[@]}")
|
||||
-[ $? -eq 0 ] || return 1
|
||||
-if [ -n "$lib_files" ]; then
|
||||
- for lib in $lib_files; do
|
||||
- [ -L $root_dir/$lib ] || verbose -n "$lib "
|
||||
- ( cd ${root_dir:-/} ; cp -dp --parents $lib $tmp_mnt )
|
||||
- done
|
||||
- lib_files=
|
||||
+copy_shared_libs() {
|
||||
+ local bins=( "$@" )
|
||||
+ local extra_lib_files lib_files lib i
|
||||
+
|
||||
+ # First see what nss and other libs are required. This can be 64bit or 32bit,
|
||||
+ # depending on the host and the already copied binaries.
|
||||
case "$(uname -m)" in
|
||||
ia64)
|
||||
+ # this is a known location
|
||||
mkdir -p $tmp_mnt/lib
|
||||
- lib_files="$lib_files `echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/lib{gcc_s,unwind}.so*`"
|
||||
+ extra_lib_files="`echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/lib{gcc_s,unwind}.so*`"
|
||||
;;
|
||||
*)
|
||||
- # no symlinks, most point into the running system
|
||||
- for i in `LANG=C LC_ALL=C file -b $tmp_mnt/{,usr/}{lib*/udev/,{,s}bin}/* | sed -n 's/^ELF \([0-9][0-9]-bit\) .*/\1/p' | sort -u`
|
||||
+ # Skip symlinks, they may point into the running system instead of $tmp_mnt
|
||||
+ for i in `LANG=C LC_ALL=C file -b $tmp_mnt/{,usr/}{lib*/udev,{,s}bin}/* | sed -n 's/^ELF \([0-9][0-9]-bit\) .*/\1/p' | sort -u`
|
||||
do
|
||||
case "$i" in
|
||||
32-bit)
|
||||
mkdir -p $tmp_mnt/lib
|
||||
- lib_files="$lib_files `echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/libgcc_s.so*`"
|
||||
+ extra_lib_files="$extra_lib_files `echo $root_dir/lib/libnss_{dns,files}* $root_dir/lib/libgcc_s.so*`"
|
||||
;;
|
||||
64-bit)
|
||||
mkdir -p $tmp_mnt/lib64
|
||||
- lib_files="$lib_files `echo $root_dir/lib64/libnss_{dns,files}* $root_dir/lib64/libgcc_s.so*`"
|
||||
+ extra_lib_files="$extra_lib_files `echo $root_dir/lib64/libnss_{dns,files}* $root_dir/lib64/libgcc_s.so*`"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
||||
- for lib in $lib_files ; do
|
||||
- if [ -f $lib ] ; then
|
||||
- verbose -n "${lib##$root_dir/} "
|
||||
- cp -dp --parents $lib $tmp_mnt
|
||||
+ verbose -ne "Shared libs:\t"
|
||||
+
|
||||
+ # Now collect a list of libraries on which the binaries and extra libs depend on
|
||||
+ lib_files=$( shared_object_files ${bins[@]} $extra_lib_files )
|
||||
+ if [ $? -eq 0 ]
|
||||
+ then
|
||||
+ if [ -n "$lib_files" ]
|
||||
+ then
|
||||
+ # Finally copy dependencies and extra libs
|
||||
+ for lib in $lib_files $extra_lib_files
|
||||
+ do
|
||||
+ [ -L $root_dir/$lib ] || verbose -n "$lib "
|
||||
+ ( cd ${root_dir:-/} ; cp -dp --parents $lib $tmp_mnt )
|
||||
+ done
|
||||
+ verbose
|
||||
+ else
|
||||
+ verbose "none"
|
||||
fi
|
||||
- done
|
||||
- verbose
|
||||
-else
|
||||
- verbose "none"
|
||||
-fi
|
||||
+ else
|
||||
+ return 1
|
||||
+ fi
|
||||
+}
|
||||
|
||||
+# Copy all required shared libraries and the symlinks that refer to them.
|
||||
+copy_shared_libs "${initrd_bins[@]}"
|
@ -1,95 +0,0 @@
|
||||
---
|
||||
mkinitrd/scripts/setup-ibft.sh | 2 +-
|
||||
mkinitrd/scripts/setup-network.sh | 11 ++++++++++-
|
||||
mkinitrd/scripts/setup-scsi_dh.sh | 2 +-
|
||||
3 files changed, 12 insertions(+), 3 deletions(-)
|
||||
|
||||
Index: 1230/mkinitrd/scripts/setup-ibft.sh
|
||||
===================================================================
|
||||
--- 1230.orig/mkinitrd/scripts/setup-ibft.sh
|
||||
+++ 1230/mkinitrd/scripts/setup-ibft.sh
|
||||
@@ -21,22 +21,22 @@ ibft_set_iface() {
|
||||
interface=$iface
|
||||
drvlink=$(get_network_module $interface)
|
||||
if [ ! "$nettype" -a -e $ibft_nic/dhcp ]; then
|
||||
nettype=dhcp
|
||||
read ibft_dhcp < $ibft_nic/dhcp
|
||||
[ "$ibft_dhcp" = "0.0.0.0" ] && nettype=static
|
||||
else
|
||||
nettype=static
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
ibft_nic=/sys/firmware/ibft/ethernet0
|
||||
-ibft_hostname=$(hostname)
|
||||
+ibft_hostname=localhost
|
||||
|
||||
if [ "$root_iscsi" = 1 -a -d $ibft_nic ]; then
|
||||
ibft_available=1
|
||||
ibft_set_iface
|
||||
fi
|
||||
save_var ibft_available
|
||||
save_var ibft_hostname
|
||||
save_var ibft_nic
|
||||
Index: 1230/mkinitrd/scripts/setup-network.sh
|
||||
===================================================================
|
||||
--- 1230.orig/mkinitrd/scripts/setup-network.sh
|
||||
+++ 1230/mkinitrd/scripts/setup-network.sh
|
||||
@@ -278,27 +278,36 @@ if [ "$nettype" = "ifup" ] ; then
|
||||
verbose "[NETWORK]\tifup: $interface"
|
||||
fi
|
||||
done
|
||||
interface=
|
||||
fi
|
||||
|
||||
# Copy the /etc/resolv.conf when the IP is static
|
||||
if test -n "$static_interfaces"; then
|
||||
verbose "[NETWORK]\tUsing /etc/resolv.conf from the system in the initrd"
|
||||
cp /etc/resolv.conf $tmp_mnt/etc
|
||||
fi
|
||||
|
||||
# Copy netcfg files (bnc#468090, bnc#714945)
|
||||
-cp /etc/{hosts,protocols,services,netconfig} $tmp_mnt/etc
|
||||
+cp /etc/{protocols,services,netconfig} $tmp_mnt/etc
|
||||
+cat > $tmp_mnt/etc/hosts <<_EOH_
|
||||
+127.0.0.1 localhost
|
||||
+::1 localhost ipv6-localhost ipv6-loopback
|
||||
+fe00::0 ipv6-localnet
|
||||
+ff00::0 ipv6-mcastprefix
|
||||
+ff02::1 ipv6-allnodes
|
||||
+ff02::2 ipv6-allrouters
|
||||
+ff02::3 ipv6-allhosts
|
||||
+_EOH_
|
||||
|
||||
# Get static IP configuration if requested
|
||||
for iface in $static_interfaces; do
|
||||
static_ips="$static_ips $(get_ip_config $iface)"
|
||||
done
|
||||
|
||||
mkdir -p $tmp_mnt/var/lib/dhcpcd
|
||||
mkdir -p $tmp_mnt/var/run
|
||||
|
||||
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
|
||||
Index: 1230/mkinitrd/scripts/setup-scsi_dh.sh
|
||||
===================================================================
|
||||
--- 1230.orig/mkinitrd/scripts/setup-scsi_dh.sh
|
||||
+++ 1230/mkinitrd/scripts/setup-scsi_dh.sh
|
||||
@@ -1,13 +1,13 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
#%stage: device
|
||||
#
|
||||
# Include all scsi_dh_* modules and load them on boot (bnc#727428 et al)
|
||||
|
||||
scsi_dh_modules=
|
||||
-for i in $(find $root_dir/lib/modules/$kernel_version/kernel/drivers/scsi/device_handler -name "scsi[-_]dh[_-]*.ko"); do
|
||||
+for i in $(find $root_dir/lib/modules/$kernel_version/kernel/drivers/scsi/device_handler -name "scsi[-_]dh[_-]*.ko"| sort); do
|
||||
i=${i%.ko}
|
||||
scsi_dh_modules="$scsi_dh_modules ${i##*/}"
|
||||
done
|
||||
|
||||
save_var scsi_dh_modules
|
@ -1,99 +0,0 @@
|
||||
---
|
||||
mkinitrd/scripts/setup-ibft.sh | 2 +-
|
||||
mkinitrd/scripts/setup-network.sh | 11 ++++++++++-
|
||||
mkinitrd/scripts/setup-scsi_dh.sh | 2 +-
|
||||
3 files changed, 12 insertions(+), 3 deletions(-)
|
||||
|
||||
Index: 1310/mkinitrd/scripts/setup-ibft.sh
|
||||
===================================================================
|
||||
--- 1310.orig/mkinitrd/scripts/setup-ibft.sh
|
||||
+++ 1310/mkinitrd/scripts/setup-ibft.sh
|
||||
@@ -22,22 +22,22 @@ ibft_set_iface() {
|
||||
drvlink="$drvlink $(get_network_module $interface)"
|
||||
if [ ! "$nettype" -a -e $ibft_nic/dhcp ]; then
|
||||
nettype=dhcp
|
||||
read ibft_dhcp < $ibft_nic/dhcp
|
||||
[ "$ibft_dhcp" = "0.0.0.0" ] && nettype=static
|
||||
else
|
||||
nettype=static
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
ibft_nic=/sys/firmware/ibft/ethernet0
|
||||
ibft_nic2=/sys/firmware/ibft/ethernet1
|
||||
-ibft_hostname=$(hostname)
|
||||
+ibft_hostname=localhost
|
||||
|
||||
if [ "$root_iscsi" = 1 -a -d $ibft_nic ]; then
|
||||
ibft_available=1
|
||||
ibft_set_iface
|
||||
fi
|
||||
save_var ibft_available
|
||||
save_var ibft_hostname
|
||||
save_var ibft_nic
|
||||
Index: 1310/mkinitrd/scripts/setup-network.sh
|
||||
===================================================================
|
||||
--- 1310.orig/mkinitrd/scripts/setup-network.sh
|
||||
+++ 1310/mkinitrd/scripts/setup-network.sh
|
||||
@@ -278,27 +278,36 @@ if [ "$nettype" = "ifup" ] ; then
|
||||
verbose "[NETWORK]\tifup: $interface"
|
||||
fi
|
||||
done
|
||||
interface=
|
||||
fi
|
||||
|
||||
# Copy the /etc/resolv.conf when the IP is static
|
||||
if test -n "$static_interfaces"; then
|
||||
verbose "[NETWORK]\tUsing /etc/resolv.conf from the system in the initrd"
|
||||
cp /etc/resolv.conf $tmp_mnt/etc
|
||||
fi
|
||||
|
||||
# Copy netcfg files (bnc#468090, bnc#714945)
|
||||
-cp /etc/{hosts,protocols,services,netconfig} $tmp_mnt/etc
|
||||
+cp /etc/{protocols,services,netconfig} $tmp_mnt/etc
|
||||
+cat > $tmp_mnt/etc/hosts <<_EOH_
|
||||
+127.0.0.1 localhost
|
||||
+::1 localhost ipv6-localhost ipv6-loopback
|
||||
+fe00::0 ipv6-localnet
|
||||
+ff00::0 ipv6-mcastprefix
|
||||
+ff02::1 ipv6-allnodes
|
||||
+ff02::2 ipv6-allrouters
|
||||
+ff02::3 ipv6-allhosts
|
||||
+_EOH_
|
||||
|
||||
# Get static IP configuration if requested
|
||||
for iface in $static_interfaces; do
|
||||
static_ips="$static_ips $(get_ip_config $iface)"
|
||||
done
|
||||
|
||||
mkdir -p $tmp_mnt/var/lib/dhcpcd
|
||||
mkdir -p $tmp_mnt/var/run
|
||||
|
||||
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
|
||||
Index: 1310/mkinitrd/scripts/setup-scsi_dh.sh
|
||||
===================================================================
|
||||
--- 1310.orig/mkinitrd/scripts/setup-scsi_dh.sh
|
||||
+++ 1310/mkinitrd/scripts/setup-scsi_dh.sh
|
||||
@@ -1,17 +1,17 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
#%stage: device
|
||||
#
|
||||
# Include all scsi_dh_* modules and load them on boot (bnc#727428 et al)
|
||||
|
||||
scsi_dh_modules=
|
||||
if test -d $root_dir/lib/modules/$kernel_version/kernel/drivers/scsi/device_handler
|
||||
then
|
||||
- for i in $(find $root_dir/lib/modules/$kernel_version/kernel/drivers/scsi/device_handler -name "scsi[-_]dh[_-]*.ko")
|
||||
+ for i in $(find $root_dir/lib/modules/$kernel_version/kernel/drivers/scsi/device_handler -name "scsi[-_]dh[_-]*.ko" | sort)
|
||||
do
|
||||
i=${i%.ko}
|
||||
scsi_dh_modules="$scsi_dh_modules ${i##*/}"
|
||||
done
|
||||
fi
|
||||
|
||||
save_var scsi_dh_modules
|
@ -1,22 +0,0 @@
|
||||
#!/bin/bash -e
|
||||
#%stage: filesystem
|
||||
#%depends: dm dmraid lvm2 udev md luks
|
||||
#%programs: btrfs
|
||||
#%programs: btrfs-convert
|
||||
#%programs: btrfs-debug-tree
|
||||
#%programs: btrfs-dump-super
|
||||
#%programs: btrfs-find-root
|
||||
#%programs: btrfs-image
|
||||
#%programs: btrfs-select-super
|
||||
#%programs: btrfs-zero-log
|
||||
#%programs: btrfsck
|
||||
#%programs: btrfstune
|
||||
# for fsck(8): listed twice so that a copy really ends up in /sbin
|
||||
#%programs: /sbin/fsck.btrfs
|
||||
#%programs: fsck.btrfs
|
||||
#%programs: mkfs.btrfs
|
||||
#%modules: btrfs
|
||||
|
||||
modprobe btrfs
|
||||
|
||||
btrfs dev scan >& /dev/null
|
@ -1,25 +0,0 @@
|
||||
#!/bin/bash
|
||||
#%stage: boot
|
||||
#%depends: start
|
||||
#%modules: $dm_modules dm-mod dm-snapshot
|
||||
#%programs: /sbin/dmsetup /sbin/blockdev
|
||||
# dm-crypt dm-zero dm-mirror
|
||||
#%if: -n "$root_dm"
|
||||
#
|
||||
##### Device Mapper
|
||||
##
|
||||
## If the root device uses device mapper, this initializes and waits for the control file
|
||||
##
|
||||
## Command line parameters
|
||||
## -----------------------
|
||||
##
|
||||
## root_dm=1 use device mapper
|
||||
##
|
||||
|
||||
load_modules
|
||||
|
||||
# because we run before udev we need to create the device node manually
|
||||
mkdir -p /dev/mapper
|
||||
if [ ! -c /dev/mapper/control ] ; then
|
||||
mknod /dev/mapper/control c 10 63
|
||||
fi
|
@ -1,79 +0,0 @@
|
||||
#!/bin/bash
|
||||
#%stage: volumemanager
|
||||
#%depends: evms
|
||||
#%programs: vgscan vgchange lvm
|
||||
#%programs: sed
|
||||
#%modules: linear
|
||||
#%if: -n "$root_lvm2"
|
||||
#
|
||||
##### LVM (Logical Volume Management)
|
||||
##
|
||||
## This activates and waits for an LVM.
|
||||
##
|
||||
## Command line parameters
|
||||
## -----------------------
|
||||
##
|
||||
## root_lvm2=1 use LVM
|
||||
## root=/dev/mapper/... use this device as Volume Group
|
||||
## vg_roots use this group as Volume Group
|
||||
##
|
||||
|
||||
lvm2_get_vg() {
|
||||
local param=$1
|
||||
local vg_root vg_name
|
||||
local sysdev
|
||||
|
||||
case $param in
|
||||
/dev/disk/by-*/*)
|
||||
vg_root=
|
||||
;;
|
||||
/dev/mapper/*)
|
||||
vg_name=${o##root=/dev/mapper/}
|
||||
vg_root=${vg_name%%-*}
|
||||
;;
|
||||
/dev/*)
|
||||
set -- $(IFS=/ ; echo $param)
|
||||
if [ "$#" = "3" ] ; then
|
||||
# Check sysfs. If there are subdirectories
|
||||
# matching this name it's a block device
|
||||
for d in /sys/block/$2\!* ; do
|
||||
if [ -d $d ] ; then
|
||||
sysdev=$d
|
||||
fi
|
||||
done
|
||||
# Not found in sysfs, looks like a VG then
|
||||
if [ -z "$sysdev" ] ; then
|
||||
vg_root=$2
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
echo $vg_root
|
||||
}
|
||||
|
||||
# load the necessary module before we initialize the raid system
|
||||
load_modules
|
||||
|
||||
if [ -n "$root_lvm2" ] ; then
|
||||
o=$(get_param root)
|
||||
# Fallback if 'root=' is not specified
|
||||
[ -z "$o" ] && o=$rootdev
|
||||
vg_root=$(lvm2_get_vg $o)
|
||||
if [ "$vg_root" ] ; then
|
||||
# We are waiting for a device-mapper device
|
||||
root_major=$(sed -n 's/\(.*\) device-mapper/\1/p' /proc/devices)
|
||||
fi
|
||||
o=$(get_param resume)
|
||||
vg_resume=$(lvm2_get_vg $o)
|
||||
if [ "$vg_resume" ] ; then
|
||||
resume_major=$(sed -n 's/\(.*\) device-mapper/\1/p' /proc/devices)
|
||||
fi
|
||||
fi
|
||||
|
||||
# initialize remebered and parameterized devices
|
||||
for vgr in $vg_root $vg_resume $vg_roots; do
|
||||
vgchange -a y $vgr
|
||||
done
|
||||
|
||||
unset lvm2_get_vg
|
@ -1,32 +0,0 @@
|
||||
#!/bin/bash
|
||||
#%stage: boot
|
||||
#%depends: start
|
||||
#%programs: /sbin/mdadm /sbin/mdmon
|
||||
#%modules: raid0 raid1 raid10 raid456
|
||||
#%if: -n "$need_mdadm"
|
||||
#
|
||||
##### MD (Software-)Raid
|
||||
##
|
||||
## This only sets the 'start_ro' module parameter to ensure
|
||||
## arrays don't start resync until after the first write.
|
||||
## All array assembly is performed by udev -> "mdadm -I"
|
||||
##
|
||||
## Command line parameters
|
||||
## -----------------------
|
||||
##
|
||||
## need_mdadm=1 use MD raid
|
||||
##
|
||||
|
||||
# load the necessary module before we initialize the raid system
|
||||
load_modules
|
||||
|
||||
#check_for_device uses $md_major
|
||||
#we depend on 'start' to ensure /proc/devices exists
|
||||
md_major=$(sed -ne 's/\s*\([0-9]\+\)\s*md$/\1/p' /proc/devices)
|
||||
|
||||
# Always start md devices read/only. They will get set to rw as soon
|
||||
# as the first write occurs. This way we can guarantee that no
|
||||
# restore occurs before resume.
|
||||
if [ -f /sys/module/md_mod/parameters/start_ro ]; then
|
||||
echo 1 > /sys/module/md_mod/parameters/start_ro
|
||||
fi
|
@ -1,70 +0,0 @@
|
||||
#!/bin/bash
|
||||
#%stage: block
|
||||
#%modules: nfs nfsv2 nfsv3 nfsv4
|
||||
#%programs: mount.nfs mount.nfs4
|
||||
#%if: "$rootfstype" = "nfs" -o "$need_nfs"
|
||||
#
|
||||
##### Network FileSystem
|
||||
##
|
||||
## This is where NFS gets mounted.
|
||||
## If no root= option was given, the root device will be taken from the DHCP-server.
|
||||
##
|
||||
## Command line parameters
|
||||
## -----------------------
|
||||
##
|
||||
## root=<server>:/<folder> the nfs root path
|
||||
##
|
||||
|
||||
# Prefer NFS root setting via DHCP the fallback provided in config/*.
|
||||
# So at first, consider the command line (that's why we check for "$cmd_root"
|
||||
# being empty here. Then consider the DHCP setting. And finally consider the
|
||||
# fallback via config/*.
|
||||
|
||||
if [ -n "$ROOTPATH" -a -z "$cmd_root" ] ; then
|
||||
case "$ROOTPATH" in
|
||||
iscsi:*)
|
||||
;;
|
||||
*:*)
|
||||
rootfstype="nfs"
|
||||
rootdev="$ROOTPATH" ;;
|
||||
*)
|
||||
if [ -n "$DHCPSIADDR" ]; then
|
||||
rootdev="$DHCPSIADDR:$ROOTPATH"
|
||||
rootfstype="nfs"
|
||||
elif [ -n "$DHCPSNAME" ]; then
|
||||
rootdev="$DHCPSNAME:$ROOTPATH"
|
||||
rootfstype="nfs"
|
||||
fi ;;
|
||||
esac
|
||||
|
||||
if [ -n "$rootdev" ] ; then
|
||||
echo >&2 "Using root device ($rootdev) provided via DHCP"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$rootfstype" = "nfs" ]; then
|
||||
# load the nfs module before using it
|
||||
load_modules
|
||||
|
||||
if [ -z "$rootdev" ]; then
|
||||
echo "no local root= kernel option given and no root server set by the dhcp server."
|
||||
echo "exiting to /bin/sh"
|
||||
cd /
|
||||
PATH=$PATH PS1='$ ' /bin/sh -i
|
||||
fi
|
||||
|
||||
rootfsmod=
|
||||
if [ -n "$rootflags" ] ; then
|
||||
rootflags="${rootflags},nolock"
|
||||
else
|
||||
rootflags="nolock"
|
||||
fi
|
||||
# tell boot.rootfsck to skip warning
|
||||
ROOTFS_FSCK=0
|
||||
export ROOTFS_FSCK
|
||||
else
|
||||
dont_load_modules
|
||||
fi
|
||||
|
||||
# Absolutely required for networking to function
|
||||
ip link set dev lo up
|
@ -1,361 +0,0 @@
|
||||
#!/bin/bash
|
||||
#%stage: block
|
||||
#
|
||||
#%modules: dm-mod
|
||||
#
|
||||
#%udevmodules: virtio_blk
|
||||
#%udevmodules: virtio_console
|
||||
#%udevmodules: virtio_net
|
||||
#%udevmodules: virtio_pci
|
||||
#%udevmodules: virtio_scsi
|
||||
#%udevmodules: sg
|
||||
#%udevmodules: sd_mod
|
||||
#%udevmodules: sr_mod
|
||||
#%udevmodules:
|
||||
#%udevmodules: loop
|
||||
#%udevmodules:
|
||||
#%udevmodules: 9p
|
||||
#%udevmodules: btrfs
|
||||
#%udevmodules: cramfs
|
||||
#%udevmodules: cuse
|
||||
#%udevmodules: ext2
|
||||
#%udevmodules: ext3
|
||||
#%udevmodules: ext4
|
||||
#%udevmodules: fat
|
||||
#%udevmodules: fuse
|
||||
#%udevmodules: hfs
|
||||
#%udevmodules: hfsplus
|
||||
#%udevmodules: isofs
|
||||
#%udevmodules: jfs
|
||||
#%udevmodules: minix
|
||||
#%udevmodules: nfs
|
||||
#%udevmodules: quota
|
||||
#%udevmodules: reiserfs
|
||||
#%udevmodules: squashfs
|
||||
#%udevmodules: squashfs3
|
||||
#%udevmodules: udf
|
||||
#%udevmodules: ufs
|
||||
#%udevmodules: xfs
|
||||
#%udevmodules:
|
||||
#%udevmodules: mac-celtic
|
||||
#%udevmodules: mac-centeuro
|
||||
#%udevmodules: mac-croatian
|
||||
#%udevmodules: mac-cyrillic
|
||||
#%udevmodules: mac-gaelic
|
||||
#%udevmodules: mac-greek
|
||||
#%udevmodules: mac-iceland
|
||||
#%udevmodules: mac-inuit
|
||||
#%udevmodules: mac-roman
|
||||
#%udevmodules: mac-romanian
|
||||
#%udevmodules: mac-turkish
|
||||
#%udevmodules: nls_ascii
|
||||
#%udevmodules: nls_cp1250
|
||||
#%udevmodules: nls_cp1251
|
||||
#%udevmodules: nls_cp1255
|
||||
#%udevmodules: nls_cp437
|
||||
#%udevmodules: nls_cp737
|
||||
#%udevmodules: nls_cp775
|
||||
#%udevmodules: nls_cp850
|
||||
#%udevmodules: nls_cp852
|
||||
#%udevmodules: nls_cp855
|
||||
#%udevmodules: nls_cp857
|
||||
#%udevmodules: nls_cp860
|
||||
#%udevmodules: nls_cp861
|
||||
#%udevmodules: nls_cp862
|
||||
#%udevmodules: nls_cp863
|
||||
#%udevmodules: nls_cp864
|
||||
#%udevmodules: nls_cp865
|
||||
#%udevmodules: nls_cp866
|
||||
#%udevmodules: nls_cp869
|
||||
#%udevmodules: nls_cp874
|
||||
#%udevmodules: nls_cp932
|
||||
#%udevmodules: nls_cp936
|
||||
#%udevmodules: nls_cp949
|
||||
#%udevmodules: nls_cp950
|
||||
#%udevmodules: nls_euc-jp
|
||||
#%udevmodules: nls_iso8859-1
|
||||
#%udevmodules: nls_iso8859-13
|
||||
#%udevmodules: nls_iso8859-14
|
||||
#%udevmodules: nls_iso8859-15
|
||||
#%udevmodules: nls_iso8859-2
|
||||
#%udevmodules: nls_iso8859-3
|
||||
#%udevmodules: nls_iso8859-4
|
||||
#%udevmodules: nls_iso8859-5
|
||||
#%udevmodules: nls_iso8859-6
|
||||
#%udevmodules: nls_iso8859-7
|
||||
#%udevmodules: nls_iso8859-9
|
||||
#%udevmodules: nls_koi8-r
|
||||
#%udevmodules: nls_koi8-ru
|
||||
#%udevmodules: nls_koi8ru
|
||||
#%udevmodules: nls_koi8-u
|
||||
#%udevmodules: nls_utf8
|
||||
#%udevmodules:
|
||||
#%udevmodules: af_packet
|
||||
#%udevmodules: nfs
|
||||
#%udevmodules: nfsv2
|
||||
#%udevmodules: nfsv3
|
||||
#%udevmodules: nfsv4
|
||||
#
|
||||
#%udevmodules: dm-crypt
|
||||
#
|
||||
#%udevmodules: ablk_helper
|
||||
#%udevmodules: aes-i586
|
||||
#%udevmodules: aes-x86_64
|
||||
#%udevmodules: aes_s390
|
||||
#%udevmodules: aesni-intel
|
||||
#%udevmodules: af_alg
|
||||
#%udevmodules: algif_hash
|
||||
#%udevmodules: algif_skcipher
|
||||
#%udevmodules: ansi_cprng
|
||||
#%udevmodules: anubis
|
||||
#%udevmodules: arc4
|
||||
#%udevmodules: asymmetric_keys
|
||||
#%udevmodules: async_memcpy
|
||||
#%udevmodules: async_pq
|
||||
#%udevmodules: async_raid6_recov
|
||||
#%udevmodules: async_tx
|
||||
#%udevmodules: async_xor
|
||||
#%udevmodules: authenc
|
||||
#%udevmodules: authencesn
|
||||
#%udevmodules: blowfish-x86_64
|
||||
#%udevmodules: blowfish_common
|
||||
#%udevmodules: blowfish_generic
|
||||
#%udevmodules: camellia-aesni-avx-x86_64
|
||||
#%udevmodules: camellia-x86_64
|
||||
#%udevmodules: camellia_generic
|
||||
#%udevmodules: cast5-avx-x86_64
|
||||
#%udevmodules: cast5_generic
|
||||
#%udevmodules: cast6-avx-x86_64
|
||||
#%udevmodules: cast6_generic
|
||||
#%udevmodules: cast_common
|
||||
#%udevmodules: cbc
|
||||
#%udevmodules: ccm
|
||||
#%udevmodules: cmac
|
||||
#%udevmodules: crc32
|
||||
#%udevmodules: crc32-pclmul
|
||||
#%udevmodules: crc32c-intel
|
||||
#%udevmodules: cryptd
|
||||
#%udevmodules: crypto_null
|
||||
#%udevmodules: crypto_user
|
||||
#%udevmodules: ctr
|
||||
#%udevmodules: cts
|
||||
#%udevmodules: deflate
|
||||
#%udevmodules: des_generic
|
||||
#%udevmodules: des_s390
|
||||
#%udevmodules: ecb
|
||||
#%udevmodules: fcrypt
|
||||
#%udevmodules: gcm
|
||||
#%udevmodules: geode-aes
|
||||
#%udevmodules: gf128mul
|
||||
#%udevmodules: ghash-clmulni-intel
|
||||
#%udevmodules: ghash-generic
|
||||
#%udevmodules: glue_helper
|
||||
#%udevmodules: hifn_795x
|
||||
#%udevmodules: khazad
|
||||
#%udevmodules: lrw
|
||||
#%udevmodules: lz4
|
||||
#%udevmodules: lz4hc
|
||||
#%udevmodules: md4
|
||||
#%udevmodules: md5
|
||||
#%udevmodules: michael_mic
|
||||
#%udevmodules: padlock-aes
|
||||
#%udevmodules: padlock-sha
|
||||
#%udevmodules: pcbc
|
||||
#%udevmodules: pcrypt
|
||||
#%udevmodules: prng
|
||||
#%udevmodules: public_key
|
||||
#%udevmodules: raid6test
|
||||
#%udevmodules: rmd128
|
||||
#%udevmodules: rmd160
|
||||
#%udevmodules: rmd256
|
||||
#%udevmodules: rmd320
|
||||
#%udevmodules: rsa
|
||||
#%udevmodules: salsa20-i586
|
||||
#%udevmodules: salsa20-x86_64
|
||||
#%udevmodules: salsa20_generic
|
||||
#%udevmodules: seed
|
||||
#%udevmodules: seqiv
|
||||
#%udevmodules: serpent-avx-x86_64
|
||||
#%udevmodules: serpent-sse2-i586
|
||||
#%udevmodules: serpent-sse2-x86_64
|
||||
#%udevmodules: serpent_generic
|
||||
#%udevmodules: sha1-ssse3
|
||||
#%udevmodules: sha1_generic
|
||||
#%udevmodules: sha1_s390
|
||||
#%udevmodules: sha256-ssse3
|
||||
#%udevmodules: sha256_generic
|
||||
#%udevmodules: sha256_s390
|
||||
#%udevmodules: sha512-ssse3
|
||||
#%udevmodules: sha512_generic
|
||||
#%udevmodules: sha512_s390
|
||||
#%udevmodules: sha_common
|
||||
#%udevmodules: tea
|
||||
#%udevmodules: tgr192
|
||||
#%udevmodules: twofish-avx-x86_64
|
||||
#%udevmodules: twofish-i586
|
||||
#%udevmodules: twofish-x86_64
|
||||
#%udevmodules: twofish-x86_64-3way
|
||||
#%udevmodules: twofish_common
|
||||
#%udevmodules: vmac
|
||||
#%udevmodules: wp512
|
||||
#%udevmodules: x509_key_parser
|
||||
#%udevmodules: xcbc
|
||||
#%udevmodules: xor
|
||||
#%udevmodules: xts
|
||||
#%udevmodules: zlib
|
||||
#
|
||||
#%programs: mdadm
|
||||
#%programs: modprobe
|
||||
#%programs: lvm
|
||||
#%programs: grep
|
||||
#%programs: ln
|
||||
#%programs: ls
|
||||
#%programs: head
|
||||
#%programs: cat
|
||||
#%programs: ip
|
||||
#%programs: date
|
||||
#%programs: valgrind
|
||||
#%programs: find
|
||||
#%programs: xargs
|
||||
#%programs: setctsid
|
||||
# mount-rootfs-and-do-chroot.sh
|
||||
#%programs: mkdir
|
||||
#%programs: stat
|
||||
#%programs: mount
|
||||
#%programs: chroot
|
||||
#%programs: umount
|
||||
#
|
||||
#%programs: bc
|
||||
#%programs: fdisk
|
||||
#
|
||||
# Generated at build time:
|
||||
#@GUESTFS_EXT_CMDS@
|
||||
#
|
||||
missing_commands="@GUESTFS_MISSING_CMDS@"
|
||||
|
||||
# Make the modules available now
|
||||
# run_all.sh will load them after this script is sourced
|
||||
load_modules
|
||||
|
||||
# load various modules for cryptsetup
|
||||
for i in 512 384 256 224 1
|
||||
do
|
||||
modprobe -v sha$i
|
||||
done
|
||||
|
||||
ln -sfbn ../proc/self/mounts /etc/mtab
|
||||
|
||||
# from libguestfs-1.19.34/appliance/init:
|
||||
|
||||
# Disk optimizations.
|
||||
# Increase the SCSI timeout so we can read remote images.
|
||||
for f in /sys/block/sd*/device/timeout; do if test -w $f ; then echo 300 > $f; fi; done
|
||||
# https://access.redhat.com/site/solutions/5427
|
||||
for f in /sys/block/{h,s,ub,v}d*/queue/scheduler; do if test -w $f ; then echo noop > $f; fi; done
|
||||
|
||||
# Disable ipv6 because host names resolve to ipv4 and ipv6
|
||||
# Resolver may prefer ipv6 and qemu usernet does only ipv4
|
||||
for f in /proc/sys/net/ipv6/conf/*/disable_ipv6
|
||||
do
|
||||
if test -w $f
|
||||
then
|
||||
echo 1 > $f
|
||||
fi
|
||||
done
|
||||
|
||||
# Set up the network.
|
||||
ip addr add 127.0.0.1/8 brd + dev lo scope host
|
||||
ip link set dev lo up
|
||||
|
||||
ip addr add 169.254.2.10/16 brd + dev eth0 scope global
|
||||
ip link set dev eth0 up
|
||||
|
||||
ip route add default via 169.254.2.2
|
||||
|
||||
echo nameserver 169.254.2.3 >> /etc/resolv.conf
|
||||
|
||||
# Scan for MDs.
|
||||
mdadm -As --auto=yes --run
|
||||
|
||||
# Scan for LVM.
|
||||
mkdir -p /etc/lvm
|
||||
echo -n >> /etc/lvm/lvm.conf
|
||||
lvm vgscan --ignorelockingfailure
|
||||
lvm vgchange -ay --ignorelockingfailure
|
||||
|
||||
# These are useful when debugging.
|
||||
if grep -sq guestfs_verbose=1 /proc/cmdline; then
|
||||
ls -lR /dev
|
||||
head -n 1234 \
|
||||
/etc/resolv.conf \
|
||||
/proc/mounts \
|
||||
/proc/modules \
|
||||
/proc/cpuinfo \
|
||||
/proc/uptime \
|
||||
/proc/version \
|
||||
/proc/partitions
|
||||
for i in pvs vgs lvs
|
||||
do
|
||||
echo "# lvm $i:"
|
||||
lvm $i
|
||||
done
|
||||
ip a
|
||||
ip r
|
||||
date
|
||||
echo -n "clocksource: "
|
||||
cat /sys/devices/system/clocksource/clocksource0/current_clocksource
|
||||
echo "These commands might be called by guestfsd, but they were not available at buildtime:"
|
||||
echo "missing commands: $missing_commands"
|
||||
echo
|
||||
fi
|
||||
|
||||
if ! grep -sq guestfs_rescue=1 /proc/cmdline; then
|
||||
# Run the daemon under valgrind if ./configure --enable-valgrind-daemon
|
||||
vg_channel=/dev/virtio-ports/org.libguestfs.valgrind
|
||||
if [ -w $vg_channel ]; then
|
||||
if [ -r /etc/guestfsd.suppressions ]; then
|
||||
suppressions="--suppressions=/etc/guestfsd.suppressions"
|
||||
fi
|
||||
exec 3>$vg_channel
|
||||
vg="valgrind --leak-check=full --log-fd=3 --error-exitcode=119 --max-stackframe=8388608 --child-silent-after-fork=yes $suppressions"
|
||||
echo "enabling valgrind: $vg"
|
||||
fi
|
||||
|
||||
# The host will kill qemu abruptly if guestfsd shuts down normally
|
||||
$vg guestfsd
|
||||
|
||||
# Otherwise we try to clean up gracefully. For example, this ensures that a
|
||||
# core dump generated by the guest daemon will be written to disk.
|
||||
else
|
||||
# Use appliance in rescue mode, also used by the virt-rescue command.
|
||||
eval $(grep -Eo 'TERM=[^[:space:]]+' /proc/cmdline)
|
||||
PS1='><rescue> '
|
||||
console_kname=ttyS0
|
||||
if test -f /proc/consoles
|
||||
then
|
||||
console_major_minor="`sed 's@^.* @@;p;Q' < /proc/consoles `"
|
||||
console_dev="`find /sys/ -name dev -type f -print0 | xargs -0 --no-run-if-empty grep -m 1 -l ${console_major_minor}`"
|
||||
console_kname=${console_dev%/dev}
|
||||
console_kname=${console_kname##*/}
|
||||
fi
|
||||
export TERM PS1
|
||||
echo
|
||||
echo "------------------------------------------------------------"
|
||||
echo
|
||||
echo "Welcome to virt-rescue, the libguestfs rescue shell."
|
||||
echo
|
||||
echo "Note: The contents of / are the rescue appliance."
|
||||
echo "You have to mount the guest's partitions under /sysroot"
|
||||
echo "before you can examine them. A helper script for that exists:"
|
||||
echo "mount-rootfs-and-do-chroot.sh /dev/sda2"
|
||||
echo
|
||||
setctsid "/dev/${console_kname}" bash -i
|
||||
echo
|
||||
echo "virt-rescue: Syncing the disk now before exiting ..."
|
||||
echo
|
||||
fi
|
||||
|
||||
echo "Leaving."
|
||||
echo s > /proc/sysrq-trigger
|
||||
echo b > /proc/sysrq-trigger
|
||||
exit 0
|
@ -1,6 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
#%stage: filesystem
|
||||
|
||||
mkdir -p $tmp_mnt/etc/udev/rules.d
|
||||
cp /usr/lib/udev/rules.d/64-btrfs.rules $tmp_mnt/etc/udev/rules.d
|
@ -1,41 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
#%stage: devicemapper
|
||||
#%depends: dmroot
|
||||
#
|
||||
|
||||
# no dmsetup -> no dm
|
||||
if [ -x "$(type -p dmsetup)" ]; then
|
||||
dm_blockdev=
|
||||
|
||||
# if any device before was on dm we have to activate it
|
||||
[ "$tmp_root_dm" ] && root_dm=1
|
||||
|
||||
blockdev="$(dm_resolvedeps_recursive $blockdev)"
|
||||
[ "$?" = 0 ] && root_dm=1
|
||||
# include dm when using dm based block devs
|
||||
[ "$DM_BLOCK" ] && root_dm=1
|
||||
|
||||
# include modules
|
||||
if [ -n "$root_dm" ] ; then
|
||||
# Add all dm modules
|
||||
dm_modules=
|
||||
for table in $(dmsetup table | cut -f 4 -d ' ' | sort | uniq); do
|
||||
if [ "$table" = "thin" ]; then table="thin-pool"; fi
|
||||
if [ "$table" ] && [ "$table" != "linear" ] && [ "$table" != "striped" ] ; then
|
||||
dm_modules="$dm_modules dm-$table"
|
||||
fi
|
||||
done
|
||||
dm_modules="$dm_modules dm-mirror"
|
||||
fi
|
||||
|
||||
# include dm block var from sysconfig
|
||||
mkdir -p $tmp_mnt/etc/sysconfig
|
||||
grep DM_BLOCK /etc/sysconfig/kernel > $tmp_mnt/etc/sysconfig/kernel
|
||||
mkdir -p $tmp_mnt/usr/lib/udev/rules.d
|
||||
cp /usr/lib/udev/rules.d/10-dm.rules $tmp_mnt/usr/lib/udev/rules.d/
|
||||
cp /usr/lib/udev/rules.d/13-dm-disk.rules $tmp_mnt/usr/lib/udev/rules.d
|
||||
cp /usr/lib/udev/rules.d/95-dm-notify.rules $tmp_mnt/usr/lib/udev/rules.d
|
||||
save_var root_dm
|
||||
save_var dm_modules
|
||||
fi
|
@ -1,47 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
#%stage: volumemanager
|
||||
#%depends: evms
|
||||
#
|
||||
# get information about the current blockdev
|
||||
update_blockdev
|
||||
|
||||
# Check whether we are using LVM2 (only available when not using EVMS)
|
||||
if [ -z "$root_evms" ] && [ -x "$(type -p lvdisplay)" ] ; then
|
||||
lvm_blockdev=
|
||||
|
||||
for bd in $blockdev; do
|
||||
update_blockdev $bd
|
||||
|
||||
vg_name=$(lvdisplay -c 2> /dev/null | sed -n "/:${blockmajor}:${blockminor}$/p")
|
||||
vg_dev=${vg_name%%:*}
|
||||
vg_name=${vg_name#*:}
|
||||
vg_root=${vg_name%%:*}
|
||||
if [ "$vg_root" ] ; then
|
||||
local vg_blockdev
|
||||
root_lvm2=1
|
||||
realrootdev=${vg_dev## }
|
||||
vg_blockdev=$(vgs --noheadings --options pv_name $vg_root 2> /dev/null | sed "s@,@\n@g" | sed "s@([0-9]*)@@g;s@ @@g" | sort | uniq)
|
||||
lvm_blockdev="$lvm_blockdev $vg_blockdev"
|
||||
[ $? -eq 0 ] || return 1
|
||||
vg_roots="$vg_roots $vg_root"
|
||||
else
|
||||
lvm_blockdev="$lvm_blockdev $bd"
|
||||
fi
|
||||
done
|
||||
blockdev="$lvm_blockdev"
|
||||
fi
|
||||
|
||||
if use_script lvm2; then
|
||||
tmp_root_dm=1 # lvm needs dm
|
||||
mkdir -p $tmp_mnt/etc/lvm
|
||||
mkdir -p $tmp_mnt/var/lock/lvm
|
||||
cp -a /etc/lvm/lvm.conf $tmp_mnt/etc/lvm/
|
||||
# udev rule for lvm2
|
||||
mkdir -p $tmp_mnt/usr/lib/udev/rules.d
|
||||
cp /usr/lib/udev/rules.d/11-dm-lvm.rules $tmp_mnt/usr/lib/udev/rules.d/
|
||||
fi
|
||||
|
||||
save_var root_lvm2
|
||||
save_var vg_roots
|
||||
|
@ -1,120 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
#%stage: softraid
|
||||
#
|
||||
mdblockdev=
|
||||
|
||||
# Full mdadm.conf generated by mdadm.
|
||||
# Contains all created MD RAIDs
|
||||
mdadm_conf=
|
||||
|
||||
cont_list=
|
||||
md_devs=
|
||||
|
||||
declare -A md_conf
|
||||
# blockdev contains real devices (/dev/X) for root, resume, journal, dumb
|
||||
for bd in $blockdev ; do
|
||||
is_part_dev=false
|
||||
case $bd in
|
||||
/dev/md[_0-9]*p[0-9]* )
|
||||
# Partitionable MD RAID. This is partition on RAID. Get the RAID
|
||||
bd=${bd%%p[0-9]*}
|
||||
is_part_dev=true
|
||||
;;
|
||||
/dev/md[0-9_]*)
|
||||
;;
|
||||
*)
|
||||
mdblockdev="$mdblockdev $bd"
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
# Check if this device is already added (possible for partitionable).
|
||||
md_dev=`mdadm -D --export $bd | sed -n -e 's/^MD_DEVNAME=//p'`
|
||||
if [ -z "$md_dev" ]; then
|
||||
md_dev=${bd##/dev/}
|
||||
else
|
||||
bd="/dev/md/$md_dev"
|
||||
fi
|
||||
dup_found=false
|
||||
for dup in $md_devs; do
|
||||
if [ x"$dup" = x"$md_dev" ]; then
|
||||
dup_found=true
|
||||
break
|
||||
fi
|
||||
done
|
||||
if $dup_found; then
|
||||
if ! $is_part_dev; then
|
||||
echo "setup-md.sh: $md_dev found multiple times" >&2
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
mdconf=$(mdadm -Db "$bd")
|
||||
if test -z "$mdconf"; then
|
||||
mdblockdev="$mdblockdev $bd"
|
||||
continue
|
||||
fi
|
||||
md_tmpblockdev=$(mdadm -Dbv $bd | sed -n "1D;s/,/ /g;s/^ *devices=//p")
|
||||
mdblockdev="$mdblockdev $md_tmpblockdev"
|
||||
md_devs="$md_devs $md_dev"
|
||||
container=$(echo "$mdconf" | sed -rn 's/.* container=([^ ]*) .*/\1/p')
|
||||
for cnt in $cont_list; do
|
||||
if [ x"$container" = x"$cnt" ]; then
|
||||
container=
|
||||
break
|
||||
fi
|
||||
done
|
||||
case "$container" in
|
||||
"")
|
||||
;;
|
||||
/dev/*)
|
||||
mdconf="$(mdadm -Db "$container")\\n$mdconf"
|
||||
cont_list="$cont_list $container"
|
||||
;;
|
||||
[0-9a-f]*[0-9a-f])
|
||||
if test -z "$mdadm_conf"; then
|
||||
mdadm_conf=$(mdadm --examine --brief --scan)
|
||||
fi
|
||||
mdconf="$(echo "$mdadm_conf" | grep "UUID=$container")\\n$mdconf"
|
||||
cont_list="$cont_list $container"
|
||||
;;
|
||||
*)
|
||||
echo "unrecognized container for $md_dev: $container"
|
||||
;;
|
||||
esac
|
||||
# If /etc/mdadm.conf contains a different name for this
|
||||
# array, then use that.
|
||||
md_uuid=`echo $mdconf | sed -n -e 's/.* UUID=\([0-9a-f:]*\).*/\1/p'`
|
||||
if [ -f /etc/mdadm.conf -a -n "$md_uuid" ]; then
|
||||
md_devname=`sed -n -e 's,^ARRAY */dev/\([^ ]*\) .*[Uu][Uu][Ii][Dd]='$md_uuid'.*,\1,p' /etc/mdadm.conf`
|
||||
if [ -n "$md_devname" ]; then
|
||||
mdconf=`echo $mdconf | sed -e 's,^ARRAY /dev/\([^ ]*\),ARRAY /dev/'$md_devname','`
|
||||
fi
|
||||
fi
|
||||
md_conf["$md_dev"]="$mdconf"
|
||||
root_md=1
|
||||
done
|
||||
|
||||
# Any 'md' device is replaced by it's component disks.
|
||||
blockdev="$mdblockdev"
|
||||
|
||||
if [ -n "$root_md" ] ; then
|
||||
need_mdadm=1
|
||||
echo "AUTO -all" > $tmp_mnt/etc/mdadm.conf
|
||||
for md in $md_devs; do
|
||||
echo -e "${md_conf["$md"]}" >> $tmp_mnt/etc/mdadm.conf
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "x$need_mdadm" = "x1" ] ; then
|
||||
for rule in \
|
||||
63-md-raid-arrays.rules \
|
||||
64-md-raid-assembly.rules; do
|
||||
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
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
save_var need_mdadm
|
@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
#%stage: device
|
||||
#
|
||||
|
||||
if [ "$rootfstype" = "nfs" ]; then
|
||||
interface=${interface:-default}
|
||||
save_var rootfstype
|
||||
fi
|
@ -1,162 +0,0 @@
|
||||
#!/bin/bash
|
||||
#%stage: block
|
||||
#
|
||||
|
||||
fdupes_s() {
|
||||
local _target=""
|
||||
local _file=
|
||||
fdupes --quiet --noempty --recurse "$@" |
|
||||
while read _file
|
||||
do
|
||||
if test -z "$_target"
|
||||
then
|
||||
_target="$_file"
|
||||
else
|
||||
if test -z "$_file"
|
||||
then
|
||||
_target=""
|
||||
continue
|
||||
fi
|
||||
echo ln -fv "${_target##*/}" "$_file"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# copy daemon manually because it is located in RPM_BUILD_ROOT
|
||||
mkdir -vp $tmp_mnt/usr/sbin
|
||||
cp_bin $(type -p guestfsd) $tmp_mnt/usr/sbin
|
||||
# required for mount.nfs inside the appliance
|
||||
for i in /etc/netconfig /etc/protocols /etc/rpc /etc/services
|
||||
do
|
||||
cp $i $tmp_mnt$i
|
||||
done
|
||||
|
||||
# Disable ipv6 because host names resolve to ipv4 and ipv6
|
||||
# Resolver may prefer ipv6 and qemu usernet does only ipv4
|
||||
echo install ipv6 /bin/true >> $tmp_mnt/etc/modprobe.conf.local
|
||||
|
||||
# many guestfish commands need a mount point
|
||||
# in guestfsd the mount point defaults to /sysroot
|
||||
mkdir -vp $tmp_mnt/sysroot
|
||||
|
||||
# guestfsd tries to bind mount this directory
|
||||
mkdir -vp $tmp_mnt/selinux
|
||||
|
||||
for f in /etc/magic /usr/share/misc/magic*
|
||||
do
|
||||
if test -e $f
|
||||
then
|
||||
cp -av --parents $f $tmp_mnt/
|
||||
fi
|
||||
done
|
||||
for d in /usr/share/*augeas*
|
||||
do
|
||||
if test -e $d
|
||||
then
|
||||
cp -av --parents $d $tmp_mnt/
|
||||
fi
|
||||
done
|
||||
|
||||
mkdir -p $tmp_mnt/usr/share/guestfs
|
||||
if test -n "$LIBGUESTFS_SRC_APPLIANCE_DIR"
|
||||
then
|
||||
for f in $LIBGUESTFS_SRC_APPLIANCE_DIR/*.aug
|
||||
do
|
||||
if test -e $f
|
||||
then
|
||||
cp -Lavt $tmp_mnt/usr/share/guestfs $f
|
||||
fi
|
||||
done
|
||||
fi
|
||||
for d in /usr/lib*/gconv
|
||||
do
|
||||
if test -e $d
|
||||
then
|
||||
cp -avL --parents $d $tmp_mnt/
|
||||
fdupes_s $tmp_mnt$d
|
||||
fi
|
||||
done
|
||||
|
||||
for t in \
|
||||
screen \
|
||||
vt100 \
|
||||
vt102 \
|
||||
linux
|
||||
do
|
||||
ti="`echo /usr/share/terminfo/*/${t}`"
|
||||
for f in $ti
|
||||
do
|
||||
if test -f "${f}"
|
||||
then
|
||||
cp -av --parents $f $tmp_mnt
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
# copy needed rules
|
||||
for rule in \
|
||||
95-dm-notify.rules \
|
||||
; do
|
||||
if [ -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
|
||||
|
||||
# Need to create the modprobe.conf file to force read-write mode
|
||||
if modinfo -k $kernel_version ext4 | grep -E '^parm:[[:blank:]]+rw:'
|
||||
then
|
||||
mkdir -vp "${tmp_mnt}/etc/modprobe.d"
|
||||
echo "options ext4 rw=1" >> "${tmp_mnt}/etc/modprobe.d/ext4-kmp-rw.conf"
|
||||
fi
|
||||
|
||||
# Bug 674684 - mount-rootfs-and-do-chroot.sh
|
||||
cat > $tmp_mnt/bin/mount-rootfs-and-do-chroot.sh <<'__EOF__'
|
||||
#!/bin/bash
|
||||
# Usage: $0 /dev/sda5
|
||||
rootfs=$1
|
||||
mnt=/sysroot
|
||||
mounts=
|
||||
|
||||
if test -b "${rootfs}"
|
||||
then
|
||||
|
||||
mkdir -v -p "${mnt}"
|
||||
|
||||
if mount -v "${rootfs}" "${mnt}"
|
||||
then
|
||||
|
||||
for i in dev dev/pts proc sys selinux
|
||||
do
|
||||
if test -d /${i} && test -d "${mnt}/${i}" && test "`stat -c %D /`" != "`stat -c %D ${i}`"
|
||||
then
|
||||
mount -v --bind /${i} "${mnt}/${i}"
|
||||
fi
|
||||
done
|
||||
|
||||
chroot "${mnt}" su -
|
||||
|
||||
while read b m rest
|
||||
do
|
||||
case "${m}" in
|
||||
${mnt}*)
|
||||
mounts="${m} ${mounts}"
|
||||
;;
|
||||
esac
|
||||
done <<-EOF
|
||||
`
|
||||
cat < /proc/mounts
|
||||
`
|
||||
EOF
|
||||
|
||||
for i in ${mounts}
|
||||
do
|
||||
umount -v "${i}"
|
||||
done
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
__EOF__
|
||||
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:dc4d1703ee39e5e79ede0e22049cdbbd02e1c9f652a5786572bb8521994a4df0
|
||||
size 88226
|
@ -1 +1,4 @@
|
||||
addFilter("binaryinfo-readelf-failed")
|
||||
addFilter("shlib-policy-nonversioned-dir")
|
||||
addFilter("shlib-policy-missing-lib")
|
||||
# This script is supposed to be run from within the appliance only
|
||||
addFilter("non-executable-script /usr/share/virt-p2v/launch-virt-p2v")
|
||||
|
302
libguestfs.spec
302
libguestfs.spec
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package libguestfs
|
||||
#
|
||||
# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2016 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2011 Michal Hrusecky <mhrusecky@novell.com>
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
@ -15,9 +15,10 @@
|
||||
|
||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||
#
|
||||
# needsbinariesforbuild
|
||||
|
||||
|
||||
Version: 1.26.10
|
||||
Version: 1.32.4
|
||||
Release: 0
|
||||
|
||||
%define opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0)
|
||||
@ -47,6 +48,7 @@ Release: 0
|
||||
%bcond_without zerofree
|
||||
%bcond_with ext4_writeable
|
||||
%endif
|
||||
%define with_p2v 0
|
||||
|
||||
%bcond_without fuse
|
||||
|
||||
@ -120,7 +122,7 @@ Release: 0
|
||||
#
|
||||
Name: libguestfs
|
||||
%if "%{?_ignore_exclusive_arch}" == ""
|
||||
ExclusiveArch: x86_64 ppc64 ppc64le s390x
|
||||
ExclusiveArch: x86_64 ppc64 ppc64le s390x aarch64
|
||||
%endif
|
||||
BuildRequires: aaa_base
|
||||
BuildRequires: attr-devel
|
||||
@ -129,8 +131,12 @@ BuildRequires: autoconf
|
||||
BuildRequires: automake
|
||||
%if %{with bash_completion}
|
||||
BuildRequires: bash-completion >= 2.0
|
||||
%if 0%{?suse_version} >= 1330
|
||||
BuildRequires: bash-completion-devel >= 2.0
|
||||
%endif
|
||||
%endif
|
||||
BuildRequires: bison
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: file-devel
|
||||
BuildRequires: flex
|
||||
BuildRequires: gcc
|
||||
@ -146,17 +152,26 @@ BuildRequires: libvirt-devel >= 0.10.2
|
||||
BuildRequires: libxml2-devel
|
||||
BuildRequires: ncurses-devel
|
||||
%if %{with perl_bindings}
|
||||
BuildRequires: perl(Module::Build)
|
||||
%if %suse_version < 1140
|
||||
BuildRequires: perl-macros
|
||||
%endif
|
||||
%endif
|
||||
BuildRequires: createrepo
|
||||
BuildRequires: db48-utils
|
||||
BuildRequires: dhcp-client
|
||||
BuildRequires: pcre-devel
|
||||
BuildRequires: pkg-config
|
||||
BuildRequires: qemu-tools
|
||||
BuildRequires: readline-devel
|
||||
%if %{with ocaml_bindings}
|
||||
BuildRequires: supermin >= 5.1.6
|
||||
# Required to build tools, its independent from bindings
|
||||
BuildRequires: glib2-devel
|
||||
BuildRequires: ocaml
|
||||
BuildRequires: ocaml-findlib
|
||||
|
||||
#
|
||||
%if %{with ocaml_bindings}
|
||||
%define _configure_ocaml --enable-ocaml
|
||||
%endif
|
||||
#
|
||||
@ -167,41 +182,24 @@ BuildRequires: fuse-devel
|
||||
#
|
||||
%if %{with hivex}
|
||||
BuildRequires: glibc-locale
|
||||
BuildRequires: hivex
|
||||
BuildRequires: hivex-devel
|
||||
%endif
|
||||
#
|
||||
%if %{with_p2v}
|
||||
BuildRequires: gtk2-devel
|
||||
%endif
|
||||
#
|
||||
Url: http://libguestfs.org/
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
Summary: Compatibility package for guestfs-tools
|
||||
License: GPL-2.0
|
||||
Group: System/Filesystems
|
||||
Patch0: 0000-hotfix.patch
|
||||
Patch1000: 1000-force-virtio_blk-in-old-guest-kernel.patch
|
||||
|
||||
Source0: %{name}-%{version}.tar.xz
|
||||
Source1: libguestfs.rpmlintrc
|
||||
Source42: libguestfs.mkinitrd.tar.bz2
|
||||
Source789653: Pod-Simple-3.23.tar.xz
|
||||
Source10: libguestfs.mkinitrd.boot.sh
|
||||
Source11: libguestfs.mkinitrd.setup.sh
|
||||
#
|
||||
Source12: libguestfs.mkinitrd.boot-dm.sh
|
||||
Source13: libguestfs.mkinitrd.setup-dm.sh
|
||||
Source14: libguestfs.mkinitrd.boot-lvm2.sh
|
||||
Source15: libguestfs.mkinitrd.setup-lvm2.sh
|
||||
Source16: libguestfs.mkinitrd.boot-md.sh
|
||||
Source17: libguestfs.mkinitrd.setup-md.sh
|
||||
Source18: libguestfs.mkinitrd.boot-nfs.sh
|
||||
Source19: libguestfs.mkinitrd.setup-nfs.sh
|
||||
Source20: libguestfs.mkinitrd.boot-btrfs.sh
|
||||
Source21: libguestfs.mkinitrd.setup-btrfs.sh
|
||||
#
|
||||
Source1310: libguestfs.mkinitrd.1310.patch
|
||||
Source1230: libguestfs.mkinitrd.1230.patch
|
||||
Source1220: libguestfs.mkinitrd.1220.patch
|
||||
Source1210: libguestfs.mkinitrd.1210.patch
|
||||
Source1140: libguestfs.mkinitrd.1140.patch
|
||||
Source1115: libguestfs.mkinitrd.1115.patch
|
||||
Source1110: libguestfs.mkinitrd.1110.patch
|
||||
#
|
||||
Source10001: libguestfs.test.simple.run-libugestfs-test-tool.sh
|
||||
Source10002: libguestfs.test.simple.create-opensuse-guest.sh
|
||||
@ -211,6 +209,7 @@ Source10005: libguestfs.test.simple.create-sles12-guest-crypt-on-lvm.sh
|
||||
|
||||
#
|
||||
Requires: guestfs-tools
|
||||
Requires: virt-v2v
|
||||
|
||||
%description
|
||||
libguestfs is a set of tools for accessing and modifying virtual machine (VM)
|
||||
@ -234,8 +233,7 @@ License: GPL-2.0
|
||||
Group: System/Filesystems
|
||||
Provides: %{name} = %{version}
|
||||
Obsoletes: %{name} < %{version}
|
||||
Requires: %{kvm_binary}
|
||||
Requires: qemu >= 2.0
|
||||
Requires: python-evtx
|
||||
%if %{with bash_completion}
|
||||
Recommends: bash-completion >= 2.0
|
||||
%endif
|
||||
@ -409,7 +407,6 @@ BuildRequires: e2fsprogs
|
||||
%if %{with ext4_writeable}
|
||||
BuildRequires: ext4-writeable-kmp-default
|
||||
%endif
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: file
|
||||
BuildRequires: findutils
|
||||
BuildRequires: gawk
|
||||
@ -429,21 +426,34 @@ BuildRequires: mdadm
|
||||
BuildRequires: mkinitrd
|
||||
%endif
|
||||
BuildRequires: module-init-tools
|
||||
BuildRequires: ncurses-utils
|
||||
BuildRequires: nfs-client
|
||||
BuildRequires: ntfs-3g
|
||||
BuildRequires: ntfsprogs
|
||||
BuildRequires: pam-config
|
||||
BuildRequires: parted
|
||||
BuildRequires: pciutils
|
||||
BuildRequires: pciutils-ids
|
||||
BuildRequires: psmisc
|
||||
BuildRequires: reiserfs
|
||||
BuildRequires: rsync
|
||||
BuildRequires: sg3_utils
|
||||
BuildRequires: strace
|
||||
%ifarch %ix86 x86_64
|
||||
BuildRequires: syslinux
|
||||
%endif
|
||||
%if %suse_version >= 1210
|
||||
BuildRequires: systemd
|
||||
BuildRequires: systemd-sysvinit
|
||||
%else
|
||||
BuildRequires: sysvinit
|
||||
%endif
|
||||
BuildRequires: tar
|
||||
BuildRequires: terminfo-base
|
||||
BuildRequires: tunctl
|
||||
BuildRequires: udev
|
||||
BuildRequires: util-linux
|
||||
BuildRequires: util-linux-lang
|
||||
BuildRequires: xfsprogs
|
||||
BuildRequires: xz
|
||||
%if %{with zerofree}
|
||||
@ -488,6 +498,9 @@ virtual machines.
|
||||
Summary: Runtime library of libguestfs
|
||||
License: LGPL-2.1
|
||||
Group: System/Filesystems
|
||||
Requires: %{kvm_binary}
|
||||
Requires: qemu >= 2.0
|
||||
Requires: supermin >= 5.1.6
|
||||
|
||||
%description -n libguestfs0
|
||||
Library for libguestfs.
|
||||
@ -508,14 +521,25 @@ guestfish, or use virt-rescue to get a rescue shell for fixing unbootable
|
||||
virtual machines.
|
||||
|
||||
|
||||
%package -n virt-v2v
|
||||
Summary: Convert a virtual machine to run on KVM
|
||||
License: GPL-2.0
|
||||
Group: System/Management
|
||||
Requires: libguestfs0 = %{version}
|
||||
Requires: qemu-block-ssh
|
||||
|
||||
%description -n virt-v2v
|
||||
virt-v2v is a tool for converting and importing virtual machines to
|
||||
libvirt-managed KVM, or Red Hat Enterprise Virtualization. It can import a
|
||||
variety of guest operating systems from libvirt-managed hosts and VMware ESX.
|
||||
|
||||
%prep
|
||||
: _ignore_exclusive_arch '%{?_ignore_exclusive_arch}'
|
||||
%setup -q -a 789653 -a 42
|
||||
%setup -q -a 789653
|
||||
%patch0 -p1
|
||||
%patch1000 -p1
|
||||
|
||||
%build
|
||||
bison --version
|
||||
# [Bug 789653] sles11 perl obsoletes perl-Pod-Simple unconditionally
|
||||
export PERLLIB=`echo $PWD/Pod-Simple-*/lib`
|
||||
# disable qemu test.
|
||||
@ -566,7 +590,7 @@ fi
|
||||
--enable-install-daemon \
|
||||
--with-qemu=$QEMU \
|
||||
--without-java \
|
||||
--disable-appliance \
|
||||
--with-supermin-packager-config="$PWD/zypper.priv.conf --use-installed --verbose" \
|
||||
--disable-haskell \
|
||||
--disable-php \
|
||||
%{_configure_fuse} \
|
||||
@ -577,6 +601,8 @@ fi
|
||||
%{_configure_ruby} \
|
||||
--disable-rpath \
|
||||
--disable-static
|
||||
#Workaround an autotools bug
|
||||
make -j1 -C builder index-parse.c
|
||||
# 'INSTALLDIRS' ensures that perl libs are installed in the vendor dir instead of the site dir
|
||||
make \
|
||||
INSTALLDIRS=vendor \
|
||||
@ -589,9 +615,9 @@ make \
|
||||
# strip kills the bytecode part of ELF binaries
|
||||
export NO_BRP_STRIP_DEBUG=true
|
||||
%endif
|
||||
%makeinstall udevrulesdir=%{udevrulesdir}
|
||||
rm -rfv $RPM_BUILD_ROOT%{_libdir}/guestfs/supermin.d
|
||||
#
|
||||
%makeinstall \
|
||||
INSTALLDIRS=vendor \
|
||||
udevrulesdir=%{udevrulesdir}
|
||||
mkdir -p $RPM_BUILD_ROOT%{_datadir}/guestfs
|
||||
cp -avLt $RPM_BUILD_ROOT%{_datadir}/guestfs \
|
||||
%{S:10005} \
|
||||
@ -613,8 +639,6 @@ find $RPM_BUILD_ROOT -type f \( \
|
||||
%if %{with perl_bindings}
|
||||
# Delete empty perl bootstrap files
|
||||
find $RPM_BUILD_ROOT -name "*.bs" -size 0c -print -delete
|
||||
# Delete unused perl script without executable permissions
|
||||
find $RPM_BUILD_ROOT%perl_vendorarch/ -name bindtests.pl -print -delete
|
||||
%perl_process_packlist
|
||||
%perl_gen_filelist
|
||||
# the macro above packages everything, here only the perl files are desrired
|
||||
@ -627,178 +651,19 @@ rm -fv $RPM_BUILD_ROOT/%{_libdir}/*.a
|
||||
#
|
||||
touch %{name}.lang
|
||||
%find_lang %{name}
|
||||
#
|
||||
ext_cmds="`
|
||||
objcopy -j .guestfsd_ext_cmds -O binary $RPM_BUILD_ROOT/usr/sbin/guestfsd /dev/stdout |
|
||||
tr '\0' '\n' |
|
||||
sort -u
|
||||
`"
|
||||
test -n "$ext_cmds"
|
||||
#
|
||||
> ext_cmds.txt
|
||||
> missing_cmds.txt
|
||||
# guestfs may call mkfs, but it cant tell in advance which filesystems
|
||||
# it must support. Collect a manual list of possible filesystems so that
|
||||
# the commands get included in the initrd.
|
||||
ext_cmds="$ext_cmds
|
||||
sparsify
|
||||
strace
|
||||
` for fs in \
|
||||
ext2 \
|
||||
ext3 \
|
||||
ext4 \
|
||||
fuse \
|
||||
ntfs \
|
||||
ntfs-3g \
|
||||
reiserfs \
|
||||
jfs \
|
||||
gfs \
|
||||
gfs2 \
|
||||
vfat \
|
||||
msdos \
|
||||
ufs \
|
||||
; do
|
||||
if test -x /sbin/mount.$fs || test -x /usr/sbin/mount.$fs
|
||||
then
|
||||
echo mount.$fs
|
||||
fi
|
||||
echo mkfs.$fs
|
||||
echo fsck.$fs
|
||||
done
|
||||
` "
|
||||
#
|
||||
for cmd in ls $ext_cmds
|
||||
do
|
||||
if test -n "` PATH=$PATH:/sbin:/usr/sbin type -p $cmd `"
|
||||
then
|
||||
echo "#%%programs: $cmd" >> ext_cmds.txt
|
||||
else
|
||||
echo "# missing: $cmd" >> ext_cmds.txt
|
||||
echo "$cmd" >> missing_cmds.txt
|
||||
fi
|
||||
done
|
||||
head -n 1234 ext_cmds.txt missing_cmds.txt
|
||||
%if %{use_included_mkinitrd}
|
||||
ln -sfvbn mkinitrd-2.8.1 mkinitrd
|
||||
ln -sfvbn mkinitrd/sbin/mkinitrd_setup mkinitrd_setup.sh
|
||||
ln -sfvbn mkinitrd/sbin/mkinitrd mkinitrd.sh
|
||||
cp -avL %{S:12} mkinitrd/scripts/boot-dm.sh
|
||||
cp -avL %{S:13} mkinitrd/scripts/setup-dm.sh
|
||||
cp -avL %{S:14} mkinitrd/scripts/boot-lvm2.sh
|
||||
cp -avL %{S:15} mkinitrd/scripts/setup-lvm2.sh
|
||||
cp -avL %{S:16} mkinitrd/scripts/boot-md.sh
|
||||
cp -avL %{S:17} mkinitrd/scripts/setup-md.sh
|
||||
cp -avL %{S:18} mkinitrd/scripts/boot-nfs.sh
|
||||
cp -avL %{S:19} mkinitrd/scripts/setup-nfs.sh
|
||||
cp -avL %{S:20} mkinitrd/scripts/setup-btrfs.sh
|
||||
cp -avL %{S:21} mkinitrd/scripts/setup-btrfs.sh
|
||||
for i in /lib/mkinitrd/scripts/*
|
||||
do
|
||||
if test -f "$i"
|
||||
then
|
||||
cp -avbt mkinitrd/scripts "$i"
|
||||
fi
|
||||
done
|
||||
mkdir -vp mkinitrd/setup mkinitrd/boot
|
||||
ln -sfvbn lib/mkinitrd/bin mkinitrd/bin
|
||||
sed -i~ "s@^INITRD_PATH=/lib/mkinitrd@INITRD_PATH=$PWD/mkinitrd@" mkinitrd/sbin/mkinitrd
|
||||
%else
|
||||
rm -rf mkinitrd
|
||||
cp -av /lib/mkinitrd .
|
||||
ln -sfvbn /sbin/mkinitrd_setup mkinitrd_setup.sh
|
||||
ln -sfvbn /sbin/mkinitrd mkinitrd.sh
|
||||
%endif
|
||||
for bad in \
|
||||
setup-storage.sh \
|
||||
boot-storage.sh \
|
||||
;
|
||||
do
|
||||
rm mkinitrd/scripts/${bad}
|
||||
done
|
||||
cp -avL %{S:10} mkinitrd/scripts/boot-guestfs.sh
|
||||
cp -avL %{S:11} mkinitrd/scripts/setup-guestfs.sh
|
||||
chmod 755 mkinitrd/scripts/*guestfs.sh
|
||||
sed -i~ '
|
||||
/^#@GUESTFS_EXT_CMDS@/ {
|
||||
s@^.*@@
|
||||
r ext_cmds.txt
|
||||
}
|
||||
/@GUESTFS_MISSING_CMDS@/ {
|
||||
s@^.*@missing_commands="@
|
||||
r missing_cmds.txt
|
||||
a \
|
||||
"
|
||||
}
|
||||
' mkinitrd/scripts/boot-guestfs.sh
|
||||
diff -u mkinitrd/scripts/boot-guestfs.sh~ mkinitrd/scripts/boot-guestfs.sh || :
|
||||
#
|
||||
pushd mkinitrd
|
||||
patched=
|
||||
for p in \
|
||||
%{S:1310} \
|
||||
%{S:1230} \
|
||||
%{S:1220} \
|
||||
%{S:1210} \
|
||||
%{S:1140} \
|
||||
%{S:1115} \
|
||||
%{S:1110} \
|
||||
;
|
||||
do
|
||||
if patch --dry-run -p2 < $p
|
||||
then
|
||||
patch -p2 < $p
|
||||
patched=$p
|
||||
break
|
||||
elif patch --dry-run -R -p2 < $p
|
||||
then
|
||||
patched=$p
|
||||
break
|
||||
fi
|
||||
done
|
||||
popd
|
||||
test -n "$patched"
|
||||
%fdupes -s $RPM_BUILD_ROOT
|
||||
|
||||
./mkinitrd_setup.sh \
|
||||
-s $PWD/mkinitrd/scripts \
|
||||
-i $PWD/mkinitrd
|
||||
mkdir mkinitrd/boot_tmp
|
||||
kver=`env PATH=/sbin:/usr/sbin:$PATH get_kernel_version '%{kernel_binary}'`
|
||||
test -n "${kver}"
|
||||
arch=`arch`
|
||||
%ifarch %ix86
|
||||
arch=i586
|
||||
# SLES has a different way to provide ntfs-3g feature.
|
||||
%if %suse_version == 1315
|
||||
mkdir -p $RPM_BUILD_ROOT/tmp/etc/alternatives
|
||||
pushd $RPM_BUILD_ROOT/tmp/etc/alternatives
|
||||
ln -s /sbin/mount.ntfs-3g mount.ntfs
|
||||
popd
|
||||
pushd $RPM_BUILD_ROOT/tmp
|
||||
tar czf $RPM_BUILD_ROOT/%{_libdir}/guestfs/supermin.d/zz-ntfs-symlink.tar.gz etc
|
||||
popd
|
||||
rm -rf $RPM_BUILD_ROOT/tmp
|
||||
%endif
|
||||
cp -avL '%{kernel_binary}' mkinitrd/boot_tmp/vmlinuz.${arch}
|
||||
cp -avL /boot/System.map-${kver} mkinitrd/boot_tmp
|
||||
%if 0
|
||||
# [Bug 778149] mkinitrd does not copy links correctly
|
||||
mkdir mkinitrd/bin_tmp
|
||||
for cmd in ` awk '/^#%%programs:/ { print $2 }' mkinitrd/scripts/boot-guestfs.sh | sort -u `
|
||||
do
|
||||
cp -v ` PATH=${RPM_BUILD_ROOT}/usr/bin:${RPM_BUILD_ROOT}/usr/sbin:${PATH}:/sbin:/usr/sbin type -p $cmd ` mkinitrd/bin_tmp/ || :
|
||||
done
|
||||
chmod -v 755 mkinitrd/bin_tmp/*
|
||||
%endif
|
||||
#
|
||||
additional_modules="
|
||||
"
|
||||
env PATH=${RPM_BUILD_ROOT}/usr/bin:${RPM_BUILD_ROOT}/usr/sbin:${PATH} \
|
||||
LIBGUESTFS_SRC_APPLIANCE_DIR=`cd $PWD/appliance ; pwd -P` \
|
||||
bash -x \
|
||||
./mkinitrd.sh \
|
||||
-l $PWD/mkinitrd \
|
||||
-k vmlinuz.${arch} \
|
||||
-i initramfs.${arch}.img \
|
||||
-b $PWD/mkinitrd/boot_tmp \
|
||||
-m "$additional_modules" \
|
||||
-f "lvm2 dm md network nfs btrfs usb" \
|
||||
-B
|
||||
#
|
||||
mkdir -vp $RPM_BUILD_ROOT%{_libdir}/guestfs
|
||||
cp -avLt $RPM_BUILD_ROOT%{_libdir}/guestfs/ \
|
||||
mkinitrd/boot_tmp/initramfs.${arch}.img \
|
||||
mkinitrd/boot_tmp/vmlinuz.${arch}
|
||||
chmod 644 $RPM_BUILD_ROOT%{_libdir}/guestfs/initramfs.${arch}.img
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
@ -813,6 +678,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%files -n guestfs-data
|
||||
%defattr(-,root,root)
|
||||
%{_libdir}/guestfs
|
||||
%exclude %{_libdir}/guestfs/supermin.d/zz-packages-*
|
||||
|
||||
%if %{with ocaml_bindings}
|
||||
%files -n ocaml-libguestfs
|
||||
@ -873,28 +739,44 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_libdir}/*.so
|
||||
%{_libdir}/pkgconfig/*
|
||||
%{_includedir}/guestfs.h
|
||||
%{_includedir}/guestfs-gobject
|
||||
%{_includedir}/guestfs-gobject.h
|
||||
%{_datadir}/gtk-doc/html/guestfs
|
||||
%{_mandir}/man3/*
|
||||
|
||||
%files -n guestfsd
|
||||
%defattr(-,root,root)
|
||||
%{udevrulesdir}
|
||||
%{_sbindir}/guestfsd
|
||||
%{_mandir}/man8/*
|
||||
|
||||
%files -n guestfs-tools -f %{name}.lang
|
||||
%defattr(-,root,root)
|
||||
%doc COPYING
|
||||
%{_sbindir}/libguestfs-make-fixed-appliance
|
||||
%{_bindir}/*
|
||||
%exclude %{_bindir}/virt-v2v
|
||||
%config(noreplace) /etc/libguestfs-tools.conf
|
||||
%if %{with ocaml_bindings}
|
||||
/etc/virt-builder
|
||||
%dir /etc/xdg/virt-builder
|
||||
%dir /etc/xdg/virt-builder/repos.d
|
||||
%config /etc/xdg/virt-builder/repos.d/*
|
||||
%endif
|
||||
%if %{with bash_completion}
|
||||
%{_datadir}/bash-completion
|
||||
%exclude %{_datadir}/bash-completion/*/virt-v2v
|
||||
%endif
|
||||
%{_mandir}/man1/*
|
||||
%exclude %{_mandir}/man1/virt-v2v.*
|
||||
%{_mandir}/man5/*
|
||||
|
||||
%files -n virt-v2v
|
||||
%defattr(-,root,root)
|
||||
%{_bindir}/virt-v2v
|
||||
%{_datadir}/bash-completion/*/virt-v2v
|
||||
%{_mandir}/man1/virt-v2v.*
|
||||
%if %{with_p2v}
|
||||
%{_prefix}/lib/virt-p2v
|
||||
%{_datadir}/virt-p2v
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
|
Loading…
Reference in New Issue
Block a user