mirror of
https://github.com/arcan1s/arcanis.me.git
synced 2025-04-25 07:47:18 +00:00
updated post about repo
This commit is contained in:
parent
d79cf9dccc
commit
97143e201a
@ -13,12 +13,57 @@ description: It is a short paper devoted to creation own ArchLinux repository.
|
|||||||
pacman -Sy devtools
|
pacman -Sy devtools
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
<p align="justify"><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 align="justify"><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 align="justify">Let's create working directories:</p>
|
<p align="justify">Let's create working directories and set colors:</p>
|
||||||
{% highlight bash %}
|
{% highlight bash %}
|
||||||
mkdir -p ~/arch/repo/{i686,x86_64}
|
# colors
|
||||||
mkdir -p ~/arch/{prepare,root,staging}
|
if [ ${USECOLOR} == "yes" ]; then
|
||||||
|
black='\e[0;30m'
|
||||||
|
bblack='\e[1;30m'
|
||||||
|
red='\e[0;31m'
|
||||||
|
bred='\e[1;31m'
|
||||||
|
green='\e[0;32m'
|
||||||
|
bgreen='\e[1;32m'
|
||||||
|
yellow='\e[0;33m'
|
||||||
|
byellow='\e[1;33m'
|
||||||
|
blue='\e[0;34m'
|
||||||
|
bblue='\e[1;34m'
|
||||||
|
purple='\e[0;35m'
|
||||||
|
bpurple='\e[1;35m'
|
||||||
|
cyan='\e[0;36m'
|
||||||
|
bcyan='\e[1;36m'
|
||||||
|
white='\e[0;37m'
|
||||||
|
bwhite='\e[1;37m'
|
||||||
|
cclose='\e[0m'
|
||||||
|
fi
|
||||||
|
export USECOLOR
|
||||||
|
# directories
|
||||||
|
if [ ! -d "${PREPAREDIR}" ]; then
|
||||||
|
[ -e "${PREPAREDIR}" ] && error_mes "file" "${PREPAREDIR}"
|
||||||
|
echo -e "${bwhite}[II] ${bblue}Creating directory ${bwhite}'${PREPAREDIR}'${cclose}"
|
||||||
|
mkdir -p "${PREPAREDIR}" || error_mes "unknown"
|
||||||
|
fi
|
||||||
|
if [ ! -d "${REPODIR}" ]; then
|
||||||
|
[ -e "${REPODIR}" ] && error_mes "file" "${REPODIR}"
|
||||||
|
echo -e "${bwhite}[II] ${bblue}Creating directory ${bwhite}'${REPODIR}'${cclose}"
|
||||||
|
mkdir -p "${REPODIR}/"{i686,x86_64} || error_mes "unknown"
|
||||||
|
fi
|
||||||
|
if [ ! -d "${REPODIR}/i686" ]; then
|
||||||
|
[ -e "${REPODIR}/i686" ] && error_mes "file" "${REPODIR}/i686"
|
||||||
|
echo -e "${bwhite}[II] ${bblue}Creating directory ${bwhite}'${REPODIR}/i686'${cclose}"
|
||||||
|
mkdir -p "${REPODIR}/i686" || error_mes "unknown"
|
||||||
|
fi
|
||||||
|
if [ ! -d "${REPODIR}/x86_64" ]; then
|
||||||
|
[ -e "${REPODIR}/x86_64" ] && error_mes "file" "${REPODIR}/x86_64"
|
||||||
|
echo -e "${bwhite}[II] ${bblue}Creating directory ${bwhite}'${REPODIR}/x86_64'${cclose}"
|
||||||
|
mkdir -p "${REPODIR}/x86_64" || error_mes "unknown"
|
||||||
|
fi
|
||||||
|
if [ ! -d "${STAGINGDIR}" ]; then
|
||||||
|
[ -e "${STAGINGDIR}" ] && error_mes "file" "${STAGINGDIR}"
|
||||||
|
echo -e "${bwhite}[II] ${bblue}Creating directory ${bwhite}'${STAGINGDIR}'${cclose}"
|
||||||
|
mkdir -p "${STAGINGDIR}" || error_mes "unknown"
|
||||||
|
fi
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
<p align="justify"><code>~/arch/repo/{i686,x86_64}</code> are directories for repository, <code>~/arch/prepare</code> is directory where compiled packages will be stored, <code>~/arch/root</code> is one where clean chroot will be created, <code>~/arch/staging</code> is one where packages will be built.</p>
|
<p align="justify"><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>
|
<h2><a name="theory" class="anchor" href="#theory"><span class="octicon octicon-link"></span></a>A bit of theory</h2>
|
||||||
<p align="justify">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>
|
<p align="justify">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>
|
||||||
@ -39,7 +84,7 @@ mkdir -p ~/arch/{prepare,root,staging}
|
|||||||
<h3><a name="pkgbuild" class="anchor" href="#pkgbuild"><span class="octicon octicon-link"></span></a>Creating PKGBUILDs</h3>
|
<h3><a name="pkgbuild" class="anchor" href="#pkgbuild"><span class="octicon octicon-link"></span></a>Creating PKGBUILDs</h3>
|
||||||
<p align="justify">Download source tarballs from AUR:</p>
|
<p align="justify">Download source tarballs from AUR:</p>
|
||||||
{% highlight bash %}
|
{% highlight bash %}
|
||||||
cd ~/arch/staging
|
cd "${STAGINGDIR}"
|
||||||
yaourt -G package-name
|
yaourt -G package-name
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
@ -47,22 +92,29 @@ yaourt -G package-name
|
|||||||
<p align="justify">Build each package automatically:</p>
|
<p align="justify">Build each package automatically:</p>
|
||||||
{% highlight bash %}
|
{% highlight bash %}
|
||||||
func_build() {
|
func_build() {
|
||||||
|
if [ ${USECOLOR} == "yes" ]; then
|
||||||
|
bblue='\e[1;34m'
|
||||||
|
bwhite='\e[1;37m'
|
||||||
|
cclose='\e[0m'
|
||||||
|
fi
|
||||||
PREPARE="$1"
|
PREPARE="$1"
|
||||||
ROOT="$2"
|
ROOT="$2"
|
||||||
eval $(/usr/bin/grep 'arch=' PKGBUILD)
|
eval $(/usr/bin/grep 'arch=' PKGBUILD)
|
||||||
if echo ${arch} | /usr/bin/grep any -q; then
|
eval $(/usr/bin/grep 'pkgname=' PKGBUILD)
|
||||||
/usr/bin/sudo /usr/bin/staging-i686-build -r "${ROOT}" -c
|
echo -e "${bwhite}[II] ${bblue}=>${cclose} Building ${bwhite}${pkgname}${cclose}"
|
||||||
|
if echo ${arch} | /usr/bin/grep 'any' -q; then
|
||||||
|
LC_MESSAGES=C /usr/bin/sudo /usr/bin/staging-i686-build -r "${ROOT}" -c
|
||||||
else
|
else
|
||||||
eval $(/usr/bin/grep 'pkgname=' PKGBUILD)
|
eval $(/usr/bin/grep 'pkgname=' PKGBUILD)
|
||||||
if echo ${pkgname} | /usr/bin/grep lib32 -q; then
|
if echo ${pkgname} | /usr/bin/grep lib32 -q; then
|
||||||
/usr/bin/sudo /usr/bin/multilib-staging-build -r "${ROOT}" -c
|
LC_MESSAGES=C /usr/bin/sudo /usr/bin/multilib-staging-build -r "${ROOT}" -c
|
||||||
else
|
else
|
||||||
if /usr/bin/grep "lib32" PKGBUILD -q; then
|
if /usr/bin/grep 'lib32' PKGBUILD -q; then
|
||||||
/usr/bin/sudo /usr/bin/staging-i686-build -r "${ROOT}" -c
|
LC_MESSAGES=C /usr/bin/sudo /usr/bin/staging-i686-build -r "${ROOT}" -c
|
||||||
/usr/bin/sudo /usr/bin/multilib-staging-build -r "${ROOT}" -c
|
LC_MESSAGES=C /usr/bin/sudo /usr/bin/multilib-staging-build -r "${ROOT}" -c
|
||||||
else
|
else
|
||||||
/usr/bin/sudo /usr/bin/staging-i686-build -r "${ROOT}" -c
|
LC_MESSAGES=C /usr/bin/sudo /usr/bin/staging-i686-build -r "${ROOT}" -c
|
||||||
/usr/bin/sudo /usr/bin/staging-x86_64-build -r "${ROOT}" -c
|
LC_MESSAGES=C /usr/bin/sudo /usr/bin/staging-x86_64-build -r "${ROOT}" -c
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -71,6 +123,7 @@ func_build() {
|
|||||||
export -f func_build
|
export -f func_build
|
||||||
|
|
||||||
# building
|
# building
|
||||||
|
echo -e "${bwhite}[II]${cclose} Building packages"
|
||||||
cd "${STAGINGDIR}"
|
cd "${STAGINGDIR}"
|
||||||
/usr/bin/find -name 'PKGBUILD' -type f -execdir /usr/bin/bash -c "func_build "${PREPAREDIR}" "${ROOTDIR}"" \;
|
/usr/bin/find -name 'PKGBUILD' -type f -execdir /usr/bin/bash -c "func_build "${PREPAREDIR}" "${ROOTDIR}"" \;
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
@ -85,7 +138,7 @@ username ALL=NOPASSWD: /usr/bin/multilib-staging-build
|
|||||||
{% highlight bash %}
|
{% highlight bash %}
|
||||||
# signing
|
# signing
|
||||||
if [ ${USEGPG} == "yes" ]; then
|
if [ ${USEGPG} == "yes" ]; then
|
||||||
echo "[II] Signing"
|
echo -e "${bwhite}[II]${cclose} Signing"
|
||||||
cd "${PREPAREDIR}"
|
cd "${PREPAREDIR}"
|
||||||
for PACKAGE in $(/usr/bin/find . -name '*.pkg.tar.xz'); do
|
for PACKAGE in $(/usr/bin/find . -name '*.pkg.tar.xz'); do
|
||||||
/usr/bin/gpg -b ${PACKAGE}
|
/usr/bin/gpg -b ${PACKAGE}
|
||||||
@ -100,45 +153,45 @@ fi
|
|||||||
cd "${PREPAREDIR}"
|
cd "${PREPAREDIR}"
|
||||||
i686_PACKAGES=$(/usr/bin/find * -name '*-i686.pkg.tar.xz' -o -name '*-any.pkg.tar.xz')
|
i686_PACKAGES=$(/usr/bin/find * -name '*-i686.pkg.tar.xz' -o -name '*-any.pkg.tar.xz')
|
||||||
x86_64_PACKAGES=$(/usr/bin/find * -name '*-x86_64.pkg.tar.xz' -o -name '*-any.pkg.tar.xz')
|
x86_64_PACKAGES=$(/usr/bin/find * -name '*-x86_64.pkg.tar.xz' -o -name '*-any.pkg.tar.xz')
|
||||||
echo -e "[II] => i686 packages: \n${i686_PACKAGES}"
|
echo -e "${bwhite}[II] ${bblue}=>${cclose} i686 packages: \n${bwhite}${i686_PACKAGES}${cclose}"
|
||||||
echo -e "[II] => x86_64 packages: \n${x86_64_PACKAGES}"
|
echo -e "${bwhite}[II] ${bblue}=>${cclose} x86_64 packages: \n${bwhite}${x86_64_PACKAGES}${cclose}"
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
<h3><a name="updating" class="anchor" href="#updating"><span class="octicon octicon-link"></span></a>Repository update</h3>
|
<h3><a name="updating" class="anchor" href="#updating"><span class="octicon octicon-link"></span></a>Repository update</h3>
|
||||||
<p align="justify">Here is a function for removal packages from database and repository:</p>
|
<p align="justify">Here is a function for removal packages from database and repository:</p>
|
||||||
{% highlight bash %}
|
{% highlight bash %}
|
||||||
func_remove() {
|
func_remove() {
|
||||||
PKGNAME="$1"
|
PACKAGE="$1"
|
||||||
/usr/bin/rm -f ${PKGNAME}-[0-9]*
|
REPODIR="$2"
|
||||||
|
/usr/bin/rm -f "${REPODIR}/${PACKAGE}"{,.sig}
|
||||||
}
|
}
|
||||||
export -f func_remove
|
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
<p align="justify"><code>i686</code> repository update:</p>
|
<p align="justify"><code>i686</code> repository update:</p>
|
||||||
{% highlight bash %}
|
{% highlight bash %}
|
||||||
# updating i686 repo
|
# updating i686 repo
|
||||||
echo "[II] Updating i686 repo"
|
echo -e "${bwhite}[II]${cclose} Updating ${bwhite}i686${cclose} repo"
|
||||||
cd "${REPODIR}/i686"
|
cd "${REPODIR}/i686"
|
||||||
for PACKAGE in ${i686_PACKAGES}; do
|
for PACKAGE in ${i686_PACKAGES}; do
|
||||||
PKGNAME=$(echo ${PACKAGE} | /usr/bin/awk -F '-' '{for(i=1; i<=NF-3;i++) {printf("%s-", $i);}}' | /usr/bin/sed 's/.$//')
|
PKGNAME=$(/usr/bin/package-query -p -f %n "${REPODIR}/i686/${PACKAGE}")
|
||||||
/usr/bin/find -name "${PKGNAME}*.pkg.tar.xz" -type f -exec /usr/bin/bash -c "func_remove "${PKGNAME}"" \;
|
func_remove "${PACKAGE}" "${REPODIR}/i686"
|
||||||
/usr/bin/cp "${PREPAREDIR}/${PACKAGE}" .
|
/usr/bin/cp "${PREPAREDIR}/${PACKAGE}" .
|
||||||
[ ${USEGPG} == "yes" ] && /usr/bin/cp "${PREPAREDIR}/${PACKAGE}.sig" .
|
[ ${USEGPG} == "yes" ] && /usr/bin/cp "${PREPAREDIR}/${PACKAGE}.sig" .
|
||||||
/usr/bin/repo-add --new ${DBNAME}.db.tar.gz "${PACKAGE}"
|
/usr/bin/repo-add ${DBNAME}.db.tar.gz "${PACKAGE}"
|
||||||
/usr/bin/repo-add --new --files ${DBNAME}.files.tar.gz "${PACKAGE}"
|
/usr/bin/repo-add --files ${DBNAME}.files.tar.gz "${PACKAGE}"
|
||||||
done
|
done
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
<p align="justify"><code>x86_64</code> repository update:</p>
|
<p align="justify"><code>x86_64</code> repository update:</p>
|
||||||
{% highlight bash %}
|
{% highlight bash %}
|
||||||
# updating x86_64 repo
|
# updating x86_64 repo
|
||||||
echo "[II] Updating x86_64 repo"
|
echo -e "${bwhite}[II]${cclose} Updating ${bwhite}x86_64${cclose} repo"
|
||||||
cd "${REPODIR}/x86_64"
|
cd "${REPODIR}/x86_64"
|
||||||
for PACKAGE in ${x86_64_PACKAGES}; do
|
for PACKAGE in ${x86_64_PACKAGES}; do
|
||||||
PKGNAME=$(echo ${PACKAGE} | /usr/bin/awk -F '-' '{for(i=1; i<=NF-3;i++) {printf("%s-", $i);}}' | /usr/bin/sed 's/.$//')
|
PKGNAME=$(/usr/bin/package-query -p -f %n "${REPODIR}/x86_64/${PACKAGE}")
|
||||||
/usr/bin/find -name "${PKGNAME}"'*.pkg.tar.xz' -type f -exec /usr/bin/bash -c "func_remove "${PKGNAME}"" \;
|
func_remove "${PACKAGE}" "${REPODIR}/x86_64"
|
||||||
/usr/bin/cp "${PREPAREDIR}/${PACKAGE}" .
|
/usr/bin/cp "${PREPAREDIR}/${PACKAGE}" .
|
||||||
[ ${USEGPG} == "yes" ] && /usr/bin/cp "${PREPAREDIR}/${PACKAGE}.sig" .
|
[ ${USEGPG} == "yes" ] && /usr/bin/cp "${PREPAREDIR}/${PACKAGE}.sig" .
|
||||||
/usr/bin/repo-add --new ${DBNAME}.db.tar.gz "${PACKAGE}"
|
/usr/bin/repo-add ${DBNAME}.db.tar.gz "${PACKAGE}"
|
||||||
/usr/bin/repo-add --new --files ${DBNAME}.files.tar.gz "${PACKAGE}"
|
/usr/bin/repo-add --files ${DBNAME}.files.tar.gz "${PACKAGE}"
|
||||||
done
|
done
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
|
@ -13,12 +13,57 @@ description: Небольшая статья, посвященная созда
|
|||||||
pacman -Sy devtools
|
pacman -Sy devtools
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
<p align="justify"><a href="https://www.archlinux.org/packages/devtools/">devtools</a> - набор скриптов, предназначенный для автоматизации сборки пакетов в чистом чруте. Думаю, большинство мейнтейнеров Arch'а пользуются им.</p>
|
<p align="justify"><a href="https://www.archlinux.org/packages/devtools/">devtools</a> - набор скриптов, предназначенный для автоматизации сборки пакетов в чистом чруте. Думаю, большинство мейнтейнеров Arch'а пользуются им.</p>
|
||||||
<p align="justify">Создадим рабочие директории:</p>
|
<p align="justify">Создадим рабочие директории и установим цвета:</p>
|
||||||
{% highlight bash %}
|
{% highlight bash %}
|
||||||
mkdir -p ~/arch/repo/{i686,x86_64}
|
# цвета
|
||||||
mkdir -p ~/arch/{prepare,root,staging}
|
if [ ${USECOLOR} == "yes" ]; then
|
||||||
|
black='\e[0;30m'
|
||||||
|
bblack='\e[1;30m'
|
||||||
|
red='\e[0;31m'
|
||||||
|
bred='\e[1;31m'
|
||||||
|
green='\e[0;32m'
|
||||||
|
bgreen='\e[1;32m'
|
||||||
|
yellow='\e[0;33m'
|
||||||
|
byellow='\e[1;33m'
|
||||||
|
blue='\e[0;34m'
|
||||||
|
bblue='\e[1;34m'
|
||||||
|
purple='\e[0;35m'
|
||||||
|
bpurple='\e[1;35m'
|
||||||
|
cyan='\e[0;36m'
|
||||||
|
bcyan='\e[1;36m'
|
||||||
|
white='\e[0;37m'
|
||||||
|
bwhite='\e[1;37m'
|
||||||
|
cclose='\e[0m'
|
||||||
|
fi
|
||||||
|
export USECOLOR
|
||||||
|
# директории
|
||||||
|
if [ ! -d "${PREPAREDIR}" ]; then
|
||||||
|
[ -e "${PREPAREDIR}" ] && error_mes "file" "${PREPAREDIR}"
|
||||||
|
echo -e "${bwhite}[II] ${bblue}Creating directory ${bwhite}'${PREPAREDIR}'${cclose}"
|
||||||
|
mkdir -p "${PREPAREDIR}" || error_mes "unknown"
|
||||||
|
fi
|
||||||
|
if [ ! -d "${REPODIR}" ]; then
|
||||||
|
[ -e "${REPODIR}" ] && error_mes "file" "${REPODIR}"
|
||||||
|
echo -e "${bwhite}[II] ${bblue}Creating directory ${bwhite}'${REPODIR}'${cclose}"
|
||||||
|
mkdir -p "${REPODIR}/"{i686,x86_64} || error_mes "unknown"
|
||||||
|
fi
|
||||||
|
if [ ! -d "${REPODIR}/i686" ]; then
|
||||||
|
[ -e "${REPODIR}/i686" ] && error_mes "file" "${REPODIR}/i686"
|
||||||
|
echo -e "${bwhite}[II] ${bblue}Creating directory ${bwhite}'${REPODIR}/i686'${cclose}"
|
||||||
|
mkdir -p "${REPODIR}/i686" || error_mes "unknown"
|
||||||
|
fi
|
||||||
|
if [ ! -d "${REPODIR}/x86_64" ]; then
|
||||||
|
[ -e "${REPODIR}/x86_64" ] && error_mes "file" "${REPODIR}/x86_64"
|
||||||
|
echo -e "${bwhite}[II] ${bblue}Creating directory ${bwhite}'${REPODIR}/x86_64'${cclose}"
|
||||||
|
mkdir -p "${REPODIR}/x86_64" || error_mes "unknown"
|
||||||
|
fi
|
||||||
|
if [ ! -d "${STAGINGDIR}" ]; then
|
||||||
|
[ -e "${STAGINGDIR}" ] && error_mes "file" "${STAGINGDIR}"
|
||||||
|
echo -e "${bwhite}[II] ${bblue}Creating directory ${bwhite}'${STAGINGDIR}'${cclose}"
|
||||||
|
mkdir -p "${STAGINGDIR}" || error_mes "unknown"
|
||||||
|
fi
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
<p align="justify">Директории <code>~/arch/repo/{i686,x86_64}</code> для самого репозитория, <code>~/arch/prepare</code> - директория, где будут лежать собранные пакеты, <code>~/arch/root</code> - директория, где будет создан чистый чрут для сборки, <code>~/arch/staging</code> - директория, откуда будут собираться пакеты.</p>
|
<p align="justify">Директории <code>${REPODIR}/{i686,x86_64}</code> для самого репозитория, <code>${PREPAREDIR}</code> - директория, где будут лежать собранные пакеты, <code>${STAGINGDIR}</code> - директория, откуда будут собираться пакеты.</p>
|
||||||
|
|
||||||
<h2><a name="theory" class="anchor" href="#theory"><span class="octicon octicon-link"></span></a>Немного теории</h2>
|
<h2><a name="theory" class="anchor" href="#theory"><span class="octicon octicon-link"></span></a>Немного теории</h2>
|
||||||
<p align="justify">Создаем директорию, расшариваем ее (например, по <a href="/ru/2014/03/06/site-changes/">ftp</a>). В ней две субдиректории - <code>i686</code> и <code>x86_64</code>, для каждого типа архитектур соответственно. И наполняем их набором пакетов по Вашему усмотрению.</p>
|
<p align="justify">Создаем директорию, расшариваем ее (например, по <a href="/ru/2014/03/06/site-changes/">ftp</a>). В ней две субдиректории - <code>i686</code> и <code>x86_64</code>, для каждого типа архитектур соответственно. И наполняем их набором пакетов по Вашему усмотрению.</p>
|
||||||
@ -40,7 +85,7 @@ mkdir -p ~/arch/{prepare,root,staging}
|
|||||||
<h3><a name="pkgbuild" class="anchor" href="#pkgbuild"><span class="octicon octicon-link"></span></a>Создание PKGBUILD'ов</h3>
|
<h3><a name="pkgbuild" class="anchor" href="#pkgbuild"><span class="octicon octicon-link"></span></a>Создание PKGBUILD'ов</h3>
|
||||||
<p align="justify">Скачаем исходники для всех нужных пакетов из AUR'а:</p>
|
<p align="justify">Скачаем исходники для всех нужных пакетов из AUR'а:</p>
|
||||||
{% highlight bash %}
|
{% highlight bash %}
|
||||||
cd ~/arch/staging
|
cd "${STAGINGDIR}"
|
||||||
yaourt -G package-name
|
yaourt -G package-name
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
@ -48,22 +93,29 @@ yaourt -G package-name
|
|||||||
<p align="justify">Автоматически соберем каждый пакет:</p>
|
<p align="justify">Автоматически соберем каждый пакет:</p>
|
||||||
{% highlight bash %}
|
{% highlight bash %}
|
||||||
func_build() {
|
func_build() {
|
||||||
|
if [ ${USECOLOR} == "yes" ]; then
|
||||||
|
bblue='\e[1;34m'
|
||||||
|
bwhite='\e[1;37m'
|
||||||
|
cclose='\e[0m'
|
||||||
|
fi
|
||||||
PREPARE="$1"
|
PREPARE="$1"
|
||||||
ROOT="$2"
|
ROOT="$2"
|
||||||
eval $(/usr/bin/grep 'arch=' PKGBUILD)
|
eval $(/usr/bin/grep 'arch=' PKGBUILD)
|
||||||
if echo ${arch} | /usr/bin/grep any -q; then
|
eval $(/usr/bin/grep 'pkgname=' PKGBUILD)
|
||||||
/usr/bin/sudo /usr/bin/staging-i686-build -r "${ROOT}" -c
|
echo -e "${bwhite}[II] ${bblue}=>${cclose} Building ${bwhite}${pkgname}${cclose}"
|
||||||
|
if echo ${arch} | /usr/bin/grep 'any' -q; then
|
||||||
|
LC_MESSAGES=C /usr/bin/sudo /usr/bin/staging-i686-build -r "${ROOT}" -c
|
||||||
else
|
else
|
||||||
eval $(/usr/bin/grep 'pkgname=' PKGBUILD)
|
eval $(/usr/bin/grep 'pkgname=' PKGBUILD)
|
||||||
if echo ${pkgname} | /usr/bin/grep lib32 -q; then
|
if echo ${pkgname} | /usr/bin/grep lib32 -q; then
|
||||||
/usr/bin/sudo /usr/bin/multilib-staging-build -r "${ROOT}" -c
|
LC_MESSAGES=C /usr/bin/sudo /usr/bin/multilib-staging-build -r "${ROOT}" -c
|
||||||
else
|
else
|
||||||
if /usr/bin/grep "lib32" PKGBUILD -q; then
|
if /usr/bin/grep 'lib32' PKGBUILD -q; then
|
||||||
/usr/bin/sudo /usr/bin/staging-i686-build -r "${ROOT}" -c
|
LC_MESSAGES=C /usr/bin/sudo /usr/bin/staging-i686-build -r "${ROOT}" -c
|
||||||
/usr/bin/sudo /usr/bin/multilib-staging-build -r "${ROOT}" -c
|
LC_MESSAGES=C /usr/bin/sudo /usr/bin/multilib-staging-build -r "${ROOT}" -c
|
||||||
else
|
else
|
||||||
/usr/bin/sudo /usr/bin/staging-i686-build -r "${ROOT}" -c
|
LC_MESSAGES=C /usr/bin/sudo /usr/bin/staging-i686-build -r "${ROOT}" -c
|
||||||
/usr/bin/sudo /usr/bin/staging-x86_64-build -r "${ROOT}" -c
|
LC_MESSAGES=C /usr/bin/sudo /usr/bin/staging-x86_64-build -r "${ROOT}" -c
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -72,6 +124,7 @@ func_build() {
|
|||||||
export -f func_build
|
export -f func_build
|
||||||
|
|
||||||
# building
|
# building
|
||||||
|
echo -e "${bwhite}[II]${cclose} Building packages"
|
||||||
cd "${STAGINGDIR}"
|
cd "${STAGINGDIR}"
|
||||||
/usr/bin/find -name 'PKGBUILD' -type f -execdir /usr/bin/bash -c "func_build "${PREPAREDIR}" "${ROOTDIR}"" \;
|
/usr/bin/find -name 'PKGBUILD' -type f -execdir /usr/bin/bash -c "func_build "${PREPAREDIR}" "${ROOTDIR}"" \;
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
@ -86,7 +139,7 @@ username ALL=NOPASSWD: /usr/bin/multilib-staging-build
|
|||||||
{% highlight bash %}
|
{% highlight bash %}
|
||||||
# signing
|
# signing
|
||||||
if [ ${USEGPG} == "yes" ]; then
|
if [ ${USEGPG} == "yes" ]; then
|
||||||
echo "[II] Signing"
|
echo -e "${bwhite}[II]${cclose} Signing"
|
||||||
cd "${PREPAREDIR}"
|
cd "${PREPAREDIR}"
|
||||||
for PACKAGE in $(/usr/bin/find . -name '*.pkg.tar.xz'); do
|
for PACKAGE in $(/usr/bin/find . -name '*.pkg.tar.xz'); do
|
||||||
/usr/bin/gpg -b ${PACKAGE}
|
/usr/bin/gpg -b ${PACKAGE}
|
||||||
@ -101,45 +154,45 @@ fi
|
|||||||
cd "${PREPAREDIR}"
|
cd "${PREPAREDIR}"
|
||||||
i686_PACKAGES=$(/usr/bin/find * -name '*-i686.pkg.tar.xz' -o -name '*-any.pkg.tar.xz')
|
i686_PACKAGES=$(/usr/bin/find * -name '*-i686.pkg.tar.xz' -o -name '*-any.pkg.tar.xz')
|
||||||
x86_64_PACKAGES=$(/usr/bin/find * -name '*-x86_64.pkg.tar.xz' -o -name '*-any.pkg.tar.xz')
|
x86_64_PACKAGES=$(/usr/bin/find * -name '*-x86_64.pkg.tar.xz' -o -name '*-any.pkg.tar.xz')
|
||||||
echo -e "[II] => i686 packages: \n${i686_PACKAGES}"
|
echo -e "${bwhite}[II] ${bblue}=>${cclose} i686 packages: \n${bwhite}${i686_PACKAGES}${cclose}"
|
||||||
echo -e "[II] => x86_64 packages: \n${x86_64_PACKAGES}"
|
echo -e "${bwhite}[II] ${bblue}=>${cclose} x86_64 packages: \n${bwhite}${x86_64_PACKAGES}${cclose}"
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
<h3><a name="updating" class="anchor" href="#updating"><span class="octicon octicon-link"></span></a>Обновление репозиториев</h3>
|
<h3><a name="updating" class="anchor" href="#updating"><span class="octicon octicon-link"></span></a>Обновление репозиториев</h3>
|
||||||
<p align="justify">Функция для удаления пакетов из базы данных и из репозитория:</p>
|
<p align="justify">Функция для удаления пакетов из базы данных и из репозитория:</p>
|
||||||
{% highlight bash %}
|
{% highlight bash %}
|
||||||
func_remove() {
|
func_remove() {
|
||||||
PKGNAME="$1"
|
PACKAGE="$1"
|
||||||
/usr/bin/rm -f ${PKGNAME}*
|
REPODIR="$2"
|
||||||
|
/usr/bin/rm -f "${REPODIR}/${PACKAGE}"{,.sig}
|
||||||
}
|
}
|
||||||
export -f func_remove
|
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
<p align="justify">Обновление репозитория <code>i686</code>:</p>
|
<p align="justify">Обновление репозитория <code>i686</code>:</p>
|
||||||
{% highlight bash %}
|
{% highlight bash %}
|
||||||
# updating i686 repo
|
# updating i686 repo
|
||||||
echo "[II] Updating i686 repo"
|
echo -e "${bwhite}[II]${cclose} Updating ${bwhite}i686${cclose} repo"
|
||||||
cd "${REPODIR}/i686"
|
cd "${REPODIR}/i686"
|
||||||
for PACKAGE in ${i686_PACKAGES}; do
|
for PACKAGE in ${i686_PACKAGES}; do
|
||||||
PKGNAME=$(echo ${PACKAGE} | /usr/bin/awk -F '-' '{for(i=1; i<=NF-3;i++) {printf("%s-", $i);}}' | /usr/bin/sed 's/.$//')
|
PKGNAME=$(/usr/bin/package-query -p -f %n "${REPODIR}/i686/${PACKAGE}")
|
||||||
/usr/bin/find -name "${PKGNAME}*.pkg.tar.xz" -type f -exec /usr/bin/bash -c "func_remove "${PKGNAME}"" \;
|
func_remove "${PACKAGE}" "${REPODIR}/i686"
|
||||||
/usr/bin/cp "${PREPAREDIR}/${PACKAGE}" .
|
/usr/bin/cp "${PREPAREDIR}/${PACKAGE}" .
|
||||||
[ ${USEGPG} == "yes" ] && /usr/bin/cp "${PREPAREDIR}/${PACKAGE}.sig" .
|
[ ${USEGPG} == "yes" ] && /usr/bin/cp "${PREPAREDIR}/${PACKAGE}.sig" .
|
||||||
/usr/bin/repo-add --new ${DBNAME}.db.tar.gz "${PACKAGE}"
|
/usr/bin/repo-add ${DBNAME}.db.tar.gz "${PACKAGE}"
|
||||||
/usr/bin/repo-add --new --files ${DBNAME}.files.tar.gz "${PACKAGE}"
|
/usr/bin/repo-add --files ${DBNAME}.files.tar.gz "${PACKAGE}"
|
||||||
done
|
done
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
<p align="justify">Обновление репозитория <code>x86_64</code>:</p>
|
<p align="justify">Обновление репозитория <code>x86_64</code>:</p>
|
||||||
{% highlight bash %}
|
{% highlight bash %}
|
||||||
# updating x86_64 repo
|
# updating x86_64 repo
|
||||||
echo "[II] Updating x86_64 repo"
|
echo -e "${bwhite}[II]${cclose} Updating ${bwhite}x86_64${cclose} repo"
|
||||||
cd "${REPODIR}/x86_64"
|
cd "${REPODIR}/x86_64"
|
||||||
for PACKAGE in ${x86_64_PACKAGES}; do
|
for PACKAGE in ${x86_64_PACKAGES}; do
|
||||||
PKGNAME=$(echo ${PACKAGE} | /usr/bin/awk -F '-' '{for(i=1; i<=NF-3;i++) {printf("%s-", $i);}}' | /usr/bin/sed 's/.$//')
|
PKGNAME=$(/usr/bin/package-query -p -f %n "${REPODIR}/x86_64/${PACKAGE}")
|
||||||
/usr/bin/find -name "${PKGNAME}"'*.pkg.tar.xz' -type f -exec /usr/bin/bash -c "func_remove "${PKGNAME}"" \;
|
func_remove "${PACKAGE}" "${REPODIR}/x86_64"
|
||||||
/usr/bin/cp "${PREPAREDIR}/${PACKAGE}" .
|
/usr/bin/cp "${PREPAREDIR}/${PACKAGE}" .
|
||||||
[ ${USEGPG} == "yes" ] && /usr/bin/cp "${PREPAREDIR}/${PACKAGE}.sig" .
|
[ ${USEGPG} == "yes" ] && /usr/bin/cp "${PREPAREDIR}/${PACKAGE}.sig" .
|
||||||
/usr/bin/repo-add --new ${DBNAME}.db.tar.gz "${PACKAGE}"
|
/usr/bin/repo-add ${DBNAME}.db.tar.gz "${PACKAGE}"
|
||||||
/usr/bin/repo-add --new --files ${DBNAME}.files.tar.gz "${PACKAGE}"
|
/usr/bin/repo-add --files ${DBNAME}.files.tar.gz "${PACKAGE}"
|
||||||
done
|
done
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user