11#! /bin/bash
22#
3- # Copyright (c) 2015, 2016 , Oracle and/or its affiliates. All rights reserved.
3+ # Copyright (c) 2015, 2022 , Oracle and/or its affiliates. All rights reserved.
44# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55#
66# This code is free software; you can redistribute it and/or modify it
@@ -135,6 +135,28 @@ install_jib() {
135135 echo " ${data_string} " > " ${install_data} "
136136}
137137
138+ # Returns a shell-escaped version of the argument given.
139+ shell_quote () {
140+ if [[ -n " $1 " ]]; then
141+ # Uses only shell-safe characters? No quoting needed.
142+ # '=' is a zsh meta-character, but only in word-initial position.
143+ if echo " $1 " | grep ' ^[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\.:,%/+=_-]\{1,\}$' > /dev/null \
144+ && ! echo " $1 " | grep ' ^=' > /dev/null; then
145+ quoted=" $1 "
146+ else
147+ if echo " $1 " | grep " [\'!]" > /dev/null; then
148+ # csh does history expansion within single quotes, but not
149+ # when backslash-escaped!
150+ local quoted_quote=" '\\ ''" quoted_exclam=" '\\ !'"
151+ word=" ${1// \' / ${quoted_quote} } "
152+ word=" ${1// \! / ${quoted_exclam} } "
153+ fi
154+ quoted=" '$1 '"
155+ fi
156+ echo " $quoted "
157+ fi
158+ }
159+
138160# Main body starts here
139161
140162setup_url
@@ -151,4 +173,16 @@ if [ -z "${JIB_SRC_DIR}" ]; then
151173 export JIB_SRC_DIR=" ${mydir} /../"
152174fi
153175
176+
177+ # Save the original command line
178+ conf_quoted_arguments=()
179+ for conf_option; do
180+ conf_quoted_arguments=(" ${conf_quoted_arguments[@]} " " $( shell_quote " $conf_option " ) " )
181+ done
182+ export REAL_CONFIGURE_COMMAND_LINE=" ${conf_quoted_arguments[@]} "
183+
184+ myfulldir=" $( cd " ${mydir} " > /dev/null && pwd) "
185+ export REAL_CONFIGURE_COMMAND_EXEC_FULL=" $BASH $myfulldir /$myname "
186+ export REAL_CONFIGURE_COMMAND_EXEC_SHORT=" $myname "
187+
154188${installed_jib_script} " $@ "
0 commit comments