You are not logged in.

#1 2018-03-15 03:12:52

gillecaluim
Member
Registered: 2014-11-02
Posts: 42

[SOLVED]post_install() problem

I was adding an install script to bind to setup a custom zone file and add rndc key.
My understanding  of the post_install() script was that it wasn't run until all of the package has been installed.  The behavior I've experienced, however, doesn't seem to validate this.
I've tried to use several of the files installed by the package in the install script and I get random errors that the files don't exist....meaning that the post_install() script is running in a separate thread and the installation of the package files is not complete.
Has anyone else experienced this?

Last edited by gillecaluim (2018-03-16 01:35:46)

Offline

#2 2018-03-15 03:17:52

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED]post_install() problem

That doesn't seem right at all, but until you post the error messages and preferably the PKGBUILD/install script you tried using, we really have no way of knowing...


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#3 2018-03-15 04:38:28

gillecaluim
Member
Registered: 2014-11-02
Posts: 42

Re: [SOLVED]post_install() problem

bind package should install /etc/named.conf and /usr/bin/rndc-confgen
my bind.install script...

post_install() {
  echo "change name server"
  sed -i 's/#name_servers/name_servers/g' /etc/resolvconf.conf
  resolvconf -u
  mkdir -p /var/log/named
  touch /var/log/named/named.log
  chown root:40 /var/log/named/named.log
  chmod 664 /var/log/named/named.log
  touch /var/log/named/update-debug.log
  chown root:40 /var/log/named/update-debug.log
  chmod 664 /var/log/named/update-debug.log
  touch /var/log/named/named-auth.info
  chown root:40 /var/log/named/named-auth.info
  chmod 664 /var/log/named/named-auth.info
# set rndc key in named.conf
  echo "set rndc key"
  rndc-confgen > /etc/rndc.conf
  secret=`cat /etc/rndc.conf | grep secret | grep "#" | cut -d \" -f2`
  sed -i 's/rndc-secret/${secret}/g' /etc/named.conf
}

here's installation messages....

# pacman -S bind bind-tools
resolving dependencies...
looking for conflicting packages...

Packages (2) bind-9.12.0-1  bind-tools-9.12.0-1

Total Download Size:   1.88 MiB
Total Installed Size:  6.94 MiB

:: Proceed with installation? [Y/n] y
:: Retrieving packages...
 bind-tools-9.12.0-1-x86_64                                            1702.9 KiB   238M/s 00:00 [########################################################] 100%
 bind-9.12.0-1-x86_64                                                   218.4 KiB  0.00B/s 00:00 [########################################################] 100%
(2/2) checking keys in keyring                                                                   [########################################################] 100%
(2/2) checking package integrity                                                                 [########################################################] 100%
(2/2) loading package files                                                                      [########################################################] 100%
(2/2) checking for file conflicts                                                                [########################################################] 100%
(2/2) checking available disk space                                                              [########################################################] 100%
:: Processing package changes...
(1/2) installing bind-tools                                                                      [########################################################] 100%
change name server
set rndc key
/tmp/alpm_hFkcc8/.INSTALL: line 128: rndc-confgen: command not found
sed: can't read /etc/named.conf: No such file or directory
error: command failed to execute correctly
Optional dependencies for bind-tools
    python: for python scripts [installed]
(2/2) installing bind                                                                            [########################################################] 100%
change name server
set rndc key
:: Running post-transaction hooks...
(1/3) Updating system user accounts...
(2/3) Creating temporary files...
(3/3) Arming ConditionNeedsUpdate...

Offline

#4 2018-03-15 04:55:53

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,540

Re: [SOLVED]post_install() problem

It's running on bind-tools, not bind. You need to define the install file in the right place.

Or do it differently, that install file is pretty horrible. Most of that should be done by systemd-tmpfiles

Last edited by Scimmia (2018-03-15 04:57:04)

Offline

#5 2018-03-16 01:37:23

gillecaluim
Member
Registered: 2014-11-02
Posts: 42

Re: [SOLVED]post_install() problem

thanks, didn't appreciate the nuances of install scripts with split packages.  Moved the install=bind.install directive into the package section for bind and that fixed the issue

Offline

Board footer

Powered by FluxBB