]> git.pld-linux.org Git - packages/geninitrd.git/blob - geninitrd-git.patch
- rel 3; group for udev and yet another rootfs fallback
[packages/geninitrd.git] / geninitrd-git.patch
1 diff --git a/functions b/functions
2 index a3f6b19..f4d9acb 100644
3 --- a/functions
4 +++ b/functions
5 @@ -291,3 +291,9 @@ find_modules_by_class_mit() {
6         '
7  }
8  
9 +# get possible paths for specifed patter containing LIBDIR
10 +get_libdir() {
11 +       for dir in lib lib64 libx32; do
12 +               echo -n "${1/LIBDIR/$dir} "
13 +       done
14 +}
15 diff --git a/geninitrd b/geninitrd
16 index b8ee2a3..7b962b5 100755
17 --- a/geninitrd
18 +++ b/geninitrd
19 @@ -505,7 +505,7 @@ inst() {
20                 mkdir -p $parentDir
21         fi
22         verbose "+ cp $* DESTDIR$dest"
23 -       cp -HR "$@" "$DESTDIR$dest"
24 +       cp -HRp "$@" "$DESTDIR$dest"
25  }
26  
27  inst_d() {
28 @@ -553,17 +553,20 @@ inst_exec() {
29  
30         # hack for uclibc linked binaries requiring this fixed path
31         # XXX: shouldn't rpath be used here instead so th
32 -       if [ -f $DESTDIR/$_lib/libc.so.0 ]; then
33 -               lib=$DESTDIR/$_lib/libc.so.0
34 -               lib=$(ldd "$lib" | awk '/statically|linux-(gate|vdso)\.so/{next} NF == 2 {print $1} /=/{print $3}' | sort -u)
35 -               libdir=$(cd $(dirname "$lib"); pwd)
36 -               if [ ! -e $DESTDIR$libdir ]; then
37 -                       libdir=$(dirname "$libdir")
38 -                       inst_d $libdir
39 -                       verbose "+ ln -s /$_lib $DESTDIR$libdir"
40 -                       ln -s /$_lib $DESTDIR$libdir
41 +       for _lib in $(get_libdir LIBDIR); do
42 +               if [ -f $DESTDIR/$_lib/libc.so.0 ]; then
43 +                       lib=$DESTDIR/$_lib/libc.so.0
44 +                       lib=$(ldd "$lib" | awk '/statically|linux-(gate|vdso)\.so/{next} NF == 2 {print $1} /=/{print $3}' | sort -u)
45 +                       libdir=$(cd $(dirname "$lib"); pwd)
46 +                       if [ ! -e $DESTDIR$libdir ]; then
47 +                               libdir=$(dirname "$libdir")
48 +                               inst_d $libdir
49 +                               verbose "+ ln -s /$_lib $DESTDIR$libdir"
50 +                               ln -s /$_lib $DESTDIR$libdir
51 +                               break
52 +                       fi
53                 fi
54 -       fi
55 +       done
56  }
57  
58  # output modules.conf / modprobe.conf
59 @@ -999,6 +1002,12 @@ initrd_gen_initramfs_switchroot() {
60                         mknod -m 660 $device b $maj $min
61                 fi
62  
63 +               # XXX hack, fallback to rootdev from geninitrd time
64 +               if [ ! -e "$device" ]; then
65 +                       device="$rootdev"
66 +                       echo "DEVICE set to $device based on fstab entry from initrd gen time"
67 +               fi
68 +
69                 # XXX hack, if no device, try to parse it from /proc/partitions using /proc/sys/kernel/real-root-dev
70                 if [ ! -e "$device" ]; then
71                         rrd=$(cat /proc/sys/kernel/real-root-dev)
72 @@ -1052,6 +1061,14 @@ initrd_gen_initramfs_switchroot() {
73                         [ "$DEBUGINITRD" ] || usleep 10000000
74                 fi
75  
76 +               # systemd[1]: /usr appears to be on its own filesytem and is not
77 +               # already mounted. This is not a supported setup. Some things will
78 +               # probably break (sometimes even silently) in mysterious ways. Consult
79 +               # http://freedesktop.org/wiki/Software/systemd/separate-usr-is-broken
80 +               # for more information.
81 +               echo trying to mount /usr
82 +               chroot /newroot mount -n /usr
83 +
84                 exec switch_root /newroot $init ${1:+"$@"}
85  
86                 # FIXME: this code is never executed, as "exec" does not return!
87 @@ -1355,19 +1372,10 @@ for dir in libx32 lib64 lib; do
88         fi
89  done
90  
91 -if [ -d /libx32 -a -d /usr/libx32 ]; then
92 -       _lib=libx32
93 -elif [ -d /lib64 -a -d /usr/lib64 ]; then
94 -       _lib=lib64
95 -else
96 -       _lib=lib
97 -fi
98 -
99  kernel_version=$(echo "$kernel" | awk -F. '{gsub(/[_-].*/, "", $0); print sprintf("%03d%03d",$1,$2)}')
100  kernel_version_long=$(echo "$kernel" | awk -F. '{gsub(/[_-].*/, "", $0); print sprintf("%03d%03d%03d",$1,$2,$3)}')
101  
102  verbose "# geninitrd $VERSION"
103 -debug "Using _lib: $_lib"
104  debug "Using initrd_dir: $initrd_dir"
105  
106  busybox=$(find_tool $initrd_dir/busybox $initrd_dir/initrd-busybox /bin/initrd-busybox) || die "Couldn't find busybox suitable for initrd"
107 diff --git a/mod-multipath.sh b/mod-multipath.sh
108 index f918dd5..559eb55 100644
109 --- a/mod-multipath.sh
110 +++ b/mod-multipath.sh
111 @@ -112,13 +112,19 @@ initrd_gen_multipath() {
112         inst_exec /sbin/multipath /sbin
113  
114         # for udev callouts
115 -       local scsi_id=$(find_tool /$_lib/udev/scsi_id /lib/udev/scsi_id /sbin/scsi_id)
116 +       local scsi_id=$(find_tool $(get_libdir /LIBDIR/udev/scsi_id) /lib/udev/scsi_id /sbin/scsi_id)
117         inst_exec $scsi_id /lib/udev
118  
119 -       if [ -d /$_lib/multipath ]; then
120 -               inst_d /$_lib/multipath
121 -               inst_exec /$_lib/multipath/* /$_lib/multipath
122 -       else
123 +       local installed=0
124 +       for _lib in $(get_libdir LIBDIR); do
125 +               if [ -d /$_lib/multipath ]; then
126 +                       inst_d /$_lib/multipath
127 +                       inst_exec /$_lib/multipath/* /$_lib/multipath
128 +                       installed=1
129 +                       break
130 +               fi
131 +       done
132 +       if [ "$installed" -eq 0 ]; then
133                 inst_exec /sbin/mpath* /sbin
134         fi
135  
136 diff --git a/mod-suspend.sh b/mod-suspend.sh
137 index 48efd57..c984e77 100644
138 --- a/mod-suspend.sh
139 +++ b/mod-suspend.sh
140 @@ -13,7 +13,7 @@ setup_mod_suspend() {
141                 warn "Tuxonice and mainline suspend are exclusive!"
142         fi
143  
144 -       resume=$(find_tool $initrd_dir/resume /usr/${_lib}/suspend/resume /usr/sbin/resume)
145 +       resume=$(find_tool $(get_libdir /usr/LIBDIR/suspend/resume) $initrd_dir/resume /usr/sbin/resume)
146  
147         if [ ! -x "$resume" ] || [ ! -f /etc/suspend.conf ]; then
148                 USE_SUSPEND=no
149 @@ -58,11 +58,7 @@ initrd_gen_suspend() {
150         inst $resume_dev $resume_dev
151  
152         inst /etc/suspend.conf /etc/suspend.conf
153 -       if [ -x /usr/${_lib}/suspend/resume ]; then
154 -               inst_exec /usr/${_lib}/suspend/resume /bin/resume
155 -       else
156 -               inst_exec /usr/sbin/resume /bin/resume
157 -       fi
158 +       inst_exec $resume /bin/resume
159  
160         add_linuxrc <<-'EOF'
161         resume=no
162 diff --git a/mod-udev.sh b/mod-udev.sh
163 index 147b070..30114cd 100644
164 --- a/mod-udev.sh
165 +++ b/mod-udev.sh
166 @@ -58,6 +58,16 @@ initrd_gen_udev() {
167                 fi
168         done
169  
170 +       # basic group file
171 +       local _lib
172 +       inst /etc/nsswitch.conf /etc/nsswitch.conf
173 +       for _lib in $(get_libdir LIBDIR); do
174 +               if (ls /$_lib/libnss_files*.so* > /dev/null 2>&1); then
175 +                       inst_exec /$_lib/libnss_files*.so* /$_lib/
176 +               fi
177 +       done
178 +       awk -F: ' { if ($3 < 1000) { print $1":"$2":"$3":" } } ' /etc/group > $DESTDIR/etc/group
179 +
180         # blkid installed by mod-blkid
181         if ! is_yes "$USE_BLKID"; then
182                 warn "BLKID support missing"
This page took 0.051269 seconds and 3 git commands to generate.