You are not logged in.

#1 2023-07-09 00:25:56

JaydenDev
Member
Registered: 2022-07-11
Posts: 172

[SOLVED] PKGBUILD post-install symlink

I am packaging the Catalyst web browser for the AUR. All of its files (libraries, the binary, and the pak files) get placed in /usr/share/catalyst-browser however I need to symlink the catalyst binary from that directory to /usr/bin. How do I do this? I read the PKGBUILD wiki page and it said I needed to define a .install file and add a post install function. I did that but it doesn't make the symlink post install. Here's the PKGBUILD and .install file:

PKGBUILD

# Maintainer: jdev082 <jdev0894@gmail.com>

pkgname=catalyst-browser-bin
pkgver=3.4.9
pkgrel=1
pkgdesc="Catalyst Web Browser"
arch=('x86_64')
url="https://getcatalyst.eu.org"
license=('MIT')
provides=("$pkgname")
source=("https://github.com/CatalystDevOrg/Catalyst/releases/download/v3.4.9/catalyst-linux-x64.tar.gz")
md5sums=("SKIP")
install="post.install"
#depends=('vim')

package() {
  mkdir -p "$pkgdir/usr/share/catalyst-browser"
  cp -r "$srcdir/catalyst-linux-x64/." "$pkgdir/usr/share/catalyst-browser"
  mkdir -p "$pkgdir/usr/bin"
}

post.install file

post_install() {
    ln -s /usr/share/catalyst-browser/catalyst /usr/bin/catalyst-browser
}

post_remove() {
    rm -rf /usr/bin/catalyst-browser
}

Last edited by JaydenDev (2023-07-16 19:29:00)


System Specs:
Intel Core i5-2400 Nvidia GTX 1050ti Logitech G402 Hyperion Fury (Mouse) BestBuy Essentials USB Keyboard
Software Specifications:
Desktop Environment: KDE Plasma Window Manager: KWin Operating System: Arch Linux (btw)

Offline

#2 2023-07-09 01:02:25

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,650

Re: [SOLVED] PKGBUILD post-install symlink

Just make the symlink in package(). DO NOT make it in post_install().

Edit: Other issues with the PKGBUILD

The provides is nonsense. A package is itself, it doesn't provide itself.
You need to rename the source file in the source array. As it sits, you'll run into problems on every update.
You should also use $pkgver to represent the version in the source array so you don't have to update it in 2 places.
Don't skip the checksum
You need to install the license.

Last edited by Scimmia (2023-07-09 01:09:26)

Offline

#3 2023-07-09 10:20:57

loqs
Member
Registered: 2014-03-06
Posts: 18,425

Re: [SOLVED] PKGBUILD post-install symlink

Why place the files under /usr/share?
You are sure the package has no dependencies?

catalyst-browser-bin W: Referenced library 'libasound.so.2' is an uninstalled dependency (needed in files ['usr/share/catalyst-browser/catalyst'])
catalyst-browser-bin W: Referenced library 'libXfixes.so.3' is an uninstalled dependency (needed in files ['usr/share/catalyst-browser/catalyst'])
catalyst-browser-bin W: Referenced library 'libgbm.so.1' is an uninstalled dependency (needed in files ['usr/share/catalyst-browser/catalyst'])
catalyst-browser-bin W: Referenced library 'libnss3.so' is an uninstalled dependency (needed in files ['usr/share/catalyst-browser/catalyst'])
catalyst-browser-bin W: Referenced library 'libatspi.so.0' is an uninstalled dependency (needed in files ['usr/share/catalyst-browser/catalyst'])
catalyst-browser-bin W: Referenced library 'libcairo.so.2' is an uninstalled dependency (needed in files ['usr/share/catalyst-browser/catalyst'])
catalyst-browser-bin W: Referenced library 'libXext.so.6' is an uninstalled dependency (needed in files ['usr/share/catalyst-browser/catalyst', 'usr/share/catalyst-browser/libGLESv2.so'])
catalyst-browser-bin W: Referenced library 'libnspr4.so' is an uninstalled dependency (needed in files ['usr/share/catalyst-browser/catalyst'])
catalyst-browser-bin W: Referenced library 'libxcb.so.1' is an uninstalled dependency (needed in files ['usr/share/catalyst-browser/catalyst', 'usr/share/catalyst-browser/libGLESv2.so'])
catalyst-browser-bin W: Referenced library 'libX11.so.6' is an uninstalled dependency (needed in files ['usr/share/catalyst-browser/catalyst', 'usr/share/catalyst-browser/libGLESv2.so'])
catalyst-browser-bin W: Referenced library 'libgtk-3.so.0' is an uninstalled dependency (needed in files ['usr/share/catalyst-browser/catalyst'])
catalyst-browser-bin W: Referenced library 'libdrm.so.2' is an uninstalled dependency (needed in files ['usr/share/catalyst-browser/catalyst'])
catalyst-browser-bin W: Referenced library 'libnssutil3.so' is an uninstalled dependency (needed in files ['usr/share/catalyst-browser/catalyst'])
catalyst-browser-bin W: Referenced library 'libXrandr.so.2' is an uninstalled dependency (needed in files ['usr/share/catalyst-browser/catalyst'])
catalyst-browser-bin W: Referenced library 'libcups.so.2' is an uninstalled dependency (needed in files ['usr/share/catalyst-browser/catalyst'])
catalyst-browser-bin W: Referenced library 'libatk-1.0.so.0' is an uninstalled dependency (needed in files ['usr/share/catalyst-browser/catalyst'])
catalyst-browser-bin W: Referenced library 'libatk-bridge-2.0.so.0' is an uninstalled dependency (needed in files ['usr/share/catalyst-browser/catalyst'])
catalyst-browser-bin W: Referenced library 'libXcomposite.so.1' is an uninstalled dependency (needed in files ['usr/share/catalyst-browser/catalyst'])
catalyst-browser-bin W: Referenced library 'libXdamage.so.1' is an uninstalled dependency (needed in files ['usr/share/catalyst-browser/catalyst'])
catalyst-browser-bin W: Referenced library 'libdbus-1.so.3' is an uninstalled dependency (needed in files ['usr/share/catalyst-browser/catalyst'])
catalyst-browser-bin W: Referenced library 'libpango-1.0.so.0' is an uninstalled dependency (needed in files ['usr/share/catalyst-browser/catalyst'])
catalyst-browser-bin W: Referenced library 'libxkbcommon.so.0' is an uninstalled dependency (needed in files ['usr/share/catalyst-browser/catalyst'])
catalyst-browser-bin W: Referenced library 'libsmime3.so' is an uninstalled dependency (needed in files ['usr/share/catalyst-browser/catalyst'])
catalyst-browser-bin E: Dependency expat detected and not included (libraries ['usr/lib/libexpat.so.1'] needed in files ['usr/share/catalyst-browser/catalyst'])
catalyst-browser-bin E: Dependency gcc-libs detected and not included (libraries ['usr/lib/libgcc_s.so.1'] needed in files ['usr/share/catalyst-browser/libGLESv2.so', 'usr/share/catalyst-browser/libvk_swiftshader.so', 'usr/share/catalyst-browser/libEGL.so', 'usr/share/catalyst-browser/libvulkan.so.1', 'usr/share/catalyst-browser/catalyst', 'usr/share/catalyst-browser/chrome_crashpad_handler', 'usr/share/catalyst-browser/libffmpeg.so'])
catalyst-browser-bin E: Dependency glib2 detected and not included (libraries ['usr/lib/libgobject-2.0.so.0', 'usr/lib/libglib-2.0.so.0', 'usr/lib/libgio-2.0.so.0'] needed in files ['usr/share/catalyst-browser/catalyst'])
catalyst-browser-bin E: Dependency glibc detected and not included (libraries ['usr/lib/libm.so.6', 'usr/lib/libpthread.so.0', 'usr/lib/libdl.so.2', 'usr/lib/libc.so.6', 'usr/lib/ld-linux-x86-64.so.2'] needed in files ['usr/share/catalyst-browser/libvulkan.so.1', 'usr/share/catalyst-browser/libGLESv2.so', 'usr/share/catalyst-browser/libEGL.so', 'usr/share/catalyst-browser/chrome_crashpad_handler', 'usr/share/catalyst-browser/libffmpeg.so', 'usr/share/catalyst-browser/chrome-sandbox', 'usr/share/catalyst-browser/libvk_swiftshader.so', 'usr/share/catalyst-browser/catalyst'])

Offline

#4 2023-07-09 15:06:45

JaydenDev
Member
Registered: 2022-07-11
Posts: 172

Re: [SOLVED] PKGBUILD post-install symlink

loqs wrote:

Why place the files under /usr/share?

Where else would I put them? There are many files that I need in the same directory so that the binary can find them and the program can run properly.


System Specs:
Intel Core i5-2400 Nvidia GTX 1050ti Logitech G402 Hyperion Fury (Mouse) BestBuy Essentials USB Keyboard
Software Specifications:
Desktop Environment: KDE Plasma Window Manager: KWin Operating System: Arch Linux (btw)

Offline

#5 2023-07-09 15:13:27

loqs
Member
Registered: 2014-03-06
Posts: 18,425

Re: [SOLVED] PKGBUILD post-install symlink

JaydenDev wrote:
loqs wrote:

Why place the files under /usr/share?

Where else would I put them? There are many files that I need in the same directory so that the binary can find them and the program can run properly.

Arch_package_guidelines#Directories /opt following the example of vivaldi or /usr following the example of chromium and opera with some binaries being placed in /usr/lib/$pkgname.

Offline

#6 2023-07-09 17:45:44

JaydenDev
Member
Registered: 2022-07-11
Posts: 172

Re: [SOLVED] PKGBUILD post-install symlink

loqs wrote:
JaydenDev wrote:
loqs wrote:

Why place the files under /usr/share?

Where else would I put them? There are many files that I need in the same directory so that the binary can find them and the program can run properly.

Arch_package_guidelines#Directories /opt following the example of vivaldi or /usr following the example of chromium and opera with some binaries being placed in /usr/lib/$pkgname.

If I were to install to /opt I would still have to figure out how to have the binary in /usr/bin so that it can be executed.


System Specs:
Intel Core i5-2400 Nvidia GTX 1050ti Logitech G402 Hyperion Fury (Mouse) BestBuy Essentials USB Keyboard
Software Specifications:
Desktop Environment: KDE Plasma Window Manager: KWin Operating System: Arch Linux (btw)

Offline

#7 2023-07-09 18:08:57

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,650

Re: [SOLVED] PKGBUILD post-install symlink

No, you still just make the same symlink.

Offline

#8 2023-07-09 18:20:23

JaydenDev
Member
Registered: 2022-07-11
Posts: 172

Re: [SOLVED] PKGBUILD post-install symlink

Scimmia wrote:

No, you still just make the same symlink.

How do I make the symlink? I know the command but how do I make this run post install?


System Specs:
Intel Core i5-2400 Nvidia GTX 1050ti Logitech G402 Hyperion Fury (Mouse) BestBuy Essentials USB Keyboard
Software Specifications:
Desktop Environment: KDE Plasma Window Manager: KWin Operating System: Arch Linux (btw)

Offline

#9 2023-07-09 18:28:24

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,650

Re: [SOLVED] PKGBUILD post-install symlink

As I said in post #2, you don't. You make the symlink in the package function.

Offline

#10 2023-07-09 18:33:31

JaydenDev
Member
Registered: 2022-07-11
Posts: 172

Re: [SOLVED] PKGBUILD post-install symlink

Scimmia wrote:

As I said in post #2, you don't. You make the symlink in the package function.

When I tried that it made a symlink from the packages binary to the system which wouldn't go very well if the AUR package files were deleted. And if I made the symlink from the actual installed files to /usr/bin that wouldn't make sense for a package function.


System Specs:
Intel Core i5-2400 Nvidia GTX 1050ti Logitech G402 Hyperion Fury (Mouse) BestBuy Essentials USB Keyboard
Software Specifications:
Desktop Environment: KDE Plasma Window Manager: KWin Operating System: Arch Linux (btw)

Offline

#11 2023-07-09 18:49:36

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 13,621

Re: [SOLVED] PKGBUILD post-install symlink

Here's an example from an aur package I maintain

    ln -s /usr/lib/libGLX_mesa.so.0 "${pkgdir}/usr/lib/libGLX_indirect.so.0"

pacman treats symlinks under $pkgdir as part of the package so if the package is removed the symlink is also gone.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#12 2023-07-09 18:51:07

loqs
Member
Registered: 2014-03-06
Posts: 18,425

Re: [SOLVED] PKGBUILD post-install symlink

You make a symlink from $pkgdir/usr/bin/something to either absolute path /opt/bin/something or to relative path ../../opt/bin/something

Offline

#13 2023-07-09 20:33:11

JaydenDev
Member
Registered: 2022-07-11
Posts: 172

Re: [SOLVED] PKGBUILD post-install symlink

Here is my finalized PKGBUILD:

# Maintainer: jdev082 <jdev0894@gmail.com>

pkgname=catalyst-browser-bin
pkgver=3.4.9
pkgrel=1
pkgdesc="Catalyst Web Browser"
arch=('x86_64')
url="https://getcatalyst.eu.org"
license=('MIT')
source=("https://github.com/CatalystDevOrg/Catalyst/releases/download/v3.4.9/catalyst-linux-x64.tar.gz")
md5sums=("a23ac6728ef4e35f6363d03825abbd3d")

package() {
  mkdir -p "$pkgdir/opt/catalyst-browser"
  cp -r "$srcdir/catalyst-linux-x64/." "$pkgdir/opt/catalyst-browser"
  mkdir -p "$pkgdir/usr/bin"
  ln -s /opt/catalyst-browser/catalyst "${pkgdir}/usr/bin/catalyst-browser"
  mkdir -p "$pkgdir/usr/share/applications"
  cp -r "../Catalyst.desktop" "$pkgdir/usr/share/applications"
  cp -r "../catalyst.png" "$pkgdir/opt/catalyst-browser"
}

I have tested this PKGBUILD and it works as intended however I want to make sure I'm doing everything the proper way.


System Specs:
Intel Core i5-2400 Nvidia GTX 1050ti Logitech G402 Hyperion Fury (Mouse) BestBuy Essentials USB Keyboard
Software Specifications:
Desktop Environment: KDE Plasma Window Manager: KWin Operating System: Arch Linux (btw)

Offline

#14 2023-07-09 20:54:41

loqs
Member
Registered: 2014-03-06
Posts: 18,425

Re: [SOLVED] PKGBUILD post-install symlink

==> Extracting sources...
  -> Extracting catalyst-linux-x64.tar.gz with bsdtar
==> Entering fakeroot environment...
==> Starting package()...
cp: cannot stat '../Catalyst.desktop': No such file or directory
==> ERROR: A failure occurred in package().
Scimmia wrote:

You need to rename the source file in the source array. As it sits, you'll run into problems on every update.
You should also use $pkgver to represent the version in the source array so you don't have to update it in 2 places.
...
You need to install the license.

loqs wrote:

You are sure the package has no dependencies?

Offline

#15 2023-07-09 21:28:49

JaydenDev
Member
Registered: 2022-07-11
Posts: 172

Re: [SOLVED] PKGBUILD post-install symlink

loqs wrote:

You are sure the package has no dependencies?

According to the deb package generated by the build system it has these dependencies:

Depends: libgtk-3-0, libnotify4, libnss3, libxtst6, xdg-utils, libatspi2.0-0, libdrm2, libgbm1, libxcb-dri3-0, kde-cli-tools | kde-runtime | trash-cli | libglib2.0-bin | gvfs-bin
Recommends: pulseaudio | libasound2
Suggests: gir1.2-gnomekeyring-1.0, libgnome-keyring0, lsb-release

System Specs:
Intel Core i5-2400 Nvidia GTX 1050ti Logitech G402 Hyperion Fury (Mouse) BestBuy Essentials USB Keyboard
Software Specifications:
Desktop Environment: KDE Plasma Window Manager: KWin Operating System: Arch Linux (btw)

Offline

#16 2023-07-16 03:05:09

JaydenDev
Member
Registered: 2022-07-11
Posts: 172

Re: [SOLVED] PKGBUILD post-install symlink

I will mark this as solved as the original problem has been solved. I will make sure to apply the previously mentioned fixes soon.


System Specs:
Intel Core i5-2400 Nvidia GTX 1050ti Logitech G402 Hyperion Fury (Mouse) BestBuy Essentials USB Keyboard
Software Specifications:
Desktop Environment: KDE Plasma Window Manager: KWin Operating System: Arch Linux (btw)

Offline

Board footer

Powered by FluxBB