Buildiso with AUR packages: Using yaourt

From Manjaro Linux
Jump to: navigation, search


Warning: As of June 2015 and the release of manjaro-tools 0.9.9, this tutrial is outdated and needs updating. Please use instead: Buildiso with AUR packages: Using buildpkg.


This tutorial is about creating your own local repository. This repository can be used to download, build (with the help of yaourt), and save packages. Later, you can install those packages to your customized Manjaro ISO using buildiso.


Before you start with this tutorial make sure you have completed the prerequisite steps in Build Manjaro ISOs with buildiso.

The same XFCE ISO profile will be used as example on this Wiki page.


1. Create a directory as your local repository

The first thing you should probably do is create a directory for your local repository. The local repository is called local-repo throughout this entire tutorial. This'll help keep things organized.

 mkdir -p ~/local-repo/

This local repository is created in your home folder, but you can create it anywhere you want.


2. Edit yaourtrc file

your /etc/yaourtrc file contains this line of code:

#EXPORT=0           # Export to 1: EXPORTDIR or PKGDEST

change it to

EXPORT=1           # Export to 1: EXPORTDIR or PKGDEST

The easiest method to change this line of code is to use your default text editor:

sudo kwrite /etc/yaourtrc

Replace kwrite with your preferred text editor.


3. Set PKGDEST

Open a terminal and execute

export PKGDEST=/home/<username>/local-repo/

Replace <username> with your username. This command needs to be executed every time you reboot your system!


4. Build packages from AUR using yaourt

Now, you can use

yaourt -S <package name>

to download and build packages from the AUR to your local repository.

Every time you finish the build of a package, it appears in your ~/local-repo/ folder. All dependencies from the AUR are also stored as files in your ~/local-repo/ folder. All dependencies from the Manjaro repositories are not needed in your local repository.

Please write down or remember all AUR dependencies, because you will need their package names later.

Example:

You want to add the package pcmanfm-qt-git to your ISO. Therefore, you need to add it to your local repository first. You download and build it using

yaourt -S pcmanfm-qt-git

You get told in the beginning of the installation process that pcmanfm-qt-git depends on these packages:

- libfm
- qt5-x11extras
- qt5-tools
- git
- cmake
- liblxqt-git (from AUR)
- lxmenu-data

The first 5 dependencies and the last are from Manjaro repositories and you do not need to care about them. The liblxqt-git package is from the AUR and has the following dependencies:

- qt5-base
- qt5-x11extras 
- qt5-tools 
- git 
- cmake
- libqtxdg-git (from AUR)

The libqtxdg-git package only has dependencies on packages from the Manjaro repositories.


When the build process of pcmanfm-qt-git has finished, you find 3 files in your local repository (~/local-repo/):

liblxqt-git-0.8.0.23.g079768e-1-x86_64.pkg.tar.xz  
libqtxdg-git-1.0.0.7.g0503cf7-1-x86_64.pkg.tar.xz  
pcmanfm-qt-git-0.8.0.4.g99987af-1-x86_64.pkg.tar.xz


All packages in our example were downloaded and build on a 64bit system. You can only build 64bit packages on a 64bit system. It is also non-trivial to build 32bit packages on a 64bit system.

Remember: these 64bit packages in our local repository can only be installed on a customized 64bit ISO.


5. Build a .db file

Use the command repo-add to build a database file. Run the following commands in a terminal:

cd ~/local-repo/
repo-add local-repo.db.tar.gz *.pkg.tar.*
sudo pacman -Syy

Every time you add packages to your local repositories, these commands need to be executed again! Otherwise, buildiso will complain later about missing packages in your local repository.

Example:

After running those commands, your local repository looks like this:

local-repo.db.tar
local-repo.db
liblxqt-git-0.8.0.23.g079768e-1-x86_64.pkg.tar.xz  
libqtxdg-git-1.0.0.7.g0503cf7-1-x86_64.pkg.tar.xz  
pcmanfm-qt-git-0.8.0.4.g99987af-1-x86_64.pkg.tar.xz


6. Add local-repo to pacman-XXXXX.conf file

Open your /etc/pacman.conf file (Attention: This file is different for 32bit and 64bit systems) and copy and save its entire content to

manjaro-tools-iso-profiles/xfce/pacman-XXXXX.conf

Replace pacman-XXXXX.conf with

  • pacman-default.conf if you have only 32bit packages in your local repository and your host system is a 32bit system
  • pacman-multilib.conf if you have only 64bit packages in your local repository and your host system is a 64bit system


At the bottom of the just created pacman-XXXXX.conf file, add:

[local-repo]
SigLevel = Never
Server = file:///home/<username>/local-repo/

Replace <username> with your username.

Example:

Your customized XFCE ISO profile should now look like this (on a 64bit system):

xfce-overlay
isolinux -> ../shared/isolinux/
mkinitcpio.conf -> ../shared/mkinitcpio.conf
overlay -> ../shared/overlay/
overlay-livecd -> ../shared/overlay-livecd/
Packages -> ../shared/Packages-Systemd
Packages-Livecd -> ../shared/Packages-Livecd-Systemd
Packages-Xfce
Packages-Xorg -> ../shared/Packages-Xorg
pacman-multilib.conf
profile.conf

With your new pacman-multilib.conf file:

#
# /etc/pacman.conf
#
# See the pacman.conf(5) manpage for option and repository directives

#
# GENERAL OPTIONS
#
[options]
# The following paths are commented out with their default values listed.
# If you wish to use different paths, uncomment and update the paths.
#RootDir     = /
#DBPath      = /var/lib/pacman/
#CacheDir    = /var/cache/pacman/pkg/
#LogFile     = /var/log/pacman.log
#GPGDir      = /etc/pacman.d/gnupg/
HoldPkg      = pacman glibc manjaro-system
# If upgrades are available for these packages they will be asked for first
SyncFirst    = manjaro-system
#XferCommand = /usr/bin/curl -C - -f %u > %o
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#CleanMethod = KeepInstalled
#UseDelta    = 0.7
Architecture = auto

# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
#IgnorePkg   =
#IgnoreGroup =

#NoUpgrade   =
#NoExtract   =

# Misc options
#UseSyslog
Color
#TotalDownload
CheckSpace
#VerbosePkgLists

# By default, pacman accepts packages signed by keys that its local keyring
# trusts (see pacman-key and its man page), as well as unsigned packages.
SigLevel    = Required DatabaseOptional
LocalFileSigLevel = Optional
#RemoteFileSigLevel = Required

# NOTE: You must run `pacman-key --init` before first using pacman; the local
# keyring can then be populated with the keys of all official Manjaro Linux
# packagers with `pacman-key --populate archlinux manjaro`.

#
# REPOSITORIES
#   - can be defined here or included from another file
#   - pacman will search repositories in the order defined here
#   - local/custom mirrors can be added here or in separate files
#   - repositories listed first will take precedence when packages
#     have identical names, regardless of version number
#   - URLs will have $repo replaced by the name of the current repo
#   - URLs will have $arch replaced by the name of the architecture
#
# Repository entries are of the format:
#       [repo-name]
#       Server = ServerName
#       Include = IncludePath
#
# The header [repo-name] is crucial - it must be present and
# uncommented to enable the repo.
#

[core]
SigLevel = PackageRequired
Include = /etc/pacman.d/mirrorlist

[extra]
SigLevel = PackageRequired
Include = /etc/pacman.d/mirrorlist

[community]
SigLevel = PackageRequired
Include = /etc/pacman.d/mirrorlist

# If you want to run 32 bit applications on your x86_64 system,
# enable the multilib repositories as required here.

[multilib]
SigLevel = PackageRequired
Include = /etc/pacman.d/mirrorlist

#[infinality-bundle]
#SigLevel = Never
#Server = http://bohoomil.com/repo/$arch

# An example of a custom package repository.  See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs

[local-repo]
SigLevel = Never
Server = file:///home/excalibur/local-repo/

As you can see, there is also another custom repository in this example pacman-multilib.conf file: [infinality-bundle]. But it is commented out. This illustrates nicely the way to add a custom non-local repository.

Custom local repositories will get removed automatically from this file before it gets copied over to the installed system, whereas custom non-local repositories will be kept. This means AUR packages are best installed from a custom local repository (as demonstrated by [local-repo] in this tutorial). Packages neither available in the Manjaro repositories nor in the AUR are best installed from a custom non-local repository (see [infinality-bundle] as example).


7. Add package names to ISO profile

Using the example mentioned in here, you can now add the AUR package names to your Packages-Xfce file.

Attention: You need to add all dependency names before the package name (only for dependencies from the AUR).

Example:

You can now add pcmanfm-qt-git to your package list for your ISO profile. This means your manjaro-tools-iso-profiles/xfce/Packages-Xfce file should look exactly like this:

### Manjaro Packages

## XFCE Main Packages
ffmpegthumbnailer
gconf                    # fix qt-theme
gnome-keyring            # fix wlan segfault
gufw                     # firewall
# mdm-themes
accountsservice
lightdm-gtk-greeter
lightdm-gtk-greeter-settings
light-locker
manjaro-settings-manager
>i686 gcc
>x86_64 gcc-multilib

...

## AUR packages
libqtxdg-git
liblxqt-git 
pcmanfm-qt-git

The order of package installations to your ISO is from top to bottom. Please note the exact order of the last 3 packages. pcmanfm-qt-git depends on liblxqt-git, which depends on libqtxdg-git (see chapter 4.1). Therefore, liblxqt-git needs to be the first package, which gets installed!


More

Just to be sure, let's do another

sudo pacman -Syy

You should see your new local-repo in the list of repositories getting synchronized (next to these repositories: core, extra, community, and multilib - only on 64bit systems).


Now, you can continue to adjust your manjaro-tools.conf or build your ISO.


Please remember to install yaourt, octopi, or pamac on your ISO, too. Only these Programs can update packages from the AUR.