updated papers

Refactoring of an English part is done
This commit is contained in:
arcan1s
2014-07-30 00:59:09 +04:00
parent 7ecdf0935c
commit af702d8511
11 changed files with 225 additions and 113 deletions

View File

@ -8,13 +8,17 @@ title: Creating own repository
short: creating-custom-repo
description: It is a short paper devoted to creation own ArchLinux repository.
---
<h2><a name="prepare" class="anchor" href="#prepare"><span class="octicon octicon-link"></span></a>Prepare</h2>
<h2><a href="#prepare" class="anchor" name="prepare"><span class="octicon octicon-link"></span></a>Prepare</h2>
<p>First find a server and desire to have sex with it. It is recommended to use Archlinux on it, but it is not necessarily - because you may create special root for Archlinux. Also you need two packages, <code>devtools</code> and <code>pacman</code>:</p>
{% highlight bash %}
pacman -Sy devtools
{% endhighlight %}
<p><a href="https://www.archlinux.org/packages/devtools/">devtools</a> is script set for building automation in the clean chroot. I think most of Arch maintainers use it.</p>
<p><a href="https://www.archlinux.org/packages/devtools/" title="Archlinux package">devtools</a> is script set for building automation in the clean chroot. I think most of Arch maintainers use it.</p>
<p>Let's create working directories and set colors:</p>
{% highlight bash %}
# colors
if [ ${USECOLOR} == "yes" ]; then
@ -50,10 +54,11 @@ if [ ! -d "${STAGINGDIR}" ]; then
mkdir -p "${STAGINGDIR}" || error_mes "unknown"
fi
{% endhighlight %}
<p><code>${REPODIR}/{i686,x86_64}</code> are directories for repository, <code>${PREPAREDIR}</code> is directory where compiled packages will be stored, <code>${STAGINGDIR}</code> is one where packages will be built.</p>
<h2><a name="theory" class="anchor" href="#theory"><span class="octicon octicon-link"></span></a>A bit of theory</h2>
<p>Create directory, share it (using <a href="/2014/03/06/site-changes/">ftp</a>, for example). It has two subdirectories - <code>i686</code> and <code>x86_64</code> - for each architecture respectively. And fill them with a set of packages.</p>
<h2><a href="#theory" class="anchor" name="theory"><span class="octicon octicon-link"></span></a>A bit of theory</h2>
<p>Create directory, share it (using <a href="/2014/03/06/site-changes/" title="Site changes paper">ftp</a>, for example). It has two subdirectories - <code>i686</code> and <code>x86_64</code> - for each architecture respectively. And fill them with a set of packages.</p>
<p>Updating repository may be split into the following steps:</p>
<ol>
<li>Creating PKGBUILDs (or updating them from AUR).</li>
@ -68,15 +73,17 @@ fi
<li>Cleaning.</li>
</ol>
<h3><a name="pkgbuild" class="anchor" href="#pkgbuild"><span class="octicon octicon-link"></span></a>Creating PKGBUILDs</h3>
<h3><a href="#pkgbuild" class="anchor" name="pkgbuild"><span class="octicon octicon-link"></span></a>Creating PKGBUILDs</h3>
<p>Download source tarballs from AUR:</p>
{% highlight bash %}
cd "${STAGINGDIR}"
yaourt -G package-name
{% endhighlight %}
<h3><a name="building" class="anchor" href="#building"><span class="octicon octicon-link"></span></a>Packages building</h3>
<h3><a href="#building" class="anchor" name="building"><span class="octicon octicon-link"></span></a>Packages building</h3>
<p>Build each package automatically:</p>
{% highlight bash %}
func_build() {
if [ ${USECOLOR} == "yes" ]; then
@ -114,14 +121,17 @@ echo -e "${bwhite}[II]${cclose} Building packages"
cd "${STAGINGDIR}"
/usr/bin/find -name 'PKGBUILD' -type f -execdir /usr/bin/bash -c "func_build "${PREPAREDIR}" "${ROOTDIR}"" \;
{% endhighlight %}
<p>It is recommended to add the following lines to <code>/etc/sudoers</code>:</p>
{% highlight bash %}
username ALL=NOPASSWD: /usr/bin/staging-i686-build
username ALL=NOPASSWD: /usr/bin/staging-x86_64-build
username ALL=NOPASSWD: /usr/bin/multilib-staging-build
{% endhighlight %}
<h3><a name="signing" class="anchor" href="#signing"><span class="octicon octicon-link"></span></a>Packages signing</h3>
<h3><a href="#signing" class="anchor" name="signing"><span class="octicon octicon-link"></span></a>Packages signing</h3>
{% highlight bash %}
# signing
if [ ${USEGPG} == "yes" ]; then
@ -132,9 +142,11 @@ if [ ${USEGPG} == "yes" ]; then
done
fi
{% endhighlight %}
<p>It is recommended to configure <a href="https://wiki.archlinux.org/index.php/GPG#gpg-agent">gpg-agent</a>.</p>
<h3><a name="list" class="anchor" href="#list"><span class="octicon octicon-link"></span></a>Creating the list of packages</h3>
<p>It is recommended to configure <a href="https://wiki.archlinux.org/index.php/GPG#gpg-agent" title="ArchWiki">gpg-agent</a>.</p>
<h3><a href="#list" class="anchor" name="list"><span class="octicon octicon-link"></span></a>Creating the list of packages</h3>
{% highlight bash %}
# creating packages list
cd "${PREPAREDIR}"
@ -144,15 +156,18 @@ echo -e "${bwhite}[II] ${bblue}=>${cclose} i686 packages: \n${bwhite}${i686_PACK
echo -e "${bwhite}[II] ${bblue}=>${cclose} x86_64 packages: \n${bwhite}${x86_64_PACKAGES}${cclose}"
{% endhighlight %}
<h3><a name="updating" class="anchor" href="#updating"><span class="octicon octicon-link"></span></a>Repository update</h3>
<h3><a href="#updating" class="anchor" name="updating"><span class="octicon octicon-link"></span></a>Repository update</h3>
<p>Here is a function for removal packages from database and repository:</p>
{% highlight bash %}
func_remove() {
_PACKAGE="$1"
/usr/bin/rm -f "${_PACKAGE}"{,.sig}
}
{% endhighlight %}
<p><code>i686</code> repository update:</p>
{% highlight bash %}
# updating i686 repo
echo -e "${bwhite}[II]${cclose} Updating ${bwhite}i686${cclose} repo"
@ -169,7 +184,9 @@ for PACKAGE in ${i686_PACKAGES}; do
/usr/bin/repo-add --files ${DBNAME}.files.tar.gz "${PACKAGE}"
done
{% endhighlight %}
<p><code>x86_64</code> repository update:</p>
{% highlight bash %}
# updating x86_64 repo
echo -e "${bwhite}[II]${cclose} Updating ${bwhite}x86_64${cclose} repo"
@ -187,7 +204,8 @@ for PACKAGE in ${x86_64_PACKAGES}; do
done
{% endhighlight %}
<h3><a name="clear" class="anchor" href="#clear"><span class="octicon octicon-link"></span></a>Cleaning</h3>
<h3><a href="#clear" class="anchor" name="clear"><span class="octicon octicon-link"></span></a>Cleaning</h3>
{% highlight bash %}
# clear
cd "${PREPAREDIR}"
@ -196,8 +214,9 @@ cd "${STAGINGDIR}"
/usr/bin/rm -rf *
{% endhighlight %}
<h3><a name="symlinks" class="anchor" href="#symlinks"><span class="octicon octicon-link"></span></a>Creating symlinks</h3>
<h3><a href="#symlinks" class="anchor" name="symlinks"><span class="octicon octicon-link"></span></a>Creating symlinks</h3>
<p>You may want to create a directory, which will contain symlinks on actual packages with names, which does not contain version:</p>
{% highlight bash %}
# creating symlinks
if [ ${SYMLINK} == "yes" ]; then
@ -219,11 +238,12 @@ if [ ${SYMLINK} == "yes" ]; then
fi
{% endhighlight %}
<h3><a name="file" class="anchor" href="#file"><span class="octicon octicon-link"></span></a>File</h3>
<p>Here is <a href="https://github.com/arcan1s/repo-scripts">the scripts</a>. Download source tarballs and run script (editing variables if it is necessary).</p>
<h3><a href="#file" class="anchor" name="file"><span class="octicon octicon-link"></span></a>File</h3>
<p>Here is <a href="https://github.com/arcan1s/repo-scripts" title="GitHub">the scripts</a>. Download source tarballs and run script (editing variables if it is necessary).</p>
<h2><a name="using" class="anchor" href="#using"><span class="octicon octicon-link"></span></a>Repository usage</h2>
<h2><a href="#using" class="anchor" name="using"><span class="octicon octicon-link"></span></a>Repository usage</h2>
<p>Just add following lines to <code>/etc/pacman.conf</code>:</p>
{% highlight bash %}
[$REPONAME]
Server = ftp://$REPOADDRESS/repo/$arch