Update install_obitools.sh to print on stderr

Former-commit-id: 830b4b12b2462bc73ad7a97718741c0f68899034
This commit is contained in:
2023-06-06 09:21:16 +02:00
parent f6628a1ba2
commit c6b59c0c80

View File

@ -33,11 +33,11 @@ while [ "$#" -gt 0 ]; do
shift 2 shift 2
;; ;;
-h|--help) -h|--help)
display_help display_help 1>&2
exit 0 exit 0
;; ;;
*) *)
echo "Error: Unsupported option $1" echo "Error: Unsupported option $1" 1>&2
exit 1 exit 1
;; ;;
esac esac
@ -55,24 +55,24 @@ WORK_DIR=$(mktemp -d "obitools4.XXXXXX")
# check if tmp dir was created # check if tmp dir was created
if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
echo "Could not create temp dir" echo "Could not create temp dir" 1>&2
exit 1 exit 1
fi fi
mkdir -p "${INSTALL_DIR}/bin" 2> /dev/null \ mkdir -p "${INSTALL_DIR}/bin" 2> /dev/null \
|| (echo "Please enter your password for installing obitools in ${INSTALL_DIR}" || (echo "Please enter your password for installing obitools in ${INSTALL_DIR}" 1>&2
sudo mkdir -p "${INSTALL_DIR}/bin") sudo mkdir -p "${INSTALL_DIR}/bin")
if [[ ! "${INSTALL_DIR}/bin" || ! -d "${INSTALL_DIR}/bin" ]]; then if [[ ! "${INSTALL_DIR}/bin" || ! -d "${INSTALL_DIR}/bin" ]]; then
echo "Could not create ${INSTALL_DIR}/bin directory for installing obitools" echo "Could not create ${INSTALL_DIR}/bin directory for installing obitools" 1>&2
exit 1 exit 1
fi fi
INSTALL_DIR="$(cd $INSTALL_DIR && pwd)" INSTALL_DIR="$(cd $INSTALL_DIR && pwd)"
echo WORK_DIR=$WORK_DIR echo WORK_DIR=$WORK_DIR 1>&2
echo INSTALL_DIR=$INSTALL_DIR echo INSTALL_DIR=$INSTALL_DIR 1>&2
echo OBITOOLS_PREFIX=$OBITOOLS_PREFIX echo OBITOOLS_PREFIX=$OBITOOLS_PREFIX 1>&2
pushd "$WORK_DIR"|| exit pushd "$WORK_DIR"|| exit
@ -93,6 +93,8 @@ GOFILE=$(curl "$URL" \
GOURL=$(curl "${URL}${GOFILE}" \ GOURL=$(curl "${URL}${GOFILE}" \
| sed -E 's@^.*href="(.*\.tar\.gz)".*$@\1@') | sed -E 's@^.*href="(.*\.tar\.gz)".*$@\1@')
echo "Install GO from : $GOURL" 1>&2
curl "$GOURL" \ curl "$GOURL" \
| tar zxf - | tar zxf -