Pacman aurutils: Difference between revisions

From wikinotes
(Created page with "scripts for working with aur, sharing built packages over local network. = Documentation = <blockquote> {| class="wikitable" |- | github || https://github.com/AladW/aurutils |- |} </blockquote><!-- Documentation -->")
 
 
(33 intermediate revisions by the same user not shown)
Line 1: Line 1:
scripts for working with aur, sharing built packages over local network.
aurutils manages aur packages within your own local pacman repository.<br>
You can then host/share this package repository with other arch systems.


= Documentation =
= Documentation =
Line 6: Line 7:
|-
|-
| github || https://github.com/AladW/aurutils
| github || https://github.com/AladW/aurutils
|-
| <code>man aur</code> || https://github.com/AladW/aurutils/blob/master/man1/aur.1
|-
| <code>man aurhosting</code> || https://github.com/AladW/aurutils/blob/master/man7/aurhosting.7
|-
|-
|}
|}
</blockquote><!-- Documentation -->
</blockquote><!-- Documentation -->
= Locations =
<blockquote>
{| class="wikitable"
|-
| <code>/etc/pacman.d/${your_repo}.conf</code> || configure your repo
|-
| <code>/etc/pacman.conf</code> || you'll need to <code>Include</code> your repo conf
|-
|}
</blockquote><!-- Locations -->
= Tutorials =
<blockquote>
{| class="wikitable"
|-
| initial setup || https://gist.github.com/geosharma/afe1ea9ebe58cb67aaaba62a0d47bc7a
|-
|}
</blockquote><!-- Tutorials -->
= Install =
<blockquote>
<syntaxhighlight lang="bash">
aura -A aurutils
</syntaxhighlight>
</blockquote><!-- Install -->
= Usage =
<blockquote>
<syntaxhighlight lang="bash">
# add or update package to repo
aur search ${pkg}
aur sync  ${pkg}                # download, build AUR package to local repo
aur sync -u                      # update all installed AUR packages
aur sync -u --ignore=git-bug-bin  # update all installed AUR packages, ignoring one with an issue
aur sync --rebuild ${pkg}        # force recompile a package (ex. qt5-styleplugins)
# install a package from the repo
sudo pacman -S ${pkg}  # install package from repo
</syntaxhighlight>
</blockquote><!-- Usage -->
= Configuration =
<blockquote>
== Notes ==
<blockquote>
Before getting started, some quick notes
* You'll be defining a single repo (server/consumer) -- '''server/client repo_names MUST MATCH'''
* The server can install packages from the <code>file:///</code> repo, you don't need a server and client on the same machine
* <code>pacman -Syu</code> (all repos) for consumers will fail unless server is online
* <code>*-dkms</code> packages are fine, and packages are built with their CPU-arch in the name; sharing across cpu types is fine
</blockquote><!-- Notes -->
== Server ==
<blockquote>
=== Create/Use Repo ===
<blockquote>
{{ WARNING |
Obviously, this setup is not ideal for a shared system.<br>
The user that builds packages should not have super-user permissions to install packages on a production system.<br>
}}
<syntaxhighlight lang="bash">
# 'build' group members can add packages
mkdir -p /var/cache/pacman/aur
sudo chown ${USER}:${USER} /var/cache/pacman/aur
sudo chmod 775 /var/cache/pacman/aur
</syntaxhighlight>
<syntaxhighlight lang="dosini">
# /etc/pacman.d/aur.conf
[options]
CacheDir = /var/cache/pacman/pkg/
CacheDir = /var/cache/pacman/aur/
[aur]
SigLevel = Optional TrustAll
Server = file:///var/cache/pacman/aur
</syntaxhighlight>
<syntaxhighlight lang="dosini">
# /etc/pacman.conf
# ...
Include /etc/pacman.d/aur.conf
</syntaxhighlight>
{{ NOTE |
careful, the user use pass to `-o` must have superuser permissions
}}
<syntaxhighlight lang="bash">
sudo install -d -d /var/cache/pacman/aur -o ${USER}
repo-add /var/cache/pacman/aur/aur.db.tar
</syntaxhighlight>
</blockquote><!-- Create/Use Repo -->
=== Adding manually built packages to repo ===
<blockquote>
<syntaxhighlight lang="bash">
# copy manually built packages to repo
cp /var/src/*/*.pkg.tar.* /var/cache/pacman/aur/
# add packages to database
repo-add -n aur.db.tar /var/cache/pacman/aur/*.pkg.tar.*
# now update :)
aur sync -u
</syntaxhighlight>
</blockquote><!-- Adding manually built packages to repo -->
=== Host Repo ===
<blockquote>
Any old http server will work
<syntaxhighlight lang="bash">
# host repo over HTTP
python -m http.server -d /var/cache/pacman/aur
</syntaxhighlight>
For example, here's a systemd service to host aur packages
<syntaxhighlight lang="dosini">
# /etc/systemd/system/aurutils-server.service
#
# vim: ft=systemd
[Unit]
Description=Custom pacman repo to centralize AUR package building.
Requires=network-online.target
After=ctrl-alt-del.target
[Service]
ExecStart=/usr/bin/python -m http.server -d /var/cache/pacman/aur 8000
Type=simple
[Install]
WantedBy=multi-user.target
</syntaxhighlight>
</blockquote><!-- Host Repo -->
</blockquote><!-- Server -->
== Clients ==
<blockquote>
Note: like when configuring packages above, the db must match the section-name in pacman.conf (ex. aur.db -> [aur]).
<syntaxhighlight lang="dosini">
# /etc/pacman.d/aur.conf
[options]
CacheDir = /var/cache/pacman/pkg/
CacheDir = /var/cache/pacman/aur/
[aur]
SigLevel = Optional TrustAll
Server = http://192.168.1.123:8000
</syntaxhighlight>
Now check for a package you've built on the server
<syntaxhighlight lang="bash">
sudo pacman -Syy google-chrome  # tadaa!
</syntaxhighlight>
</blockquote><!-- Clients -->
</blockquote><!-- Configuration -->

Latest revision as of 18:58, 17 December 2023

aurutils manages aur packages within your own local pacman repository.
You can then host/share this package repository with other arch systems.

Documentation

github https://github.com/AladW/aurutils
man aur https://github.com/AladW/aurutils/blob/master/man1/aur.1
man aurhosting https://github.com/AladW/aurutils/blob/master/man7/aurhosting.7

Locations

/etc/pacman.d/${your_repo}.conf configure your repo
/etc/pacman.conf you'll need to Include your repo conf

Tutorials

initial setup https://gist.github.com/geosharma/afe1ea9ebe58cb67aaaba62a0d47bc7a

Install

aura -A aurutils

Usage

# add or update package to repo
aur search ${pkg}
aur sync   ${pkg}                 # download, build AUR package to local repo
aur sync -u                       # update all installed AUR packages
aur sync -u --ignore=git-bug-bin  # update all installed AUR packages, ignoring one with an issue
aur sync --rebuild ${pkg}         # force recompile a package (ex. qt5-styleplugins)

# install a package from the repo
sudo pacman -S ${pkg}   # install package from repo

Configuration

Notes

Before getting started, some quick notes

  • You'll be defining a single repo (server/consumer) -- server/client repo_names MUST MATCH
  • The server can install packages from the file:/// repo, you don't need a server and client on the same machine
  • pacman -Syu (all repos) for consumers will fail unless server is online
  • *-dkms packages are fine, and packages are built with their CPU-arch in the name; sharing across cpu types is fine

Server

Create/Use Repo

WARNING:

Obviously, this setup is not ideal for a shared system.
The user that builds packages should not have super-user permissions to install packages on a production system.

# 'build' group members can add packages
mkdir -p /var/cache/pacman/aur
sudo chown ${USER}:${USER} /var/cache/pacman/aur
sudo chmod 775 /var/cache/pacman/aur
# /etc/pacman.d/aur.conf
[options]
CacheDir = /var/cache/pacman/pkg/
CacheDir = /var/cache/pacman/aur/

[aur]
SigLevel = Optional TrustAll
Server = file:///var/cache/pacman/aur
# /etc/pacman.conf

# ...


Include /etc/pacman.d/aur.conf

NOTE:

careful, the user use pass to `-o` must have superuser permissions

sudo install -d -d /var/cache/pacman/aur -o ${USER}
repo-add /var/cache/pacman/aur/aur.db.tar

Adding manually built packages to repo

# copy manually built packages to repo
cp /var/src/*/*.pkg.tar.* /var/cache/pacman/aur/

# add packages to database
repo-add -n aur.db.tar /var/cache/pacman/aur/*.pkg.tar.*

# now update :)
aur sync -u

Host Repo

Any old http server will work

# host repo over HTTP
python -m http.server -d /var/cache/pacman/aur

For example, here's a systemd service to host aur packages

# /etc/systemd/system/aurutils-server.service
#
# vim: ft=systemd

[Unit]
Description=Custom pacman repo to centralize AUR package building.
Requires=network-online.target
After=ctrl-alt-del.target

[Service]
ExecStart=/usr/bin/python -m http.server -d /var/cache/pacman/aur 8000
Type=simple

[Install]
WantedBy=multi-user.target

Clients

Note: like when configuring packages above, the db must match the section-name in pacman.conf (ex. aur.db -> [aur]).

# /etc/pacman.d/aur.conf

[options]
CacheDir = /var/cache/pacman/pkg/
CacheDir = /var/cache/pacman/aur/

[aur]
SigLevel = Optional TrustAll
Server = http://192.168.1.123:8000

Now check for a package you've built on the server

sudo pacman -Syy google-chrome  # tadaa!