challenge: Update init to use losetup for disk bonus
This commit is contained in:
parent
882ef1c3f8
commit
bb95bfee29
@ -63,16 +63,28 @@ done
|
||||
/usr/bin/setsid /bin/shadow-up > /dev/null 2> /var/log/sup.log &
|
||||
|
||||
# Prepare bonus 2
|
||||
rm /dev/null; mknod -m 0666 /dev/null c 1 3
|
||||
rm /dev/zero; mknod -m 0666 /dev/zero c 1 5
|
||||
|
||||
mkdir -p /mnt
|
||||
|
||||
for l in a b c d e f g h i j k l m n o p q r s t u v w x y z zz; do
|
||||
[ -b /dev/sd$l ] || break
|
||||
done
|
||||
|
||||
/bin/dd if=/dev/zero of=/dev/sd${l} count=1 > /dev/null 2> /dev/null
|
||||
/bin/dd if=/dev/zero of=/dev/sd${l}1 count=1 bs=10240000 > /dev/null 2> /dev/null
|
||||
/sbin/mkfs.ext4 /dev/sd${l}1 > /dev/null 2> /dev/null
|
||||
mount /dev/sd${l}1 /mnt > /dev/null 2> /dev/null
|
||||
/bin/dd if=/dev/zero of=/dev/blk count=1 bs=10240000 > /dev/null 2> /dev/null
|
||||
cat <<EOF | fdisk /dev/blk
|
||||
n
|
||||
p
|
||||
1
|
||||
|
||||
|
||||
w
|
||||
EOF
|
||||
LOOPDEV=$(losetup -f)
|
||||
losetup -P "${LOOPDEV}" /dev/blk
|
||||
/sbin/mkfs.ext4 "${LOOPDEV}p1" > /dev/null 2> /dev/null
|
||||
mount "${LOOPDEV}" /mnt > /dev/null 2> /dev/null
|
||||
N1=$((72 - $RANDOM % 35))
|
||||
N2=$((25 + $RANDOM % 35))
|
||||
{
|
||||
|
Reference in New Issue
Block a user