Skip to content

Commit d6e3865

Browse files
committed
CHG: Compatibility updated and hidden --allowroot feature
1 parent 670fdaa commit d6e3865

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

config/build-root.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,9 @@ else
376376
for s in `seq -w 00 2 98`; do
377377
TESTTARBALL="root_v${WANTEDVERSION}.${s}.source.tar.gz"
378378
echo "Trying to find ${TESTTARBALL}..."
379-
EXISTS=`curl -s --head https://root.cern.ch/download/${TESTTARBALL} | grep gzip`
380-
if [[ ${EXISTS} == "" ]]; then # sometimes version 00 does not exist...
379+
# old: EXISTS=`curl -s --head https://root.cern.ch/download/${TESTTARBALL} | grep gzip`
380+
EXISTS=$(curl -s --head https://root.cern.ch/download/${TESTTARBALL} | head -n 1 )
381+
if [[ ${EXISTS} != *OK* ]]; then
381382
MAX_TRIALS=$(( MAX_TRIALS - 1 ))
382383
if [[ ${MAX_TRIALS} -eq 0 ]]; then
383384
break

setup.sh

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
#
66
# Please see the MEGAlib software license and documentation for more informations.
77

8-
98
# Part 1:
9+
# Store command line as array
10+
CMD=( "$@" )
11+
1012
# Helper functions
1113

1214
TIMESTART=$(date +%s)
@@ -77,6 +79,9 @@ confhelp() {
7779
echo " Check periodically for updates. Default is off."
7880
echo " Even if set to on, update checks will only be performed, if the user has write access to the MEGAlib installation."
7981
echo " "
82+
#echo "--allowroot"
83+
#echo " By default this script does not allow to be installed as ROOT. This option allows it."
84+
#echo " "
8085
echo "--help or -h"
8186
echo " Show this help."
8287
echo " "
@@ -104,7 +109,15 @@ if [ "$SHELL" != "/bin/bash" ]; then
104109
echo " "
105110
fi
106111

107-
if [[ $EUID -eq 0 ]]; then
112+
# Check if the command line contains "--allowroot"
113+
ALLOWROOT="off"
114+
for C in "${CMD[@]}"; do
115+
if [[ ${C} == *--allowroot* ]]; then
116+
ALLOWROOT="on"
117+
fi
118+
done
119+
120+
if [[ $EUID -eq 0 ]] && [[ ${ALLOWROOT} == off ]]; then
108121
echo " " 1>&2
109122
echo "Error: For security reasons, this script is not intended to be run as superuser/root." 1>&2
110123
echo " It is intended for a user installation of MEGAlib." 1>&2
@@ -130,9 +143,6 @@ fi
130143
# Part 3:
131144
# Upgrade the input options:
132145

133-
# Store command line as array
134-
CMD=( "$@" )
135-
136146
# Check for help
137147
for C in "${CMD[@]}"; do
138148
if [[ ${C} == *-h ]] || [[ ${C} == *-hel* ]]; then
@@ -171,6 +181,7 @@ UPDATES="off"
171181
PATCH="on"
172182
CLEANUP="off"
173183
BRANCH=""
184+
# ALLOWROOT="off" - initialized in the beginning not here
174185

175186
MAXTHREADS=1;
176187
if [[ ${OSTYPE} == *arwin* ]]; then
@@ -253,6 +264,9 @@ for C in "${CMD[@]}"; do
253264
elif [[ ${C} == *-b* ]]; then
254265
BRANCH=`echo ${C} | awk -F"=" '{ print $2 }'`
255266
RELEASE="dev"
267+
elif [[ ${C} == *--allowroot* ]]; then
268+
# Handled above too
269+
ALLOWROOT="on"
256270
elif [[ ${C} == *-h ]] || [[ ${C} == *-hel* ]]; then
257271
echo ""
258272
confhelp

0 commit comments

Comments
 (0)