init_rootfs.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. if [ -z $1 ];then
  2. echo "kokdizin parametresi eksik!"
  3. exit 1
  4. else
  5. PKG=$1
  6. fi
  7. [ ! -d $PKG ] && mkdir -pv $PKG
  8. mkdir -pv $PKG/{boot,etc/{opt,sysconfig},home,mnt,opt}
  9. mkdir -pv $PKG/{media/{floppy,cdrom},srv,var}
  10. install -dv -m 0750 $PKG/root
  11. install -dv -m 1777 $PKG/tmp $PKG/var/tmp
  12. mkdir -pv $PKG/usr/{,local/}{bin,include,lib,lib/firmware,src}
  13. mkdir -pv $PKG/usr/{,local/}share/{color,dict,doc,info,locale,man}
  14. mkdir -v $PKG/usr/{,local/}share/{misc,terminfo,zoneinfo}
  15. mkdir -pv $PKG/usr/{,local/}share/man/man{1..8}
  16. ln -sf /usr/bin $PKG/bin
  17. ln -sf /usr/bin $PKG/usr/sbin
  18. ln -sf /usr/bin $PKG/sbin
  19. ln -sf /usr/lib $PKG/lib
  20. ln -sf /usr/lib $PKG/lib64
  21. ln -sf /usr/lib $PKG/usr/lib64
  22. mkdir -v $PKG/var/{log,mail,spool}
  23. ln -sv $PKG/run $PKG/var/run
  24. ln -sv $PKG/run/lock $PKG/var/lock
  25. mkdir -pv $PKG/var/{opt,cache,lib/{color,misc,locate},local}
  26. install -vdm755 $PKG/usr/lib/pkgconfig
  27. ln -sv /proc/self/mounts $PKG/etc/mtab
  28. cat > $PKG/etc/passwd << "EOF"
  29. root:x:0:0:root:/root:/bin/bash
  30. bin:x:1:1:bin:/dev/null:/bin/false
  31. daemon:x:6:6:Daemon User:/dev/null:/bin/false
  32. messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false
  33. nobody:x:99:99:Unprivileged User:/dev/null:/bin/false
  34. EOF
  35. cat > $PKG/etc/group << "EOF"
  36. root:x:0:
  37. bin:x:1:daemon
  38. sys:x:2:
  39. kmem:x:3:
  40. tape:x:4:
  41. tty:x:5:
  42. daemon:x:6:
  43. floppy:x:7:
  44. disk:x:8:
  45. lp:x:9:
  46. dialout:x:10:
  47. audio:x:11:
  48. video:x:12:
  49. utmp:x:13:
  50. usb:x:14:
  51. cdrom:x:15:
  52. adm:x:16:
  53. messagebus:x:18:
  54. input:x:24:
  55. mail:x:34:
  56. kvm:x:61:
  57. wheel:x:97:
  58. nogroup:x:99:
  59. users:x:999:
  60. EOF
  61. touch $PKG/var/log/{btmp,lastlog,faillog,wtmp}
  62. chgrp -v utmp $PKG/var/log/lastlog
  63. chmod -v 664 $PKG/var/log/lastlog
  64. chmod -v 600 $PKG/var/log/btmp
  65. # talimatname yolu
  66. mkdir -p $PKG/usr/milis/talimatname
  67. # mps
  68. #mkdir -p $PKG/var/lib/mps/db
  69. #mkdir -p $PKG/var/log/mps/kur
  70. #mkdir -p $PKG/var/log/mps/sil