diff --git a/bin/yugabyted b/bin/yugabyted index 4166f1f9dc8b..0e1047ec0308 100755 --- a/bin/yugabyted +++ b/bin/yugabyted @@ -587,15 +587,6 @@ class ControlScript(object): return post_install_script_path = os.path.join(YUGABYTE_DIR, 'bin', 'post_install.sh') - post_install_completion_bin_path = post_install_script_path + ".completed" - post_install_completion_flag_path = os.path.join( - YUGABYTE_DIR, os.path.basename(post_install_completion_bin_path)) - - # Check both "bin" and top-level "yugabyte" dir in case post_install was run - # from another source (e.g. yb-ctl). - if os.path.exists(post_install_completion_flag_path) \ - or os.path.exists(post_install_completion_bin_path): - return Output.log("Running the post-installation script {}".format(post_install_script_path)) process = subprocess.Popen( @@ -608,9 +599,6 @@ class ControlScript(object): post_install_script_path, process.returncode, std_out, std_err)) Output.log("Successfully ran the post-installation script.") - with open(post_install_completion_flag_path, 'w'): - # Write an empty file. - pass # Initialize YW process. Creates all necessary tables. Returns false if init failed. def init_yw(self): diff --git a/build-support/post_install.sh b/build-support/post_install.sh index 5210ebff1918..495ea918203d 100755 --- a/build-support/post_install.sh +++ b/build-support/post_install.sh @@ -39,6 +39,14 @@ lib_dir="$distribution_dir/lib" linuxbrew_dir="$distribution_dir/linuxbrew" rpath="$lib_dir/yb:$lib_dir/yb-thirdparty:$linuxbrew_dir/lib" patchelf_path=$bin_dir/patchelf +script_name=$(basename "$0") +completion_file="$distribution_dir/.${script_name}.completed" + +if [[ -f $completion_file ]]; +then + echo "${script_name} was already run (marker at ${completion_file})" + exit +fi if [[ ! -x $patchelf_path ]]; then echo >&2 "patchelf not found or is not executable: '$patchelf_path'" @@ -66,22 +74,20 @@ done # We are filtering out warning from stderr which are produced by this bug: # https://github.com/NixOS/patchelf/commit/c4deb5e9e1ce9c98a48e0d5bb37d87739b8cfee4 # This bug is harmless, it only could unnecessarily increase file size when patching. -find $lib_dir $linuxbrew_dir -name "*.so*" ! -name "ld.so*" -exec "$patchelf_path" \ +find "$lib_dir" "$linuxbrew_dir" -name "*.so*" ! -name "ld.so*" -exec "$patchelf_path" \ --set-rpath "$rpath" {} 2> \ >(grep -v 'warning: working around a Linux kernel bug by creating a hole' >&2) \; ORIG_BREW_HOME=${original_linuxbrew_path_to_patch} ORIG_LEN=${#ORIG_BREW_HOME} -ORIG_BREW_HOME_DIR=${ORIG_BREW_HOME##*/} -BREW_DIR_NAME=${ORIG_BREW_HOME_DIR%-*} # Take $ORIG_LEN number of '\0' from /dev/zero, replace '\0' with 'x', then prepend to # "$distribution_dir/linuxbrew-" and keep first $ORIG_LEN symbols, so we have a path of $ORIG_LEN # length. -BREW_HOME=$(echo "$distribution_dir/linuxbrew-$(head -c $ORIG_LEN