--- category: en type: paper layout: paper tags: archlinux, configuration, linux title: Creating own repository short: creating-custom-repo description: It is a short paper devoted to creation own ArchLinux repository. ---
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, devtools
and pacman
:
devtools is script set for building automation in the clean chroot. I think most of Arch maintainers use it.
Let's create working directories:
{% highlight bash %} mkdir -p ~/arch/repo/{i686,x86_64} mkdir -p ~/arch/{prepare,root,staging} {% endhighlight %}~/arch/repo/{i686,x86_64}
are directories for repository, ~/arch/prepare
is directory where compiled packages will be stored, ~/arch/root
is one where clean chroot will be created, ~/arch/staging
is one where packages will be built.
Create directory, share it (using ftp, for example). It has two subdirectories - i686
and x86_64
- for each architecture respectively. And fill them with a set of packages.
Updating repository may be split into the following steps:
Download source tarballs from AUR:
{% highlight bash %} cd ~/arch/staging yaourt -G package-name {% endhighlight %}Build each package automatically:
{% highlight bash %} func_build() { PREPARE="$1" ROOT="$2" if grep "arch=('any')" PKGBUILD -q; then /usr/bin/sudo /usr/bin/staging-i686-build -r "${ROOT}" else /usr/bin/sudo /usr/bin/staging-i686-build -r "${ROOT}" /usr/bin/sudo /usr/bin/staging-x86_64-build -r "${ROOT}" fi /usr/bin/cp *.pkg.tar.xz "${PREPARE}" } export -f func_build # building cd "${STAGINGDIR}" /usr/bin/find -name 'PKGBUILD' -type f -execdir /usr/bin/bash -c "func_build "${PREPAREDIR}" "${ROOTDIR}"" \; {% endhighlight %}It is recommended to add the following lines to /etc/sudoers
:
It is recommended to configure gpg-agent.
Here is a function for removal packages from database and repository:
{% highlight bash %} func_remove() { DBPATH="$1" PKGNAME="$2" /usr/bin/repo-remove ${DBNAME}.db.tar.gz ${PKGNAME} /usr/bin/repo-remove ${DBNAME}.files.tar.gz ${PKGNAME} /usr/bin/rm -f ${PKGNAME}* } export -f func_remove {% endhighlight %}i686
repository update:
x86_64
repository update:
Here is the script. Download source tarballs and run script (editing variables if it is necessary).
Just add following lines to /etc/pacman.conf
: