FreeBSD ¤ò¥¼¥í¤«¤éÀßÄꤹ¤ë¤Ë¤Ï

Jens Schweikhardt

$FreeBSD: head/ja_JP.eucJP/articles/fbsd-from-scratch/article.xml 39632 2012-10-01 11:56:00Z gabor $

$FreeBSD: head/ja_JP.eucJP/articles/fbsd-from-scratch/article.xml 39632 2012-10-01 11:56:00Z gabor $

FreeBSD ¤Ï The FreeBSD Foundation ¤ÎÅÐÏ¿¾¦É¸¤Ç¤¹¡£

Adobe, Acrobat, Acrobat Reader ¤ª¤è¤Ó PostScript ¤Ï ¥¢¥á¥ê¥«¹ç½°¹ñ¤ª¤è¤Ó/¤Þ¤¿¤Ï¤½¤Î¾¤Î¹ñ¤Î Adobe Systems Incorporated ¤ÎÅÐÏ¿¾¦É¸¤Þ¤¿¤Ï¾¦É¸¤Ç¤¹¡£

À½Â¤¼Ô¤ª¤è¤ÓÈÎÇä¼Ô¤¬À½Éʤò¶èÊ̤¹¤ë¤Î¤Ë ÍѤ¤¤Æ¤¤¤ëɽ¼¨¤Î¿¤¯¤Ï¡¢¾¦É¸¤È¤µ¤ì¤Æ¤¤¤Þ¤¹¡£ ¤³¤Îʸ½ñ¤ËÅо줹¤ëɽ¼¨¤Î¤¦¤Á FreeBSD Project ¤¬¤½¤Î¾¦É¸¤ò³Îǧ¤·¤Æ¤¤¤ë¤â¤Î¤Ë¤Ï¡¢¤½¤Îɽ¼¨¤Ë³¤¤¤Æ “™” ¤Þ¤¿¤Ï “®” µ­¹æ¤¬¤ª¤«¤ì¤Æ¤¤¤Þ¤¹¡£


¤³¤Îµ­»ö¤Ï¡¢¡ÖFreeBSD ¤ò¥¼¥í¤«¤éÀßÄꤹ¤ë (FreeBSD From Scratch)¡×¤È¤¤¤¦¡¢ ¤ï¤¿¤·¤Î¸Ä¿ÍŪ¤Ê·Ð¸³¤ò¤Þ¤È¤á¤¿¤â¤Î¤Ç¤¹¡£ ¥«¥¹¥¿¥Þ¥¤¥º¤·¤¿ FreeBSD ¥·¥¹¥Æ¥à¤ò¥½¡¼¥¹¤«¤é¥³¥ó¥Ñ¥¤¥ë¤·¡¢ ¤µ¤é¤Ë¹¥¤ß¤Î ports ¤Î¥³¥ó¥Ñ¥¤¥ë¤·¤Æ¡¢ ¤¢¤Ê¤¿¤¬Ë¾¤à¹½À®¤Î¥·¥¹¥Æ¥à¤Î¡¢ ´°Á´¤Ë¼«Æ°²½¤µ¤ì¤¿¥¤¥ó¥¹¥È¡¼¥ë¤ò¼Â¸½¤·¤Þ¤¹¡£ make world ¤¬¤¹¤Ð¤é¤·¤¤¹Í¤¨Êý¤À¤È¤ª»×¤¤¤ÎÊý¤Ë¤È¤Ã¤Æ¡¢ ¡ÖFreeBSD ¤ò¥¼¥í¤«¤éÀßÄꤹ¤ë¡×¤Ï¡¢¤Þ¤µ¤Ë make world ¤ò make evenmore (¤µ¤é¤Ë¤½¤ÎÀè) ¤Ø¤È¹­¤²¤ë¤â¤Î¤Ë¤Ê¤ë¤³¤È¤Ç¤·¤ç¤¦¡£


1. ¤Ï¤¸¤á¤Ë

º£¤Þ¤Ç¤Ë make world ¤ò»È¤Ã¤Æ¥·¥¹¥Æ¥à¤ò¥¢¥Ã¥×¥°¥ì¡¼¥É¤·¤¿·Ð¸³¤Ï¤¢¤ë¤Ç¤·¤ç¤¦¤«? ¤â¤·¥Ç¥£¥¹¥¯¤Ë°ì¤Ä¤Î¥·¥¹¥Æ¥à¤·¤«Æþ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤ÏÌäÂê¤Ç¤¹¡£ installworld ¤¬ÅÓÃæ¤Ç»ß¤Þ¤Ã¤Æ¤·¤Þ¤Ã¤¿¤é¡¢ ¤¢¤Ê¤¿¤Î¥·¥¹¥Æ¥à¤Ï²õ¤ì¤¿¤Þ¤Þ¡¢¤â¤¦µ¯Æ°¤·¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤¦¤«¤âÃΤì¤Þ¤»¤ó¡£ ¤¢¤ë¤¤¤Ï¡¢installworld ¤¬Àµ¾ï¤Ë½ªÎ»¤·¤Æ¤â¡¢ ¿·¤·¤¤¥«¡¼¥Í¥ë¤Ïµ¯Æ°¤Ë¼ºÇÔ¤·¤Æ¤·¤Þ¤¦¤«¤âÃΤì¤Þ¤»¤ó¡£ ¤µ¤Æ¡¢¤½¤¦¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿¤é¡¢Fixit CD ¤ò¼è¤ê½Ð¤·¤ÆȾǯÁ°¤Î¥Ð¥Ã¥¯¥¢¥Ã¥×¤òÌ᤹¡¢ ¤Ê¤ó¤Æ¤Ï¤á¤Ë¤Ê¤Ã¤Æ¤·¤Þ¤¦¤«¤âÃΤì¤Þ¤»¤ó¤è¤Í¡£

¤ï¤¿¤·¤Ï¡¢“¥¢¥Ã¥×¥°¥ì¡¼¥É¤Î»þ¤Ï¥Ç¥£¥¹¥¯¤ò½é´ü²½¤¹¤ë” ¤È¤¤¤¦ÊýË¡¤¬¤è¤¤¤È¹Í¤¨¤Æ¤¤¤Þ¤¹¡£¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤Ç¤Ï¤Ê¤¯¥Ç¥£¥¹¥¯Á´ÂΤΥǡ¼¥¿¤ò ¾Ãµî¤¹¤ë¤³¤È¤Ç¡¢¥¢¥Ã¥×¥°¥ì¡¼¥É¤Î¼ê½ç¤Ç¤Ï̵»ë¤µ¤ì¤ë¤è¤¦¤Ê¸Å¤¤¥Ç¡¼¥¿¤¬ »Ä¤Ã¤Æ¤·¤Þ¤¦¤³¤È¤òËɤ°¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤¿¤À¡¢ ¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤òÁ´Éô½é´ü²½¤¹¤ë¤È¤¤¤¦¤³¤È¤Ï¡¢ ports/packages ¤ò¤¹¤Ù¤ÆºÆ¥³¥ó¥Ñ¥¤¥ë¡¦ºÆ¥¤¥ó¥¹¥È¡¼¥ë¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤º¡¢ ÀßÄê¥Õ¥¡¥¤¥ë¤âÃí°Õ¿¼¤¯ºîÀ®¤·Ä¾¤µ¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¤È¤¤¤¦¤³¤È¤Ç¤¹¡£ ¤³¤¦¤¤¤¦ºî¶È¤ò¼«Æ°²½¤·¤¿¤¤¤È»×¤¤¤Þ¤»¤ó¤«? ¤½¤¦»×¤¦¿Í¤Ï¡¢¤³¤ÎÀè¤òÆɤ߿ʤá¤Þ¤·¤ç¤¦¡£


2. ¤É¤¦¤·¤Æ¡ÖFreeBSD ¤ò¥¼¥í¤«¤éÀßÄꤹ¤ë¡×(¤¢¤ë¤¤¤Ï¡Ö¡Á¤·¤Ê¤¤¡×) ¤³¤È¤¬É¬ÍפʤΤ«

¤³¤ì¤Ï¤â¤Ã¤È¤â¤Ê¼ÁÌä¤Ç¤¹¡£ ¤¹¤Ç¤Ë sysinstall ¤¬¤¢¤ê¤Þ¤¹¤·¡¢ ¥«¡¼¥Í¥ë¤È¥æ¡¼¥¶¥é¥ó¥É¥Ä¡¼¥ë¤ò¥³¥ó¥Ñ¥¤¥ë¤¹¤ëÊýË¡¤Ë¤Ï¡¢ ¤â¤Ã¤Èͭ̾¤ÊÊýË¡¤¬Â¾¤Ë¤â¤¢¤ë¤«¤é¤Ç¤¹¡£

sysinstall ¤ÎÌäÂê¤Ï¡¢¡Ö²¿¤ò¡¢¤É¤³¤Ë¡¢ ¤É¤¦¤ä¤Ã¤Æ¥¤¥ó¥¹¥È¡¼¥ë¤¹¤ë¤Î¤«¡×¤¬Èó¾ï¤Ë¸ÂÄꤵ¤ì¤Æ¤¤¤ë¤È¤¤¤¦ÅÀ¤Ç¤¹¡£

¥·¥¹¥Æ¥àÁ´ÂΤò¹½ÃÛ¤·¤Æ¥¤¥ó¥¹¥È¡¼¥ë¤¹¤ëÊýË¡¤Ï¡¢ ¥Ï¥ó¥É¥Ö¥Ã¥¯¤Ë¤¢¤ëÊýË¡¤¬Í­Ì¾¤Ç¤¹¡£ ¤³¤ì¤Ï¥Ç¥Õ¥©¥ë¥È¤Ç´û¸¤Î¥·¥¹¥Æ¥à¤òÃÖ¤­´¹¤¨¤ë¤â¤Î¤Ç¡¢ ¥«¡¼¥Í¥ë¤È¥â¥¸¥å¡¼¥ë¤À¤±¤¬Êݸ¤µ¤ì¡¢ ¥·¥¹¥Æ¥à¥Ð¥¤¥Ê¥ê¡¢¥Ø¥Ã¥À¡¢¤½¤Î¾¤Î¿¤¯¤Î¥Õ¥¡¥¤¥ë¤Ï¾å½ñ¤­¤µ¤ì¤Þ¤¹¡£ »È¤ï¤ì¤Ê¤¯¤Ê¤Ã¤¿¸Å¤¤¥Õ¥¡¥¤¥ë¤Ï¤½¤Î¤Þ¤Þ»Ä¤ê¡¢ Æ°ºî¤ËÌäÂ꤬½Ð¤ë¤³¤È¤â¤¢¤ê¤Þ¤¹¡£ ²¿¤é¤«¤ÎÍýͳ¤Ç¥¢¥Ã¥×¥°¥ì¡¼¥É¤Ë¼ºÇÔ¤¹¤ë¤È¡¢ ¥·¥¹¥Æ¥à¤ò¸µ¤Î¾õÂÖ¤ËÌ᤹¤ë¤³¤È¤ÏÉÔ²Äǽ¤«¡¢¤Ç¤­¤Æ¤âÈó¾ï¤Ëº¤Æñ¤Ç¤¹¡£

¡ÖFreeBSD ¤ò¥¼¥í¤«¤éÀßÄꤹ¤ë¡×ÊýË¡¤Ï¡¢¤³¤ì¤é¤ÎÌäÂê¤ò¤¹¤Ù¤Æ²ò·è¤Ç¤­¤Þ¤¹¡£ ¹Í¤¨Êý¤Ïñ½ã¤Ç¤¹¡£ ²ÔƯÃæ¤Î¥·¥¹¥Æ¥à¤ò»È¤Ã¤Æ¶õ¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ë¥·¥¹¥Æ¥à¤ò¥¤¥ó¥¹¥È¡¼¥ë¤·¤Þ¤¹¡£ ¤½¤Î»þ¡¢¤½¤Î¿·¤·¤¤¥·¥¹¥Æ¥à¤Î¥Ç¥£¥ì¥¯¥È¥ê¥Ä¥ê¡¼¤Ë¤Ï¡¢ ¿·¤·¤¤¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤òŬÀڤ˥ޥ¦¥ó¥È¤·¤Æ¤ªa¤­¤Þ¤¹¡£ ¿ô¿¤¯¤¢¤ëÀßÄê¥Õ¥¡¥¤¥ë¤Ï¡¢¥³¥Ô¡¼¤Ç¤­¤ë¤â¤Î¤ÏŬÀڤʾì½ê¤Ë¥³¥Ô¡¼¤·¡¢ ¤½¤ì¤¬¤Ç¤­¤Ê¤¤¤â¤Î¤Ë¤Ï mergemaster(8) ¤ò»È¤¤¤Þ¤¹¡£ ¿·¤·¤¤¥·¥¹¥Æ¥à¤ËÂФ¹¤ë¥¤¥ó¥¹¥È¡¼¥ë¸å¤ÎÀßÄê¤Ï¡¢ ¸Å¤¤¥·¥¹¥Æ¥à¤òÆ°ºî¤µ¤»¤Ê¤¬¤é¡¢¿·¤·¤¤¥·¥¹¥Æ¥à¤ËÂФ·¤Æ chroot ¤·¤Æ ¼«Í³¤Ë¹Ô¤Ê¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¶ñÂÎŪ¤Ë¤Ï¡¢ ¥·¥§¥ë¥¹¥¯¥ê¥×¥È¡¢¤â¤·¤¯¤Ï make ¤Î¼Â¹Ô¤Ç¹½À®¤µ¤ì¤ë¡¢¼¡¤Î 3 Ãʳ¬¤Ç¤³¤ì¤é¤ò¼Â¸½¤·¤Þ¤¹¡£

  1. stage_1.sh: ¿·¤·¤¤µ¯Æ°²Äǽ¤Ê¥·¥¹¥Æ¥à¤ò¶õ¤Î¥Ç¥£¥ì¥¯¥È¥ê°Ê²¼¤ËºîÀ®¤·¡¢ ɬÍפʥե¡¥¤¥ë¤ò¥Þ¡¼¥¸¡¢¤â¤·¤¯¤Ï¥³¥Ô¡¼¤·¤Þ¤¹¡£ ¤½¤·¤Æ¡¢¿·¤·¤¤¥·¥¹¥Æ¥à¤òµ¯Æ°¤·¤Þ¤¹¡£

  2. stage_2.sh: ɬÍ×¤Ê ports ¤ò¥¤¥ó¥¹¥È¡¼¥ë¤·¤Þ¤¹¡£

  3. stage_3.mk: ¤Ò¤È¤ÄÁ°¤ÎÃʳ¬¤Ç¥¤¥ó¥¹¥È¡¼¥ë¤·¤¿¥½¥Õ¥È¥¦¥§¥¢¤Î¡¢ ¥¤¥ó¥¹¥È¡¼¥ë¸å¤ÎÀßÄê¤ò¹Ô¤Ê¤¤¤Þ¤¹¡£

¿·¤·¤¤¥·¥¹¥Æ¥à¤ò¹½ÃÛ¤¹¤ë¤¿¤á¤Ë¡ÖFreeBSD ¤ò¥¼¥í¤«¤éÀßÄꤹ¤ë¡×ÊýË¡¤ò»È¤¤¡¢ ¤½¤ì¤¬¿ô½µ´Ö¡¢Ëþ­¤¹¤ëÄøÅÙ¤ËÆ°ºî¤·¤Æ¤¤¤ë¤³¤È¤ò³Îǧ¤·¤¿¤é¡¢ ¤â¤¦°ìÅÙ¤½¤ì¤ò»È¤Ã¤Æ¡¢Â縵¤Î¥·¥¹¥Æ¥à¤òºÆ¥¤¥ó¥¹¥È¡¼¥ë¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£ ¤³¤ì¤«¤é¤Ï¤¤¤Ä¤Ç¤â¹¥¤­¤Ê»þ¤Ë¥·¥¹¥Æ¥à¤ò¹¹¿·¤·¤Æ¡¢ ½é´ü²½¡¦ºÆ¥¤¥ó¥¹¥È¡¼¥ë¤·¤¿¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤ËÀÚ¤êÂؤ¨¤ë¤À¤±¤Ç¤è¤¯¤Ê¤ë¤ï¤±¤Ç¤¹¡£

Linux From Scratch (¤â¤·¤¯¤Ï¾Êά¤·¤Æ LFS) ¤Ë¤Ä¤¤¤Æ¼ª¤Ë¤·¤¿¤ê¡¢»î¤µ¤ì¤¿Êý¤¬¤¤¤é¤Ã¤·¤ã¤ë¤«¤âÃΤì¤Þ¤»¤ó¡£ LFS ¤âƱ¤¸¤è¤¦¤Ë¡¢²ÔƯÃæ¤Î¥·¥¹¥Æ¥à¤ò»È¤Ã¤Æ¥·¥¹¥Æ¥à¤ò¥¼¥í¤«¤é¹½ÃÛ¤·¡¢ ¶õ¤Î¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤Ë¥¤¥ó¥¹¥È¡¼¥ë¤¹¤ëÊýË¡¤¬½ñ¤«¤ì¤Æ¤¤¤Þ¤¹¡£ LFS ¤¬ÏÃÂê¤ÎÃæ¿´¤È¤·¤Æ¤¤¤ë¤Î¤Ï¡¢(¥«¡¼¥Í¥ë¡¢¥³¥ó¥Ñ¥¤¥é¡¢¥Ç¥Ð¥¤¥¹¡¢ ¥·¥§¥ë¡¢Ã¼Ëö¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ê¤É¤Î) ³Æ¥·¥¹¥Æ¥à¥³¥ó¥Ý¡¼¥Í¥ó¥È¤ÎÌò³ä¤È¡¢ ¤½¤ì¤é¤Î¥¤¥ó¥¹¥È¡¼¥ë¤Î¾ÜºÙ¤ò¸«¤»¤ë¤³¤È¤Î¤è¤¦¤Ç¤¹¡£ ¤³¤Î¡ÖFreeBSD ¤ò¥¼¥í¤«¤éÀßÄꤹ¤ë¡×¤Ç¤Ï¡¢¤½¤Î¤è¤¦¤Ê¾ÜºÙ¤Ë¤Ï¿¨¤ì¤Þ¤»¤ó¡£ ¤ï¤¿¤·¤ÎÌÜŪ¤Ï¡¢¥¤¥ó¥¹¥È¡¼¥ë¤ò½ª¤ï¤ê¤Þ¤Ç¼«Æ°²½¤¹¤ë¤³¤È¤Ç¤¢¤ê¡¢ ¥·¥¹¥Æ¥à¹½ÃÛ»þ¤ÎÅ¥¤¯¤µ¤¤²áÄø¤òÁ´ÉôÀâÌÀ¤¹¤ë¤³¤È¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£ FreeBSD ¤ò¤½¤Î¤è¤¦¤Ê¥ì¥Ù¥ë¤Ç·¡¤ê²¼¤²¤Æ¤ß¤¿¤¤¿Í¤Ï¡¢ /usr/src/Makefile ¤òÆɤó¤Ç¡¢ make buildworld ¤ÎÆ°ºî¤òÄɤ¤¤«¤±¤ë¤È¤³¤í¤«¤é»Ï¤á¤Þ¤·¤ç¤¦¡£

¤Þ¤¿¡¢¡ÖFreeBSD ¤ò¥¼¥í¤«¤éÀßÄꤹ¤ë¡×ÊýË¡¤Ë¤â¡¢ ¼¡¤Î¤è¤¦¤Ê·çÅÀ¤¬¤¢¤ë¤³¤È¤ò¿´¤Ëα¤á¤Æ¤ª¤¤¤Æ¤¯¤À¤µ¤¤¡£


3. Á°Äó¤È¤¹¤ë´Ä¶­

¡ÖFreeBSD ¤ò¥¼¥í¤«¤éÀßÄꤹ¤ë¡×ÊýË¡¤ò¼Â¹Ô¤¹¤ë¤Ë¤Ï¡¢ ¼¡¤Î¤â¤Î¤¬É¬ÍפǤ¹¡£


4. Âè 1 Ãʳ¬: ¥·¥¹¥Æ¥à¤Î¥¤¥ó¥¹¥È¡¼¥ë

¤³¤Îʸ½ñ¤Î½éÈǤǤϡ¢Âè 1 Ãʳ¬¤Ë¤Ò¤È¤Ä¤Î¥·¥§¥ë¥¹¥¯¥ê¥×¥È¤ò»È¤Ã¤Æ¤¤¤Þ¤·¤¿¡£ ¥«¥¹¥¿¥Þ¥¤¥º¤Ï¤¹¤Ù¤Æ¡¢¤½¤Î¥¹¥¯¥ê¥×¥È¤òÊÔ½¸¤¹¤ëɬÍפ¬¤¢¤Ã¤¿¤Î¤Ç¤¹¤¬¡¢ ÍøÍѼԤ«¤é¤Î°Õ¸«¤ò»²¹Í¤Ë¤·¤Æ¡¢¥¹¥¯¥ê¥×¥È¤Î¥³¡¼¥É¤È¥Ç¡¼¥¿¤òʬΥ¤¹¤ë¤³¤È¤Ë¤·¤Þ¤·¤¿¡£ ¤½¤Î¤¿¤á¿·¤·¤¤¥¹¥¯¥ê¥×¥È¤Ç¤Ï¡¢¥³¡¼¥É¥¹¥¯¥ê¥×¥È¤òÊѹ¹¤»¤º¤Ë¡¢ Ê£¿ô¤Î°Û¤Ê¤ë¥·¥¹¥Æ¥à¤Ë°Û¤Ê¤ë¹½À®¤Î¥Ç¡¼¥¿¤òÃÖ¤¯¤³¤È¤¬²Äǽ¤Ë¤Ê¤ê¤Þ¤·¤¿¡£

Âè 1 Ãʳ¬¤Î¥³¡¼¥É¥¹¥¯¥ê¥×¥È¤Ï stage_1.sh ¤Ç¤¢¤ê¡¢¼¡¤Î¤è¤¦¤Ë 1 ¸Ä¤Î°ú¿ô¤ò¤Ä¤±¤Æ¼Â¹Ô¤¹¤ë¤È

# ./stage_1.sh default

ÀßÄê¥Õ¥¡¥¤¥ë¤È¤·¤Æ stage_1.conf.default ¤òÆɤ߹þ¤ß¡¢ ¥í¥°¥Õ¥¡¥¤¥ë¤È¤·¤Æ stage_1.log.default ¤Ë½ñ¤­¹þ¤ß¤Þ¤¹¡£

ʸËö¤Ë¤ï¤¿¤·¤¬»È¤Ã¤Æ¤¤¤ë stage_1.conf.default ¤¬ÅºÉÕ¤·¤Æ¤¢¤ê¤Þ¤¹¡£ ¤¢¤Ê¤¿¤¬¹Í¤¨¤ë “´°àú¤Ê¥·¥¹¥Æ¥à” ¤Ë¹ç¤ï¤»¤Æ¡¢ ³ÆÀßÄê¤ò¥«¥¹¥¿¥Þ¥¤¥º¤·¤Æ¤¯¤À¤µ¤¤¡£¤¢¤Ê¤¿¤¬Êѹ¹¤·¤½¤¦¤ÊÀßÄê¤Ë¤Ï¡¢ ¾ÜºÙ¤Ê¥³¥á¥ó¥È¤òÄɲ䷤Ƥ¢¤ê¤Þ¤¹¡£ÀßÄꥹ¥¯¥ê¥×¥È¤Ç¤Ï¡¢ create_file_systems, create_etc_fstab, copy_files, all_remaining_customization ¤È¤¤¤¦¡¢ 4 ¸Ä¤Î¥·¥§¥ë´Ø¿ô¤òÄ󶡤·¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó (¤³¤ì¤Ï¡¢ stage_1.sh ¤«¤é¸Æ¤Ð¤ì¤ë½ç¤Ë½ñ¤¤¤Æ¤¢¤ê¤Þ¤¹)¡£

¹Íθ¤¹¤Ù¤­ÅÀ¤Ï¡¢°Ê²¼¤Î¤È¤ª¤ê¤Ç¤¹¡£

stage_1.sh ¤ò¼Â¹Ô¤¹¤ëÁ°¤Ë¡¢ make installworld installkernel ¤ò¼Â¹Ô¤¹¤ë¤¿¤á¤ËÄ̾ï¹Ô¤Ê¤¦ºî¶È¤ò´°Î»¤µ¤»¤Æ¤ª¤¤¤Æ¤¯¤À¤µ¤¤¡£ ¤³¤ì¤é¤Ï¡¢¤¿¤È¤¨¤Ð¼¡¤Î¤è¤¦¤Ê¤â¤Î¤Ç¤¹¡£

½é¤á¤Æ stage_1.sh ¤ò¼Â¹Ô¤·¤¿¾ì¹ç¤Ï¡¢ ²ÔƯÃæ¤Î¥·¥¹¥Æ¥à¤«¤é¿·¤·¤¤¥·¥¹¥Æ¥à¤Ø¤È¥³¥Ô¡¼¤µ¤ì¤ëÀßÄê¥Õ¥¡¥¤¥ë¤Ï /usr/src ¤Î¤â¤Î¤ÈÈæ¤Ù¤ë¤È¸Å¤¤¤Î¤Ç¡¢ mergemaster ¤¬¤É¤¦¤¹¤ë¤«¤òʹ¤¤¤Æ¤­¤Þ¤¹¡£ ¤ª¤¹¤¹¤á¤Ï¡¢¤³¤³¤ÇÊѹ¹ÅÀ¤òÅý¹ç¤·¤Æ¤ª¤¯¤³¤È¤Ç¤¹¡£ ¤â¤·¡¢²¿ÅÙ¤â¼ÁÌä¤ËÅú¤¨¤ë¤Î¤¬ÌÌÅݤǤ¢¤ì¤Ð¡¢ ²ÔƯÃæ¤Î¥·¥¹¥Æ¥à¤Î¥Õ¥¡¥¤¥ë¤ò¹¹¿·¤·¤Æ¤ª¤­¤Þ¤·¤ç¤¦ (¤¿¤À¤·¤³¤ì¤Ï¡¢¤½¤¦¤Ç¤­¤ì¤Ð¤ÎÏäǤ¹¡£ -STABLE ¤Î¥·¥¹¥Æ¥à¤ò¼Â¹Ô¤·¤Æ¤¤¤Æ¡¢ -CURRENT ¤ò¹½ÃÛ¤¹¤ë¡¢ ¤â¤·¤¯¤Ï¤½¤ÎµÕ¤Î¤è¤¦¤Ê¥±¡¼¥¹¤Ç¤Ï¡¢¤½¤¦¤·¤Æ¤Ï¤¤¤±¤Þ¤»¤ó)¡£ ¼¡¤Ë mergemaster ¤ò¼Â¹Ô¤·¤¿»þ¡¢ RCS ¥Ð¡¼¥¸¥ç¥ó ID ¤¬ /usr/src ¤Ë¤¢¤ë¥Õ¥¡¥¤¥ë¤È°ìÃפ·¤Æ¤¤¤ë¤â¤Î¤Ï¡¢½èÍý¤¬Èô¤Ð¤µ¤ì¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£

stage_1.sh ¥¹¥¯¥ê¥×¥È¤Ï set -e ¤¬»ØÄꤵ¤ì¤Æ¤ª¤ê¡¢ ºÇ½é¤Î¥³¥Þ¥ó¥É¤¬¼ºÇÔ (½ªÎ»¥³¡¼¥É¤¬ 0 °Ê³°) ¤¹¤ë¤ÈÄä»ß¤·¤Þ¤¹¡£ ¤½¤Î¤¿¤á¡¢¥¨¥é¡¼¤ò¸«Æ¨¤·¤Æ¤·¤Þ¤¦¤È¤¤¤¦¤³¤È¤Ï¤Ê¤¤¤Ç¤·¤ç¤¦¡£ ¤³¤ì¤Ï¡¢¥¿¥¤¥×¥ß¥¹¤Ê¤É¤Ç̤ÄêµÁ¤ÎÊÑ¿ô¤ò»È¤Ã¤¿¾ì¹ç¤Ë¤â¥¨¥é¡¼¤Ë¤Ê¤ê¤Þ¤¹¡£ ¼¡¤Ë¿Ê¤àÁ°¤Ë¡¢stage_1.conf.default ¤Ë¤¢¤ë¥¨¥é¡¼¤òÁ´Éô½¤Àµ¤·¤Æ¤ª¤¤¤Æ¤¯¤À¤µ¤¤¡£

stage_1.sh ¤Ç¤Ï mergemaster ¤¬¼Â¹Ô¤µ¤ì¤Þ¤¹¡£ Åý¹çºî¶È¤ò¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¥Õ¥¡¥¤¥ë¤¬°ì¤Ä¤â¤Ê¤¤¾õÂ֤Ǥ⡢ ¼Â¹Ô¤Î½ª¤ï¤ê¤Ë¼¡¤Î¥á¥Ã¥»¡¼¥¸¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£

*** Comparison complete

Do you wish to delete what is left of /var/tmp/temproot.stage1? [no] no

no ¤ÈÅú¤¨¤ë¤«¡¢ ñ¤Ë Enter ¤ò²¡¤·¤Æ¤¯¤À¤µ¤¤¡£ ¤Ê¤¼¤«¤È¸À¤¦¤È¡¢mergemaster ¤Ï /var/tmp/temproot.stage1 ¤Ë¥µ¥¤¥º¤¬ 0 ¤Î¥Õ¥¡¥¤¥ë¤ò¤¤¤¯¤Ä¤«»Ä¤¹¤«¤é¤Ç¤¹¡£ ¤³¤ì¤Ï¡¢¸å¤Ç¿·¤·¤¤¥·¥¹¥Æ¥à¤Ë (¸ºß¤·¤Ê¤±¤ì¤Ð) ¥³¥Ô¡¼¤µ¤ì¤Þ¤¹¡£

¤³¤Î¸å¡¢¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¤Î¥ê¥¹¥È¤¬¥Ú¡¼¥¸¥ã (¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï more(1) ¤Ç¤¹¡£less(1) ¤ò»È¤¦¤³¤È¤â¤Ç¤­¤Þ¤¹) ¤Ëɽ¼¨¤µ¤ì¤Þ¤¹¡£

*** You chose the automatic install option for files that did not
    exist on your system.  The following were installed for you:
      /newroot/etc/defaults/rc.conf
      ...
      /newroot/COPYRIGHT

(END)

q ¤òÆþÎϤ·¤Æ¥Ú¡¼¥¸¥ã¤ò½ªÎ»¤·¤Þ¤¹¡£ ¤¹¤ë¤È login.conf ¤Ë´Ø¤·¤Æ¡¢¼¡¤Î¤è¤¦¤Ëɽ¼¨¤µ¤ì¤Þ¤¹¡£

*** You installed a login.conf file, so make sure that you run
    '/usr/bin/cap_mkdb /newroot/etc/login.conf'
    to rebuild your login.conf database

    Would you like to run it now? y or n [n]

¤³¤ì¤ËÂФ¹¤ëÅú¤¨¤Ï¤É¤Á¤é¤Ç¤â¹½¤¤¤Þ¤»¤ó¡£ ¤É¤¦Åú¤¨¤Æ¤â¡¢¥¹¥¯¥ê¥×¥È¤«¤é cap_mkdb(1) ¤¬¼Â¹Ô¤µ¤ì¤Þ¤¹¡£

¼¡¤Ë¼¨¤¹¤Î¤Ï¡¢É®¼Ô¤Î»È¤Ã¤Æ¤¤¤ë stage_1.conf.default ¤Ç¤¹¤¬¡¢¤¿¤¯¤µ¤ó¤ÎÉôʬ¤ò½ñ¤­´¹¤¨¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¤Î¤ÇÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£ ¤É¤³¤ò½ñ¤­´¹¤¨¤ì¤Ð¤è¤¤¤Î¤«¤Ë¤Ä¤¤¤Æ¤Ï¡¢¥³¥á¥ó¥È¤òÆɤá¤Ð½½Ê¬Íý²ò¤Ç¤­¤ë¤È»×¤¤¤Þ¤¹¡£

警告newfs(8) ¥³¥Þ¥ó¥É¤Ë¤ÏÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£ ¥Þ¥¦¥ó¥È¤º¤ß¤Î¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤Ë¿·¤·¤¤¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤òºîÀ®¤¹¤ë¤³¤È¤Ï¤Ç¤­¤Ê¤¤¤â¤Î¤Î¡¢ ¤³¤Î¥¹¥¯¥ê¥×¥È¤Ï¥Þ¥¦¥ó¥È¤µ¤ì¤Æ¤¤¤Ê¤¤ /dev/da0s1a, /dev/da0s1e, /dev/da2s1e ¤ò¤¹¤Ù¤Æºï½ü¤·¤Þ¤¹¡£ ¤Ò¤È¤Ä´Ö°ã¤¨¤ì¤Ð¡¢¤¢¤Ê¤¿¤Î´Ä¶­¤òÇ˲õ¤·¤Æ¤·¤Þ¤¦²ÄǽÀ­¤¬¤¢¤ê¤Þ¤¹¤Î¤Ç¡¢ ¥Ç¥Ð¥¤¥¹Ì¾¤ÎÊѹ¹¤ÏÃí°Õ¿¼¤¯¹Ô¤Ê¤Ã¤Æ¤¯¤À¤µ¤¤¡£

# This file: stage_1.conf.default, sourced by stage_1.sh.
#
# $Id: stage_1.conf.default,v 1.5 2011-05-14 20:44:31 hrs Exp $
# $FreeBSD: head/en_US.ISO8859-1/articles/fbsd-from-scratch/stage_1.conf.default 38826 2012-05-17 19:12:14Z hrs $

# Root mount point where you create the new system. Because it is only
# used as a mount point, no space will be used on that file system as all
# files are of course written to the mounted file system(s).
DESTDIR="/newroot"

# Where your src tree is.
SRC="/usr/src"

# Where your obj is.
MAKEOBJDIRPREFIX="/usr/obj"

# Your kernel config name as from make buildkernel KERNCONF=...
KERNCONF="HAL9000"

# Your target architecture as used for make buildworld TARGET=...
# If you did not specify a TARGET when building world, it defaulted
# to the build architecture (run "uname -m" to find out if you are unsure).
TARGET="i386"  # amd64 arm i386 ia64 mips pc98 powerpc sparc64

# Available time zones are those under /usr/share/zoneinfo.
TIMEZONE="Europe/Berlin"


#
# The create_file_systems function must create the mountpoints under
# DESTDIR, create the file systems, and then mount them under DESTDIR.
#
create_file_systems () {
  # The new root file system. Mandatory.
  # Change DEVICE names.
  DEVICE=/dev/daXYZs1a
  mkdir -m 755 -p ${DESTDIR}
  chown root:wheel ${DESTDIR}
  newfs -U ${DEVICE}
  mount -o noatime ${DEVICE} ${DESTDIR}

  # Additional file systems and initial mount points. Optional.
  DEVICE=/dev/daXYZs1e
  mkdir -m 755 -p ${DESTDIR}/var
  chown root:wheel ${DESTDIR}/var
  newfs -U ${DEVICE}
  mount -o noatime ${DEVICE} ${DESTDIR}/var

  DEVICE=/dev/daXYZs1e
  mkdir -m 755 -p ${DESTDIR}/usr
  chown root:wheel ${DESTDIR}/usr
  newfs -U ${DEVICE}
  mount -o noatime ${DEVICE} ${DESTDIR}/usr
}

#
# The create_etc_fstab function must create an fstab matching the
# file systems created in create_file_systems.
#
create_etc_fstab () {
  cat <<EOF >${DESTDIR}/etc/fstab
# Device         Mountpoint          FStype    Options              Dump Pass#
/dev/da0s1b      none                swap      sw                   0    0
/dev/da1s1b      none                swap      sw                   0    0
/dev/da2s2b      none                swap      sw                   0    0
/dev/da3s2b      none                swap      sw                   0    0
/dev/da0s1a      /                   ufs       rw,noatime           1    1
/dev/da0s1e      /var                ufs       rw,noatime           1    1
/dev/da2s1e      /usr                ufs       rw,noatime           1    1
/dev/vinum/Share /share              ufs       rw,noatime           0    2
/dev/vinum/home  /home               ufs       rw,noatime           0    2
/dev/vinum/ncvs  /home/ncvs          ufs       rw,noatime           0    2
/dev/vinum/ports /usr/ports          ufs       rw,noatime           0    2
/dev/ad1s1a      /flash              ufs       rw,noatime           0    0
/dev/ad0s1       /2k                 ntfs      ro,noauto            0    0
/dev/ad0s6       /linux              ext2fs    ro,noauto            0    0
#
/dev/cd0         /cdrom              cd9660    ro,noauto            0    0
/dev/cd1         /dvd                cd9660    ro,noauto            0    0
proc             /proc               procfs    rw                   0    0
linproc          /compat/linux/proc  linprocfs rw                   0    0
EOF
  chmod 644 ${DESTDIR}/etc/fstab
  chown root:wheel ${DESTDIR}/etc/fstab
}

#
# The copy_files function is used to copy files before mergemaster is run.
#
copy_files () {
  # Add or remove from this list at your discretion. Mostly mandatory.
  for f in \
    /.profile \
    /etc/devd.conf \
    /etc/devd.rules \
    /etc/exports \
    /etc/group \
    /etc/hosts \
    /etc/inetd.conf \
    /etc/ipfw.conf \
    /etc/make.conf \
    /etc/master.passwd \
    /etc/nsswitch.conf \
    /etc/ntp.conf \
    /etc/printcap \
    /etc/profile \
    /etc/rc.conf \
    /etc/resolv.conf \
    /etc/src.conf \
    /etc/sysctl.conf \
    /etc/ttys \
    /etc/mail/aliases \
    /etc/mail/aliases.db \
    /etc/mail/hal9000.mc \
    /etc/mail/service.switch \
    /etc/ssh/*key* \
    /etc/ssh/*_config \
    /etc/X11/xorg.conf \
    /var/cron/tabs/* \
    /root/.profile \
    /boot/*.bmp \
    /boot/loader.conf \
    /boot/device.hints ; do
    cp -p ${f} ${DESTDIR}${f}
  done
}

#
# Everything else you want to tune in the new system.
# NOTE: Do not install too many binaries here. With the old system running and
# the new binaries and headers installed you are likely to run into bootstrap
# problems. Ports should be compiled after you have booted in the new system.
#
all_remaining_customization () {
  # Without the compat symlink the linux_base files end up on the root fs:
  cd ${DESTDIR}
  mkdir -m 755 usr/compat; chown root:wheel usr/compat; ln -s usr/compat
  mkdir -m 755 usr/compat/linux;      chown root:wheel usr/compat/linux
  mkdir -m 555 usr/compat/linux/proc; chown root:wheel usr/compat/linux/proc
  mkdir -m 755 boot/grub;             chown root:wheel boot/grub
  mkdir -m 755 linux 2k;              chown root:wheel linux 2k
  mkdir -m 755 src;                   chown root:wheel src
  mkdir -m 755 share;                 chown root:wheel share
  mkdir -m 755 dvd cdrom flash;       chown root:wheel dvd cdrom flash
  mkdir -m 755 home;                  chown root:wheel home
  mkdir -m 755 usr/ports;             chown root:wheel usr/ports

  # Create the ntp and slip log files.
  touch ${DESTDIR}/var/log/ntp ${DESTDIR}/var/log/slip.log

  # Make /usr/src point to the right directory. Optional.
  # Note: some ports need part of the src tree, e.g. emulators/kqemu,
  # sysutils/lsof, sysutils/fusefs, ...
  cd ${DESTDIR}/usr
  if test "${SRC}" != /usr/src; then
    rmdir src; ln -s ${SRC}
  fi
  if test "${MAKEOBJDIRPREFIX}" != /usr/obj; then
    rmdir obj; ln -s ${MAKEOBJDIRPREFIX}
  fi

  # My personal preference is to symlink tmp -> var/tmp. Optional.
  cd ${DESTDIR}; rmdir tmp; ln -s var/tmp

  # Make spooldirs for the printers in my /etc/printcap.
  cd ${DESTDIR}/var/spool/output/lpd; mkdir -p as od ev te lp da
  touch ${DESTDIR}/var/log/lpd-errs

  # If you do not have /home on a shared partition, you may want to copy it:
  # mkdir -p ${DESTDIR}/home
  # cd /home; tar cf - . | (cd ${DESTDIR}/home; tar xpvf -)
}

# vim: tabstop=2:expandtab:shiftwidth=2:syntax=sh:
# EOF $RCSfile: stage_1.conf.default,v $

¥À¥¦¥ó¥í¡¼¥É: stage_1.conf.default .

¤³¤Î¥¹¥¯¥ê¥×¥È¤ò¼Â¹Ô¤¹¤ë¤È¡¢ µ¯Æ°¤·¤¿»þ¤Ë¼¡¤Î¤è¤¦¤Ê¾õÂ֤ˤʤäƤ¤¤ë¥·¥¹¥Æ¥à¤¬¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Þ¤¹¡£

¾¤ÎÉôʬ¤ËÂФ¹¤ëÀßÄê¤Ï¡¢Âè 2 Ãʳ¬¤¬½ª¤ï¤ë¤Þ¤ÇÆ°ºî¤·¤Þ¤»¤ó¡£ ¤¿¤È¤¨¤Ð¡¢¥×¥ê¥ó¥¿¤ä X11 ¤ÎÀßÄê¥Õ¥¡¥¤¥ë¤â¥³¥Ô¡¼¤µ¤ì¤Þ¤¹¤¬¡¢ ¥×¥ê¥ó¥¿¤Ï PostScript® ¥æ¡¼¥Æ¥£¥ê¥Æ¥£¤Ê¤É¡¢ ¥Ù¡¼¥¹¥·¥¹¥Æ¥à¤Ë´Þ¤Þ¤ì¤Ê¤¤¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ò»È¤¦¤³¤È¤¬Â¿¤¤¤Ç¤·¤ç¤¦¡£ X11 ¤Ï¥µ¡¼¥Ð¡¢¥é¥¤¥Ö¥é¥ê¡¢¥×¥í¥°¥é¥à¤ò¥³¥ó¥Ñ¥¤¥ë¤·¤Ê¤¤¤ÈÆ°ºî¤·¤Þ¤»¤ó¡£


5. Âè 2 Ãʳ¬: ports ¤Î¥¤¥ó¥¹¥È¡¼¥ë

注意: ¤³¤ÎÃʳ¬¤Ç ports ¤ò¥³¥ó¥Ñ¥¤¥ë¤¹¤ë¤Î¤Ç¤Ï¤Ê¤¯¡¢ (¥³¥ó¥Ñ¥¤¥ë¤º¤ß¤Î) packages ¤ò¥¤¥ó¥¹¥È¡¼¥ë¤¹¤ë¤³¤È¤â¤Ç¤­¤Þ¤¹¡£ ¤½¤Î¾ì¹ç¡¢stage_2.sh ¤Ï ñ¤Ë pkg_add ¥³¥Þ¥ó¥É¤òÍåÎ󤹤ë¤À¤±¤Ë¤Ê¤ë¤Ç¤·¤ç¤¦¡£ ÆɼԤΤߤʤµ¤ó¤Ë¤È¤Ã¤Æ¡¢¤½¤¦¤¤¤¦¥¹¥¯¥ê¥×¥È¤ò½ñ¤¯¤Î¤ÏÆñ¤·¤¯¤Ê¤¤¤È»×¤¤¤Þ¤¹¤Î¤Ç¡¢ ¤³¤³¤Ç¤Ï¤â¤Ã¤È½ÀÆð¤Ç¡¢ports ¤ò»È¤Ã¤¿ÅÁÅýŪ¤ÊÊýË¡¤Ë¤Ä¤¤¤Æ¹Í¤¨¤ë¤³¤È¤Ë¤·¤Þ¤¹¡£

¼¡¤Ë¾Ò²ð¤¹¤ë stage_2.sh ¥¹¥¯¥ê¥×¥È¤Ï¡¢ ¤ï¤¿¤·¤¬¹¥¤ß¤Î ports ¤ò¥¤¥ó¥¹¥È¡¼¥ë¤¹¤ë¤¿¤á¤Ë»È¤Ã¤¿¤â¤Î¤Ç¤¹¡£ ¤³¤ì¤Ï²¿Å٤Ǥâ¼Â¹Ô¤Ç¤­¡¢¥¤¥ó¥¹¥È¡¼¥ë¤º¤ß¤Î ports ¤¬¤¢¤ì¤Ð¡¢ Èô¤Ð¤·¤Æ½èÍý¤µ¤ì¤Þ¤¹¡£¥¹¥¯¥ê¥×¥È¤Ï ¼Â¹Ô¤»¤º¡¢¼Â¹Ô¤µ¤ì¤ëÆâÍƤÀ¤± ¤òɽ¼¨¤¹¤ë (dryrun) ¥ª¥×¥·¥ç¥ó (-n) ¤¬¤¢¤ê¤Þ¤¹¡£¼Â¹Ô»þ¤Ë¤Ï stage_1.sh ¤ÈƱÍÍ¡¢ ÀßÄꥹ¥¯¥ê¥×¥È¤ò¼¨¤¹¤¿¤á¤Î¤Ò¤È¤Ä¤Î°ú¿ô¤ò»ØÄꤷ¤Þ¤¹¡£

# ./stage_2.sh default

¤³¤ì¤Ï¡¢ports ¤Î¥ê¥¹¥È¤ò stage_2.conf.default ¤È¤¤¤¦¥Õ¥¡¥¤¥ë¤«¤éÆɤ߹þ¤ß¤Þ¤¹¡£

ports ¥ê¥¹¥È¤Ï¡¢¶õÇò¤Ç¶èÀÚ¤é¤ì¤¿ 2 ¸Ä°Ê¾å¤Î¥­¡¼¥ï¡¼¥É¤«¤é¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£ ¥«¥Æ¥´¥ê¡¢port ̾¤Ë»Ï¤Þ¤ê¡¢¥ª¥×¥·¥ç¥ó¤È¤·¤Æ port ¤ò¥³¥ó¥Ñ¥¤¥ë¤·¤Æ¥¤¥ó¥¹¥È¡¼¥ë¤¹¤ë¤¿¤á¤Î¥³¥Þ¥ó¥É (¥Ç¥Õ¥©¥ë¥È¤Ï make install BATCH=yes < /dev/null) ¤¬Â³¤­¤Þ¤¹¡£ ¶õÇò¹Ô¤È # ¤«¤é»Ï¤Þ¤ë¹Ô¤Ï̵»ë¤µ¤ì¤Þ¤¹¡£ ¤ª¤½¤é¤¯Â¿¤¯¤Î¾ì¹ç¤Ë¹Í¤¨¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¤Î¤Ï¡¢¥«¥Æ¥´¥ê̾¤È port ̾¤À¤±¤Ç¤·¤ç¤¦¡£ ports ¤Ë¤è¤Ã¤Æ¤Ï¡¢¤¿¤È¤¨¤Ð¼¡¤Î¤è¤¦¤Ë make ÊÑ¿ô¤ò»È¤Ã¤ÆÈùÄ´À°¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£

www mozilla make WITHOUT_MAILNEWS=yes WITHOUT_CHATZILLA=yes install

¼ÂºÝ¤Ë¤ÏǤ°Õ¤Î¥·¥§¥ë¥³¥Þ¥ó¥É¤ò»ØÄê¤Ç¤­¤Þ¤¹¤Î¤Ç¡¢ make ¤ò»È¤¦°Ê³°¤Ë¤â±þÍѤϲÄǽ¤Ç¤¹¡£

java linux-sun-jdk13 yes | make install
news inn-stable CONFIGURE_ARGS="--enable-uucp-rnews --enable-setgid-inews" make install

news/inn-stable ¤Î¹Ô¤Ï¡¢ CONFIGURE_ARGS ¤È¤¤¤¦ ¥·¥§¥ëÊÑ¿ô¤òÄêµÁ¤·¤¿Îã¤Ç¤¹¡£ ¤³¤Î port ¤Î Makefile ¤Ï¡¢ ¤³¤Î»ØÄꤷ¤¿ÃͤòÊÑ¿ô¤Î½é´üÃͤȤ·¤Æ¡¢¤½¤Î¾¤Îɬ¿Ü¤Î°ú¿ô¤È°ì½ï¤Ë»È¤¤¤Þ¤¹¡£ ¤³¤ì¤È

news inn-stable make CONFIGURE_ARGS="--enable-uucp-rnews --enable-setgid-inews" install

¤Î¤è¤¦¤Ë¤·¤Æ make ÊÑ¿ô¤ò¥³¥Þ¥ó¥É¥é¥¤¥ó¤ËÀßÄꤷ¤¿¾ì¹ç¤È¤Î°ã¤¤¤Ï¡¢ ¤³¤Á¤é¤Î¾ì¹ç¤ËÊÑ¿ô¤½¤Î¤â¤Î¤ò´°Á´¤Ë¾å½ñ¤­¤·¤Æ¤·¤Þ¤¦¤È¤¤¤¦ÅÀ¤Ç¤¹¡£ ¤É¤ÎÊýË¡¤ò»È¤¨¤Ð¤¤¤¤¤Î¤«¤Ë¤Ä¤¤¤Æ¤Ï¡¢³Æ port ¤Ë¤è¤ê¤Þ¤¹¡£

¥¤¥ó¥¹¥È¡¼¥ë¤·¤¿¤¤ ports ¤¬¡¢ ÂÐÏÃŪ¥¤¥ó¥¹¥È¡¼¥ë¤ò»È¤Ã¤Æ¤¤¤Ê¤¤¤³¤È¤ò³Îǧ¤·¤Æ¤¯¤À¤µ¤¤¡£ ports ¤Ï¡¢¤¢¤Ê¤¿¤¬É¸½àÆþÎϤËÌÀ¼¨Åª¤Ë»ØÄꤷ¤¿¤â¤Î°Ê³°¡¢ ɸ½àÆþÎϤòÆɤ߹þ¤àÆ°ºî¤ò¤·¤Æ¤Ï¤¤¤±¤Þ¤»¤ó¡£ ¤â¤· ports ¤¬¤½¤Î¤è¤¦¤Ëºî¤é¤ì¤Æ¤¤¤ë¤È¡¢ports ¤Ï¥Ò¥¢¥É¥­¥å¥á¥ó¥È¤Ë¤¢¤ë ports ¥ê¥¹¥È¤Î¼¡¤Î¹Ô¤òÆɤ߹þ¤ó¤Çº®Í𤷤Ƥ·¤Þ¤¤¤Þ¤¹¡£ stage_2.sh ¤ò¼Â¹Ô¤·¤¿»þ¡¢ ¤¢¤ë port ¤¬Èô¤Ð¤µ¤ì¤¿¤ê¡¢Æ°ºî¤¬»ß¤Þ¤Ã¤Æ¤·¤Þ¤¦¤è¤¦¤Ê¤³¤È¤¬¤¢¤ì¤Ð¡¢ ¤ª¤½¤é¤¯¤³¤ì¤¬¸¶°ø¤Ç¤·¤ç¤¦¡£

¼¡¤Ë¼¨¤¹¤Î¤Ï stage_2.conf.default ¤Ç¤¹¡£ ¤³¤ì¤Ï¡¢¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤ë port ¤½¤ì¤¾¤ì¤ËÂФ·¤Æ LOGDIR/category+port ¤È¤¤¤¦Ì¾Á°¤Î¥í¥°¥Õ¥¡¥¤¥ë¤¬ºîÀ®¤µ¤ì¤Þ¤¹¡£

# vim: syntax=sh
# $Id: stage_2.conf.default,v 1.4 2008-12-03 21:59:51 schweikh Exp $
# $FreeBSD: head/en_US.ISO8859-1/articles/fbsd-from-scratch/stage_2.conf.default 38826 2012-05-17 19:12:14Z hrs $
ports-mgmt portaudit
devel ccache
shells zsh
devel gettext
archivers unzip
archivers zip
security sudo
x11 xorg
x11-servers xorg-server
x11-fonts xorg-fonts-100dpi
x11-fonts xorg-fonts-75dpi
x11-fonts xorg-fonts-miscbitmaps
x11-fonts xorg-fonts-truetype
x11-fonts xorg-fonts-type1
x11-fonts gnu-unifont make install && mkfontdir /usr/local/lib/X11/fonts/local
x11-fonts urwfonts
x11-fonts webfonts
x11-toolkits open-motif
x11-wm ctwm
x11 wdm
security openssh-askpass
astro xplanet
astro xephem
editors vim
print ghostscript8
print psutils-a4
print a2ps-a4
print gv
print transfig
print teTeX
print cups-base
emulators linux_base-fc6
print acroread8 yes accept | make install PAGER=ls
java jdk16 echo true > files/license.sh; make install BATCH=yes < /dev/null
www apache22
www amaya
www firefox3
www checkbot
www p5-HTML-Parser
www validator
www mplayer-plugin
math p5-Math-Combinatorics
math p5-Bit-Vector
graphics evince
graphics xfig
graphics xv
graphics gphoto2
multimedia xawtv
lang expect
lang gawk
lang python
news tin
net freebsd-uucp
net cvsup-without-gui
net rsync
ftp wget
textproc ispell
german ispell-neu
german ispell-alt
textproc docproj
sysutils samefile
sysutils smartmontools
sysutils pstree
sysutils cdrtools
sysutils dvd+rw-tools
sysutils grub
sysutils lsof
devel subversion-freebsd
devel bcc
devel ddd
devel gindent
devel ctags
devel ElectricFence
devel strace
devel perltidy
mail procmail
mail metamail
mail mutt-devel
ports-mgmt portupgrade
news inn CONFIGURE_ARGS="--enable-uucp-rnews --enable-setgid-inews" make BATCH=yes install < /dev/null
misc figlet-fonts
security gpa
mail spamoracle
textproc rman
multimedia mplayer
multimedia mplayer-fonts
multimedia acidrip
multimedia ogle
multimedia ogle-gui
audio pacpl
audio p5-CDDB_get
audio cowbell
shells bash
editors openoffice.org-3-RC
java eclipse
java netbeans

¥À¥¦¥ó¥í¡¼¥É: stage_2.conf.default.


6. Âè 3 Ãʳ¬

Âè 2 Ãʳ¬¤Ç¡¢¹¥¤ß¤Î ports ¤¬¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Þ¤·¤¿¤¬¡¢ ports ¤Ë¤Ï¡¢ÀßÄê¤òɬÍפȤ¹¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤¹¡£ Âè 3 Ãʳ¬¤Ï¡¢¥¤¥ó¥¹¥È¡¼¥ë¸å¤ÎÀßÄê¤ò¹Ô¤Ê¤¦Ãʳ¬¤Ç¤¹¡£ stage_2.sh ¤ÎºÇ¸å¤Ë¤³¤ÎÃʳ¬¤òÅý¹ç¤¹¤ë¤³¤È¤â¤Ç¤­¤¿¤Î¤Ç¤¹¤¬¡¢ ¤ï¤¿¤·¤Ï port ¤ò¥¤¥ó¥¹¥È¡¼¥ë¤¹¤ë¤³¤È¤È½é´üÀßÄê¤òÊѹ¹¤¹¤ë¤³¤È¤¬°Û¤Ê¤ë¹©Äø¤Ç¤¢¤ë¤È¹Í¤¨¤¿¤¿¤á¡¢ ÆÈΩ¤·¤¿Ãʳ¬¤È¤·¤Æ¤¤¤Þ¤¹¡£

Âè 3 Ãʳ¬¤Ï¡¢Makefile ¤È¤·¤Æ¼ÂÁõ¤·¤Æ¤¤¤Þ¤¹¡£ ¤³¤ì¤Ï¡¢¼¡¤Î¤è¤¦¤Ë¼Â¹Ô¤¹¤ë¤³¤È¤Ç¡¢ÀßÄêÂоݤò´Êñ¤ËÁª¤Ö¤³¤È¤¬¤Ç¤­¤ë¤«¤é¤Ç¤¹¡£

# make -f stage_3.mk target

stage_2.sh ¤ÎÃʳ¬¤Ç¡¢ stage_3.mk ¤ò¶¦Í­¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤ËÃÖ¤¯¤«¡¢ ¿·¤·¤¤¥·¥¹¥Æ¥à¤Î¤É¤³¤«¤Ë¥³¥Ô¡¼¤¹¤ë¤Ê¤É¤·¤Æ¡¢ ¿·¤·¤¤¥·¥¹¥Æ¥à¤¬µ¯Æ°¤·¤¿»þ¤Ë stage_3.mk ¤¬»È¤¨¤ë¤è¤¦¤Ë¤·¤Æ¤ª¤­¤Þ¤·¤ç¤¦¡£


7. À©¸Â»ö¹à

ÂÐÏÃŪ¤Ç¡¢¤«¤Ä make BATCH=YES install ¤Ç¤Î¥¤¥ó¥¹¥È¡¼¥ë¤ËÂбþ¤·¤Æ¤¤¤Ê¤¤ port ¤Î¼«Æ°¥¤¥ó¥¹¥È¡¼¥ë¤ÏÆñ¤·¤¤¤«¤âÃΤì¤Þ¤»¤ó¡£ ÂÐÏÃŪ¤Ë¥¤¥ó¥¹¥È¡¼¥ë¤¹¤ë ports ¤Ë¤Ï¡¢¥é¥¤¥»¥ó¥¹¾ò¹à¤ÎƱ°Õ¤ò¿Ò¤Í¤é¤ì¤¿»þ¤Ë yes ¤ÈÆþÎϤ¹¤ë¤À¤±¤Î¤â¤Î¤¬¤¤¤¯¤Ä¤«¤¢¤ê¤Þ¤¹¡£ ¤½¤Î¤è¤¦¤ËÆþÎϤ¬É¸½àÆþÎϤ«¤éÆɤߤȤé¤ì¤ë¾ì¹ç¤Ï¡¢ ŬÀڤʲóÅú¤ò¥¤¥ó¥¹¥È¡¼¥ë¥³¥Þ¥ó¥É (Ä̾ï¤Ï make install) ¤Ë¥Ñ¥¤¥×¤ÇÅϤ¹¤³¤È¤¬¤Ç¤­¤Þ¤¹ (¤ï¤¿¤·¤¬ stage_2.conf.default ¤Î java/linux-sun-jdk14 ¤Ç¤È¤Ã¤¿ÊýË¡¤¬¤½¤¦¤Ç¤¹)¡£

¤·¤«¤·¤³¤ÎÊýË¡¤Ï¡¢¤¿¤È¤¨¤Ð editors/staroffice52 ¤Î¾ì¹ç¤Ë¤Ï¤¦¤Þ¤¯Æ°¤­¤Þ¤»¤ó¡£ ¤³¤ì¤Ï X11 ¤¬¼Â¹Ô¤µ¤ì¤Æ¤¤¤ë¤³¤È¤òÍ׵᤹¤ë¤«¤é¤Ç¤¹¡£ ¥¤¥ó¥¹¥È¡¼¥ë¼ê½ç¤Ë¤Ï¿¤¯¤Î¥¯¥ê¥Ã¥¯¤äʸ»úÆþÎϤ¬É¬ÍפʤΤǡ¢ ¾¤Î ports ¤Î¤è¤¦¤Ë¼«Æ°²½¤¹¤ë¤³¤È¤Ï¤Ç¤­¤Þ¤»¤ó¡£ ¤ï¤¿¤·¤Ï¡¢¼¡¤Î¤è¤¦¤Ë¤·¤ÆÌäÂê¤ò²óÈò¤·¤Þ¤·¤¿¡£ ºÇ½é¤Ë¸Å¤¤¥·¥¹¥Æ¥à¤Ç staroffice ¤Î package ¤òºîÀ®¤·¡¢

# cd /usr/ports/editors/staroffice52
# make package
===>  Building package for staroffice-5.2_1
Creating package /usr/ports/editors/staroffice52/staroffice-5.2_1.tbz
Registering depends:.
Creating bzip'd tar ball in '/usr/ports/editors/staroffice52/staroffice-5.2_1.tbz'

¤½¤Î¸å¡¢Âè 2 Ãʳ¬¤Ç¼¡¤Î¤è¤¦¤Ë¤·¤¿¤ï¤±¤Ç¤¹¡£

# pkg_add /usr/ports/editors/staroffice52/staroffice-5.2_1.tbz

¤½¤Î¾¤Ë¡¢ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥¢¥Ã¥×¥°¥ì¡¼¥ÉÌäÂê¤Ëµ¤¤ò¤Ä¤±¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£ °ìÈÌŪ¤Ë¡¢ÀßÄê¥Õ¥¡¥¤¥ë¤Î½ñ¼°¤äÆâÍƤ¬¤¤¤ÄÊѹ¹¤µ¤ì¤ë¤«¤òÃΤ뤳¤È¤Ï¤Ç¤­¤Þ¤»¤ó¡£ ¿·¤·¤¤¥°¥ë¡¼¥×¤¬ /etc/group ¤ËÄɲ䵤ì¤ë¤«¤âÃΤì¤Þ¤»¤ó¤·¡¢/etc/passwd ¤Ë¿·¤·¤¤¥Õ¥£¡¼¥ë¥É¤¬Äɲ䵤ì¤ë¤«¤âÃΤì¤Þ¤»¤ó¡£ ¤³¤Î¤è¤¦¤ÊÎã¤Ï¡¢¼ÂºÝ¤Ë²áµî¤Ë¤¢¤ê¤Þ¤·¤¿¡£ ñ½ã¤Ë¸Å¤¤¥·¥¹¥Æ¥à¤«¤é¿·¤·¤¤¥·¥¹¥Æ¥à¤ËÀßÄê¥Õ¥¡¥¤¥ë¤ò¥³¥Ô¡¼¤¹¤ë¤À¤±¤Ç ¤Û¤È¤ó¤É¤Î¾ì¹ç¤Ï½½Ê¬¤Ê¤Î¤Ç¤¹¤¬¡¢»þ¤Ë¤ÏÉÔÅÔ¹ç¤Ê¾ì¹ç¤â¤¢¤ê¤Þ¤¹¡£ ¸Å¤¤¥Õ¥¡¥¤¥ë¤ò¾å½ñ¤­¤¹¤ëÊýË¡¤Ç¥·¥¹¥Æ¥à¤ò¥¢¥Ã¥×¥°¥ì¡¼¥É¤·¤¿¤é¡¢ ¥í¡¼¥«¥ë¤Ë¤¢¤ëÀßÄê¥Õ¥¡¥¤¥ë¤Ë¿·¤·¤¯Äɲ䵤줿¤«¤âÃΤì¤Ê¤¤¹àÌܤòÅý¹ç¤¹¤ëÌÜŪ¤Ç mergemaster ¤ò»È¤¦¤È»×¤¤¤Þ¤¹¡£ ¤·¤«¤·»ÄÇ°¤Ê¤³¤È¤Ë¡¢mergemaster ¤Ï¥Ù¡¼¥¹¥·¥¹¥Æ¥à¤Ë¸ºß¤¹¤ë¥Õ¥¡¥¤¥ë¤À¤±¤Ç¡¢¥¤¥ó¥¹¥È¡¼¥ë¤·¤¿ ports ¤Ë¤Ä¤¤¤Æ¤Ï²¿¤â½èÍý¤ò¹Ô¤Ê¤Ã¤Æ¤¯¤ì¤Þ¤»¤ó¡£ ¥µ¡¼¥É¥Ñ¡¼¥Æ¥£À½¥½¥Õ¥È¥¦¥§¥¢¤Ë¤Ï¡¢ ¥ê¥ê¡¼¥¹¤Î¤¿¤Ó¤ËÀßÄê¥Õ¥¡¥¤¥ë¤Î¥Õ¥©¡¼¥Þ¥Ã¥È¤¬Êѹ¹¤µ¤ì¡¢ ¤ï¤¿¤·¤ò¥¤¥é¥¤¥é¤µ¤»¤ë¤è¤¦¤Ê¤â¤Î¤â¤¢¤ê¤Þ¤¹¡£ ¤³¤Î¤è¤¦¤Êͽ¹ð¤Ê¤·¤ÎÊѹ¹¤ò¸¡½Ð¤¹¤ë¤¿¤á¤Ë¡¢ ¤ï¤¿¤·¤ÏÊѹ¹¤·¤¿ÀßÄê¥Õ¥¡¥¤¥ë¤ò stage_3.mk ¤ÈƱ¤¸¥Ç¥£¥ì¥¯¥È¥ê¤Ë¥³¥Ô¡¼¤·¤Æ¤ª¤­¡¢ make ¥ë¡¼¥ë¤ò»È¤Ã¤Æ·ë²Ì¤òÈæ³Ó¤·¤Æ¤¤¤Þ¤¹¡£ ¤¿¤È¤¨¤Ð¡¢apache ¤Î httpd.conf ¤Ç¤¢¤ì¤Ð¡¢¼¡¤Î¤è¤¦¤Ê config_apache ¤È¤¤¤¦¥¿¡¼¥²¥Ã¥È¤òÍÑ°Õ¤·¤Æ¤ª¤­¤Þ¤¹¡£


@if ! cmp -s /usr/local/etc/apache2/httpd.conf httpd.conf; then \
    echo "ATTENTION: the httpd.conf has changed. Please examine if"; \
    echo "the modifications are still correct. Here is the diff:"; \
    diff -u /usr/local/etc/apache2/httpd.conf httpd.conf; \
fi

º¹Ê¬¤¬Ìµ³²¤Ê¤â¤Î¤Ç¤¢¤ë¤È³Îǧ¤Ç¤­¤¿¤é¡¢ cp /usr/local/etc/apache2/httpd.conf httpd.conf ¤ò¼Â¹Ô¤¹¤ë¤ï¤±¤Ç¤¹¡£

¤ï¤¿¤·¤Ï 5-CURRENT ¤«¤é 5-CURRENT ¤Ë¹¹¿·¤¹¤ë¤¿¤á¤Ë ¡ÖFreeBSD ¤ò¥¼¥í¤«¤éÀßÄꤹ¤ë¡×ÊýË¡¤ò¿ô²ó»È¤¤¤Þ¤·¤¿¤¬¡¢ 4-STABLE ¤È 5-CURRENT ¤Î´Ö¤Ç¹¹¿·¤ò¹Ô¤Ê¤Ã¤¿·Ð¸³¤Ï¤¢¤ê¤Þ¤»¤ó¡£ °Û¤Ê¤ë¥á¥¸¥ã¡¼¥ê¥ê¡¼¥¹ÈÖ¹æ¤Î´Ö¤Ï¡¢Èó¾ï¤Î¿¿ô¤ÎÊѹ¹¤¬¹Ô¤Ê¤ï¤ì¤Æ¤¤¤ë¤¿¤á¡¢ ¹¹¿·ºî¶È¤Ï¤â¤Ã¤ÈÊ£»¨¤Ê¤â¤Î¤Ë¤Ê¤ë¤È»×¤¤¤Þ¤¹¡£ (»î¤·¤¿¤ï¤±¤Ç¤Ï¤Ê¤¤¤Î¤Ç¤¹¤¬) 4-STABLE ¤«¤é 4-STABLE ¤Ø¤Î¹¹¿·¤Ç¤¢¤ì¤Ð¡¢¡ÖFreeBSD ¤ò¥¼¥í¤«¤éÀßÄꤹ¤ë¡×ÊýË¡¤ÏÌäÂê¤Ê¤¯Æ°ºî¤¹¤ë¤Ï¤º¤Ç¤¹¡£ 4-STABLE ¤Î¥æ¡¼¥¶¤Ï¡¢¼¡¤ÎÅÀ¤ò¹Íθ¤·¤Æ¤¯¤À¤µ¤¤¡£

注意: ¥Ç¥Ð¥¤¥¹¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à devfs(5) ¤ò»È¤Ã¤Æ¤Ê¤±¤ì¤Ð¡¢ all_remaining_customization ¤ÎÃæ¤Ç MAKEDEV(8) ¤ò»È¤¤¡¢ ¥Ï¡¼¥É¥¦¥§¥¢ÍѤΥǥХ¤¥¹¥Õ¥¡¥¤¥ë¤òºîÀ®¤¹¤ë¤È¤è¤¤¤Ç¤·¤ç¤¦¡£


8. ¥Õ¥¡¥¤¥ë

¤³¤³¤Ç¤Ï¡¢¤¹¤Ç¤ËÀâÌÀ¤·¤¿ÀßÄê¥Õ¥¡¥¤¥ë¤Î¾¤ËɬÍפʡ¢ 3 ¸Ä¤Î¥Õ¥¡¥¤¥ë¤ò¼¨¤·¤Þ¤¹¡£

¤³¤ì¤Ï stage_1.sh ¥¹¥¯¥ê¥×¥È¤Ç¤¹¡£ÆâÍƤòÊѹ¹¤¹¤ëɬÍפϤʤ¤¤Ç¤·¤ç¤¦¡£

#!/bin/sh
#
# stage_1.sh - FreeBSD From Scratch, Stage 1: System Installation.
#              Usage: ./stage_1.sh profile
#              will read profile
#              and write ./stage_1.log.profile
#
# Author:      Jens Schweikhardt
# $Id: stage_1.sh,v 1.7 2008-12-11 19:48:21 schweikh Exp $
# $FreeBSD: head/en_US.ISO8859-1/articles/fbsd-from-scratch/stage_1.sh 38826 2012-05-17 19:12:14Z hrs $

PATH=/bin:/usr/bin:/sbin:/usr/sbin

# Prerequisites:
#
# a) Successfully completed "make buildworld" and "make buildkernel"
# b) Unused partitions (at least one for the root fs, probably more for
#    the new /usr and /var, to your liking.)
# c) A customized profile file.

if test $# -ne 1; then
  echo "usage: stage_1.sh profile" 1>&2
  exit 1
fi

# ---------------------------------------------------------------------------- #
# Step 1: Create an empty directory tree below $DESTDIR.
# ---------------------------------------------------------------------------- #

step_one () {
  create_file_systems
  # Now create all the other directories. Mandatory.
  cd ${SRC}/etc; make distrib-dirs DESTDIR=${DESTDIR} TARGET=${TARGET}
}

# ---------------------------------------------------------------------------- #
# Step 2: Fill the empty /etc directory tree and put a few files in /.
# ---------------------------------------------------------------------------- #

step_two () {
  copy_files

  # Delete mergemaster's temproot, if any.
  TEMPROOT=/var/tmp/temproot.stage1
  if test -d ${TEMPROOT}; then
    chflags -R 0 ${TEMPROOT}
    rm -rf ${TEMPROOT}
  fi
  export MAKEDEVPATH="/bin:/sbin:/usr/bin"
  mergemaster -i -m ${SRC}/etc -t ${TEMPROOT} -D ${DESTDIR}
  cap_mkdb ${DESTDIR}/etc/login.conf
  pwd_mkdb -d ${DESTDIR}/etc -p ${DESTDIR}/etc/master.passwd

  # Mergemaster does not create empty files, e.g. in /var/log. Do so now,
  # but do not clobber files that may have been copied with copy_files.
  cd ${TEMPROOT}
  find . -type f | sed 's,^\./,,' |
  while read f; do
    if test -r ${DESTDIR}/${f}; then
      echo "${DESTDIR}/${f} already exists; not copied"
    else
      echo "Creating empty ${DESTDIR}/${f}"
      cp -p ${f} ${DESTDIR}/${f}
    fi
  done
  chflags -R 0 ${TEMPROOT}
  rm -rf ${TEMPROOT}
}

# ---------------------------------------------------------------------------- #
# Step 3: Install world.
# ---------------------------------------------------------------------------- #

step_three () {
  cd ${SRC}
  make installworld DESTDIR=${DESTDIR} TARGET=${TARGET}
}

# ---------------------------------------------------------------------------- #
# Step 4: Install kernel and modules.
# ---------------------------------------------------------------------------- #

step_four () {
  cd ${SRC}
  # The loader.conf and device.hints are required by the installkernel target.
  # If you have not copied them in Step 2, cp them as shown in the next 2 lines.
  #   cp sys/boot/forth/loader.conf ${DESTDIR}/boot/defaults
  #   cp sys/${TARGET}/conf/GENERIC.hints ${DESTDIR}/boot/device.hints
  make installkernel DESTDIR=${DESTDIR} KERNCONF=${KERNCONF} TARGET=${TARGET}
}

# ---------------------------------------------------------------------------- #
# Step 5: Install /etc/fstab and time zone info.
# ---------------------------------------------------------------------------- #

step_five () {
  create_etc_fstab

  # Setup time zone info; pretty much mandatory.
  cp ${DESTDIR}/usr/share/zoneinfo/${TIMEZONE} ${DESTDIR}/etc/localtime
  if test -r /etc/wall_cmos_clock; then
    cp -p /etc/wall_cmos_clock ${DESTDIR}/etc/wall_cmos_clock
  fi
}

# ---------------------------------------------------------------------------- #
# Step 6: All remaining customization.
# ---------------------------------------------------------------------------- #

step_six () {
  all_remaining_customization
}

do_steps () {
  echo "PROFILE=${PROFILE}"
  echo "TARGET=${TARGET}"
  echo "DESTDIR=${DESTDIR}"
  echo "SRC=${SRC}"
  echo "KERNCONF=${KERNCONF}"
  echo "TIMEZONE=${TIMEZONE}"
  echo "TYPE=${TYPE}"
  echo "REVISION=${REVISION}"
  echo "BRANCH=${BRANCH}"
  echo "RELDATE=${RELDATE}"
  step_one
  step_two
  step_three
  step_four
  step_five
  step_six
}

# ---------------------------------------------------------------------------- #
# The ball starts rolling here.
# ---------------------------------------------------------------------------- #

PROFILE="$1"
set -x -e -u # Stop for any error or use of an undefined variable.
. ${PROFILE}

# Determine a few variables from the sources that were used to make the
# world. The variables can be used to modify actions, e.g. depending on
# the system's version. The __FreeBSD_version numbers
# for RELDATE are documented in the Porter's Handbook,
# doc/en_US.ISO8859-1/books/porters-handbook/freebsd-versions.html.
# Scheme is:  <major><two digit minor><0 if release branch, otherwise 1>xx
# The result will be something like
#
#   TYPE="FreeBSD"
#   REVISION="8.0"
#   BRANCH="RC"      { "CURRENT", "STABLE", "RELEASE" }
#   RELDATE="800028"
#
eval $(awk '/^(TYPE|REVISION|BRANCH)=/' ${SRC}/sys/conf/newvers.sh)
RELDATE=$(awk '/^[ \t]*#[ \t]*define[ \t][ \t]*__FreeBSD_version[ \t]/ {
                print $3
              }' ${SRC}/sys/sys/param.h)

echo "=> Logging to stage_1.${PROFILE}.log"
do_steps 2>&1 | tee "stage_1.${PROFILE}.log"

# vim: tabstop=2:expandtab:shiftwidth=2:
# EOF $RCSfile: stage_1.sh,v $

¥À¥¦¥ó¥í¡¼¥É: stage_1.sh.

¤³¤ì¤Ï stage_2.sh ¥¹¥¯¥ê¥×¥È¤Ç¤¹¡£ºÇ½é¤ÎÉôʬ¤Ë¤¢¤ëÊÑ¿ô¤òÊѹ¹¤·¤Þ¤·¤ç¤¦¡£

#!/bin/sh
#
# stage_2.sh - FreeBSD From Scratch, Stage 2: Ports Installation.
#              Usage: ./stage_2.sh [-hnp] configname
#
# Author:      Jens Schweikhardt
# $Id: stage_2.sh,v 1.5 2004-07-19 21:02:26 schweikh Exp $
# $FreeBSD: head/en_US.ISO8859-1/articles/fbsd-from-scratch/stage_2.sh 38826 2012-05-17 19:12:14Z hrs $

DBDIR="/var/db/pkg"
PORTS="/usr/ports"
: ${PACKAGES:=${PORTS}/packages}
LOGDIR="/home/root/setup/ports.log"; mkdir -p ${LOGDIR}
PKG_PATH="/cdrom/packages/All:/dvd/packages/All"
PKG=

MYNAME="$(basename $0)"
usage () {
	exec >&2
	echo "usage: ${MYNAME} [-hnp] configname"
	echo ""
	echo "  Options:"
	echo "  -h    Print this help text."
	echo "  -n    Dryrun: just show what would be done."
	echo "  -p    Install a precompiled package if one can be found."
	echo ""
	echo "  The config file (stage_2.conf.configname) is a list of"
	echo "  ports to install with one entry per line. Each line"
	echo "  consists of two or three space separated fields:"
	echo "  category, port, and optionally a build command."
	echo ""
	exit 1
}

# Look for a package in these locations in sequence.
# Returns as soon as the first is found. Result on stdout.
#
#   ${PORTS}/${CATEGORY}/${NAME}
#   ${PACKAGES}/All
#   ${PACKAGES}/${CATEGORY}
#   ${PKG_PATH}
#
find_package () {
	echo "${PORTS}/${CATEGORY}/${NAME}:${PACKAGES}/All:${PACKAGES}/${CATEGORY}:${PKG_PATH}" |
	tr : '\n' |
	while read d; do
		test -d "${d}" || continue
		PKG=$(ls ${d}/${PKGNAME}.* 2>/dev/null)
		test $? -eq 0 && echo "${PKG}" && return
	done
}

#
# Parse command line arguments.
#
args=`getopt hnp $*`
if test $? != 0; then
	usage
fi
set -- $args
DRYRUN=
CHKPKG=
for i; do
	case "$i" in
	-n) DRYRUN="yes"; shift;;
	-p) CHKPKG="yes"; shift;;
	--) shift; break;;
	*) usage;;
	esac
done
if test $# -eq 1; then
	DATAFILE="$1"
else
	usage
fi

#
# Loop over the ports list.
#
while read CATEGORY NAME CMD; do
	case "${CATEGORY}" in
	\#*) continue;;
	'') continue;;
	esac
	DIR="${PORTS}/${CATEGORY}/${NAME}"
	if ! test -d "${DIR}"; then
		echo "$DIR does not exist -- ignored"
		continue
	fi
	cd ${DIR}
	PKGNAME=`make -V PKGNAME`
	if test -n "${CHKPKG}"; then
		PKG=$(find_package)
	else
		PKG=""
	fi
	if test -d "${DBDIR}/${PKGNAME}"; then
		echo "${CATEGORY}/${NAME} already installed as ${PKGNAME}"
		continue
	fi
	LOG="${LOGDIR}/${CATEGORY}+${NAME}"
	echo "===> Installing ${CATEGORY}/${NAME}; logging to ${LOG}"
	test -n "${CMD}" || CMD="make install BATCH=yes < /dev/null"
	if test -n "${DRYRUN}"; then
		if test -n "${PKG}"; then
			echo pkg_add -v ${PKG}
		else
			echo "${CMD}"
		fi
		continue
	fi
	date "++++ Started %v %T +++" > ${LOG}
	STARTED=$(date +%s)
	(
		if test -n "${PKG}"; then
			echo "Found package ${PKG}"
			pkg_add -v ${PKG}
		else
			echo "CMD: ${CMD}"
			make clean
			eval "${CMD}"
			make clean # Uncomment if diskspace is tight under ${PORTS}.
		fi
	) 2>&1 | tee -a ${LOG}
	FINISHED=$(date +%s)
	DURATION=$(dc -e "${FINISHED} ${STARTED} - p")
	date "++++ Finished %v %T after ${DURATION} secs +++" >> ${LOG}
done < stage_2.conf.${DATAFILE}

# vim: tabstop=4:
# EOF $RCSfile: stage_2.sh,v $

¥À¥¦¥ó¥í¡¼¥É: stage_2.sh.

¤³¤ì¤Ï¡¢¤ï¤¿¤·¤¬»È¤Ã¤Æ¤¤¤ë stage_3.mk ¤Ç¤¹¡£ ÀßÄê¤ò¼«Æ°Åª¤Ë¤ª¤³¤Ê¤¦¤¿¤á¤Î¼ê½ç¤ò¡¢¤³¤³¤ËÆþ¤ì¤Þ¤¹¡£

# stage_3.mk - FreeBSD From Scratch, Stage 3: Ports Post-Configuration.
#              Usage: make -f stage_3.mk all     (configure everything)
#                or   make -f stage_3.mk target  (just configure target)
#
# Author:      Jens Schweikhardt
#
# It is a good idea to make sure any target can be made more than
# once without ill effect.
#
# $Id: stage_3.mk,v 1.5 2008-12-03 21:59:51 schweikh Exp $
# $FreeBSD: head/en_US.ISO8859-1/articles/fbsd-from-scratch/stage_3.mk 38826 2012-05-17 19:12:14Z hrs $

.POSIX:

message:
	@echo "Please use one of the following targets:"
	@echo "config_apache"
	@echo "config_cups"
	@echo "config_firefox"
	@echo "config_inn"
	@echo "config_javaplugin"
	@echo "config_openoffice"
	@echo "config_sudo"
	@echo "config_TeX"
	@echo "config_tin"
	@echo "config_wdm"
	@echo "config_uucp"
	@echo "all -- all of the above"

all: \
	config_apache \
	config_cups \
	config_firefox \
	config_inn \
	config_javaplugin \
	config_openoffice \
	config_sudo \
	config_TeX \
	config_tin \
	config_wdm \
	config_uucp

APACHE = apache22
config_apache:
	# 1. Modify httpd.conf.
	perl -pi \
	-e 's/^\s*ServerAdmin.*/ServerAdmin schweikh\@schweikhardt.net/;' \
	-e 's/^#?ServerName .*/ServerName hal9000.schweikhardt.net:80/;' \
	-e 's/^\s*Listen.*/Listen 127.0.0.1:80/;' \
	-e 's/^\s*Deny from all/    Allow from 127.0.0.1/i;' \
	-e 's,/usr/local/www/$(APACHE)/cgi-bin/,/home/opt/www/cgi-bin/,;' \
	  /usr/local/etc/$(APACHE)/httpd.conf
	cp w3c-validator.conf /usr/local/etc/$(APACHE)/Includes
	# 2. Restore symlinks to web pages.
	cd /usr/local/www/$(APACHE)/data && \
	ln -fs /home/schweikh/prj/homepage schweikhardt.net && \
	ln -fs /home/opt/www/test .
	# 3. Restore W3C Validator config.
	mkdir -p /etc/w3c
	cp /usr/local/www/validator/htdocs/config/validator.conf.sample \
		/etc/w3c/validator.conf
	perl -pi \
	-e 's/^Allow Private IPs.*/Allow Private IPs = yes/;' \
		/etc/w3c/validator.conf
	# Test if the httpd.conf has changed.
	@if ! cmp -s /usr/local/etc/$(APACHE)/httpd.conf httpd.conf; then \
		echo "ATTENTION: the httpd.conf has changed. Please examine if"; \
		echo "the modifications are still correct. If so you can simply"; \
		echo "cp /usr/local/etc/$(APACHE)/httpd.conf httpd.conf"; \
		echo "to make this message go away. Here is the diff:"; \
		diff -u /usr/local/etc/$(APACHE)/httpd.conf httpd.conf; \
	fi
	if test -f /var/run/httpd.pid; then \
		/usr/local/etc/rc.d/$(APACHE) stop; \
		/usr/local/etc/rc.d/$(APACHE) start; \
	else \
		/usr/local/etc/rc.d/$(APACHE) start; \
	fi

# The original ppd file is from http://www.cups.org/ppd.php?L63+I0+T+Q2300
# = http://www.cups.org/ppd/hp/de/hpc2325s.ppd.gz
config_cups:
	chmod 644 /usr/local/etc/cups/cupsd.conf
	cp printers.conf /usr/local/etc/cups/printers.conf
	cp LaserJet_2300d.ppd /usr/local/etc/cups/ppd/LaserJet_2300d.ppd

config_firefox:
	# Make this group wheel writable to allow extensions being installed.
	chmod -R g+w /usr/local/lib/firefox3/chrome

config_inn:
	pw usermod -n news -d /usr/local/news -s /bin/sh
	mkdir -p /share/news/spool/outgoing \
	         /share/news/spool/incoming \
	         /share/news/spool/articles \
	         /share/news/spool/overview \
	         /share/news/spool/tmp      \
	         /share/news/db
	chown -R news:news /share/news
	# Give the news system its initial configuration.
	cd /home/root/setup && \
	if test ! -f /share/news/db/active; then \
		echo "installing /share/news/db/active"; \
		install -C -o news -g news -m 664 active /share/news/db; \
	fi; \
	if test ! -f /share/news/db/newsgroups; then \
		echo "installing /share/news/db/newsgroups"; \
		install -C -o news -g news -m 664 newsgroups /share/news/db; \
	fi
	# Configure storage method.
	cd /home/root/setup &&    \
	printf "%s\n%s\n%s\n%s\n" \
		"method tradspool {"  \
		"  newsgroups: *"     \
		"  class: 0"          \
		"}"                   \
	>storage.conf &&          \
	install -C -o news -g news -m 664 storage.conf /usr/local/news/etc
	# Configure newsfeeds.
	printf "%s\n%s\n" \
		"ME:*::"      \
		"shuttle/news2.shuttle.de:!junk,!control:B32768/512,Tf,Wfb:" \
	>/usr/local/news/etc/newsfeeds
	# Configure inn.conf.
	perl -pi                                                        \
	-e 's/^#*\s*(organization:\s*).*/$$1"An Open Pod Bay Door"/;'   \
	-e 's/^#*\s*(pathhost:\s*).*/$$1hal9000.schweikhardt.net/;'     \
	-e 's/^#*\s*(server:).*/$$1 localhost/;'                        \
	-e 's/^#*\s*(domain:).*/$$1 schweikhardt.net/;'                 \
	-e 's/^#*\s*(fromhost:).*/$$1 schweikhardt.net/;'               \
	-e 's,^#*\s*(moderatormailer:).*,$$1 \%s\@moderators.isc.org,;' \
	-e 's,^#*\s*(pathdb:\s*).*,$$1/share/news/db,;'                 \
	-e 's,/usr/local/news/spool,/share/news/spool,;'                \
	/usr/local/news/etc/inn.conf
	# Create empty history, if none there.
	# See post-install in /usr/ports/news/inn-stable/Makefile.
	set -e; cd /share/news/db; \
	if test ! -f history; then \
		touch history; \
		chmod 644 history; \
		chown news:news history; \
		su -fm news -c "/usr/local/news/bin/makedbz -i"; \
		for s in dir hash index; do \
			mv history.n.$${s} history.$${s}; \
		done; \
	fi
	# Configure send-uucp.
	echo shuttle:shuttle >/usr/local/news/etc/send-uucp.cf
	# Satisfy inncheck:
	set -e; cd /usr/local/news/etc; \
	chown news:news *; \
	chmod 640 control.ctl expire.ctl nntpsend.ctl readers.conf
	/usr/local/news/bin/inncheck
	# Test if the inn.conf has changed.
	@if ! cmp -s /usr/local/news/etc/inn.conf inn.conf; then \
		echo "ATTENTION: the inn.conf has changed. Please examine if"; \
		echo "the modifications are still correct. If so you can simply"; \
		echo "cp /usr/local/news/etc/inn.conf inn.conf"; \
		echo "to make this message go away. Here is the diff:"; \
		diff -u /usr/local/news/etc/inn.conf inn.conf; \
	fi
	if ! test -f /usr/local/news/run/innd.pid; then \
		/usr/local/etc/rc.d/innd start; \
	fi

config_javaplugin:
	cd /usr/local/lib/firefox3/plugins && \
	  ln -fs /usr/local/jdk1.6.0/jre/plugin/$$(uname -m)/ns7/libjavaplugin_oji.so

config_openoffice:
	# Copy some truetype files so ooo can use them.
	find /usr/local/openoffice.org* -type d -name truetype \
		-exec echo cp *.ttf {} \; -exec cp *.ttf {} \;

config_sudo:
	if ! grep -q schweikh /usr/local/etc/sudoers; then \
		echo 'schweikh ALL = (ALL) NOPASSWD: ALL' >> /usr/local/etc/sudoers; \
	fi
	chmod 440 /usr/local/etc/sudoers

config_TeX:
	# textproc/docproj advises: to typeset the FreeBSD Handbook with JadeTeX,
	# change the following settings to the listed values:
	perl -pi                                      \
	-e 's/^% original texmf.cnf/% texmf.cnf/;'    \
	-e 's/^(hash_extra\s*=\s*).*/$${1}60000/;'    \
	-e 's/^(pool_size\s*=\s*).*/$${1}1000000/;'   \
	-e 's/^(max_strings\s*=\s*).*/$${1}70000/;'   \
	-e 's/^(save_size\s*=\s*).*/$${1}10000/;'     \
	/usr/local/share/texmf/web2c/texmf.cnf
	# Test if the texmf.cnf has changed.
	@if ! cmp -s /usr/local/share/texmf/web2c/texmf.cnf texmf.cnf; then \
		echo "ATTENTION: the texmf.cnf has changed. Please examine if"; \
		echo "the modifications are still correct. If so you can simply"; \
		echo "cp /usr/local/share/texmf/web2c/texmf.cnf texmf.cnf"; \
		echo "to make this message go away. Here is the diff:"; \
		diff -u /usr/local/share/texmf/web2c/texmf.cnf texmf.cnf; \
	fi

config_tin:
	# Point tin to our files.
	printf "%s\n%s\n%s\n"                          \
		"activefile=/share/news/db/active"         \
		"newsgroupsfile=/share/news/db/newsgroups" \
		"spooldir=/share/news/spool/articles"      \
	>/usr/local/etc/tin.defaults

config_wdm:
	cp daemon1-JS-1600x1200.jpg FreeBSD_small.png \
		/usr/local/lib/X11/wdm/pixmaps
	perl -pi \
	-e 's,^(DisplayManager\*wdmBg:).*,\1 pixmap:/usr/local/lib/X11/wdm/pixmaps/daemon1-JS-1600x1200.jpg,;' \
	-e 's,^(DisplayManager\*wdmLogo:).*,\1 /usr/local/lib/X11/wdm/pixmaps/FreeBSD_small.png,;' \
	-e 's,^(DisplayManager\*wdmWm:).*,\1 ctwm:icewm:xfce4:tvtwm,;' \
		/usr/local/lib/X11/wdm/wdm-config
	@if ! cmp -s /usr/local/lib/X11/wdm/wdm-config wdm-config; then \
		echo "ATTENTION: the wdm-config has changed. Please examine if"; \
		echo "the modifications are still correct. If so you can simply"; \
		echo "cp /usr/local/lib/X11/wdm/wdm-config wdm-config"; \
		echo "to make this message go away. Here is the diff:"; \
		diff -u /usr/local/lib/X11/wdm/wdm-config wdm-config; \
	fi

config_uucp:
	cd /etc/mail && make install SENDMAIL_MC=/etc/mail/hal9000.mc
	# Make the uucp user's shell the correct uucico, so su(1) works.
	chpass -s /usr/local/libexec/uucp/uucico uucp
	# UUCP expects to find /usr/bin/rnews.
	cd /usr/bin && ln -fs ../local/news/bin/rnews .
	# Actual UUCP configuration.
	echo nodename js2015           > /usr/local/etc/uucp/config
	echo shuttle js2015 `cat uucp` > /usr/local/etc/uucp/call
	printf 'port tcp\ntype tcp\n'  > /usr/local/etc/uucp/port
	printf "%s\n"                         \
		"call-login    *"                 \
		"call-password *"                 \
		"time          any"               \
		"system        shuttle"           \
		"address       mail.s.shuttle.de" \
		"commands      rmail rnews"       \
		"port          tcp"               \
	>/usr/local/etc/uucp/sys
	cd /usr/local/etc/uucp && chown uucp:uucp * && chmod o-rwx *
	# Trigger uucico after booting.
	mkdir -p /usr/local/etc/rc.d
	cp uucp.sh /usr/local/etc/rc.d
	# Rebuild the aliases.db.
	cp aliases /etc/mail/aliases
	newaliases

# vim: tabstop=4:
# EOF $RCSfile: stage_3.mk,v $

¥À¥¦¥ó¥í¡¼¥É: stage_3.mk.


ËÜʸ½ñ¡¢¤ª¤è¤Ó¾¤Îʸ½ñ¤Ï ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/ ¤«¤é¥À¥¦¥ó¥í¡¼¥É¤Ç¤­¤Þ¤¹¡£

FreeBSD ¤Ë´Ø¤¹¤ë¼ÁÌ䤬¤¢¤ë¾ì¹ç¤Ë¤Ï¡¢¥É¥­¥å¥á¥ó¥È ¤òÆɤó¤À¾å¤Ç <questions@FreeBSD.org> ¤Þ¤Ç (±Ñ¸ì¤Ç) Ï¢Íí¤·¤Æ¤¯¤À¤µ¤¤¡£
ËÜʸ½ñ¤Ë´Ø¤¹¤ë¼ÁÌä¤Ë¤Ä¤¤¤Æ¤Ï¡¢<doc@FreeBSD.org> ¤Þ¤ÇÅŻҥ᡼¥ë¤ò (±Ñ¸ì¤Ç) Á÷¤Ã¤Æ¤¯¤À¤µ¤¤¡£