init_script.sh 779 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/mnt/busybox sh
  2. BUSYBOX=/mnt/busybox
  3. $BUSYBOX mkdir -p /dev
  4. $BUSYBOX mknod -m 666 /dev/console c 5 1
  5. $BUSYBOX mknod -m 666 /dev/null c 1 3
  6. $BUSYBOX mknod -m 666 /dev/zero c 1 5
  7. $BUSYBOX mknod -m 666 /dev/sda b 8 0
  8. $BUSYBOX mknod -m 666 /dev/sda1 b 8 1
  9. echo -n -e "deploying busybox... " > /dev/console
  10. $BUSYBOX mkdir -p /bin
  11. $BUSYBOX --install -s /bin
  12. export PATH="/bin"
  13. echo ok > /dev/console
  14. mkdir -p /etc /root /proc
  15. mount -t procfs proc proc
  16. cat > /etc/passwd <<EOF
  17. root:x:0:0:root:/root:/mnt/busybox sh
  18. EOF
  19. cat > /etc/group <<EOF
  20. root:x:0:root
  21. EOF
  22. cat > /etc/profile <<EOF
  23. export PATH=/bin
  24. EOF
  25. cat > /root/.profile <<EOF
  26. export HOME=/root
  27. alias ll="ls -l "
  28. alias la="ls -la "
  29. EOF
  30. exec /mnt/init /bin/sh -l \
  31. < /dev/console > /dev/console 2> /dev/console