You are not logged in.

#1 2020-12-30 13:27:54

potatocup
Member
Registered: 2020-12-30
Posts: 5

[SOLVED] Self-made AUR package: Add informative console output

Hello everyone,

today I made and submitted my first AUR package (https://aur.archlinux.org/packages/rpiplay-git/).

Unfortunately I couldn't find a way to add some informative console output, after the installation of the package has finished.
After installing the package with pacman in the terminal (with an aur-wrapper), I want to show the user some messages, that explain to them that they have to start the avahi system service and how to do that. Otherwise the program will not work correctly.

Does anyone have an idea or a link where this concept is explained? I already looked into pacman post_install (https://wiki.archlinux.org/index.php/PKGBUILD#install), but this looks more like a script for handling actual installation details and not for printing information.

Thank you for your help smile!

Last edited by potatocup (2020-12-30 16:32:54)

Offline

#2 2020-12-30 13:42:34

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,352

Re: [SOLVED] Self-made AUR package: Add informative console output

post_install is the place to do it, echo what you want to convey there.

Offline

#3 2020-12-30 13:42:38

potatocup
Member
Registered: 2020-12-30
Posts: 5

Re: [SOLVED] Self-made AUR package: Add informative console output

Perfect... after searching around so long, I find the answer myself 5 minutes after posting here... Sorry!
I found a package that also has this behavior (https://aur.archlinux.org/packages/flutter/), downloaded the files with pacman -G flutter and looked at their flutter.install file. There they do exactly what I was looking for; print informative messages to the user after install and upgrade.

The link to the Arch Wiki I posted before (https://wiki.archlinux.org/index.php/PKGBUILD#install) explains how to bind the script to your AUR package.

For anyone interested, this is how their script looks:

  0 post_install() {
  1   groupadd -f flutterusers
  2   chgrp -R flutterusers /opt/flutter
  3   chmod -R g+w /opt/flutter
  4   printf "$(tput setaf 4)Flutter was installed on $(tput setaf 2)/opt/flutter$(tput sgr0)\n"
  5   printf "$(tput setaf 4)$(tput sgr0)\n"
  6   printf "$(tput setaf 4)If you intend to use it as a regular user, add your user into the group flutterusers:$(tput sgr0)\n"
  7   printf "$(tput setaf 2)gpasswd -a <user> flutterusers$(tput sgr0)\n"
  8   printf "$(tput setaf 4)$(tput sgr0)\n"
  9   printf "$(tput setaf 4)You need to source $(tput setaf 2)/etc/profile$(tput setaf 4) or relogin to add flutter to your path.$(tput sgr0)\n"
 10   printf "$(tput setaf 4)$(tput sgr0)\n"
 11   printf "$(tput setaf 4)Re-login your terminal in to the group flutterusers:$(tput sgr0)\n"
 12   printf "$(tput setaf 2)newgrp flutterusers$(tput sgr0)\n"
 13 }
 14
 15 post_upgrade() {
 16   post_install
 17 }
 18
 19 post_remove() {
 20   groupdel flutterusers
 21   printf "$(tput setaf 4)If you had added/modified files or permissions in folder /opt/flutter is possible you need to delete it manually.$(tput sgr0)\n"
 22   printf "$(tput setaf 2)rm -rf /opt/flutter$(tput sgr0)\n"
 23 }

Sorry for this meaningless post. Cheers smile!

Offline

#4 2020-12-30 13:44:11

potatocup
Member
Registered: 2020-12-30
Posts: 5

Re: [SOLVED] Self-made AUR package: Add informative console output

Yes, thank you @V1del!

Offline

#5 2020-12-30 13:46:53

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,352

Re: [SOLVED] Self-made AUR package: Add informative console output

Good to hear, please mark as [SOLVED] by editing the title in the first post.

Offline

#6 2020-12-30 15:17:03

twelveeighty
Member
Registered: 2011-09-04
Posts: 1,456

Re: [SOLVED] Self-made AUR package: Add informative console output

@potatocup: there is also the Creating & Modifying Packages forum, where you can ask for tips or a review on your PKGBUILD by experienced Arch packagers.

Offline

#7 2020-12-30 16:33:31

potatocup
Member
Registered: 2020-12-30
Posts: 5

Re: [SOLVED] Self-made AUR package: Add informative console output

Thank you @twelveeighty, I will check that out!

Offline

Board footer

Powered by FluxBB