mirror of
git://git.2f30.org/morpheus.git
synced 2024-06-27 14:38:33 +00:00
47 lines
609 B
Bash
Executable File
47 lines
609 B
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Ensure you've loaded the loop module with max_part=15
|
|
|
|
if test "$2" = ""; then
|
|
echo "Usage: $0 <rootdir> <imgfile>"
|
|
exit
|
|
fi
|
|
root=$1
|
|
img=$2
|
|
mnt="/mnt/morpheus"
|
|
|
|
set -e -x
|
|
|
|
dd if=/dev/zero of=$img bs=512M count=4
|
|
(
|
|
cat << EOF
|
|
o
|
|
n
|
|
p
|
|
1
|
|
|
|
|
|
a
|
|
1
|
|
w
|
|
EOF
|
|
) | fdisk $img
|
|
|
|
lodev=$(losetup -f)
|
|
losetup "$lodev" "$img"
|
|
partition="$lodev"p1
|
|
mkfs.ext2 -L MORPHEUS $partition
|
|
mkdir -p "$mnt"
|
|
mount $partition "$mnt"
|
|
rmdir "$mnt/lost+found"
|
|
|
|
fakeroot cp -arP "$root"/* "$mnt"
|
|
extlinux --install "$mnt/boot"
|
|
|
|
dd if=stuff/mbr.bin of=$lodev conv=notrunc bs=440 count=1
|
|
sync
|
|
|
|
umount "$mnt"
|
|
sleep 3
|
|
losetup -d $lodev
|