]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2008] don't install the hashes directory Kea-1.9.10
authorAndrei Pavel <andrei@isc.org>
Fri, 30 Jul 2021 11:42:05 +0000 (14:42 +0300)
committerAndrei Pavel <andrei@isc.org>
Fri, 30 Jul 2021 11:42:05 +0000 (14:42 +0300)
and make reinstall.sh work from installation

.gitlab-ci.yml
configure.ac
src/share/yang/modules/Makefile.am
src/share/yang/modules/utils/.gitignore [new file with mode: 0644]
src/share/yang/modules/utils/Makefile.am
src/share/yang/modules/utils/reinstall.sh.in [moved from src/share/yang/modules/utils/reinstall.sh with 81% similarity]

index 9a4bee84bd840c9092ccd8f15f82d3f9b248da1c..ae3efed8bc9c3626a49baafe509197df971da269 100644 (file)
@@ -86,7 +86,7 @@ shellcheck:
     - SCRIPTS+="src/share/yang/modules/utils/check-hashes.sh "
     - SCRIPTS+="src/share/yang/modules/utils/check-revisions.sh "
     - SCRIPTS+="src/share/yang/modules/utils/gen-revisions.sh "
-    - SCRIPTS+="src/share/yang/modules/utils/reinstall.sh "
+    - SCRIPTS+="src/share/yang/modules/utils/reinstall.sh.in "
     - SCRIPTS+="tools/add-config-h.sh "
     - SCRIPTS+="tools/bump-lib-versions.sh "
     - SCRIPTS+="tools/check-for-duplicate-includes.sh "
index d1343037f47ae0ff156fe1a40cb7fde8eda57637..3af6b1a9d382fd03973ae55e5dfb50688233b622 100644 (file)
@@ -1824,6 +1824,8 @@ AC_CONFIG_FILES([src/share/database/scripts/pgsql/wipe_data.sh],
 AC_CONFIG_FILES([src/share/yang/Makefile])
 AC_CONFIG_FILES([src/share/yang/modules/Makefile])
 AC_CONFIG_FILES([src/share/yang/modules/utils/Makefile])
+AC_CONFIG_FILES([src/share/yang/modules/utils/reinstall.sh],
+                [chmod +x src/share/yang/modules/utils/reinstall.sh])
 AC_CONFIG_FILES([tools/Makefile])
 AC_CONFIG_FILES([tools/path_replacer.sh],
                 [chmod +x tools/path_replacer.sh])
index c2be6c755c641485099786e56594a364a553b291..a0a0bcfc9cbedc97ce76709c6b9f84861d368652 100644 (file)
@@ -3,7 +3,6 @@ SUBDIRS = utils
 yangmodulesdir = ${datarootdir}/${PACKAGE_NAME}/yang/modules
 
 yangmodules_list  =
-yangmodules_list += hashes
 yangmodules_list += ietf-dhcpv6-client@2018-09-04.yang
 yangmodules_list += ietf-interfaces@2018-02-20.yang
 yangmodules_list += ietf-dhcpv6-options@2018-09-04.yang
@@ -20,7 +19,7 @@ yangmodules_list += kea-dhcp6-server@2019-08-12.yang
 yangmodules_list += kea-types@2019-08-12.yang
 yangmodules_list += keatest-module@2018-11-20.yang
 
-EXTRA_DIST = ${yangmodules_list}
+EXTRA_DIST = hashes ${yangmodules_list}
 
 if HAVE_SYSREPO
 yangmodules_DATA = ${yangmodules_list}
diff --git a/src/share/yang/modules/utils/.gitignore b/src/share/yang/modules/utils/.gitignore
new file mode 100644 (file)
index 0000000..8cf91b2
--- /dev/null
@@ -0,0 +1 @@
+/reinstall.sh
index 53d050bdf05e6b459fef1f6a681d9a9c261f584c..58c4087b2a08e5fc295e40ba9bf597dc2c1db39c 100644 (file)
@@ -12,8 +12,8 @@ EXTRA_DIST = ${yang_list}
 if HAVE_SYSREPO
 
 # Add to the tarball.
-yang_DATA = ${yang_list}
-yang_SCRIPTS = ${yang_list}
+yang_DATA = reinstall.sh
+yang_SCRIPTS = reinstall.sh
 
 # Shell tests
 SHTESTS  =
similarity index 81%
rename from src/share/yang/modules/utils/reinstall.sh
rename to src/share/yang/modules/utils/reinstall.sh.in
index d34084cd4827364516ae70a2e058a7f08dcd9019..5beae1371fd867687dbed7d0b366e79cf9650e86 100755 (executable)
@@ -8,16 +8,12 @@
 
 # Usage:
 #
-# ./src/share/yang/modules/reinstall.sh [-d|--debug] [-h|--help] [-s|--sysrepo ${SYSREPO_INSTALLATION}]
+# reinstall.sh [-d|--debug] [-h|--help] [-s|--sysrepo ${SYSREPO_INSTALLATION}]
 
 # Exit with error if commands exit with non-zero and if undefined variables are
 # used.
 set -eu
 
-script_path=$(cd "$(dirname "${0}")" && pwd)
-kea_sources=$(cd "${script_path}/../../../../.." && pwd)
-modules="${kea_sources}/src/share/yang/modules"
-
 # Print usage.
 # Expressions don't expand in single quotes, use double quotes for that. [SC2016]
 # shellcheck disable=SC2016
@@ -64,6 +60,31 @@ test -z "${sysrepo+x}" && sysrepo='/usr/local'
 
 #------------------------------------------------------------------------------#
 
+# Get script path.
+script_path=$(cd "$(dirname "${0}")" && pwd)
+
+# shellcheck disable=SC2034
+# prefix appears unused. Verify use (or export if used externally).
+# reason: prefix is used in datarootdir (@datarootdir@) below.
+prefix="@prefix@"
+
+# Find modules location.
+# If script is in sources, use modules from sources.
+# If script is in installation, use modules from installation.
+for i in \
+  "@datarootdir@/@PACKAGE_NAME@/yang/modules" \
+  "@abs_top_builddir@/src/share/yang/modules" \
+; do
+  if test "${script_path}" = "${i}/utils"; then
+    modules="${i}"
+    break
+  fi
+done
+if test -z "${modules+x}"; then
+  printf 'ERROR: cannot find location of modules. Use this script from sources or from installation.' >&2
+  exit 1
+fi
+
 # Check if model is installed.
 is_model_installed() {
   model=${1}
@@ -117,9 +138,9 @@ install_yang_models() {
 #   Internal module "ietf-inet-types" cannot be uninstalled.
 # Something about another module depending on ietf-inet-types.
 # Might be related to a module that is internal to sysrepo.
-# Might be for the better since installing YANG modules is idempotent and
-# actually has logic to only install if the revision is newer which is arguably
-# beneficial.
+# Might be for the better to not uninstall them since installing YANG modules is
+# idempotent and actually has logic to only install if the revision is newer
+# which is arguably beneficial.
 uninstall_yang_models() {
   uninstall_model 'kea-dhcp6-server'
   uninstall_model 'kea-dhcp4-server'