summaryrefslogtreecommitdiff
path: root/doc/guide/files/getting.xml
blob: 68b8db54a4f6ff39c7eb24285417309ca1b93766 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<!-- $NetBSD: getting.xml,v 1.18 2007/04/20 08:33:41 ghen Exp $ -->

<chapter id="getting">
<title>Where to get pkgsrc and how to keep it up-to-date</title>

<para>Before you download and extract the files, you need to decide
where you want to extract them. When using pkgsrc as root user, pkgsrc
is usually installed in <filename>/usr/pkgsrc</filename>. You are though
free to install the sources and binary packages wherever you want in
your filesystem, provided that the pathname does not contain white-space
or other characters that are interpreted specially by the shell and some
other programs. A safe bet is to use only letters, digits, underscores
and dashes.</para>

<sect1 id="getting-first">
<title>Getting pkgsrc for the first time</title>

	<para>Before you download any pkgsrc files, you should decide
	whether you want the <emphasis>current</emphasis> branch or the
	<emphasis>stable</emphasis> branch. The latter is forked on a
	quarterly basis from the current branch and only gets modified
	for security updates. The names of the stable branches are built
	from the year and the quarter, for example
	<literal>2007Q1</literal>.</para>

	<para>The second step is to decide <emphasis>how</emphasis> you
	want to download pkgsrc. You can get it as a tar file, via SUP,
	or via CVS. All three ways are described here.</para>

<sect2 id="getting-via-tar">
<title>As tar file</title>

	<para>The primary download location for all pkgsrc files is
	<ulink url="ftp://ftp.NetBSD.org/pub/pkgsrc/"/>. There are a
	number of subdirectories for different purposes, which are
	described in detail in <xref linkend="ftp-layout"/>.</para>

	<para>The tar file for the current branch is in the directory
	<filename>current</filename> and is called <ulink
	url="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz"><filename>pkgsrc.tar.gz</filename></ulink>.
	It is autogenerated daily.</para>

	<para>The tar file for the stable branch 2007Q1 is in the
	directory <filename>pkgsrc-2007Q1</filename> and is also called <ulink
	url="ftp://ftp.NetBSD.org/pub/pkgsrc/pkgsrc-2007Q1/pkgsrc-2007Q1.tar.gz"><filename>pkgsrc-2007Q1.tar.gz</filename></ulink>.</para>

	<para>After downloading the tar file, change to the directory
	where you want to have pkgsrc. This is usually
	<filename>/usr</filename>. Then, run <command>gzcat
	pkgsrc.tar.gz | tar xf -</command> to extract the files.</para>

</sect2>
<sect2 id="getting-via-sup">
<title>Via SUP</title>

	<para>As an alternative to the tar file, you can get pkgsrc via
	the Software Update Protocol, SUP. To do so, make sure your
	supfile has a line

<programlisting>
    release=pkgsrc
</programlisting>

	in it, see the examples in
	<filename>/usr/share/examples/supfiles</filename>, and that the
	<filename>/usr/pkgsrc</filename> directory exists. Then, simply
	run <command>sup -v
	<replaceable>/path/to/your/supfile</replaceable></command>.</para>

</sect2>
<sect2 id="getting-via-cvs">
<title>Via anonymous CVS</title>

	<para>To get pkgsrc via CVS, make sure you have &man.cvs.1;
	installed. To do an initial (full) checkout of pkgsrc, you first
	have to set some environment variables. For the C-Shell,
	type:</para>

<screen>
    &cprompt; <userinput>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</userinput>
    &cprompt; <userinput>setenv CVS_RSH ssh</userinput>
</screen>

	<para>Or, the same for the bourne shell:</para>

<screen>
    &uprompt; <userinput>CVSROOT="anoncvs@anoncvs.NetBSD.org:/cvsroot"</userinput>
    &uprompt; <userinput>CVS_RSH="ssh"</userinput>
    &uprompt; <userinput>export CVSROOT CVS_RSH</userinput>
</screen>

	<para>Then, you change to the directory where you want to have
	your copy of pkgsrc. In most cases this is
	<filename>/usr</filename>. In that directory you run the
	checkout command, which is <command>cvs -q checkout -P
	pkgsrc</command> for the current branch and <command>cvs -q
	checkout -rpkgsrc-2007Q1 -P pkgsrc</command> for the stable
	branch. This command will create a directory called
	<filename>pkgsrc</filename> with all the pkgsrc files in
	it.</para>

</sect2>
</sect1>

<sect1 id="uptodate">
<title>Keeping pkgsrc up-to-date</title>

	<para>The preferred way to keep pkgsrc up-to-date is via CVS
	(which also works if you have first installed it via a tar
	file). It saves bandwidth and hard disk activity, compared to
	downloading the tar file again.</para>

<sect2 id="uptodate-tar">
<title>Via tar files</title>

	<warning><para>When updating from a tar file, you first need to
	completely remove the old pkgsrc directory. Otherwise those
	files that have been removed from pkgsrc in the mean time will
	not be removed on your local disk, resulting in inconsistencies.
	When removing the old files, any changes that you have done to
	the pkgsrc files will be lost after updating. Therefore updating
	via CVS is strongly recommended.</para></warning>

	<para>Note that by default the distfiles and the binary packages
	are saved in the pkgsrc tree, so don't forget to rescue them
	before updating. You can also configure pkgsrc to use other than
	the default directories by setting the
	<varname>DISTDIR</varname> and <varname>PACKAGES</varname>
	variables. See <xref linkend="configuring"/> for the details.</para>

	<para>To update pkgsrc from a tar file, download the tar file as
	explained above. Then, make sure that you have not made any
	changes to the files in the pkgsrc directory. Remove the pkgsrc
	directory and extract the new tar file. Done.</para>

</sect2>
<sect2 id="uptodate-cvs">
<title>Via CVS</title>

	<para>To update pkgsrc via CVS, make sure the environment
	variable <varname>CVS_RSH</varname> is set as above. Then,
	change to the pkgsrc directory and run <command>cvs -q update
	-dP</command>.</para>

<sect3 id="uptodate-cvs-switch">
<title>Switching between different pkgsrc branches</title>

	<para>When updating pkgsrc, the CVS program keeps track of the
	branch you selected. But if you, for whatever reason, want to
	switch from the stable branch to the current one, you can do it
	by adding the option <quote>-A</quote> after the
	<quote>update</quote> keyword. To switch from the current branch
	back to the stable branch, add the
	<quote>-rpkgsrc-2007Q1</quote> option.</para>

</sect3>
<sect3 id="uptodate-cvs-changes">
<title>What happens to my changes when updating?</title>

	<para>When you update pkgsrc, the CVS program will only touch
	those files that are registered in the CVS repository. That
	means that any packages that you created on your own will stay
	unmodified. If you change files that are managed by CVS, later
	updates will try to merge your changes with those that have been
	done by others. See the CVS manual, chapter
	<quote>update</quote> for details.</para>

</sect3>
</sect2>
</sect1>
</chapter>