aboutsummaryrefslogtreecommitdiffstats
path: root/make/install_dir_data.sh.in
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2019-03-04 16:27:21 +0100
committerRickard Green <[email protected]>2019-03-04 16:27:21 +0100
commit565adc6d7ffb0778df06d5011ec56dc7b3eb0d2b (patch)
treeb57d7b81624d9172d8c26daad18f9c45b6b2f76d /make/install_dir_data.sh.in
parentda06fd040775fffee17409ebbd6fa797e34d6f99 (diff)
parent250462066db0344e5387d15ed2b89bce261ea64d (diff)
downloadotp-565adc6d7ffb0778df06d5011ec56dc7b3eb0d2b.tar.gz
otp-565adc6d7ffb0778df06d5011ec56dc7b3eb0d2b.tar.bz2
otp-565adc6d7ffb0778df06d5011ec56dc7b3eb0d2b.zip
Merge 'rickard/make-fixes-18/OTP-15551' into 'rickard/make-fixes-19/OTP-15551'
* rickard/make-fixes-18/OTP-15551: Fix install phase in build system - Install of (mainly) documentation caused rebuild and modification of the source tree even when the source previously had been built. Also otp_patch_apply modified the source tree when updating documentation. This messed up the installation if installation was performed by another user than the user that originally built the system which not is an uncommon scenario. - Some documentation was installed by copying files instead of installing the files which caused faulty access rights on files. - The documentation was not properly updated when applying a patch using otp_patch_apply.
Diffstat (limited to 'make/install_dir_data.sh.in')
-rw-r--r--make/install_dir_data.sh.in70
1 files changed, 70 insertions, 0 deletions
diff --git a/make/install_dir_data.sh.in b/make/install_dir_data.sh.in
new file mode 100644
index 0000000000..8c1dc3d889
--- /dev/null
+++ b/make/install_dir_data.sh.in
@@ -0,0 +1,70 @@
+#!/bin/sh
+#
+# %CopyrightBegin%
+#
+# Copyright Ericsson AB 2019. All Rights Reserved.
+#
+# The contents of this file are subject to the Erlang Public License,
+# Version 1.1, (the "License"); you may not use this file except in
+# compliance with the License. You should have received a copy of the
+# Erlang Public License along with this software. If not, it can be
+# retrieved online at http://www.erlang.org/.
+#
+# Software distributed under the License is distributed on an "AS IS"
+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+# the License for the specific language governing rights and limitations
+# under the License.
+#
+# %CopyrightEnd%
+#
+
+#
+# install_dir_data.sh <SourceDir> <DestDir>
+#
+# Install all content in <SourceDir> including subdirectories
+# into <DestDir>.
+#
+
+INSTALL="@INSTALL@"
+INSTALL_DIR="@INSTALL_DIR@"
+INSTALL_DATA="@INSTALL_DATA@"
+
+debug=yes
+
+error () {
+ echo "ERROR: $1" 1>&2
+ exit 1
+}
+
+usage () {
+ error "$1\n Usage $progname <SourceDir> <DestDir>"
+}
+
+cmd () {
+ [ $debug = no ] || echo "$@"
+ "$@" || exit 1
+}
+
+progname="$0"
+
+[ $# -eq 2 ] || usage "Invalid amount of arguments"
+
+src="$1"
+dest="$2"
+
+cmd cd "$src"
+
+for dir in `find . -type d`; do
+ destdir="$dest"
+ [ "$dir" = "." ] || destdir="$dest/$dir"
+ cmd $INSTALL_DIR "$destdir"
+done
+
+for file in `find . -type f`; do
+ subdir=`dirname "$file"`
+ destdir="$dest"
+ [ "$subdir" = "." ] || destdir="$dest/$subdir"
+ cmd $INSTALL_DATA "$file" "$destdir"
+done
+
+exit 0