Skip to content

Commit

Permalink
download script: Allow custom download without authentication. Suppor…
Browse files Browse the repository at this point in the history
…t for custom authentication, start script add time information to server startup
  • Loading branch information
Daniel-Nashed committed Dec 7, 2024
1 parent db33125 commit 834ba4c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
24 changes: 17 additions & 7 deletions domdownload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

###########################################################################
# Domino Software Download Script #
# Version 1.0.5 22.09.2024 #
# Version 1.0.6 06.12.2024 #
# Copyright Nash!Com, Daniel Nashed #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
Expand Down Expand Up @@ -47,11 +47,12 @@
# 1.0.3 Add support for direct download specifying -filename & -fileid and -hash
# 1.0.4 Add error checks for fileURL results specially for license accept returned errors
# 1.0.5 Support for Alpine Linux
# 1.0.6 Allow custom download without authentication. Support for custom authentication

SCRIPT_NAME=$0
SCRIPT_DIR=$(dirname $SCRIPT_NAME)

DOMDOWNLOAD_SCRIPT_VERSION=1.0.5
DOMDOWNLOAD_SCRIPT_VERSION=1.0.6

# Just print version and exit
case "$1" in
Expand Down Expand Up @@ -841,13 +842,18 @@ DownloadCustom()

LogMessage "Downloading from $DOWNLOAD_URL ..."

if [ -n "$DOMDOWNLOAD_CUSTOM_USER" ] && [ -n "$DOMDOWNLOAD_CUSTOM_PASSWORD" ]; then
DOWNLOAD_BASIC_AUTH="$DOMDOWNLOAD_CUSTOM_USER:$DOMDOWNLOAD_CUSTOM_PASSWORD"
DOWNLOAD_BASIC_AUTH_CMD="--user"
PerfTimerBegin

if [ -n "$DOMDOWNLOAD_CUSTOM_AUTHORIZATION" ]; then
$CURL_DOWNLOAD_CMD -L "$DOWNLOAD_URL" -o "$OUTFILE_FULLPATH" -H "Authorization: $DOMDOWNLOAD_CUSTOM_AUTHORIZATION"

elif [ -n "$DOMDOWNLOAD_CUSTOM_USER" ] && [ -n "$DOMDOWNLOAD_CUSTOM_PASSWORD" ]; then
$CURL_DOWNLOAD_CMD -L "$DOWNLOAD_URL" -o "$OUTFILE_FULLPATH" --user "$DOMDOWNLOAD_CUSTOM_USER:$DOMDOWNLOAD_CUSTOM_PASSWORD"

else
$CURL_DOWNLOAD_CMD -L "$DOWNLOAD_URL" -o "$OUTFILE_FULLPATH"
fi

PerfTimerBegin
$CURL_DOWNLOAD_CMD -L "$DOWNLOAD_URL" -o "$OUTFILE_FULLPATH" "$DOWNLOAD_BASIC_AUTH_CMD" "$DOWNLOAD_BASIC_AUTH"
PerfTimerEnd $PERF_MAX_CURL "$OUTFILE_FULLPATH"

if [ ! -e "$OUTFILE_FULLPATH" ]; then
Expand Down Expand Up @@ -2096,6 +2102,10 @@ CheckWriteStandardConfig()
echo \#Password for custom download in local mode >> "$DOMDOWNLOAD_CFG_FILE"
echo \#DOMDOWNLOAD_CUSTOM_PASSWORD= >> "$DOMDOWNLOAD_CFG_FILE"
echo >> "$DOMDOWNLOAD_CFG_FILE"

echo \#Authentication token >> "$DOMDOWNLOAD_CFG_FILE"
echo \#DOMDOWNLOAD_CUSTOM_AUTHORIZATION=\"Bearer xyz\" >> "$DOMDOWNLOAD_CFG_FILE"
echo >> "$DOMDOWNLOAD_CFG_FILE"
}


Expand Down
2 changes: 2 additions & 0 deletions nshinfo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ print_infos()
printf "Linux OS : $LINUX_PRETTY_NAME\n"
printf "Linux Version : $LINUX_VERSION\n"
printf "Kernel : $LINUX_KERNEL\n"
printf "Timezone : $(date +"%Z %z")\n"


if [ -n "$LINUX_VIRT" ]; then
printf "Virt : $LINUX_VIRT\n"
Expand Down
14 changes: 14 additions & 0 deletions rc_domino_script
Original file line number Diff line number Diff line change
Expand Up @@ -2592,6 +2592,18 @@ domino_start()
echo "---- umask ----" >> $DOMINO_OUTPUT_LOG
echo >> $DOMINO_OUTPUT_LOG
umask >> $DOMINO_OUTPUT_LOG
echo >> $DOMINO_OUTPUT_LOG


echo "---- time info ----" >> $DOMINO_OUTPUT_LOG
echo >> $DOMINO_OUTPUT_LOG

if [ -n "$(ps --no-headers -o comm 1 | grep systemd)" ] || [ -x /usr/bin/timedatectl ]; then
/usr/bin/timedatectl >> $DOMINO_OUTPUT_LOG
else
echo "timezone: $(date +"%Z %z")" >> $DOMINO_OUTPUT_LOG
fi
echo >> $DOMINO_OUTPUT_LOG

if [ ${LARCH} = "ibmpow" ]; then

Expand All @@ -2611,6 +2623,7 @@ domino_start()
echo "---- no info ----" >> $DOMINO_OUTPUT_LOG
echo >> $DOMINO_OUTPUT_LOG
no -a >> $DOMINO_OUTPUT_LOG
echo >> $DOMINO_OUTPUT_LOG
fi

if [ ${LARCH} = "linux" ]; then
Expand All @@ -2624,6 +2637,7 @@ domino_start()
echo "---- ulimit hard info ----" >> $DOMINO_OUTPUT_LOG
echo >> $DOMINO_OUTPUT_LOG
ulimit -a -H >> $DOMINO_OUTPUT_LOG
echo >> $DOMINO_OUTPUT_LOG
fi

echo >> $DOMINO_OUTPUT_LOG
Expand Down

0 comments on commit 834ba4c

Please sign in to comment.