
INSTRUCTIONS FOR BUILDING on SLES
================================================================================

Pre-requisites
----------------------------------------------------------------

- have a SLES 12 SP1 system,
- up to date,
- with SDK repository available ((yast2 -> Software -> Software Repositories ->
                         Add -> Extensions and modules from Registration Server)
- have internet access (port 21, 80, 443)
- copy generation scripts to server: create-lemonldap-packages.sh and zypper-download


Build packages
----------------------------------

The build package can construct what is necessary:
- it can install basic dependencies needed to build things
- it can install LemonLDAP::NG build dependencies
- it can build perl dependencies, getting them from CPAN, creating
  RPM thanks to CPAN2RPM tool, and installing them
- it can get available Red Hat LemonLDAP packages and rebuild them on
  the fly for SLES
- it can generate a SLES package repository


Build script is auto-descriptive:
USAGE:
./create-lemonldap-packages.sh [pre] [iba] [ibu] [bde] [ble] [help]
[pre] - install PRErequisites
[iba] - Install BAsic dependencies
[ibu] - Install BUild dependencies
[bde] - Build DEpendencies packages
[ble] - Build LEmonldap
[bre] - Build REpository
[help] - print this help

Make it executable:
chmod +x create-lemonldap-packages.sh zypper-download

and launch in the same order:
./create-lemonldap-packages.sh pre
./create-lemonldap-packages.sh iba
./create-lemonldap-packages.sh ibu
./create-lemonldap-packages.sh bde
./create-lemonldap-packages.sh ble

Last target is optional:
./create-lemonldap-packages.sh bre
(it allows to create a repository with the desired packages


Signature
----------------------------------
There are two options:
- sign RPM packages
- sign repository

Sign the repository is not so useful, so this procedure only take care
about RPM signature.

Generate gpg key:
pgp -kg

Set RPM macro for choosing correct key:
echo '%_signature gpg
%_gpg_name KEY_NAME' > ~/.rpmmacros

Sign the packages:
rpm --resign lemonldap-sles12-repository/noarch/*.rpm \
             lemonldap-sles12-repository/src/*.rpm \
             lemonldap-sles12-repository/x86_64/*.rpm

Signature generates different files. It is recommended to
resign only new packages. Then the checksum must be
calculated again:
createrepo --update lemonldap-sles12-repository

You can also configure a .repo descriptor for better integration:
echo '[lemonldap-sles12-repository-signed]
name=lemonldap-sles12-repository
type=rpm-md
baseurl=http://host.tld/lemonldap-sles12-repository
gpgcheck=1
gpgkey=http://host.tld/lemonldap-sles12-repository/repodata/repomd.xml.key
enabled=1' > lemonldap-sles12-repository/lemonldap-sles12-repository.repo

With this .repo file, you need to export the GPG key with:
gpg --armor --export KEY_NAME > lemonldap-sles12-repository/repodata/repomd.xml.key

With this .repo file, the repository can be added with:
zypper addrepo http://host.tld/lemonldap-sles12-repository/lemonldap-sles12-repository.repo

On the client side, the GPG key can be imported with:
rpm --import http://host.tld/lemonldap-sles12-repository/repodata/repomd.xml.key

