1
0
mirror of git://git.2f30.org/morpheus.git synced 2024-06-16 12:18:33 +00:00
morpheus/stuff/create-bootable

44 lines
591 B
Plaintext
Raw Normal View History

2014-02-20 16:21:27 +00:00
#!/bin/sh
2013-09-16 11:23:55 +00:00
#
# Ensure you've loaded the loop module with max_part=15
2014-02-27 12:41:37 +00:00
if test "$2" = ""; then
echo "Usage: $0 <rootdir> <imgfile>"
exit
fi
root=$1
img=$2
2013-09-20 10:20:41 +00:00
2014-02-27 12:41:37 +00:00
set -e -x
2013-09-17 18:04:01 +00:00
dd if=/dev/zero of=$img bs=512M count=8
2014-02-20 16:21:27 +00:00
(
cat << EOF
2013-09-16 11:23:55 +00:00
o
n
p
1
a
1
2014-02-20 16:21:27 +00:00
w
EOF
) | fdisk $img
2013-09-16 11:23:55 +00:00
2013-09-17 18:04:01 +00:00
lodev=$(losetup -f --show $img) || exit 1
2013-09-16 11:23:55 +00:00
partition="$lodev"p1
mkfs.ext2 -L MORPHEUS $partition || exit 1
2013-09-16 11:23:55 +00:00
mount $partition /mnt || exit 1
2013-09-17 13:19:04 +00:00
rmdir /mnt/lost+found
2013-09-16 11:23:55 +00:00
2014-02-20 16:29:21 +00:00
fakeroot cp -arP "$root"/* /mnt
extlinux --install /mnt/boot || exit 1
2013-09-16 11:23:55 +00:00
2013-09-16 18:43:29 +00:00
dd if=stuff/mbr.bin of=$lodev conv=notrunc bs=440 count=1
2013-09-16 12:58:37 +00:00
sync
2013-09-16 11:23:55 +00:00
umount /mnt
sleep 3
losetup -d $lodev