ºìÁªLinuxÃÅ»§
Linux°ïÖú

Linux ²Ù×÷ϵͳ°²×°Å̵Ķ¨ÖÆ

·¢²¼Ê±¼ä:2005-11-14 21:37:20À´Ô´:ºìÁª×÷Õß:koov
±¾ÎIJûÊöÈçºÎÒÔÒ»¸öÏÖÓÐµÄ RedHat Linuxϵͳ°²×°ÅÌΪÀ¶±¾£¬¶¨ÖÆ·ûºÏÐèÒªµÄ Linux ϵͳ°²×°ÅÌ¡£


1 ÒýÑÔ
ͨ³£ÓÉÓÚijÖÖʵ¼ÊÓ¦Óã¬ÐèÒªÒ»¸ö°üº¬ËùÓÐ×î½ü¸üеÄRPM°üµÄ²Ù×÷ϵͳ·¢²¼ÅÌ£¬ÒÔ±¸ÔÚ°²×°Ê±Ò»´ÎÍê³ÉËùÓеĸüвÙ×÷£¬»òÕßÊÇÏ붨ÖÆÒ»¸öÓÐ×Ô¼ºÌØÉ«µÄ²Ù×÷ϵͳ·¢²¼ÅÌ£¬È罫×Ô¼º¿ª·¢µÄÓ¦ÓóÌÐòͨ¹ý´´½¨RPM°ü£¬¼ÓÈëµ½²Ù×÷ϵͳÖУ¬ÔÚϵͳ°²×°Ê±Ò»´ÎÍê³É£¬Ðγɰüº¬×Ô¼º²úÆ·µÄ²Ù×÷ϵͳ·¢²¼ÅÌ¡£ÕâЩ¶¼ÐèÒªÖØÐÂÉú³É°²×°ÅÌ£¬¶øÇÒÉú³É°²×°ÅÌÒ²ÊÇÊ®·Ö±ØÒªµÄ£¬ÒòΪ²Ù×÷ϵͳ·¢²¼ÉÌÔÚÿһ´ÎÕýʽ·¢²¼ºó£¬×Ü»á¶ÔһЩ©¶´½øÐиüд¦Àí£¬ÓÐЩ»¹ÊÇÓ밲ȫÏà¹ØµÄ£¬ÔÚÖØÐÂÉú³É°²×°ÅÌʱ¾Í¿ÉÒÔ½«ÕâЩbugÐÞ¸´Ìí¼Ó½øÄã×Ô¼º¶¨ÖƵݲװÅÌÖУ¬¶ÔһЩÉ豸пª·¢µÄÇý¶¯³ÌÐòÌṩ֧³ÖÒ²ÐèÒªÖØÐÂÉú³É°²×°ÅÌ¡£

ÔÚһЩǶÈëʽ¾ßÌåÓ¦ÓÃÖУ¬ÓÉÓÚÆä¶Ô²Ù×÷ϵͳµÄÒªÇó½Ï¾ßÌ壬²»ÐèÒªµ±Ç°²Ù×÷ϵͳ°²×°ÅÌÖÐ×Ô´øµÄÄÇô¶àµÄ¹¦ÄÜ£¬ÈçFedora Core 2µ±Ç°ÓÐ4ÕÅ°²×°ÅÌ£¬Ëü°üº¬ÁËÐí¶àÆäËüµÄÓ¦Óã¬Èçoffice¡¢ÓéÀÖºÍÓÎÏ·µÈµÈ£¬¶øһЩ¾ßÌåµÄÓ¦Óøù±¾²»ÐèÒªÕâô¶àµÄ¹¦ÄÜ£¬Òò´Ë£¬ËüÃdz£³£ÐèÒª»ùÓÚÒ»¸ö°æ±¾µÄ²Ù×÷ϵͳ£¬È»ºó¶ÔÖ®½øÐÐÏàÓ¦µÄ²Ã¼õ£¬Ê¹Ö®ÄÜÂú×ã¾ßÌåÓ¦ÓõÄʵ¼ÊÐèÒª£¬¶ø²»ÐèÒªÆäËüµÄ¶àÓàµÄ¹¦ÄÜ¡£Òò´Ë£¬Í¨¹ý²Ù×÷ϵͳ°²×°Å̵Ķ¨ÖÆ£¬¿ÉÒÔ¸ù¾Ý×Ô¼º»òʵ¼ÊµÄÐèÒª£¬Ñ¡ÔñÓÐÓõÄÈí¼þ°ü£¬×é³É°²×°ÅÌ£¬´Ó¶øͨ¹ý¶¨ÖƲÙ×÷ϵͳµÄ°²×°£¬Âú×ã¾ßÌåÓ¦ÓõÄÐèÒª¡£

ÎÒÃÇÔÚ¶¨ÖƲÙ×÷ϵͳ°²×°ÅÌ֮ǰ£¬±ØÐëÓÐÒ»¸öÀ¶±¾×÷Ϊ°²×°Å̵Ļù´¡£¬±ÈÈçÊÇRed Hat 9.0°²×°ÅÌ»òFedora Core 2°²×°ÅÌ£¬Ò²¿ÉÒÔÊÇRed Hat 9.0»òFedora Core 2°²×°Å̵ÄisoÎļþ£¬ÕâЩÎÒÃÇ¿ÉÒÔ´ÓRed HatµÄÍøÕ¾»òÆäËüһЩÍøÕ¾ÉÏÏÂÔØ¡£ÏÖ¼ÙÉèÎÒÃÇÒѾ­ÓÐÁËFedora Core 2µÄ°²×°ÅÌ£¬ÏÂÃæÎÒÃÇÏÈ´óÂÔ¿´Ò»ÏÂFedora Core 2µÄ°²×°ÅÌÀïÃæµÄÄÚÈÝ¡£

ÔÚ°²×°ÅÌÖÐÓÐÒ»¸öĿ¼ΪFedora,Ëü°üº¬ÁË·¢²¼Å̵ĺËÐÄÄÚÈÝ£¬ÈçÏ£º



drwxr-xr-x 2 root root 2048 May 13 2004 base
drwxr-xr-x 2 root root 77824 May 13 2004 RPMS



RPMSĿ¼°üº¬Fedora Core 2·¢²¼Å̵ÄÖ÷Òª²¿·Ö£¬ËüÊÇһЩRPMÎļþ¡£RPM°üͨ³£°üº¬¶þ½øÖÆ¿ÉÖ´ÐÐÎļþ¡¢ÓйصÄÅäÖÃÎļþºÍÎĵµ£¬ÎÒÃÇ¿ÉÒԲο¼RPM°ïÖúÒÔ»ñµÃ¸ü¶àÐÅÏ¢¡£

base Ŀ¼Öаüº¬Ò»Ð©ÔÚ°²×°¹ý³ÌÖÐËùÐèÒªµÄÎļþ£¬Èçcomps.xmlÎļþ£¬Ëü¶¨ÒåÄĸö×é¼þ°üº¬ÄÄЩRPM°üÒÔ¼°RPM°üÖ®¼äµÄÒÀÀµ¹Øϵ£¬ÐèҪעÒâµÄÊÇ£¬ÔÚcomps.xmlÎļþÖбíʾÄĸö×é¼þÓÐÄÄЩRPM°ü²ÉÓõÄÊÇRPM°üÃû£¬¶ø²»ÊÇ°üµÄÎļþÃû¡£±ÈÈçperl-5.8.3-18.i386.rpmÕâ¸öÎļþÃû£¬ÔÚcomps.xmlÖÐËù±íʾµÄRPM°üÃûΪperl¡£¶ÔÓÚcomps.xmlÎļþ£¬ÎÒÃÇ»áÔÚºóÃæ×÷½øÒ»²½½âÊÍ¡£ÁíÒ»¸öÖØÒªµÄÎļþÊÇhdlistÎļþ£¬Ëü°üº¬ÁËRPMĿ¼ÖеÄËùÓÐRPM°ü´ó²¿·ÖµÄÍ·Îļþ£¬ÕâÒâζ×ÅÔÚRPM°üÖÐÏ໥ÒÀÀµ¹Øϵ¿ÉÒÔͨ¹ý¶ÁÈ¡hdlistÎļþ¶ø¾ö¶¨£¬¶ø²»ÐèÒª¶ÁËùÓеÄRPM°ü¡£hdlistÎļþµÄÁíÒ»¸ö×÷ÓÃÊǽ«°üÃûÓ³Éäµ½ÎļþÃû£¬È罫perl°üÃûÓ³Éäµ½perl-5.8.3-18.i386.rpm£¬ÕâÒâζ×ÅÈç¹ûÄãÏë¸üÐÂRPM°ü»òÌí¼ÓÄã×Ô¼ºµÄ°üµ½RPMĿ¼ÖУ¬Äã¾ÍÐèÒª¸üÐÂhdlistÕâ¸öÎļþ£¬Õâ»áÔÚºóÃæ½øÐÐÃèÊö¡£

2 RPM²Ù×÷
RPM£¨Redhat Package Management£©ÊÇÓÉRedHat¿ª·¢µÄ£¬ÔÚLinuxϵͳϵÄϵͳ°ü¹ÜÀí¹¤¾ß¡£ËüµÄÄ¿±êÊÇ£ºÊ¹°üµÄ°²×°ºÍжÔعý³Ì¸üÈÝÒ×£¬ËüÄܹ»Ö¤ÊµÒ»¸ö°üÊÇ·ñÒѾ­ÕýÈ·°²×°ÁË£¬¿ÉÒÔ¼ò»¯°üµÄ½¨Á¢¹ý³Ì£¬¿ÉÒÔ´ÓÔ´´úÂ뽨Á¢Õû¸ö°ü£¬ËüÄÜÓÃÓÚ²»Í¬µÄÌåϵ½á¹¹¡£RPMϵͳÒѾ­³ÉΪÏÖÔÚLinuxϵͳÏ°ü¹ÜÀí¹¤¾ßÊÂʵÉϵıê×¼£¬²¢ÇÒËüÒ²ÒÆÖ²µ½ºÜ¶àÉÌÒµµÄunixϵͳ֮Ï¡£

RPM°üÓÉ°ü±êÇ©¶ÔËü±êʶ£¬°ü±êÇ©°üº¬Èí¼þÃû£¬Èí¼þ°æ±¾£¬°üµÄ·¢Ðа汾¼¸²¿·Ö¡£ÔÚ°üµÄÄÚ²¿»¹°üº¬°üµÄ½¨Á¢Ê±¼ä£¬°üµÄÄÚÈÝÃèÊö£¬°²×°°üµÄËùÓÐÎļþµÄ´óС£¬Êý×ÖÇ©ÃûÒÔ֤ʵ°üµÄÍêÕûÐÔµÈÐÅÏ¢¡£RMP°ü»¹°üº¬°üÄÚµÄÎļþÐÅÏ¢£¬ÆäÖаüÀ¨£ºÃ¿¸öÎļþµÄÎļþÃû£¬Ã¿¸öÎļþµÄȨÏÞ£¬ÎļþµÄÊô×éºÍÓµÓÐÕߣ¬Ã¿¸öÎļþµÄmd5УÑéºÍ£¬ÎļþµÄÄÚÈݵȡ£

RPM°ü¹ÜÀíϵͳÌṩÁËÏÂÁй¦ÄÜ£º°²×°Ðµİü£¬Ð¶Ôؾɵİü£¬½«Ò»¸ö¾É°üÉý¼¶ÎªÐµİü£¬»ñµÃÒѾ­°²×°°üµÄÐÅÏ¢µÈ¡£

Red Hat·¢²¼ÅÌÖ÷ÒªÊÇÓÉһЩRPM°ü×é³É¡£RPM°üµÄÃû×Ö°üº¬Ò»¸öºó׺£ºarch.rpm£¬arch Ö¸µÄÊÇÌåϵ½á¹¹£¬¶ÔÓÚIntelƽ̨µÄÓÐi386¡¢i586¡¢i686µÈ£¬ÄãËù°²×°µÄ°ü±ØÐëÒªÓë»úÆ÷ÉϵĹ²Ïí¿âµÄ°æ±¾ÏàÆ¥Åä¡£Èç¹ûÄã·¢ÏÖij¸öRPM°üûÓа²×°£¬Äã¿ÉÒÔ×Ô¼º°²×°¡£ÈκÎʱºò£¬Ä㶼¿ÉÒÔ£¨±ØÐëÊÇrootÓû§£©°²×°RPM°ü¡£RPMÃüÁîʹÓÃÇá²Î¿¼Ïà¹Ø×ÊÁÏ¡£

3 RPM°ü´´½¨¹ý³Ì
ΪÁËÍê³ÉRPM°üµÄ´´½¨£¬ÐèÒªÖ´ÐÐÒÔϲ½Ö裺

Ö´ÐÐspecÎļþprep½ÚµÄÃüÁîºÍºê£»
¼ì²éÎļþÁбíµÄÄÚÈÝ£»
Ö´ÐÐspecÎļþbuild½ÚµÄÃüÁîºÍºê£»
Ö´ÐÐspecÎļþinstall½ÚµÄÃüÁîºÍºê£¬Í¬Ê±Ò²Ö´ÐÐÎļþÁбíÖеĺꣻ
´´½¨¶þ½øÖÆ°üÎļþ£»
´´½¨Ô´Âë°ü¡£
ΪÁËÖ´Ðдò°üµÄ¹¤×÷£¬RPMÐèҪһϵÁÐĿ¼Íê³É½¨Á¢µÄ¹¤×÷¡£Õý³£µÄĿ¼½á¹¹Í¨³£ÓÉÒ»¸ö¶¥¼¶Ä¿Â¼ºÍÎå¸ö×ÓĿ¼¹¹³É¡£ÕâÎå¸ö×ÓĿ¼·Ö±ðÊÇ£º

SOURCES------°üº¬Ô­Ê¼µÄÔ´ÎļþºÍ²¹¶¡Îļþ¡£
SPECS--------°üº¬¿ØÖÆRPM°ü½¨Á¢¹ý³ÌµÄspecÎļþ¡£
BUILD--------°üº¬Ô´Âë½â°üºÍÈí¼þ½¨Á¢µÄĿ¼¡£
RPMS---------°üº¬½¨Á¢¹ý³Ì´´½¨µÄ¶þ½øÖÆ°üÎļþ¡£
SRPMS--------°üº¬½¨Á¢¹ý³Ì´´½¨µÄÔ´Âë°üÎļþ¡£
³ýÁËÉÏÊöÕâÎå¸öÖ÷ÒªµÄĿ¼Í⣬ÔÚRPMS»òSRPMSĿ¼ÏÂͨ³£»¹»áÓйØÓÚRPM°üÄ¿±êƽ̨µÄĿ¼¡£ÀýÈ磬i386¡¢i586¡¢i686µÈ´ú±íÓëIntel¼æÈÝcpuµÄƽ̨£¬noarchĿ¼ÏµÄRPM°ü´ú±í¿ÉÒÔÔÚÈκÎƽ̨ÏÂÖ´ÐС£
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 11 ÌõÆÀÂÛ

  1. jeffyyko ÓÚ 2011-10-16 02:36:14·¢±í:

    òËƺܸ´ÔÓ¡£¡£¡£

  2. amengw ÓÚ 2011-10-15 11:54:22·¢±í:

    ÑÏÖØѧϰ£¡

  3. feiying246 ÓÚ 2009-12-11 16:37:20·¢±í:

    {:2_100:}

  4. feiying246 ÓÚ 2009-12-11 16:30:16·¢±í:

    ѧϰÀ²~

  5. Ã÷ÌìÔÙ˵ ÓÚ 2009-12-11 10:23:58·¢±í:

    ding yi ge

  6. cxjnet ÓÚ 2009-12-10 21:49:34·¢±í:

    ºÃ¶«Î÷£¬ÎÒ¾ÍÔÚ¶¨ÖÆÒ»¸öLINUX °²×°ÅÌ

  7. koov ÓÚ 2005-11-14 21:40:53·¢±í:

    5 Éú³ÉisoÓ³Ïó
    µ±Ç°Ãæϵͳ½øÐÐÍøÂç°²×°³É¹¦ºó£¬Ôò¿ÉÒÔÉú³ÉisoÓ³Ïó£¬È»ºó½øÐпÌÅÌ£¬Ö´ÐеIJÙ×÷ÈçÏ£º

    # build disk 1
    cd ~/disc1 /*¼ÙÉèÎÒÃǽ«µÚÒ»ÕÅÅ̵ÄÄÚÈÝ·ÅÖÃÔÚ´ËÍâ*/
    mkisofs -R -J -T -no-emul-boot -boot-load-size 4 -boot-info-table -V fedora -b isolinux/isolinux.bin -c isolinux/boot.cat -o /iso/exm-disc1.iso .
    /*ʹÓÃmkisofs¹¤¾ßÉú³ÉisoÓ³Ï󣬽«Éú³ÉµÄisoÓ³Ïó·ÅÔÚ/isoĿ¼ÖÐ*/
    # build disk 2
    cd ~/disc2 /*²ÉÓÃͬÑùµÄ·½·¨£¬Éú³ÉµÚ¶þ¸öiso£¬ÒÀ´Î¡£*/
    mkisofs -R -J -T -V fedora -o /iso/exm-disc2.iso .

    ÔÚÉú³ÉisoÓ³ÏóÖ®ºó£¬ÐèÒª¶ÔËü½øÐвâÊÔ£¬Äã¿ÉÒÔ½«Ëü¹Ò½Óµ½Ä³¸öµØ·½£¬±ÈÈ磺

    mount -o loop /iso/exm1-disc1.iso /mnt

    ÔÚÉú³É°²×°iso£¨exm-disc1.iso£©Ö®ºó£¬ÎÒÃÇ¿ÉÒÔ½«Ëü¸´ÖƵ½windowsϵͳÖУ¬²ÉÓÿ̼³ÌÐò½øÐп̼£¬È»ºó¿ÉÒÔ´Ó¹âÅÌ°²×°£¬½øÐа²×°²âÊÔ¡£

    ¸½Â¼Ò»£ºkernel-update.sh

    #!/bin/sh

    # current working directory
    BASE=`pwd`

    # generate hdlists
    mkdir -p $BASE/SOURCES
    echo
    echo Copying disc1 to SOURCES directory, please wait...
    cp -Rf $BASE/disc1/* $BASE/SOURCES
    echo Copying disc2 to SOURCES directory, please wait...
    cp -Rf $BASE/disc2/* $BASE/SOURCES
    echo Copying disc3 to SOURCES directory, please wait...
    cp -Rf $BASE/disc3/* $BASE/SOURCES
    echo Copying disc4 to SOURCES directory, please wait...
    cp -Rf $BASE/disc4/* $BASE/SOURCES
    echo

    echo Make sure anaconda, anaconda-runtime is installed...
    rpm -U $BASE/SOURCES/Fedora/RPMS/anaconda-*.rpm

    # generate hdlists*
    cd /usr/lib/anaconda-runtime
    ./genhdlist --withnumbers $BASE/disc1 $BASE/disc2 $BASE/disc3 $BASE/disc4
    # generate the package ordering
    ./pkgorder $BASE/SOURCES i386 |tee /root/pkgorder.txt

    ./buildinstall --pkgorder /root/pkgorder.txt --version 1 --product "Fedora" --release "Fedora" $BASE/SOURCES

    $BASE/SOURCES
    cp -apRf $BASE/SOURCES/images/* $BASE/disc1/images
    cp -apRf $BASE/SOURCES/isolinux/* $BASE/disc1/isolinux
    cp -apRf $BASE/SOURCES/RedHat/base/* $BASE/disc1/RedHat/base

    echo Cleaning up...
    rm -rf $BASE/SOURCES

  8. koov ÓÚ 2005-11-14 21:40:10·¢±í:

    4.3 ÖØбàÒë°²×°³ÌÐò£¬µ÷Õû°²×°½×¶Î
    °²×°³ÌÐòÊDz»¿ÉÄÜÒ»´Î¾Í¼ÓÔؽøÀ´µÄ£¬±ØÐë·Ö½×¶Î½øÐУ¬Í¨³£ÎÒÃǾͳÆΪ"stage"¡£µÚÒ»¸ö½×¶ÎËùÓóÌÐòºÜС£¬Ö»ÓÐÕâÑù²ÅÄÜ´ÓÒ»ÕÅÈíÅÌ¡¢tftp·þÎñÆ÷µÈµÈÉÏÃæ¼ÓÔØ¡£Í¨³£Õâ¸ö½×¶Î³ÌÐò°üº¬µÄÖ»ÓÐÒ»¸ö¾«¼ò¹ýµÄLinuxÄں˺ÍÔÚºóÐø²½Öèµ±ÖбØÒªµÄһЩÇý¶¯³ÌÐò£¨±ÈÈçSCSI£©¡£

    Òª²ÉÓÃÒ»¸öеÄRedHat°²×°£¬¾Í»áÐèÒªºÜ¶àµÄÓ³Ïñ£¬×îÃ÷ÏԵľÍÊÇÒýµ¼°²×°Å̱¾Éí£¨´ÓÈíÇý»òÕß¹âÇý°²×°£©µÄboot.img£¬µ«ÊÇÎÒÃÇÒ²ÐèÒª¶Ô´ÓÓ²ÅÌ¡¢ÍøÂçÎļþϵͳµÈ°²×°·½Ê½Ìṩ֧³Ö¡£

    RedHat¾Í´ËÌṩÁ˺ܺõĽű¾ÃüÁֻÐèÒ»¸ö¼òµ¥µÄ²Ù×÷¾Í¿ÉÒÔÍê³ÉËùÓеIJÙ×÷¡£ÕâЩ½Å±¾µÄ¹¤×÷¾ÍÊÇ°ÑijЩRPM°üµÄÄÚÈÝÌáÈ¡³öÀ´£¬È»ºóÓÃÀ´Éú³É¸÷°²×°²½ÖèËùÓóÌÐòµÄÓ³Ïñ¡£

    ËùÔÙÇ¿µ÷µÄÊÇ£¬ÎÒÃDZØÐë±£Ö¤°²×°ÁËanaconda-runtime£º

    #rpm -i anaconda-runtime-xxxxx-i386.rpm

    ½Ó׎øÈëĿ¼/usr/lib/anaconda-runtime£¬ÕâÀïÎÒÃǻῴµ½Ò»Ð©·Ç³£ÓÐÓõĽű¾£¬±ÈÈ磺

    mk-images.i386£º°üº­Óд´½¨Æô¶¯´ÅÅÌʱi386µÄרÃÅÉèÖã¨Í¨³£Çé¿öÏ£¬ÍøÂçºÍpcmcia£©ÒÔ¼°¸¨Öú´ÅÅÌÇý¶¯³ÌÐò¡£ÔÚ´ËÄú¿ÉÒԸıäÆô¶¯Ó³ÏñÖÐËù°üº¬µÄÄ£¿é£¬±ÈÈç˵ÔÚÍøÂçÆô¶¯´ÅÅÌÓУº

    ¡­¡­
    NETWORKMODULES="$COMMONMODULES nfs 3c59x eepro100 tulip pcnet32
    ne2k-pci 8139too"
    ¡­¡­..

    buildinstall ÕâÊÇÖ÷ÒªµÄ¡£

    #cd /usr/lib/anaconda-runtime
    #./buildinstall ~/disc1/

    Õâ¸ö½Å±¾ÃüÁî»áÔÚ~/disc1/imagesĿ¼Ï¸üÐÂһЩµÄÎļþ¡£
    4.4 Éú³ÉеÄhdlistÎļþ
    µ±°²×°Ê±£¬°²×°³ÌÐòÐèÒªÒÀÀµ¹âÅÌÉϵÄFedora/base/hdlistÎļþ£¬Ëü°üº¬µÄÊÇËùÓпÉÓõÄRPM°üµÄ±ØÒªÐÅÏ¢£¬ÕâЩÐÅÏ¢ÔÚ°²×°¹ý³Ìµ±ÖÐÊÇÓÃÀ´ÏÔʾÿһ¸ö°üµÄÓÃ;ÒÔ¼°½â¾öÓû§Ñ¡ÔñÈí¼þ°üºóµÄÒÀÀµÐÔÎÊÌâ¡£

    ÓÃÒÔÉú³ÉhdlistÎļþµÄ³ÌÐò½Ð×ögenhdlist£¬ËüÊÇÓÉanaconda-runtimeÕâ¸ö°ü²úÉúµÄ¡£ÏÖÔÚµÄgenhdlist¶àÁËÒ»¸öеIJÎÊý£º--withnumbers£¬ÊÇÓÃÀ´¼Ç¼hdlistÎļþÖÐÿ¸öRPM°üµÄý½é´úºÅ¡£

    ·Ö²½´¦ÀíµÄ¹ý³ÌÈçÏ£º

    #rpm -i anaconda-runtime-xxxxx-i386.rpm
    #cd /usr/lib/anaconda-runtime
    #./genhdlist -- withnumbers ~/disc1 ~/disc2¡¡~/disc3 ~/disc4

    Õû¸ö¹ý³ÌÖ»ÐèÒªÖ´ÐÐÒ»¸ö½Å±¾£¬¼û¸½Â¼Ò»£ºkernel-update.sh¡£

    Èç¹ûÄãÔÚϵͳÖÐÌí¼ÓÁËRPM°ü£¬ÄÇôÔÚÉú³É°²×°ÅÌ֮ǰ£¬×îºÃ½«ÕâËÄÕÅÅÌÉϵÄÄÚÈݸ´ÖƵ½Ò»¸öĿ¼Ï£¬È»ºóÐ޸ĸ½Â¼Ò»µÄ½Å±¾Îļþ£¬ÔËÐнű¾£¬ÏÈÍøÂç°²×°Ò»´Î£¬¿´ÊÇ·ñ´æÔÚ°üµÄÒÀÀµ¹ØϵÎÊÌâ¡£Èç¹ûûÓУ¬Ôò¿ÉÒÔÉú³É°²×°ÅÌ¡£

  9. koov ÓÚ 2005-11-14 21:39:34·¢±í:

    ÏÂÃæ·Ö±ð˵Ã÷×鶨ÒåÖÐһЩ²ÎÊýµÄº¬Ò壺

    id£º×éµÄid½ö½öÊÇÔÚcomps.xmlÎļþÖÐ×÷Ϊ¸Ã×éµÄÒ»¸ö±êʶ£¬ÕâÊDZØÐëµÄ£»
    name£º±íʾÓû§¿ÉÒÔ¿´µ½µÄ×éµÄÃû×Ö£¬ËüÒ²ÊDZØÐëµÄ£»
    default£ºËü±íʾÔÚϵͳ°²×°¹ý³ÌÖУ¬µ±Ñ¡Ôñ¶¨ÖÆ£¨custom£©°²×°Ê±£¬¸Ã×éÊÇ·ñÔÚȱʡÇé¿öϱ»Ñ¡ÖС£Èç¹ûûÓÐ˵Ã÷£¬ÔòȱʡÇé¿öÏÂΪ²»Ñ¡ÖС£
    uservisible£ºËü±íʾ¸Ã×éÔÚȱʡÇé¿öÏÂÊÇ·ñÔÚ°²×°Ê±¿ÉÒÔ¿´µ½£¬Èç¹ûûÓÐ˵Ã÷£¬È±Ê¡ÉèÖÃΪYES£¬Îª¿ÉÒÔ¿´µ½¡£
    description£ºËü±íʾ¶Ô¸Ã×é½øÐмò¶ÌµÄÃèÊö£¬ÕâÊDZØÐëµÄ£»
    packagelist£ºËü˵Ã÷ÔÚ¸Ã×éÄÚµÄһϵÁа²×°°ü£¬ÕâÒ²ÊDZØÐëµÄ¡£
    packagereq£º°üÃû
    ÊôÐÔ£º

    type£ºµ±½øÐа²×°Ê±£¬Åж¨¶ÔÓ¦µÄ°üÊÇ·ñÊÇ×éµÄ"Ç¿ÖÆ"²¿·Ö¡¢»ò"ȱʡ"²¿·Ö»ò"¿ÉÑ¡"²¿·Ö¡£Ëü¿ÉÒÔÊÇ"mandatory"¡¢"default"»ò"optional"Ö®Ò»¡£
    requires£ºËü˵Ã÷Ö»Óе±ËüËùÐèÒª£¨ÒÀÀµ£©µÄ°üÒ²°²×°Çé¿öÏ£¬´Ë°ü²Å°²×°½øϵͳ¡£
    £¨2£©×é²ã´Î½á¹¹

    ËüÃèÊöÁË×éµÄÊ÷×´²ã´Î½á¹¹£¬×é²ã´Î½á¹¹¶¨ÒåÔںͱê¼ÇÖ®¼ä£¬Óɶ¨ÒåµÄ±ê¼Ç×é³ÉÀà¡£

    Ò»¸ö¼òµ¥µÄ×é²ã´Î½á¹¹¿ÉÒÔÈçÏÂËùÊö£º

    Random Groups

    somegroup

    Ò»¸öÀàÓÉÏÂÃæÕâЩÊôÐÔ×é³É£º

    name: Ëü±íʾÀàÃû£¬ÊDZØÐëµÄ£»
    subcategories: Ëü±íʾ´ËÀàµÄһЩ×ÓÀ࣬ÓÉÒ»ÁбíºÍ ÔªËØ×é³É
    subcategory: Ç°Ã涨ÒåµÄ×éµÄid
    £¨3£©RPM°ü

    ´Ë²¿·Ö˵Ã÷Òª°²×°µÄRPM°ü£¬Ëü¶¨ÒåÔںͱê¼ÇÖ®ÄÚ¡£Ò»¸ö¼òµ¥µÄRPM°ü²¿·Ö¿ÉÒÔÈ磺

    bash

    mktemp
    bash
    glibc
    libtermcap

    name£ºËüÖ¸µÄÊÇRPM°üÃû£¬ÊDZØÐëµÄ¡£
    dependencylist£ºËü˵Ã÷´Ë°ü¶ÔÓ¦µÄÒÀÀµµÄRPM°ü¡£
    dependency£º´Ë°üÐèÒªµÄ°üµÄÃû×Ö
    4.2 ²úÉúÍêÕûµÄcomps.xmlÎļþ
    ÉÏÊö˵Ã÷µÄcomps.xmlÎļþÖеÄRPM°ü²¿·ÖÊÇÊÇ×Ô¶¯²úÉúµÄ£¬ÎªÁËÐγÉÍêÈ«µÄcomps.xmlÎļþ£¬ÐèÒªÔÚϵͳÖа²×°comps-extras RPM°ü£¬È»ºó½øÐÐÏÂÃæµÄ²Ù×÷£º

    ½«comps.xmlÎļþÖеÄÔ­À´µÄRPM°ü²¿·Öɾ³ý£»
    ÔËÐУº
    /usr/share/comps-extras/getfullcomps.py comps.xml /path/to/tree arch¡¡>/root/filelist ÔÚ´Ë£¬/path/to/treeÊÇRed Hat Linux²Ù×÷ϵͳ°²×°ÅÌÄÚÈÝ´æ´¢µÄµØ·½£¬archÖ¸µÄÊÇÌåϵ½á¹¹£¬Îªi386¡£×¢ÒâµÄÊÇ£¬¼Ù¶¨comps.xmlÒѾ­´æ·Å/path/to/tree/arch/RedHat/base/Ŀ¼Ï£¬½«´ËÊä³öÖض¨Ïòµ½Ò»¸öÁÙʱÎļþ£¬Èç/root/filelist¡£
    ½«comps.xmlÎļþÖÐ×îºóÒ»ÐÐÄÚÈÝ£¨Îª£©É¾³ý
    ½«Ç°ÃæÉú³ÉµÄÁÙʱÎļþÌí¼Óµ½comps.xmlÖÐ
    ÔÙ½«Ìí¼Óµ½comps.xmlÎļþÖÐ
    ͨ¹ýÐÂÔöÄãµÄ°üµ½comps.xmlÎļþ£¬Äã¿ÉÒÔ¸ù¾ÝÄãµÄÐèÒª×öÄã×Ô¼ºµÄ·¢²¼ÅÌ£¬È·ÐÅÄãµÄ°üÔÚȱʡÇé¿öÏ»ᱻ°²×°¡£ÐèҪעÒâµÄÒ»¼þÊÂÊÇÄã¸üеİüÓëÆäËü°üµÄÒÀÀµ¹Øϵ£¬ÕâÊÇÄãÐèÒª´¦ÀíµÄ£¬Òª×¢ÒâÄã¸üеİüËùÓ¦¸Ã·ÅÖõÄλÖá£ÁíÍ⣬²»ÒªÔÚÎļþÖÐËæÒâÔö¼Ó»òɾ³ýÆäÓàµÄ¿Õ¸ñ¡£ÔÚÐÞ¸Äcomps.xml֮ǰ£¬Ò²×îºÃ¶Ô×î³õµÄcomps.xml×ö¸ö±¸·Ý£¬ÒÔ±¸»Ö¸´Ê¹Óá£

  10. koov ÓÚ 2005-11-14 21:38:44·¢±í:

    3.2 ´´½¨RPM°ü
    Èç¹ûÎÒÃÇÐèÒª¶ÔRPM°ü×÷Ð޸ģ¬ÄÇôÎÒÃÇÊ×ÏÈÐèÒª½«Ô´Âë°üÈ¡À´£¬±ÈÈçÎÒÃÇÒªÐÞ¸ÄÄںˣ¬ÄÇôÎÒÃÇ¿ÉÒÔ´ÓÍøÉÏ»ò¹âÅÌÖÐÈ¡µ½Äں˵ÄÔ´´úÂëRPM°ü£¬Èçkernel-2.6.5-1.358.src.rpm£¬½«Ô´Âë°ü½â¿ª£ºrpm -i kernel-2. 6.5-1.358.src.rpm£¬Ôò¸ÃRPMÖеÄÄÚÈݽ«´æ·ÅÔÚĿ¼/usr/src/redhat/SOURCESºÍ/usr/src/redhat/SPECĿ¼ÖУ¬Ç°Õß´æ·ÅµÄÊÇÔ´Âë¡¢²¹¶¡ÒÔ¼°Ò»Ð©ÅäÖÃÎļþµÈ£¬ºóÕß´æ·ÅµÄÊÇ°ü¶ÔÓ¦µÄspecÎļþ£¬Èçkernel-2.6.spec£¬ÏÖÔÚÄã¾Í¿ÉÒÔ¶ÔÄں˽øÐÐÐ޸ġ£¼Ù¶¨ÎÒÃÇÏëÁíÍâÔÙ¶ÔÄں˴òÒ»¸ö²¹¶¡£¬±ÈÈç˵£ºmypatch-2.6.5.patch£¬ÄãÐèÒª½«Õâ¸ö²¹¶¡Îļþ¸´ÖƵ½/usr/src/redhat/SOURCES/Ŀ¼Ï£¬È»ºó±à¼­kernel-2.6.specÎļþ¡£ÄãÐèÒªÏÈÔÚ¶¨Òå²¹¶¡ÎļþµÄ×îºó¼ÓÈë¶ÔÄã²¹¶¡ÎļþµÄ³õʼ¶¨Ò壬È磺
    ¡­¡­¡­¡­
    Patch10000: linux-2.6.0-compile.patch
    # Patch10010: linux-2.6.0-module-license.patch
    Patch10030: mypatch-2.6.5.patch /*мÓÈëµÄ²¹¶¡ÎļþµÄ¶¨Òå*/

    # END OF PATCH DEFINITIONS
    ¡­¡­¡­¡­

    È»ºóÔÚÎļþµÄºóÃæ¼ÓÈë¶ÔÄں˴ò²¹¶¡ÃüÁ

    ¡­¡­¡­¡­
    %patch10000 -p1
    %patch10030 -p1¡¡¡¡¡¡/*мÓÈëµÄ´ò²¹¶¡ÃüÁî*/
    # END OF PATCH APPLICATIONS
    ¡­¡­¡­¡­

    Èç¹ûÄ㻹Ïë¶ÔÄÚºË×öÆäËüµÄÐ޸ģ¬Äã¿ÉÒÔÐÞ¸ÄÏàÓ¦µÄÎļþ»òÌí¼ÓÏàÓ¦µÄÎļþ£¬È»ºóÐÞ¸Äkernel-2.6.specÎļþ¡£µ±specÎļþÐÞ¸ÄÍê³ÉÖ®ºó£¬ÄãÖ»ÐèÒªÖ´ÐÐ rpmbuild -ba kernel-2.6.spec ¾Í¿ÉÒÔÉú³ÉËùÐèÒªµÄRPM°üÁË¡£ÁíÍâÐèҪעÒâµÄÊÇ£¬ÒÔÉú³ÉÄں˰üΪÀý£¬¼ÙÈçÎÒÃÇÏëÉú³Ékernel-smp-2.6.5-1.358.i686.rpm°ü£¬ÔÚkernel-2.6.specÎļþÖаüº¬ÓÐһЩ¿ª¹ØÑ¡Ï±ÈÈ磬ÔÚÎļþµÄ¿ªÍ·ÐèÒª¶¨Òå´´½¨ÄÄЩÄں˵ÄRPM°ü£¬È磺

    %define buildup 1
    %define buildsmp 0
    %define buildsource 1

    ÔÚͨ³£Çé¿öÏ£¬ÔÚÖ´ÐÐrpmbuild -ba kernel-2.6.spec ÃüÁîºó£¬»á´´½¨Ò»¸ökernel-2.6.5-1.358.i386.rpm¡¢kernel-source-2.6.5-1.358.i386.rpmºÍÔ´ÂëRPM°ükernel-2.6.5-1.358.src.rpm¡£Òò´Ë£¬µ±ÄãÐèÒª´´½¨Ö§³ÖSMPµÄÄں˵ÄRPM°üʱ£¬ÐèÒªÐÞ¸Äkernel-2.6.specÎļþ¿ªÍ·Ê±µÄ¶¨ÒåΪ£º

    %define buildup 1
    %define buildsmp 1
    %define buildsource 1
    %define -target_cpu i686

    ´ËÍ⣬ÔÚÎļþµÄ¿ªÍ·»¹ÐèÒª¶¨Òå-target_cpu Ϊi686£¬´Ó¶ø´´½¨i686µÄÄÚºËRPM°ü£¬²¢ÇÒÐèÒª¶Ô/usr/lib/rpmĿ¼ÏÂÃæµÄһЩºêÖØж¨Ò壬±ÈÈ統ǰĿ¼ÏÂÃæµÄmacrosÎļþ£¬ÐèÒªÖØж¨Òåarch ºÍbuild_archΪi686¡£×îºó£¬Ö´ÐÐÃüÁî rpmbuild -ba kernel-2.6.spec --with smp ¾Í¿ÉÒÔ¡£µ±È»£¬Èç¹û¶ÔÄں˽øÐÐÁËÏàÓ¦µÄÐ޸ģ¬¾Í±ØÐëÉú³É¶à¸öÄÚºËRPM°ü£¬ÒÔÊÊÓÃÓÚ¶à¸öarch£¬Èçkernel-2.4.18-3-i586-smp.rpm, kernel-2.4.18-3-athlon.rpmµÈ¡£

    4 ²Ù×÷ϵͳ°²×°Å̵Ķ¨Öƹý³Ì
    ÄãÐèÒª½«Ô­À´²Ù×÷ϵͳ·¢²¼ÅÌÉϵÄÄÚÈÝ¿½±´µ½±¾»úÓ²ÅÌÖУ¬¸ù¾ÝÓм¸ÕÅ·¢²¼Å̶øÉú³É¼¸¸öĿ¼£¬±ÈÈçFedora Core 2ÓÐËÄÕÅÅÌ£¬ÄãÔòÐèÒªÔÚϵͳÉÏÉú³ÉËĸöĿ¼£¬Èçdisc1¡¢disc2¡¢disc3¡¢disc4£¬·Ö±ð½«ÕâËÄÕÅÅÌÉÏÄÚÈÝ¿½±´µ½ÕâËĸöĿ¼ÖУ¬È»ºó¶ÔÏàÓ¦µÄRPM°ü½øÐиüС£

    Ê×ÏÈÕÒµ½ÄãÏë¸üеÄRPM°ü£¬½«ÐµÄRPMÌæ»»¾É°ü¡£µ±È»ÄãÒ²¿ÉÒÔ¸ù¾ÝÄãµÄÐèÒªÐÂÔö»òɾ³ýRPM°ü£¬ÐèҪעÒâµÄÊÇ£¬ÄãÐèÒªÔÚcomps.xmlÎļþÖн«ÐÂÔö¼Ó»òɾ³ýµÄRPM°üÃû¼ÓÈëij¸ö×é¼þÖУ¬²¢ÇÒ×¢ÒâÆäÓëÆäËüRPM°üµÄÒÀÀµ¹Øϵ£¬Ò²¾ÍÊÇ˵ÄãËù·ÅÖõİüµÄλÖÃҪǡµ±£¬·ñÔòËü»áÒÀÀµÓÚÔÚËü֮ǰ¶øûÓмÓÈëϵͳµÄij¸öRPM°ü¡£

    4.1 ±à¼­comps.xmlÎļþ
    ÔÚÉú³É°²×°ÅÌ֮ǰ£¬ÐèҪעÒâ¶Ôcomps.xmlÎļþ½øÐÐÐ޸ġ£Õâ¸öÎļþÓÃÀ´¸æÖª°²×°³ÌÐòanaconda£¬Óû§Ñ¡ÔñÁËij¸ö×éÊÇÓ¦¸ÃÓÐÄÄЩ°üÐèÒª°²×°£¬¶¨ÒåÁËÔÚ°²×°¹ý³ÌÖУ¬°üÊÇÈçºÎ±»À¦°óÔÚÒ»ÆðµÄ¡£ÔÚRed Hat 8.0ÒÔÇ°°æ±¾µÄ·¢²¼ÅÌÖУ¬¶ÔÓ¦µÄÎļþΪcomps£¬ËüÖ»ÊÇÒ»¸ö¼òµ¥µÄÎı¾Îļþ£¬ÔÚRed Hat 8.0Ö®ºóµÄ°æ±¾ÖУ¬ÓÃcomps.xml´úÌæÁËÔ­À´µÄcompsÎļþ¡£comps.xmlÊÇÒ»¸öXMLÎļþ£¬Ò×ÓÚ¶ÔÄÚÈݽøÐзÖÎöºÍ˵Ã÷¡£

    comps.xmlÎļþ¿ªÊ¼ÊÇ˵Ã÷xmlµÄ°æ±¾ºÍDTD¶ÏÑÔ£¬È»ºó½øÈëÒÔ±ê¼Ç¿ªÊ¼µÄÎļþµÄÖ÷ÌåÄÚÈÝ¡£È磺


    comps.xmlÖ÷ÒªÓÉÈý²¿·Ö×é³É£¬Ê×ÏÈÊÇ×éÁÐ±í£¬ËüÃèÊöÁËÔÚ°²×°¹ý³ÌÖÐÐèÒªµÄ²»Í¬µÄ×飨»ò×é¼þ£©£¬°üÀ¨×éÃû¡¢×éµÄÃèÊöºÍ°üº¬µÄRPM°ü£»Æä´ÎÊÇ×éµÄ²ã´Î½á¹¹£¬Ëü½«×é·Ö³É²»Í¬µÄÀ࣬²¢¶¨ÒåÁË×éµÄÒ»¸ö˳Ðò£¬´Ó¶ø¿ÉÒÔ¾ö¶¨ÄÄЩ×éÐèÒªÏÈ°²×°£»×îºóΪһϵÁÐRPM°üÒÔ¼°ËüÃÇÖ®¼äµÄÒÀÀµ¹Øϵ¡£

    ÏÂÃæ·Ö±ð½éÉÜcomps.xmlÎļþµÄÕâÈý²¿·Ö£º

    £¨1£©¡¡×éÁбí

    ÔÚϵͳ°²×°Ê±£¬ÐèÒªÓõ½Ò»¸ö×éÖеÄһЩÊôÐÔ£¬ÏÂÃæ¾ÍÊÇÊôÐÔÁбíÒÔ¼°ËüÃÇÈçºÎʹÓá£Ò»¸ö×é±»¶¨ÒåÔںͱê¼ÇÖ®ÄÚ.

    Ò»¸ö¼òµ¥µÄ×鶨Òå¿ÉÒÔÊÇ£º

    somegroup
    Sample Group
    true
    false
    This is a silly sample group

    bash
    cpio

  11. koov ÓÚ 2005-11-14 21:37:44·¢±í:

    3.1 SPECÎļþ
    specÎļþÊÇÕû¸öRPM°ü½¨Á¢¹ý³ÌµÄÖÐÐÄ£¬ËüµÄ×÷ÓþÍÈçͬ±àÒë³ÌÐòʱµÄMakefileÎļþ¡£specÎļþ°üº¬½¨Á¢Ò»¸öRPM°ü±ØÐèµÄÐÅÏ¢£¬°üÀ¨ÄÄЩÎļþÊÇ°üµÄÒ»²¿·ÖÒÔ¼°ËüÃÇ°²×°ÔÚÄĸöĿ¼Ï¡£Õâ¸öÎļþÒ»°ã·ÖΪÈçϵļ¸½Ú£º

    (1) Preamle£¨ÐòÑÔ£©

    ÐòÑÔ°üº¬Óû§ÇëÇó°üµÄÐÅϢʱËùÏÔʾµÄÄÚÈÝ¡£Ëü¿ÉÒÔ°üº¬°üµÄ¹¦ÄÜÃèÊö¡¢°üµÄÈí¼þ°æ±¾¡¢°æȨÐÅÏ¢ºÍËùÊôµÄ°ü×éµÈ¡£Summary ÊÇÒ»ÐйØÓÚ¸ÃÈí¼þ°üµÄÃèÊö£¬Name ÊǸÃÈí¼þ°üµÄ»ùÃû£¬Version ÊǸÃÈí¼þµÄ°æ±¾ºÅ£¬Release ÊÇ RPM ±¾ÉíµÄ°æ±¾ºÅ£¬Èç¹ûÐÞ¸´ÁË spec ÎļþÖеÄÒ»¸ö´íÎó²¢·¢²¼Á˸ÃÈí¼þͬһ°æ±¾µÄРRPM£¬¾ÍÓ¦¸ÃÔö¼Ó·¢ÐаæºÅ¡£License Ó¦¸Ã¸ø³öһЩÐí¿ÉÊõÓÈ磺"GPL"¡¢"Commercial"¡¢"Shareware"£©£¬Group ±êʶÈí¼þÀàÐÍ¡£ÄÇЩÊÔͼ°ïÖúÈËÃǹÜÀí RPM µÄ³ÌÐòͨ³£°´ÕÕ×éÁгö RPM¡£Äú¿ÉÒÔÔÚusr/share/doc/rpm-4.0.4/GROUPS Îļþ¿´µ½Ò»¸ö Red Hat ʹÓõÄ×éÁÐ±í£¨¼ÙÉèÄú°²×°µÄ RPM °æ±¾ÊÇ 4.0.4£©¡£µ«ÊÇÄú»¹¿ÉÒÔʹÓÃÄÇЩ×éÃûÒÔÍâµÄÃû³Æ¡£Source0¡¢Source1µÈµÈ¸øÕâЩԴÎļþÃüÃû£¨Í¨³£Îª tar.gz Îļþ£©¡£%{name} ºÍ %{version} ÊÇ RPM ºê£¬ËüÃÇÀ©Õ¹³ÉΪͷÖж¨ÒåµÄ rpm Ãû³ÆºÍ°æ±¾¡£

    ҪעÒâµÄÊÇ£¬Äã²»ÒªÔÚ Source Óï¾äÖаüº¬Èκη¾¶¡£È±Ê¡Çé¿öÏ£¬RPM »áÔÚ /usr/src/redhat/SOURCES ÖÐÑ°ÕÒÎļþ£¬Ç뽫ÄúµÄÔ´Îļþ¸´ÖÆ»òÁ´½Óµ½ÄÇÀï¡££¨ÒªÊ¹ spec Îļþ¾¡Á¿¿ÉÒÆÖ²µÄ»°£¬Ó¦µ±¾¡Á¿±ÜÃâǶÈë×Ô¼º¿ª·¢»úÆ÷ÉϵļÙÏë·¾¶¡£ÆäËû¿ª·¢ÈËÔ±¾Í¿ÉÒÔָʾ RPM ÔÚ±ðµÄĿ¼Ï²éÕÒÔ´Îļþ£¬¶ø²»ÓÃÐÞ¸ÄÄúµÄ spec Îļþ¡££©

    ½ÓÏÂÀ´µÄ²¿·Ö´Ó %description ÐпªÊ¼¡£ÄúÓ¦¸ÃÔÚÕâÀïÌṩ¸ÃÈí¼þ¸ü¶àµÄÃèÊö£¬ÕâÑùÈκÎÈËʹÓà rpm -qi ²éѯÄúµÄÈí¼þ°üʱ¶¼¿ÉÒÔ¿´µ½Ëü¡£Äú¿ÉÒÔ½âÊÍÕâ¸öÈí¼þ°ü×öʲô£¬ÃèÊöÈκξ¯¸æ»ò¸½¼ÓµÄÅäÖÃÖ¸ÁµÈµÈ¡£

    (2) Prep½Ú

    Prep½Ú½øÐÐʵ¼ÊµÄ´ò°ü×¼±¸¹¤×÷£¬ËüÊÇʹÓýÚǰ׺%prep±íʾµÄ¡£Ò»°ã¶øÑÔ£¬ÕâÒ»½ÚµÄÖ÷Òª¹¤×÷ÊǼì²é±êÇ©Óï·¨ÊÇ·ñÕýÈ·£¬É¾³ý¾ÉµÄÈí¼þÔ´³ÌÐò£¬¶Ô°üº¬Ô´³ÌÐòµÄtarÎļþ½øÐнâÂë¡£Èç¹û°üº¬²¹¶¡£¨patch£©Îļþ£¬½«²¹¶¡ÎļþÓ¦Óõ½½â¿ªµÄÔ´ÂëÖС£ËüÒ»°ã°üº¬%setupÓë%patchÁ½¸öÃüÁî¡£%setupÓÃÓÚ½«Èí¼þÔ´Âë°ü½â¿ª£¬Ö´ÐÐ%patch¿É½«²¹¶¡Îļþ¼ÓÈë½â¿ªµÄÔ´³ÌÐòÖС£

    %setup
    -n newdir---------½«Ñ¹ËõµÄÈí¼þÔ´³ÌÐòÔÚnewdirĿ¼Ï½⿪¡£
    -c ---------------Ôڽ⿪Դ³ÌÐò֮ǰÏÈ´´½¨Ä¿Â¼¡£
    -b num------------ÔÚ°üº¬¶à¸öÔ´³ÌÐòʱ£¬½«µÚnum¸öÔ´³ÌÐò½âѹËõ¡£
    -T----------------²»Ê¹ÓÃȱʡµÄ½âѹËõ²Ù×÷¡£

    ÀýÈ磺

    %setup -T -b 0
    /*½â¿ªµÚÒ»¸öÔ´³ÌÐòÎļþ¡£*/
    %setup -c -n newdir
    /*´´½¨Ä¿Â¼newdir£¬²¢ÔÚ´ËĿ¼֮Ͻ⿪Դ³ÌÐò¡£*/
    %patch
    %patchN-------ÕâÀïNÊÇÊý×Ö£¬±íʾʹÓõÚN¸ö²¹¶¡Îļþ£¬µÈ¼ÛÓÚ%patch -P N
    -p0-----------Ö¸¶¨Ê¹ÓõÚÒ»¸ö²¹¶¡Îļþ£¬-p1Ö¸¶¨Ê¹Óõڶþ¸ö²¹¶¡Îļþ¡£ -s------------ÔÚʹÓò¹¶¡Ê±£¬²»ÏÔʾÈκÎÐÅÏ¢¡£
    -b name-------ÔÚ¼ÓÈë²¹¶¡Îļþ֮ǰ£¬½«Ô´ÎļþÃûÉϼÓÈëname¡£ÈôΪָ¶¨´Ë²ÎÊý£¬ÔòȱʡԴÎļþ¼ÓÈë.orig¡£
    -T------------½«ËùÓдò²¹¶¡Ê±²úÉúµÄÊä³öÎļþɾ³ý¡£

    (3) Build½Ú

    ÕâÒ»½ÚÖ÷ÒªÓÃÓÚ±àÒëÔ´Â룬ËüÊÇʹÓýÚǰ׺%build±íʾµÄ¡£ÕâÒ»½ÚÒ»°ãÓɶà¸ömakeÃüÁî×é³É¡£

    (4) Install½Ú

    ÕâÒ»½ÚÖ÷ÒªÓÃÓÚÍê³Éʵ¼Ê°²×°Èí¼þ±ØÐëÖ´ÐеÄÃüÁËüÊÇʹÓýÚǰ׺%install±íʾµÄ¡£ÕâÒ»½ÚÒ»°ãÊÇÓÉmake installÖ¸Áî¹¹³É£¬µ«ÊÇÓÐʱҲ»á°üº¬cp¡¢mv¡¢installµÈÖ¸Áî¡£

    ÕâÒ»½Ú»¹ÄÜÖ¸¶¨ÔÚÓû§°²×°µÄϵͳÉÏ£¬°ü°²×°Ê±ÔËÐеĽű¾¡£ÕâÑùµÄ½Å±¾³ÆΪ°²×°£¨Ð¶ÔØ£©½Å±¾¡£Ëü¿ÉÒÔÖ¸¶¨°ü°²×°Ç°¡¢°ü°²×°ºó¡¢°ü³ýȥǰ¡¢°ü³ýÈ¥ºóµÄϵͳ±ØÐëÔËÐеÄÍâ¿Ç³ÌÐò¶Î¡£ÔÚÓû§°²×°µÄϵͳÉÏ£¬ÎªÁËÑéÖ¤Ò»¸ö°üÊÇ·ñÒѾ­³É¹¦°²×°µÄÑéÖ¤½Å±¾Ò²¿ÉÓÉÕâÒ»½ÚÖ¸¶¨¡£

    (5) Clean½Ú

    ÕâÒ»½ÚËùÃèÊöµÄÄÚÈݱíʾÔÚÍê³É°ü½¨Á¢µÄ¹¤×÷Ö®ºó£¬×Ô¶¯Ö´Ðд˽ÚϵĽű¾½øÐи½¼ÓµÄÇå³ý¹¤×÷£¬ËüÊÇʹÓýÚǰ׺%clean±íʾµÄ¡£Ò»°ã¶øÑÔ£¬ÕâÒ»½ÚµÄÄÚÈÝÊǼòµ¥µØʹÓÃrm -rf $RPM_BUILD_ROOTÃüÁ²»ÐèÒªÖ¸¶¨´Ë½ÚµÄÆäËüÄÚÈÝ¡£

    (6) ÎļþÁбí

    ÕâÒ»½ÚÖ¸¶¨¹¹³É°üµÄÎļþµÄÁÐ±í£¬ËüÊÇʹÓýÚǰ׺%files±íʾµÄ¡£´ËÍ⣬Ëü»¹°üº¬Ò»ÏµÁкê¿ØÖÆ°²×°ºóµÄÎļþÊôÐÔºÍÅäÖÃÐÅÏ¢¡£

    %files ÁгöÓ¦¸ÃÀ¦°óµ½ RPM ÖеÄÎļþ£¬²¢Äܹ»¿ÉÑ¡µØÉèÖÃÐí¿ÉȨºÍÆäËüÐÅÏ¢¡£ÔÚ %files ÖУ¬Äú¿ÉÒÔʹÓà %defattr À´¶¨ÒåȱʡµÄÐí¿ÉȨ¡¢ËùÓÐÕߺÍ×飻%defattr(-,root,root) »á°²×° root Óû§ÓµÓеÄËùÓÐÎļþ£¬Ê¹Óõ± RPM ´Ó¹¹½¨ÏµÍ³À¦°óËüÃÇʱËüÃÇËù¾ßÓеÄÈκÎÐí¿ÉȨ¡£

    ¿ÉÒÔÓà %attr(permissions,user,group) ¸²¸Ç¸ö±ðÎļþµÄËùÓÐÕߺÍÐí¿ÉȨ¡£¿ÉÒÔÔÚ %files ÖÐÓÃÒ»ÐаüÀ¨¶à¸öÎļþ¡£¿ÉÒÔͨ¹ýÔÚÐÐÖÐÌí¼Ó %doc »ò %config À´±ê¼ÇÎļþ¡£%doc ¸æËß RPM ÕâÊÇÒ»¸öÎĵµÎļþ£¬Òò´ËÈç¹ûÓû§°²×°Èí¼þ°üʱʹÓà --excludedocs£¬½«²»°²×°¸ÃÎļþ¡£ÄúÒ²¿ÉÒÔÔÚ %doc ϲ»´ø·¾¶ÁгöÎļþÃû£¬RPM »áÔÚ¹¹½¨Ä¿Â¼Ï²éÕÒÕâЩÎļþ²¢ÔÚ RPM ÎļþÖаüÀ¨ËüÃÇ£¬²¢°ÑËüÃÇ°²×°µ½ /usr/share/doc/%{name}-%{version}¡£ÒÔ %doc µÄÐÎʽ°üÀ¨ README ºÍ ChangeLog ÕâÑùµÄÎļþÊǸöºÃÖ÷Òâ¡£

    %config ¸æËß RPM ÕâÊÇÒ»¸öÅäÖÃÎļþ¡£ÔÚÉý¼¶Ê±£¬RPM ½«»áÊÔͼ±ÜÃâÓà RPM ´ò°üµÄȱʡÅäÖÃÎļþ¸²¸ÇÓû§×ÐϸÐ޸ĹýµÄÅäÖá£

    ×¢Ò⣺Èç¹ûÔÚ %files ÏÂÁгöÒ»¸öĿ¼Ãû£¬RPM »á°üÀ¨¸ÃĿ¼ÏµÄËùÓÐÎļþ¡£Í¨³£Õâ²»ÊÇÄúÏëÒªµÄ£¬Ìرð¶ÔÓÚ /bin ÕâÑùµÄĿ¼¡£

    (7) ¸Ä¶¯ÈÕÖ¾

    ÕâÒ»½ÚÖ÷ÒªÃèÊöÈí¼þµÄ¿ª·¢¼Ç¼£¬ËüÊÇʹÓýÚǰ׺%changlog±íʾµÄ¡£Õâ¸ö¶ÎµÄÄÚÈÝÊÇΪÁË¿ª·¢ÈËÔ±ÄÜÏêϸµÄÁ˽â¸ÃÈí¼þµÄ¿ª·¢¹ý³Ì£¬¶ÔÓÚ°üµÄά»¤¼«Óкô¦¡£