03-temel-dosya-sistemi-hazirla 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #!/tools/bin/bash
  2. # temel dosya sistemini ilklemek, tools a chroot olurken 1 kere kullanılır.
  3. # yanlışlıkla önsistem içinde yapılmasını önlemek için
  4. [ ! -z $ONSISTEM_CHROOT ] && exit 1
  5. mkdir -pv /{boot,etc/{opt,sysconfig},home,mnt,opt}
  6. mkdir -pv /{media/{floppy,cdrom},srv,var}
  7. install -dv -m 0750 /root
  8. install -dv -m 1777 /tmp /var/tmp
  9. mkdir -pv /usr/{,local/}{bin,include,lib,lib/firmware,src}
  10. mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man}
  11. mkdir -v /usr/{,local/}share/{misc,terminfo,zoneinfo}
  12. mkdir -pv /usr/{,local/}share/man/man{1..8}
  13. ln -sf /usr/bin /bin
  14. ln -sf /usr/bin /usr/sbin
  15. ln -sf /usr/bin /sbin
  16. case $(uname -m) in
  17. x86_64)
  18. ln -sf /usr/lib /lib
  19. ln -sf /usr/lib /lib64
  20. ln -sf /usr/lib /usr/lib64
  21. ;;
  22. esac
  23. mkdir -v /var/{log,mail,spool}
  24. ln -sv /run /var/run
  25. ln -sv /run/lock /var/lock
  26. mkdir -pv /var/{opt,cache,lib/{color,misc,locate},local}
  27. ln -sv /tools/bin/{bash,cat,dd,echo,ln,pwd,rm,stty} /usr/bin
  28. ln -sv /tools/bin/{env,install,perl} /usr/bin
  29. ln -sv /tools/lib/libgcc_s.so{,.1} /usr/lib
  30. ln -sv /tools/lib/libstdc++.{a,so{,.6}} /usr/lib
  31. install -vdm755 /usr/lib/pkgconfig
  32. ln -sv bash /usr/bin/sh
  33. ln -sv /proc/self/mounts /etc/mtab
  34. cat > /etc/passwd << "EOF"
  35. root:x:0:0:root:/root:/bin/bash
  36. bin:x:1:1:bin:/dev/null:/bin/false
  37. daemon:x:6:6:Daemon User:/dev/null:/bin/false
  38. messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false
  39. nobody:x:99:99:Unprivileged User:/dev/null:/bin/false
  40. EOF
  41. cat > /etc/group << "EOF"
  42. root:x:0:
  43. bin:x:1:daemon
  44. sys:x:2:
  45. kmem:x:3:
  46. tape:x:4:
  47. tty:x:5:
  48. daemon:x:6:
  49. floppy:x:7:
  50. disk:x:8:
  51. lp:x:9:
  52. dialout:x:10:
  53. audio:x:11:
  54. video:x:12:
  55. utmp:x:13:
  56. usb:x:14:
  57. cdrom:x:15:
  58. adm:x:16:
  59. messagebus:x:18:
  60. input:x:24:
  61. mail:x:34:
  62. kvm:x:61:
  63. wheel:x:97:
  64. nogroup:x:99:
  65. users:x:999:
  66. EOF
  67. touch /var/log/{btmp,lastlog,faillog,wtmp}
  68. chgrp -v utmp /var/log/lastlog
  69. chmod -v 664 /var/log/lastlog
  70. chmod -v 600 /var/log/btmp
  71. # talimatname yolu
  72. mkdir -p /usr/milis/talimatname
  73. [ -d /tools/share/talimatname ] && cp -rf /tools/share/talimatname/* /usr/milis/talimatname/
  74. # eski onsistem paketlerini içeren db i pasif etmek
  75. mv /var/lib/mps/db /var/lib/mps/db.onsistem
  76. mkdir /var/lib/mps/db
  77. mv /var/log/mps /var/log/mps.onsistem
  78. mkdir -p /var/log/mps/kur
  79. mkdir -p /var/log/mps/sil
  80. # resolv.conf net için
  81. [ -f /tools/etc/resolv.conf ] && cp -fv /tools/etc/resolv.conf /etc/
  82. # hazır betikler - milis-rootfs gibi paketle sunulacak
  83. [ -d /tools/share/bin ] && cp -rf /tools/share/bin/* /usr/bin/
  84. # +h direktifiyle iç yol hashlemesini kullanmayacak
  85. # bu direktif verilmezse bash çalıştırdığı ikilileri hatırlayabilir
  86. exec /tools/bin/bash --login +h