summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2018-09-13 17:24:58 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2018-09-19 16:03:32 +0200
commit98b4a19a536ddb9f75611deaa272ae5661c5df4d (patch)
treedccf8de03536282b57aa0cfab770764578767be5 /tools
parente732789bbfad6f4824d66a6ed76e40f8d907e846 (diff)
downloadNetworkManager-98b4a19a536ddb9f75611deaa272ae5661c5df4d.tar.gz
build: meson: support $DESTDIR in installation script
Adapt the meson post-installation script to handle the $DESTDIR variable supplied by user to specify the installation target directory. While at it, convert the script to shell because it seems simpler to me.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/meson-post-install.sh44
1 files changed, 44 insertions, 0 deletions
diff --git a/tools/meson-post-install.sh b/tools/meson-post-install.sh
new file mode 100755
index 0000000000..fd21941bbd
--- /dev/null
+++ b/tools/meson-post-install.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+datadir=$1
+bindir=$2
+pkgconfdir=$3
+pkglibdir=$4
+localstatedir=$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"
+fi
+
+if [ -x "${DESTDIR}${bindir}/nmtui" ]; then
+ for alias in nmtui-connect nmtui-edit nmtui-hostname; do
+ ln -sf nmtui "${DESTDIR}${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" \
+ "${pkgconfdir}/conf.d" \
+ "${pkgconfdir}/VPN" \
+ "${localstatedir}/lib/NetworkManager"; do
+ mkdir -p "${DESTDIR}${dir}"
+done
+
+if [ "$6" = install_docs ]; then
+ mandir=$7
+
+ for alias in nmtui-connect nmtui-edit nmtui-hostname; do
+ ln -f "${DESTDIR}${mandir}/man1/nmtui.1" "${DESTDIR}${mandir}/man1/${alias}.1"
+ done
+
+ ln -f "${DESTDIR}${mandir}/man5/NetworkManager.conf.5" "${DESTDIR}${mandir}/man5/nm-system-settings.conf"
+fi
+