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

48 lines
610 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
2014-03-06 10:26:54 +00:00
set -e -x
2014-02-27 12:41:37 +00:00
root=$1
img=$2
mnt="/mnt/morpheus"
2013-09-20 10:20:41 +00:00
dd if=/dev/zero of=$img bs=512M count=4
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
lodev=$(losetup -f)
losetup "$lodev" "$img"
2013-09-16 11:23:55 +00:00
partition="$lodev"p1
mkfs.ext4 -L MORPHEUS $partition
mkdir -p "$mnt"
mount $partition "$mnt"
rmdir "$mnt/lost+found"
2013-09-16 11:23:55 +00:00
fakeroot cp -arP "$root"/* "$mnt"
extlinux --install "$mnt/boot"
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"
2013-09-16 11:23:55 +00:00
sleep 3
losetup -d $lodev