summaryrefslogtreecommitdiff
path: root/mkinitramfs
diff options
context:
space:
mode:
authorMichael Tokarev <mjt@tls.msk.ru>2014-12-20 08:48:44 +0000
committerMichael Tokarev <mjt@tls.msk.ru>2014-12-20 08:48:44 +0000
commit489bea7ee8e1dbecfa517b8415568044ab57c73a (patch)
tree44d4878d4c7da3f4908ea9a765ef9b8f9c141756 /mkinitramfs
mdadm (3.3.2-5) unstable; urgency=medium
* use-tempnode-not-devnode.patch: change udev rules file to use $tempnode which works both on wheezy and jessie udev, instead of $devnode which only works in jessie. At this stage it is better to make rules file compatible with old version instead of adding versioned dependency. Should be removed for jessie+1. (Closes: #770883) * fix Closes: list in previous entry (Closes: #771852) # imported from the archive
Diffstat (limited to 'mkinitramfs')
-rw-r--r--mkinitramfs55
1 files changed, 55 insertions, 0 deletions
diff --git a/mkinitramfs b/mkinitramfs
new file mode 100644
index 00000000..c6275ddb
--- /dev/null
+++ b/mkinitramfs
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+# make sure we are being run in the right directory...
+if [ -f mkinitramfs ]
+then :
+else
+ echo >&2 mkinitramfs must be run from the mdadm source directory.
+ exit 1
+fi
+if [ -f /bin/busybox ]
+then : good, it exists
+ case `file /bin/busybox` in
+ *statically* ) : good ;;
+ * ) echo >&2 mkinitramfs: /bin/busybox is not statically linked: cannot proceed.
+ exit 1
+ esac
+else
+ echo >&2 "mkinitramfs: /bin/busybox doesn't exist - please install it statically linked."
+ exit 1
+fi
+
+rm -rf initramfs
+mkdir initramfs
+mkdir initramfs/bin
+make mdadm.static
+cp mdadm.static initramfs/bin/mdadm
+cp /bin/busybox initramfs/bin/busybox
+ln initramfs/bin/busybox initramfs/bin/sh
+cat <<- END > initramfs/init
+ #!/bin/sh
+
+ echo 'Auto-assembling boot md array'
+ mkdir /proc
+ mount -t proc proc /proc
+ if [ -n "$rootuuid" ]
+ then arg=--uuid=$rootuuid
+ elif [ -n "$mdminor" ]
+ then arg=--super-minor=$mdminor
+ else arg=--super-minor=0
+ fi
+ echo "Using $arg"
+ mdadm -Acpartitions $arg --auto=part /dev/mda
+ cd /
+ mount /dev/mda1 /root || mount /dev/mda /root
+ umount /proc
+ cd /root
+ exec chroot . /sbin/init < /dev/console > /dev/console 2>&1
+END
+chmod +x initramfs/init
+
+(cd initramfs
+ find init bin | cpio -o -H newc | gzip --best
+) > init.cpio.gz
+rm -rf initramfs
+ls -l init.cpio.gz