Sharing the changes I did in scripts - bind
by Weber Kai from LinuxQuestions.org on (#5NRRV)
Hi!
I am creating an ARM filesystem but some packages don't install correctly with "installpkg --root newroot".
In bind package there is a problem in the script install/doinst.sh:
1) It tries to generate rndc keys, and for this, it executes ldconfig.
I've changed it like openssh package: The keys are generated late at boot time.
I've edited the latest source at https://mirror.slackbuilds.org/slack...source/n/bind/
The 'diff -u' files are:
doinst.sh.diff:
Code:--- doinst.sh 2021-08-25 10:20:38.202353497 -0300
+++ doinst.sh.new 2021-08-25 10:23:30.891841976 -0300
@@ -10,27 +10,23 @@
fi
# Otherwise, we leave the .new copy for the admin to consider...
}
-
-# Keep same perms on rc.bind.new:
-if [ -e etc/rc.d/rc.bind ]; then
- cp -a etc/rc.d/rc.bind etc/rc.d/rc.bind.new.incoming
- cat etc/rc.d/rc.bind.new > etc/rc.d/rc.bind.new.incoming
- mv etc/rc.d/rc.bind.new.incoming etc/rc.d/rc.bind.new
-fi
+preserve_perms() {
+ NEW="$1"
+ OLD="$(dirname ${NEW})/$(basename ${NEW} .new)"
+ if [ -e ${OLD} ]; then
+ cp -a ${OLD} ${NEW}.incoming
+ cat ${NEW} > ${NEW}.incoming
+ touch -r ${NEW} ${NEW}.incoming
+ mv ${NEW}.incoming ${NEW}
+ fi
+ config ${NEW}
+}
config etc/named.conf.new
-config etc/rc.d/rc.bind.new
+preserve_perms etc/rc.d/rc.bind.new
# Add a /var/named if it doesn't exist:
if [ ! -d var/named ]; then
mkdir -p var/named
chmod 755 var/named
fi
-
-# Generate /etc/rndc.key if there's none there,
-# and there also no /etc/rndc.conf (the other
-# way to set this up).
-if [ ! -r etc/rndc.key -a ! -r /etc/rndc.conf ]; then
- chroot . /sbin/ldconfig
- chroot . /usr/sbin/rndc-confgen -r /dev/urandom -a 2> /dev/null
-firc.bind.diff:
Code:--- rc.bind 2021-08-25 10:19:57.519774075 -0300
+++ rc.bind.new 2021-08-25 10:22:35.099039894 -0300
@@ -56,6 +56,14 @@
# Seriously, don't run "rc.bind start" if BIND is already
# running or you'll get more than one copy running.
bind_start() {
+ # Generate /etc/rndc.key if there's none there,
+ # and there also no /etc/rndc.conf (the other
+ # way to set this up).
+ if [ ! -r etc/rndc.key -a ! -r /etc/rndc.conf ]; then
+ echo "Generating /etc/rndc.key: /usr/sbin/rndc-confgen -r /dev/urandom -a"
+ /usr/sbin/rndc-confgen -r /dev/urandom -a 2> /dev/null
+ fi
+
# Make sure /var/run/named exists:
mkdir -p /var/run/named
# If we are running as a non-root user, we'll need to be sure thatWith this script the package installed correctly to my ARM jail.
Thanks!
I am creating an ARM filesystem but some packages don't install correctly with "installpkg --root newroot".
In bind package there is a problem in the script install/doinst.sh:
1) It tries to generate rndc keys, and for this, it executes ldconfig.
I've changed it like openssh package: The keys are generated late at boot time.
I've edited the latest source at https://mirror.slackbuilds.org/slack...source/n/bind/
The 'diff -u' files are:
doinst.sh.diff:
Code:--- doinst.sh 2021-08-25 10:20:38.202353497 -0300
+++ doinst.sh.new 2021-08-25 10:23:30.891841976 -0300
@@ -10,27 +10,23 @@
fi
# Otherwise, we leave the .new copy for the admin to consider...
}
-
-# Keep same perms on rc.bind.new:
-if [ -e etc/rc.d/rc.bind ]; then
- cp -a etc/rc.d/rc.bind etc/rc.d/rc.bind.new.incoming
- cat etc/rc.d/rc.bind.new > etc/rc.d/rc.bind.new.incoming
- mv etc/rc.d/rc.bind.new.incoming etc/rc.d/rc.bind.new
-fi
+preserve_perms() {
+ NEW="$1"
+ OLD="$(dirname ${NEW})/$(basename ${NEW} .new)"
+ if [ -e ${OLD} ]; then
+ cp -a ${OLD} ${NEW}.incoming
+ cat ${NEW} > ${NEW}.incoming
+ touch -r ${NEW} ${NEW}.incoming
+ mv ${NEW}.incoming ${NEW}
+ fi
+ config ${NEW}
+}
config etc/named.conf.new
-config etc/rc.d/rc.bind.new
+preserve_perms etc/rc.d/rc.bind.new
# Add a /var/named if it doesn't exist:
if [ ! -d var/named ]; then
mkdir -p var/named
chmod 755 var/named
fi
-
-# Generate /etc/rndc.key if there's none there,
-# and there also no /etc/rndc.conf (the other
-# way to set this up).
-if [ ! -r etc/rndc.key -a ! -r /etc/rndc.conf ]; then
- chroot . /sbin/ldconfig
- chroot . /usr/sbin/rndc-confgen -r /dev/urandom -a 2> /dev/null
-firc.bind.diff:
Code:--- rc.bind 2021-08-25 10:19:57.519774075 -0300
+++ rc.bind.new 2021-08-25 10:22:35.099039894 -0300
@@ -56,6 +56,14 @@
# Seriously, don't run "rc.bind start" if BIND is already
# running or you'll get more than one copy running.
bind_start() {
+ # Generate /etc/rndc.key if there's none there,
+ # and there also no /etc/rndc.conf (the other
+ # way to set this up).
+ if [ ! -r etc/rndc.key -a ! -r /etc/rndc.conf ]; then
+ echo "Generating /etc/rndc.key: /usr/sbin/rndc-confgen -r /dev/urandom -a"
+ /usr/sbin/rndc-confgen -r /dev/urandom -a 2> /dev/null
+ fi
+
# Make sure /var/run/named exists:
mkdir -p /var/run/named
# If we are running as a non-root user, we'll need to be sure thatWith this script the package installed correctly to my ARM jail.
Thanks!