You are not logged in.

#1 2021-04-20 00:14:55

theokonos
Member
Registered: 2021-04-20
Posts: 5

Configuring PKGBUILD to install shared libraries from package source

Hello! I’ve recently adopted an application in the AUR for PKGBUILD maintenance, but the latest version of the application (veeam agent for Linux) started including a couple of shared libraries. I’m using the RPM provided by Veeam as the package source, and within the RPM there is a usr/lib/veeam/ directory with the two shared libraries, libNtlmAuth.so and libPkcs12Converter.so.

For context, I’m completely new to AUR package maintenance and development in general. For some reason, I can’t figure out how to make the PKGBUILD direct yay to install the shared libraries under the /usr/lib/ system directory and associate them properly.

Any help would be appreciated!

Cheers,
Theo

Offline

#2 2021-04-20 00:39:04

loqs
Member
Registered: 2014-03-06
Posts: 13,257

Re: Configuring PKGBUILD to install shared libraries from package source

Using install in the same way the PKGBUILD already installs the binaries.
Edit:

# Maintainer: dekart811

pkgname=veeam
pkgver=5.0.0.4318
pkgrel=1
pkgdesc="Veeam Agent for Linux"
arch=('x86_64')
url=http://repository.veeam.com/backup/linux/agent
license=('custom')
depends=('ncurses' 'lvm2' 'fuse')
source=( "$url/rpm/el/7/x86_64/$pkgname-$pkgver-1.el7.x86_64.rpm" )
sha256sums=('b59550472d161c53708a6d0a06fce1f594535d9b5211c5056b99dfbf35f9fac7')
noextract=("$pkgname-$pkgver-1.el7.x86_64.rpm")
backup=('etc/veeam/veeam.ini' 'usr/share/veeam/lpb_scheme.sql' 'usr/share/veeam/db_upgrade.sql' 'usr/share/veeam/db_scheme.sql')

package() {
  bsdtar -xf $pkgname-$pkgver-1.el7.x86_64.rpm -C "$pkgdir" -s /sbin/bin/ -s '|lib/systemd|usr/lib/systemd|' -s "|/usr/share/doc/veeam/|/usr/share/licenses/$pkgname/|"
  sed -i -e 's|/var/run|/run|' -e 's|/sbin|/bin|' "$pkgdir"/usr/lib/systemd/system/veeamservice.service
  rm -rf "$pkgdir"/usr/lib/.build-id/
  rmdir "$pkgdir"/usr/share/doc/veeam/ "$pkgdir"/usr/share/doc/
}

Drop rpmextract as bsdtar can manage rpm archives.
Use noextract to stop makepkg extracting the archive so it can be performed in package with path substitution.  This saves having to manually install everything to its location.
I dropped the .install file.  Nothing it performed should have been there.  Use sysusers.d to create the group veeam if it is needed.
Do not enable or disable services in .install.  Do not delete logs in .install.
Do not do the following anywhere:

sudo ln -s libncursesw.so.6 libncursesw.so.5

Last edited by loqs (2021-04-20 01:31:05)

Offline

#3 2021-04-20 02:31:26

theokonos
Member
Registered: 2021-04-20
Posts: 5

Re: Configuring PKGBUILD to install shared libraries from package source

loqs wrote:

Using install in the same way the PKGBUILD already installs the binaries.
Edit:

# Maintainer: dekart811

pkgname=veeam
pkgver=5.0.0.4318
pkgrel=1
pkgdesc="Veeam Agent for Linux"
arch=('x86_64')
url=http://repository.veeam.com/backup/linux/agent
license=('custom')
depends=('ncurses' 'lvm2' 'fuse')
source=( "$url/rpm/el/7/x86_64/$pkgname-$pkgver-1.el7.x86_64.rpm" )
sha256sums=('b59550472d161c53708a6d0a06fce1f594535d9b5211c5056b99dfbf35f9fac7')
noextract=("$pkgname-$pkgver-1.el7.x86_64.rpm")
backup=('etc/veeam/veeam.ini' 'usr/share/veeam/lpb_scheme.sql' 'usr/share/veeam/db_upgrade.sql' 'usr/share/veeam/db_scheme.sql')

package() {
  bsdtar -xf $pkgname-$pkgver-1.el7.x86_64.rpm -C "$pkgdir" -s /sbin/bin/ -s '|lib/systemd|usr/lib/systemd|' -s "|/usr/share/doc/veeam/|/usr/share/licenses/$pkgname/|"
  sed -i -e 's|/var/run|/run|' -e 's|/sbin|/bin|' "$pkgdir"/usr/lib/systemd/system/veeamservice.service
  rm -rf "$pkgdir"/usr/lib/.build-id/
  rmdir "$pkgdir"/usr/share/doc/veeam/ "$pkgdir"/usr/share/doc/
}

Drop rpmextract as bsdtar can manage rpm archives.
Use noextract to stop makepkg extracting the archive so it can be performed in package with path substitution.  This saves having to manually install everything to its location.
I dropped the .install file.  Nothing it performed should have been there.  Use sysusers.d to create the group veeam if it is needed.
Do not enable or disable services in .install.  Do not delete logs in .install.
Do not do the following anywhere:

sudo ln -s libncursesw.so.6 libncursesw.so.5

Oh hey, thanks for the thorough response! Before your edit, I got the libraries installed successfully using the older install method. Everything in the existing PKGBUILD is from the previous maintainer -- I'll look at your changes and test them out!

Offline

#4 2021-04-20 03:55:19

theokonos
Member
Registered: 2021-04-20
Posts: 5

Re: Configuring PKGBUILD to install shared libraries from package source

So I had to make a couple tweaks to get it to work (EULA needs to be installed within /usr/share/doc/veeam, not /usr/share/licenses/veeam, and the older format SQLite db's need to be backed up to retain existing job info for existing veeam installations):

diff PKGBUILD PKGBUILD-loqs 
1,3c1
< # Maintainer: theokonos
< # Contributors: dekart811
< # Contributors: loqs
---
> # Maintainer: dekart811
13,16c11,14
< source=( "$url/rpm/el/8/x86_64/veeam-$pkgver-1.el8.x86_64.rpm" )
< sha256sums=('6c4cdf522868e376050ce7969194451d9d2c73f48419928aeceff58b3d8e827e')
< noextract=("$pkgname-$pkgver-1.el8.x86_64.rpm")
< backup=('etc/veeam/veeam.ini' 'usr/share/veeam/lpb_scheme.sql' 'usr/share/veeam/db_upgrade.sql' 'usr/share/veeam/db_scheme.sql' 'var/lib/veeam/veeam_db.sqlite' 'var/lib/veeam/veeam_db.sqlite-shm' 'var/lib/veeam/veeam_db.sqlite-wal')
---
> source=( "$url/rpm/el/7/x86_64/$pkgname-$pkgver-1.el7.x86_64.rpm" )
> sha256sums=('b59550472d161c53708a6d0a06fce1f594535d9b5211c5056b99dfbf35f9fac7')
> noextract=("$pkgname-$pkgver-1.el7.x86_64.rpm")
> backup=('etc/veeam/veeam.ini' 'usr/share/veeam/lpb_scheme.sql' 'usr/share/veeam/db_upgrade.sql' 'usr/share/veeam/db_scheme.sql')
19c17
<   bsdtar -xf $pkgname-$pkgver-1.el8.x86_64.rpm -C "$pkgdir" -s /sbin/bin/ -s '|lib/systemd|usr/lib/systemd|' -s "|/usr/share/doc/veeam/|/usr/share/doc/$pkgname/|"
---
>   bsdtar -xf $pkgname-$pkgver-1.el7.x86_64.rpm -C "$pkgdir" -s /sbin/bin/ -s '|lib/systemd|usr/lib/systemd|' -s "|/usr/share/doc/veeam/|/usr/share/licenses/$pkgname/|"
21a20
>   rmdir "$pkgdir"/usr/share/doc/veeam/ "$pkgdir"/usr/share/doc/

Thanks again for the help!

Offline

#5 2021-04-20 05:01:59

loqs
Member
Registered: 2014-03-06
Posts: 13,257

Re: Configuring PKGBUILD to install shared libraries from package source

See PKGBUILD#license for why I placed the EULA in /usr/share/licenses/$pkgname/

Last edited by loqs (2021-04-20 05:07:57)

Offline

#6 2021-04-20 12:45:59

theokonos
Member
Registered: 2021-04-20
Posts: 5

Re: Configuring PKGBUILD to install shared libraries from package source

loqs wrote:

See PKGBUILD#license for why I placed the EULA in /usr/share/licenses/$pkgname/

I figured you had a reason -- but veeam looks for it under docs. Unless there's a way to change that?

Offline

#7 2021-04-20 13:57:15

loqs
Member
Registered: 2014-03-06
Posts: 13,257

Re: Configuring PKGBUILD to install shared libraries from package source

If the files need to be in two places you can symlink them:

diff --git a/PKGBUILD b/PKGBUILD
index dedcbd2..e9075e8 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -16,7 +16,10 @@ noextract=("$pkgname-$pkgver-1.el8.x86_64.rpm")
 backup=('etc/veeam/veeam.ini' 'usr/share/veeam/lpb_scheme.sql' 'usr/share/veeam/db_upgrade.sql' 'usr/share/veeam/db_scheme.sql' 'var/lib/veeam/veeam_db.sqlite' 'var/lib/veeam/veeam_db.sqlite-shm' 'var/lib/veeam/veeam_db.sqlite-wal')
 
 package() {
-  bsdtar -xf $pkgname-$pkgver-1.el8.x86_64.rpm -C "$pkgdir" -s /sbin/bin/ -s '|lib/systemd|usr/lib/systemd|' -s "|/usr/share/doc/veeam/|/usr/share/doc/$pkgname/|"
+  bsdtar -xf $pkgname-$pkgver-1.el8.x86_64.rpm -C "$pkgdir" -s /sbin/bin/ -s '|lib/systemd|usr/lib/systemd|'
   sed -i -e 's|/var/run|/run|' -e 's|/sbin|/bin|' "$pkgdir"/usr/lib/systemd/system/veeamservice.service
   rm -rf "$pkgdir"/usr/lib/.build-id/
+  install -d  "$pkgdir"/usr/share/licenses/$pkgname/
+  ln -s ../../doc/$pkgname/EULA "$pkgdir"/usr/share/licenses/$pkgname/
+  ln -s ../../doc/$pkgname/3rdPartyNotices.txt "$pkgdir"/usr/share/licenses/$pkgname/
 }

Offline

#8 2021-04-20 19:12:53

theokonos
Member
Registered: 2021-04-20
Posts: 5

Re: Configuring PKGBUILD to install shared libraries from package source

loqs wrote:

If the files need to be in two places you can symlink them:

diff --git a/PKGBUILD b/PKGBUILD
index dedcbd2..e9075e8 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -16,7 +16,10 @@ noextract=("$pkgname-$pkgver-1.el8.x86_64.rpm")
 backup=('etc/veeam/veeam.ini' 'usr/share/veeam/lpb_scheme.sql' 'usr/share/veeam/db_upgrade.sql' 'usr/share/veeam/db_scheme.sql' 'var/lib/veeam/veeam_db.sqlite' 'var/lib/veeam/veeam_db.sqlite-shm' 'var/lib/veeam/veeam_db.sqlite-wal')
 
 package() {
-  bsdtar -xf $pkgname-$pkgver-1.el8.x86_64.rpm -C "$pkgdir" -s /sbin/bin/ -s '|lib/systemd|usr/lib/systemd|' -s "|/usr/share/doc/veeam/|/usr/share/doc/$pkgname/|"
+  bsdtar -xf $pkgname-$pkgver-1.el8.x86_64.rpm -C "$pkgdir" -s /sbin/bin/ -s '|lib/systemd|usr/lib/systemd|'
   sed -i -e 's|/var/run|/run|' -e 's|/sbin|/bin|' "$pkgdir"/usr/lib/systemd/system/veeamservice.service
   rm -rf "$pkgdir"/usr/lib/.build-id/
+  install -d  "$pkgdir"/usr/share/licenses/$pkgname/
+  ln -s ../../doc/$pkgname/EULA "$pkgdir"/usr/share/licenses/$pkgname/
+  ln -s ../../doc/$pkgname/3rdPartyNotices.txt "$pkgdir"/usr/share/licenses/$pkgname/
 }

Hey, that worked great! Thanks again!

Offline

Board footer

Powered by FluxBB