Annotation of pkgsrc/doc/guide/files/binary.xml, revision 1.26

1.26    ! wiz         1: <!-- $NetBSD: binary.xml,v 1.25 2006/09/09 23:40:40 wiz Exp $ -->
1.1       grant       2: 
                      3: <chapter id="binary">
                      4:   <title>Creating binary packages</title>
                      5: 
1.13      wiz         6:   <sect1 id="building-a-single-binary-package">
1.1       grant       7:     <title>Building a single binary package</title>
                      8: 
1.25      wiz         9:     <para>Once you have built and installed a package, you can create
                     10:     a <emphasis>binary package</emphasis> which can be installed on
                     11:     another system with &man.pkg.add.1;. This saves having to build
                     12:     the same package on a group of hosts and wasting CPU time. It also
                     13:     provides a simple means for others to install your package, should
                     14:     you distribute it.</para>
                     15: 
                     16:     <para>To create a binary package, change into the appropriate
                     17:     directory in pkgsrc, and run <command>make
                     18:     package</command>:</para>
1.1       grant      19: 
1.26    ! wiz        20:     <screen>
        !            21: &rprompt; <userinput>cd misc/figlet</userinput>
        !            22: &rprompt; <userinput>make package</userinput>
        !            23:     </screen>
1.1       grant      24: 
1.25      wiz        25:     <para>This will build and install your package (if not already done),
                     26:     and then build a binary package from what was installed. You can
                     27:     then use the <command>pkg_*</command> tools to manipulate
                     28:     it. Binary packages are created by default in
                     29:     <filename>/usr/pkgsrc/packages</filename>, in the form of a
                     30:     gzipped tar file. See <xref linkend="logs.package"/> for a
                     31:     continuation of the above <filename
                     32:     role="pkg">misc/figlet</filename> example.</para>
                     33: 
                     34:     <para>See <xref linkend="submit"/> for information on how to submit
                     35:     such a binary package.</para>
1.1       grant      36:   </sect1>
                     37: 
1.13      wiz        38:   <sect1 id="settings-for-creationg-of-binary-packages">
1.1       grant      39:     <title>Settings for creation of binary packages</title>
                     40: 
                     41:     <para>See <xref linkend="build.helpful-targets"/>.</para>
                     42:   </sect1>
                     43: 
                     44:   <sect1 id="bulkbuild">
                     45:     <title>Doing a bulk build of all packages</title>
                     46: 
1.9       wiz        47:     <para>If you want to get a full set of precompiled binary
1.25      wiz        48:     packages, this section describes how to get them. Beware that
                     49:     the bulk build will remove all currently installed packages from
                     50:     your system!</para>
                     51: 
                     52:     <para>Having an FTP server configured either on the
                     53:     machine doing the bulk builds or on a nearby NFS server can help
                     54:     to make the packages available to other machines that can then
                     55:     save time by installing only the binary packages. See &man.ftpd.8; for
                     56:     more information. If you use a remote NFS server's storage, be
                     57:     sure to not actually compile on NFS storage, as this slows
                     58:     things down a lot.</para>
1.1       grant      59: 
                     60:     <sect2 id="binary.configuration">
                     61:       <title>Configuration</title>
                     62: 
1.17      rillig     63:       <sect3 id="binary.bulk.build.conf">
                     64:        <title><filename>build.conf</filename></title>
                     65: 
1.25      wiz        66:        <para>The <filename>build.conf</filename> file is the main
                     67:        configuration file for bulk builds. You can configure how your
                     68:        copy of pkgsrc is kept up to date, how the distfiles are
                     69:        downloaded, how the packages are built and how the report is
                     70:        generated. You can find an annotated example file in
                     71:        <filename>pkgsrc/mk/bulk/build.conf-example</filename>. To use
                     72:        it, copy <filename>build.conf-example</filename> to
                     73:        <filename>build.conf</filename> and edit it, following the
                     74:        comments in that file.</para>
1.17      rillig     75:       </sect3>
                     76: 
1.1       grant      77:       <sect3 id="binary.mk.conf">
                     78:        <title>/etc/mk.conf</title>
                     79: 
1.9       wiz        80:        <para>You may want to set variables in
1.25      wiz        81:        <filename>/etc/mk.conf</filename>.
                     82:        Look at <filename>pkgsrc/mk/defaults/mk.conf</filename> for
                     83:        details of the default settings. You will want to ensure that
                     84:        <varname>ACCEPTABLE_LICENSES</varname> meet your local policy.
                     85:        As used in this example, <varname>_ACCEPTABLE=yes</varname>
                     86:        accepts <emphasis>all</emphasis> licenses.</para>
                     87: 
                     88:        <programlisting>
                     89:          PACKAGES?=      ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
                     90:          WRKOBJDIR?=     /usr/tmp/pkgsrc   # build here instead of in pkgsrc
                     91:          BSDSRCDIR=      /usr/src
                     92:          BSDXSRCDIR=     /usr/xsrc         # for x11/xservers
                     93:          OBJHOSTNAME?=   yes               # use work.`hostname`
                     94:          FAILOVER_FETCH= yes               # insist on the correct checksum
                     95:          PKG_DEVELOPER?= yes
                     96:          _ACCEPTABLE=    yes
                     97:        </programlisting>
1.18      rillig     98: 
                     99:        <para>Some options that are especially useful for bulk builds
                    100:        can be found at the top lines of the file
                    101:        <filename>mk/bulk/bsd.bulk-pkg.mk</filename>. The most useful
                    102:        options of these are briefly described here.</para>
                    103: 
                    104:        <itemizedlist>
                    105: 
1.25      wiz       106:          <listitem><para>If you are on a slow machine, you may want to
                    107:          set <varname>USE_BULK_BROKEN_CHECK</varname> to
                    108:          <quote>no</quote>.</para></listitem>
                    109: 
                    110:          <listitem><para>If you are doing bulk builds from a read-only
                    111:          copy of pkgsrc, you have to set <varname>BULKFILESDIR</varname>
                    112:          to the directory where all log files are created. Otherwise the
                    113:          log files are created in the pkgsrc directory.</para></listitem>
                    114: 
                    115:          <listitem><para>Another important variable is
                    116:          <varname>BULK_PREREQ</varname>, which is a list of packages that
                    117:          should be always available while building other
                    118:          packages.</para></listitem>
1.18      rillig    119: 
                    120:        </itemizedlist>
1.19      rillig    121: 
                    122:        <para>Some other options are scattered in the pkgsrc
                    123:        infrastructure:</para>
                    124: 
                    125:        <itemizedlist>
                    126: 
1.25      wiz       127:          <listitem><para><varname>ALLOW_VULNERABLE_PACKAGES</varname>
                    128:          should be set to <literal>yes</literal>. The purpose of the bulk
                    129:          builds is creating binary packages, no matter if they are
                    130:          vulnerable or not. When uploading the packages to a public
                    131:          server, the vulnerable packages will be put into a directory of
                    132:          their own. Leaving this variable unset would prevent the bulk
                    133:          build system from even trying to build them, so possible
                    134:          building errors would not show up.</para></listitem>
                    135: 
                    136:          <listitem><para><varname>CHECK_FILES</varname>
                    137:          (<filename>pkgsrc/mk/bsd.pkg.check.mk</filename>) can be set to
                    138:          <quote>yes</quote> to check that the installed set of files
                    139:          matches the <filename>PLIST</filename>.</para></listitem>
                    140: 
                    141:          <listitem><para><varname>CHECK_INTERPRETER</varname>
                    142:          (<filename>pkgsrc/mk/bsd.pkg.check.mk</filename>) can be set to
                    143:          <quote>yes</quote> to check that the installed
                    144:          <quote>#!</quote>-scripts will find their
                    145:          interpreter.</para></listitem>
1.19      rillig    146: 
                    147:        </itemizedlist>
                    148: 
1.1       grant     149:       </sect3>
                    150: 
1.13      wiz       151:       <sect3 id="pre-build.local">
1.1       grant     152:        <title><filename>pre-build.local</filename></title>
                    153: 
1.9       wiz       154:        <para>It is possible to configure the bulk build to perform
1.25      wiz       155:        certain site-specific tasks at the end of the pre-build
                    156:        stage.  If the file
                    157:        <filename>pre-build.local</filename> exists in
                    158:        <filename>/usr/pkgsrc/mk/bulk</filename>, it will be executed
                    159:        (as a &man.sh.1; script) at the end of the usual pre-build
                    160:        stage.  An example use of
                    161:        <filename>pre-build.local</filename> is to have the line:</para>
1.1       grant     162: 
1.23      wiz       163:        <screen>echo "I do not have enough disk space to build this pig." \
1.25      wiz       164:        &gt; misc/openoffice/$BROKENF</screen>
1.1       grant     165: 
                    166:        <para>to prevent the system from trying to build a particular package
1.25      wiz       167:        which requires nearly 3 GB of disk space.</para>
1.1       grant     168:       </sect3>
                    169:     </sect2>
                    170: 
1.13      wiz       171:     <sect2 id="other-environmental-considerations">
1.1       grant     172:       <title>Other environmental considerations</title>
                    173: 
1.6       hubertf   174:       <para>As <filename>/usr/pkg</filename> will be completely
1.25      wiz       175:       deleted at the start of bulk builds, make sure your login
                    176:       shell is placed somewhere else. Either drop it into
                    177:       <filename>/usr/local/bin</filename> (and adjust your login
                    178:       shell in the passwd file), or (re-)install it via
                    179:       &man.pkg.add.1; from <filename>/etc/rc.local</filename>, so
                    180:       you can login after a reboot (remember that your current
                    181:       process won't die if the package is removed, you just can't
                    182:       start any new instances of the shell any more).  Also, if you
                    183:       use &os; earlier than 1.5, or you still want to use the pkgsrc
                    184:       version of ssh for some reason, be sure to install ssh before
                    185:       starting it from <filename>rc.local</filename>:</para>
                    186: 
                    187:       <programlisting>
                    188:        ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
                    189:        if [ -f /usr/pkg/etc/rc.d/sshd ]; then
                    190:        /usr/pkg/etc/rc.d/sshd
                    191:        fi
                    192:       </programlisting>
1.1       grant     193: 
1.6       hubertf   194:       <para>Not doing so will result in you being not able to log in
1.25      wiz       195:       via ssh after the bulk build is finished or if the machine
                    196:       gets rebooted or crashes. You have been warned! :)</para>
1.1       grant     197:     </sect2>
                    198: 
1.13      wiz       199:     <sect2 id="operation">
1.1       grant     200:       <title>Operation</title>
                    201: 
1.6       hubertf   202:       <para>Make sure you don't need any of the packages still
1.25      wiz       203:       installed.</para>
1.1       grant     204: 
                    205:       <warning>
1.21      rillig    206:        <para>During the bulk build, <emphasis>all packages will be
1.25      wiz       207:        removed!</emphasis></para>
1.1       grant     208:       </warning>
                    209: 
                    210:       <para>Be sure to remove all other things that might
1.25      wiz       211:       interfere with builds, like some libs installed in
                    212:       <filename>/usr/local</filename>, etc. then become root and type:</para>
1.1       grant     213: 
1.26    ! wiz       214:       <screen>
        !           215: &rprompt; <userinput>cd /usr/pkgsrc</userinput>
        !           216: &rprompt; <userinput>sh mk/bulk/build</userinput>
        !           217:       </screen>
1.1       grant     218: 
1.6       hubertf   219:       <para>If for some reason your last build didn't complete (power
1.25      wiz       220:       failure, system panic, ...), you can continue it by
                    221:       running:</para>
1.1       grant     222: 
                    223:       <screen>&rprompt; <userinput>sh mk/bulk/build restart</userinput></screen>
                    224: 
1.25      wiz       225:       <para>At the end of the bulk build, you will get a summary via mail,
                    226:       and find build logs in the directory specified by
                    227:       <varname>FTP</varname> in the <filename>build.conf</filename>
                    228:       file.</para>
1.1       grant     229:     </sect2>
                    230: 
1.13      wiz       231:     <sect2 id="what-it-does">
1.1       grant     232:       <title>What it does</title>
                    233: 
                    234:       <para>The bulk builds consist of three steps:</para>
                    235: 
                    236:       <variablelist>
                    237:        <varlistentry>
                    238:          <term>1. pre-build</term>
                    239: 
                    240:          <listitem>
1.25      wiz       241:            <para>The script updates your pkgsrc tree via (anon)cvs, then
                    242:            cleans out any broken distfiles, and removes all
                    243:            packages installed.</para>
1.1       grant     244:          </listitem>
                    245:        </varlistentry>
                    246: 
                    247:        <varlistentry>
                    248:          <term>2. the bulk build</term>
                    249: 
                    250:          <listitem>
1.25      wiz       251:            <para>This is basically <quote>make bulk-package</quote> with
                    252:            an optimised order in which packages will be
                    253:            built. Packages that don't require other packages will
                    254:            be built first, and packages with many dependencies will
                    255:            be built later.</para>
1.1       grant     256:          </listitem>
                    257:        </varlistentry>
                    258: 
                    259:        <varlistentry>
                    260:          <term>3. post-build</term>
                    261: 
                    262:          <listitem>
1.25      wiz       263:            <para>Generates a report that's placed in the directory
                    264:            specified in the <filename>build.conf</filename> file
                    265:            named <filename>broken.html</filename>, a short version
                    266:            of that report will also be mailed to the build's
                    267:            admin.</para>
1.1       grant     268:          </listitem>
                    269:        </varlistentry>
                    270:       </variablelist>
                    271: 
1.25      wiz       272:       <para>During the build, a list of broken packages will be compiled
                    273:       in <filename>/usr/pkgsrc/.broken</filename> (or
                    274:       <filename>.../.broken.${MACHINE}</filename> if
                    275:       <varname>OBJMACHINE</varname> is set), individual build logs
                    276:       of broken builds can be found in the package's
                    277:       directory. These files are used by the bulk-targets to mark
                    278:       broken builds to not waste time trying to rebuild them, and
                    279:       they can be used to debug these broken package builds
                    280:       later.</para>
1.1       grant     281:     </sect2>
                    282: 
1.13      wiz       283:     <sect2 id="disk-space-requirements">
1.1       grant     284:       <title>Disk space requirements</title>
                    285: 
                    286:       <para>Currently, roughly the following requirements are valid for
1.25      wiz       287:       NetBSD 2.0/i386:</para>
1.1       grant     288: 
                    289:       <itemizedlist>
                    290:        <listitem>
1.25      wiz       291:          <para>10 GB - distfiles (NFS ok)</para>
1.1       grant     292:        </listitem>
                    293: 
                    294:        <listitem>
1.25      wiz       295:          <para>8 GB - full set of all binaries (NFS ok)</para>
1.1       grant     296:        </listitem>
                    297: 
                    298:        <listitem>
1.25      wiz       299:          <para>5 GB - temp space for compiling (local disk recommended)</para>
1.1       grant     300:        </listitem>
                    301:       </itemizedlist>
                    302: 
1.25      wiz       303:       <para>Note that all pkgs will be de-installed as soon as they are
                    304:       turned into a binary package, and that sources are removed,
                    305:       so there is no excessively huge demand to disk
                    306:       space. Afterwards, if the package is needed again, it will
                    307:       be installed via &man.pkg.add.1; instead of building again, so
                    308:       there are no cycles wasted by recompiling.</para>
1.1       grant     309:     </sect2>
                    310: 
1.13      wiz       311:     <sect2 id="setting-up-a-sandbox">
1.15      rillig    312:       <title>Setting up a sandbox for chrooted builds</title>
1.1       grant     313: 
1.25      wiz       314:       <para>If you don't want all the packages nuked from a machine
                    315:       (rendering it useless for anything but pkg compiling), there
                    316:       is the possibility of doing the package bulk build inside a
                    317:       chroot environment.</para>
                    318: 
                    319:       <para>The first step is to set up a chroot sandbox,
                    320:       e.g. <filename>/usr/sandbox</filename>.  This can be done by
                    321:       using null mounts, or manually.</para>
                    322: 
                    323:       <para>There is a shell script called
                    324:       <filename>pkgsrc/mk/bulk/mksandbox</filename> which will set
                    325:       up the sandbox environment using null mounts. It will also
                    326:       create a script called <filename>sandbox</filename> in the
                    327:       root of the sandbox environment, which will allow the null
                    328:       mounts to be activated using the <command>sandbox
                    329:       mount</command> command and deactivated using the
                    330:       <command>sandbox umount</command> command.</para>
                    331: 
                    332:       <para>To set up a sandbox environment by hand, after extracting all
                    333:       the sets from a &os; installation or doing a <command>make
                    334:       distribution DESTDIR=/usr/sandbox</command> in
                    335:       <filename>/usr/src/etc</filename>, be sure the following items
                    336:       are present and properly configured:</para>
1.1       grant     337: 
                    338:       <procedure>
                    339:        <step>
                    340:          <para>Kernel</para>
                    341: 
                    342:          <screen>&rprompt; <userinput>cp /netbsd /usr/sandbox</userinput></screen>
                    343:        </step>
                    344: 
                    345:        <step>
                    346:          <para><filename>/dev/*</filename></para>
                    347: 
                    348:          <screen>&rprompt; <userinput>cd /usr/sandbox/dev ; sh MAKEDEV all</userinput></screen>
                    349:        </step>
                    350: 
                    351:        <step>
1.21      rillig    352:          <para><filename>/etc/resolv.conf</filename> (for <filename
1.25      wiz       353:          role="pkg">security/smtpd</filename> and mail):</para>
1.1       grant     354: 
                    355:          <screen>&rprompt; <userinput>cp /etc/resolv.conf /usr/sandbox/etc</userinput></screen>
                    356:        </step>
                    357: 
                    358:        <step>
                    359:          <para>Working(!) mail config (hostname, sendmail.cf):</para>
                    360: 
                    361:          <screen>&rprompt; <userinput>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</userinput></screen>
                    362:        </step>
                    363: 
                    364:        <step>
1.21      rillig    365:          <para><filename>/etc/localtime</filename> (for <filename
1.25      wiz       366:          role="pkg">security/smtpd</filename>):</para>
1.1       grant     367: 
                    368:          <screen>&rprompt; <userinput>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</userinput></screen>
                    369:        </step>
                    370: 
                    371:        <step>
1.24      rillig    372: 
                    373:          <para><filename>/usr/src</filename> (system sources,
                    374:          e.&nbsp;g. for <filename
                    375:          role="pkg">sysutils/aperture</filename>):</para>
1.1       grant     376: 
                    377:          <screen>&rprompt; <userinput>ln -s ../disk1/cvs .</userinput>
1.25      wiz       378:          &rprompt; <userinput>ln -s cvs/src-2.0 src</userinput></screen>
1.1       grant     379:        </step>
                    380: 
                    381:        <step>
                    382:          <para>Create <filename>/var/db/pkg</filename> (not part of default install):</para>
                    383: 
                    384:          <screen>&rprompt; <userinput>mkdir /usr/sandbox/var/db/pkg</userinput></screen>
                    385:        </step>
                    386: 
                    387:        <step>
                    388:          <para>Create <filename>/usr/pkg</filename> (not part of default install):</para>
                    389: 
                    390:          <screen>&rprompt; <userinput>mkdir /usr/sandbox/usr/pkg</userinput></screen>
                    391:        </step>
                    392: 
                    393:        <step>
                    394:          <para>Checkout pkgsrc via cvs into
1.25      wiz       395:          <filename>/usr/sandbox/usr/pkgsrc</filename>:</para>
1.1       grant     396: 
1.26    ! wiz       397:          <screen>
        !           398: &rprompt; <userinput>cd /usr/sandbox/usr</userinput>
        !           399: &rprompt; <userinput>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</userinput>
        !           400:          </screen>
1.1       grant     401: 
1.25      wiz       402:          <para>Do not mount/link this to the copy of your pkgsrc tree
                    403:          you do development in, as this will likely cause problems!</para>
1.1       grant     404:        </step>
                    405: 
                    406:        <step>
                    407:          <para>Make
1.25      wiz       408:          <filename>/usr/sandbox/usr/pkgsrc/packages</filename> and
                    409:          <filename>.../distfiles</filename> point somewhere
                    410:          appropriate. NFS- and/or nullfs-mounts may come in handy!</para>
1.1       grant     411:        </step>
                    412: 
                    413:        <step>
                    414:          <para>Edit <filename>/etc/mk.conf</filename>, see <xref linkend="binary.mk.conf"/>.</para>
                    415:        </step>
                    416: 
                    417:        <step>
                    418:          <para>Adjust <filename>mk/bulk/build.conf</filename> to suit your needs.</para>
                    419:        </step>
                    420:       </procedure>
                    421: 
1.15      rillig    422:       <para>When the chroot sandbox is set up, you can start
1.25      wiz       423:       the build with the following steps:</para>
1.1       grant     424: 
1.26    ! wiz       425:       <screen>
        !           426: &rprompt; <userinput>cd /usr/sandbox/usr/pkgsrc</userinput>
        !           427: &rprompt; <userinput>sh mk/bulk/do-sandbox-build</userinput>
        !           428:       </screen>
1.1       grant     429: 
1.25      wiz       430:       <para>This will just jump inside the sandbox and start building.  At
                    431:        the end of the build, mail will be sent with the results of
                    432:        the build. Created binary pkgs will be in
                    433:        <filename>/usr/sandbox/usr/pkgsrc/packages</filename>
                    434:       (wherever that points/mounts to/from).</para>
1.1       grant     435:     </sect2>
                    436: 
1.13      wiz       437:     <sect2 id="building-a-partial-set">
1.1       grant     438:       <title>Building a partial set of packages</title>
                    439: 
1.25      wiz       440:       <para>In addition to building a complete set of all packages in
                    441:       pkgsrc, the <filename>pkgsrc/mk/bulk/build</filename> script
                    442:       may be used to build a subset of the packages contained in
                    443:       pkgsrc.  By setting <varname>SPECIFIC_PKGS</varname>
                    444:       in <filename>/etc/mk.conf</filename>, the variables</para>
1.1       grant     445: 
                    446:       <itemizedlist>
                    447:        <listitem><para>SITE_SPECIFIC_PKGS</para></listitem>
                    448:        <listitem><para>HOST_SPECIFIC_PKGS</para></listitem>
                    449:        <listitem><para>GROUP_SPECIFIC_PKGS</para></listitem>
                    450:        <listitem><para>USER_SPECIFIC_PKGS</para></listitem>
                    451:       </itemizedlist>
                    452: 
1.25      wiz       453:       <para>will define the set of packages which should be built.
                    454:       The bulk build code will also include any packages which are
                    455:       needed as dependencies for the explicitly listed packages.</para>
                    456: 
                    457:       <para>One use of this is to do a bulk build with
                    458:       <varname>SPECIFIC_PKGS</varname> in a chroot sandbox
                    459:       periodically to have a complete set of the binary packages
                    460:       needed for your site available without the overhead of
                    461:       building extra packages that are not needed.</para>
1.1       grant     462: 
                    463:     </sect2>
1.6       hubertf   464: 
                    465:     <sect2 id="bulk-upload">
                    466:       <title>Uploading results of a bulk build</title>
                    467: 
1.25      wiz       468:       <para>This section describes how pkgsrc developers can upload binary
                    469:       pkgs built by bulk builds to ftp.NetBSD.org.</para>
                    470: 
                    471:       <para>If you would like to automatically create checksum files for the
                    472:       binary packages you intend to upload, remember to set
                    473:       <varname>MKSUMS=yes</varname> in your
                    474:       <filename>mk/bulk/build.conf</filename>.</para>
                    475: 
                    476:       <para>If you would like to PGP sign the checksum files (highly
                    477:       recommended!), remember to set
                    478:       <varname>SIGN_AS=username@NetBSD.org</varname> in your
                    479:       <filename>mk/bulk/build.conf</filename>.  This will prompt you for
                    480:       your GPG password to sign the files before uploading everything.</para>
                    481: 
                    482:       <para>Then, make sure that you have <varname>RSYNC_DST</varname>
                    483:       set properly in your <filename>mk/bulk/build.conf</filename>
                    484:       file, i.e. adjust it to something like one of the following:</para>
1.6       hubertf   485: 
1.20      rillig    486:       <screen>RSYNC_DST=ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload </screen>
1.6       hubertf   487: 
1.25      wiz       488:       <para>Please use appropriate values for "pkgsrc-200xQy",
                    489:       "NetBSD-a.b.c" and "arch" here. If your login on ftp.NetBSD.org
                    490:       is different from your local login, write your login directly
                    491:       into the variable, e.g. my local account is "feyrer", but for my
                    492:       login "hubertf", I use:</para>
1.6       hubertf   493: 
1.26    ! wiz       494:       <screen>RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</screen>
1.6       hubertf   495: 
1.25      wiz       496:       <para>A separate <filename>upload</filename> directory is used
                    497:       here to allow "closing" the directory during upload. To do
                    498:       so, run the following command on ftp.NetBSD.org next:</para>
1.6       hubertf   499: 
                    500:       <screen>nbftp% <userinput>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</userinput></screen>
                    501: 
1.25      wiz       502:       <para>Please note that <filename>/pub/NetBSD/packages</filename> is
                    503:       only appropriate for packages for the NetBSD operating
                    504:       system. Binary packages for other operating systems should go
                    505:       into <filename>/pub/pkgsrc</filename>.</para>
                    506: 
                    507:       <para>Before uploading the binary pkgs, ssh authentication needs
                    508:       to be set up. This example shows how to set up temporary keys
                    509:       for the root account <emphasis>inside the sandbox</emphasis>
                    510:       (assuming that no keys should be present there usually):</para>
1.6       hubertf   511: 
1.26    ! wiz       512:       <screen>
        !           513: &rprompt; <userinput>chroot /usr/sandbox</userinput>
        !           514: chroot-&rprompt; <userinput>rm $HOME/.ssh/id-dsa*</userinput>
        !           515: chroot-&rprompt; <userinput>ssh-keygen -t dsa</userinput>
        !           516: chroot-&rprompt; <userinput>cat $HOME/.ssh/id-dsa.pub</userinput>
        !           517:       </screen>
1.25      wiz       518: 
                    519:       <para>Now take the output of <filename>id-dsa.pub</filename> and
                    520:       append it to your <filename>~/.ssh/authorized_keys</filename>
                    521:       file on ftp.NetBSD.org. You can remove the key after the
                    522:       upload is done!</para>
                    523: 
                    524:       <para>Next, test if your ssh connection really works:</para>
1.6       hubertf   525: 
                    526:       <screen>chroot-&rprompt; <userinput>ssh ftp.NetBSD.org date</userinput> </screen>
                    527: 
1.25      wiz       528:       <para>Use "-l yourNetBSDlogin" here as appropriate!</para>
                    529: 
                    530:       <para>Now after all this works, you can exit the sandbox and start
                    531:       the upload:</para>
1.6       hubertf   532: 
1.26    ! wiz       533:       <screen>
        !           534: chroot-&rprompt; <userinput>exit</userinput>
        !           535: &rprompt; <userinput>cd /usr/sandbox/usr/pkgsrc</userinput>
        !           536: &rprompt; <userinput>sh mk/bulk/do-sandbox-upload</userinput>
        !           537:       </screen>
1.25      wiz       538: 
                    539:       <para>The upload process may take quite some time. Use &man.ls.1; or
                    540:       &man.du.1; on the FTP server to monitor progress of the
                    541:       upload. The upload script will take care of not uploading
                    542:       restricted packages and putting vulnerable packages into the
                    543:       <filename>vulnerable</filename> subdirectory.</para>
1.6       hubertf   544: 
1.25      wiz       545:       <para>After the upload has ended, first thing is to revoke ssh access:</para>
1.6       hubertf   546: 
                    547:       <screen>nbftp% <userinput>vi ~/.ssh/authorized_keys</userinput>
1.25      wiz       548:       Gdd:x! </screen>
1.6       hubertf   549: 
1.25      wiz       550:       <para>Use whatever is needed to remove the key you've entered
                    551:       before! Last, move the uploaded packages out of the
                    552:       <filename>upload</filename> directory to have them accessible
                    553:       to everyone:</para>
1.6       hubertf   554: 
1.26    ! wiz       555:       <screen>
        !           556: nbftp% <userinput>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</userinput>
        !           557: nbftp% <userinput>mv upload/* .</userinput>
        !           558: nbftp% <userinput>rmdir upload</userinput>
        !           559: nbftp% <userinput>chmod 755 .</userinput>
        !           560:       </screen>
1.6       hubertf   561:     </sect2>
1.1       grant     562:   </sect1>
                    563: 
1.13      wiz       564:   <sect1 id="creating-cdroms">
1.1       grant     565:     <title>Creating a multiple CD-ROM packages collection</title>
                    566: 
1.25      wiz       567:     <para>After your pkgsrc bulk-build has completed, you may wish to
                    568:     create a CD-ROM set of the resulting binary packages to assist
                    569:     in installing packages on other machines.  The
                    570:     <filename role="pkg">pkgtools/cdpack</filename> package provides
                    571:     a simple tool for creating the ISO 9660 images.
                    572:     <command>cdpack</command> arranges the packages on the CD-ROMs in a
                    573:     way that keeps all the dependencies for a given package on the same
                    574:     CD as that package.</para>
1.1       grant     575: 
1.13      wiz       576:     <sect2 id="cdpack-example">
1.1       grant     577:       <title>Example of cdpack</title>
                    578: 
1.25      wiz       579:       <para>Complete documentation for cdpack is found in the cdpack(1)
                    580:       man page. The following short example assumes that the binary
                    581:       packages are left in
                    582:       <filename>/usr/pkgsrc/packages/All</filename> and that
                    583:       sufficient disk space exists in <filename>/u2</filename> to
                    584:       hold the ISO 9660 images.</para>
1.1       grant     585: 
1.26    ! wiz       586:       <screen>
        !           587: &rprompt; <userinput>mkdir /u2/images</userinput>
        !           588: &rprompt; <userinput>pkg_add /usr/pkgsrc/packages/All/cdpack</userinput>
        !           589: &rprompt; <userinput>cdpack /usr/pkgsrc/packages/All /u2/images</userinput>
        !           590:       </screen>
1.1       grant     591: 
1.25      wiz       592:       <para>If you wish to include a common set of files
                    593:       (<filename>COPYRIGHT</filename>, <filename>README</filename>,
                    594:       etc.) on each CD in the collection, then you need to create a
                    595:       directory which contains these files. e.g.</para>
1.1       grant     596: 
1.26    ! wiz       597:       <screen>
        !           598: &rprompt; <userinput>mkdir /tmp/common</userinput>
        !           599: &rprompt; <userinput>echo "This is a README" &gt; /tmp/common/README</userinput>
        !           600: &rprompt; <userinput>echo "Another file" &gt; /tmp/common/COPYING</userinput>
        !           601: &rprompt; <userinput>mkdir /tmp/common/bin</userinput>
        !           602: &rprompt; <userinput>echo "#!/bin/sh" &gt; /tmp/common/bin/myscript</userinput>
        !           603: &rprompt; <userinput>echo "echo Hello world" &gt;&gt; /tmp/common/bin/myscript</userinput>
        !           604: &rprompt; <userinput>chmod 755 /tmp/common/bin/myscript</userinput>
        !           605:       </screen>
1.1       grant     606: 
                    607:       <para>Now create the images:</para>
                    608: 
                    609:       <screen>&rprompt; <userinput>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</userinput></screen>
                    610: 
                    611:       <para>Each image will contain <filename>README</filename>,
1.25      wiz       612:       <filename>COPYING</filename>, and <filename>bin/myscript</filename>
                    613:       in their root directories.</para>
1.1       grant     614:     </sect2>
                    615:   </sect1>
                    616: </chapter>

CVSweb <webmaster@jp.NetBSD.org>