summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-11-22 15:59:11 +0100
committerThomas Haller <thaller@redhat.com>2019-11-22 16:07:02 +0100
commit21845ae4e342bca61ad71a1ec6ba239df805eb76 (patch)
tree35a9930b526709f22ea38be760be5a0a8c462a42
parent6d7270e222cce3edaf95c463bec9f3212f5e5c73 (diff)
downloadNetworkManager-21845ae4e342bca61ad71a1ec6ba239df805eb76.tar.gz
build/meson: cleanup "meson-post-install.sh"
- the variables in meson.build and in the meson-post-install.sh script should have the same names. - the positional command line arguments should be assigned to variables, because the variable name acts like a documentation what the variable means (contrary to the argument number). - the boolean flags should not map to other special values, like "enable_docs ? 'install_docs' : ''". The name "enable_docs" is good already, it shall be either passed as 1 or 0 and use the name consistently.
-rw-r--r--meson.build4
-rwxr-xr-xtools/meson-post-install.sh72
2 files changed, 39 insertions, 37 deletions
diff --git a/meson.build b/meson.build
index 29da0b0504..ec2f5a94a8 100644
--- a/meson.build
+++ b/meson.build
@@ -906,10 +906,10 @@ meson.add_install_script(
nm_pkgconfdir,
nm_pkglibdir,
nm_pkgstatedir,
- enable_docs ? 'install_docs' : '',
nm_mandir,
- enable_ifcfg_rh ? 'create_network_scripts' : '',
nm_sysconfdir,
+ enable_docs ? '1' : '0',
+ enable_ifcfg_rh ? '1' : '0',
)
output = '\nSystem paths:\n'
diff --git a/tools/meson-post-install.sh b/tools/meson-post-install.sh
index aaf3576da4..4e8549a95e 100755
--- a/tools/meson-post-install.sh
+++ b/tools/meson-post-install.sh
@@ -1,55 +1,57 @@
#!/bin/sh
-datadir=$1
-bindir=$2
-pkgconfdir=$3
-pkglibdir=$4
-pkgstatedir=$5
-
-[ -n "$DESTDIR" ] && DESTDIR=${DESTDIR%%/}/
-
-if [ -f "${DESTDIR}${datadir}/bash-completion/completions/nmcli-completion" ]; then
- mv "${DESTDIR}${datadir}/bash-completion/completions/nmcli-completion" \
- "${DESTDIR}${datadir}/bash-completion/completions/nmcli"
+nm_datadir="$1"
+nm_bindir="$2"
+nm_pkgconfdir="$3"
+nm_pkglibdir="$4"
+nm_pkgstatedir="$5"
+nm_mandir="$6"
+nm_sysconfdir="$7"
+enable_docs="$8"
+enable_ifcfg_rh="$9"
+
+[ -n "$DESTDIR" ] && DESTDIR="${DESTDIR%%/}/"
+
+if [ -f "${DESTDIR}${nm_datadir}/bash-completion/completions/nmcli-completion" ]; then
+ mv "${DESTDIR}${nm_datadir}/bash-completion/completions/nmcli-completion" \
+ "${DESTDIR}${nm_datadir}/bash-completion/completions/nmcli"
fi
-if [ -x "${DESTDIR}${bindir}/nmtui" ]; then
+if [ -x "${DESTDIR}${nm_bindir}/nmtui" ]; then
for alias in nmtui-connect nmtui-edit nmtui-hostname; do
- ln -sf nmtui "${DESTDIR}${bindir}/$alias"
+ ln -sf nmtui "${DESTDIR}${nm_bindir}/$alias"
done
fi
-for dir in "${pkgconfdir}/conf.d" \
- "${pkgconfdir}/system-connections" \
- "${pkgconfdir}/dispatcher.d/no-wait.d" \
- "${pkgconfdir}/dispatcher.d/pre-down.d" \
- "${pkgconfdir}/dispatcher.d/pre-up.d" \
- "${pkgconfdir}/dnsmasq.d" \
- "${pkgconfdir}/dnsmasq-shared.d" \
- "${pkglibdir}/conf.d" \
- "${pkglibdir}/dispatcher.d/no-wait.d" \
- "${pkglibdir}/dispatcher.d/pre-down.d" \
- "${pkglibdir}/dispatcher.d/pre-up.d" \
- "${pkglibdir}/system-connections" \
- "${pkglibdir}/VPN"; do
+for dir in "${nm_pkgconfdir}/conf.d" \
+ "${nm_pkgconfdir}/system-connections" \
+ "${nm_pkgconfdir}/dispatcher.d/no-wait.d" \
+ "${nm_pkgconfdir}/dispatcher.d/pre-down.d" \
+ "${nm_pkgconfdir}/dispatcher.d/pre-up.d" \
+ "${nm_pkgconfdir}/dnsmasq.d" \
+ "${nm_pkgconfdir}/dnsmasq-shared.d" \
+ "${nm_pkglibdir}/conf.d" \
+ "${nm_pkglibdir}/dispatcher.d/no-wait.d" \
+ "${nm_pkglibdir}/dispatcher.d/pre-down.d" \
+ "${nm_pkglibdir}/dispatcher.d/pre-up.d" \
+ "${nm_pkglibdir}/system-connections" \
+ "${nm_pkglibdir}/VPN"; do
mkdir -p "${DESTDIR}${dir}"
chmod 0755 "${DESTDIR}${dir}"
done
-mkdir -p "${DESTDIR}${pkgstatedir}"
-chmod 0700 "${DESTDIR}${pkgstatedir}"
+mkdir -p "${DESTDIR}${nm_pkgstatedir}"
+chmod 0700 "${DESTDIR}${nm_pkgstatedir}"
-if [ "$6" = install_docs ]; then
- mandir=$7
+if [ "$enable_docs" = 1 ]; then
for alias in nmtui-connect nmtui-edit nmtui-hostname; do
- ln -f "${DESTDIR}${mandir}/man1/nmtui.1" "${DESTDIR}${mandir}/man1/${alias}.1"
+ ln -f "${DESTDIR}${nm_mandir}/man1/nmtui.1" "${DESTDIR}${nm_mandir}/man1/${alias}.1"
done
- ln -f "${DESTDIR}${mandir}/man5/NetworkManager.conf.5" "${DESTDIR}${mandir}/man5/nm-system-settings.conf.5"
+ ln -f "${DESTDIR}${nm_mandir}/man5/NetworkManager.conf.5" "${DESTDIR}${nm_mandir}/man5/nm-system-settings.conf.5"
fi
-if [ "$8" = create_network_scripts ]; then
- sysconfdir=$9
- mkdir -p "${DESTDIR}${sysconfdir}/sysconfig/network-scripts"
+if [ "$enable_ifcfg_rh" = 1 ]; then
+ mkdir -p "${DESTDIR}${nm_sysconfdir}/sysconfig/network-scripts"
fi