summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-06-14 14:26:01 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2011-06-14 14:26:01 +0200
commit5ffab91263850a03f5a85eac9511fefc1dc158fd (patch)
treec62a4f9c9f7412ab0777f1dd3054fc5cf06f9fbc
parent102a998d1c321870e5892066145900233da2f952 (diff)
downloadbin-5ffab91263850a03f5a85eac9511fefc1dc158fd.zip
bin-5ffab91263850a03f5a85eac9511fefc1dc158fd.tar.gz
easy_e17.sh: update check_script_version
-rw-r--r--easy_e17.sh67
1 files changed, 32 insertions, 35 deletions
diff --git a/easy_e17.sh b/easy_e17.sh
index a0e9ec0..3b1ab18 100644
--- a/easy_e17.sh
+++ b/easy_e17.sh
@@ -212,6 +212,7 @@ function help ()
}
function wrong () {
+ header
if [ "$1" ]; then
echo -e "\033[1m-------------------------------\033[7m Bad script argument \033[0m\033[1m----------------------------\033[0m"
echo -e " \033[1m$1\033[0m"
@@ -466,6 +467,31 @@ function parse_args ()
}
+# SETUP #############################################################################
+function check_script_version ()
+{
+ echo -e "\033[1m------------------------------\033[7m Check script version \033[0m\033[1m----------------------------\033[0m"
+ echo "- local version .............. $version"
+ echo -n "- downloading script ......... "
+ remote_version=`wget $online_source -q -U "easy_e17.sh/$version" -O - | grep -m 2 -o [0-9]\.[0-9]\.[0-9] | sort -n | head -n 1`
+ if [ "$remote_version" ]; then
+ echo "ok"
+ echo "- remote version ............. $remote_version"
+ remote_ver=`echo "$remote_version" | tr -d '.'`
+ local_ver=`echo "$version" | tr -d '.'`
+ echo
+ echo -n "- update available ........... "
+ if [ $remote_ver -gt $local_ver ]; then
+ echo -e "\033[1mYES!\033[0m"
+ else echo "no"; fi
+ else
+ echo -e "\033[1mERROR!\033[0m"
+ fi
+ echo -e "\033[1m--------------------------------------------------------------------------------\033[0m"
+ echo
+ exit 0
+}
+
#############################################################################
function find_src_path ()
{
@@ -968,26 +994,6 @@ function cnt_pkgs () {
fi
}
-function check_script_version ()
-{
- echo "- local version .............. $version"
- echo -n "- downloading script ......... "
- remote_version=`wget $online_source -q -U "easy_e17.sh/$version" -O - | grep -m 2 -o [0-9]\.[0-9]\.[0-9] | sort -n | head -n 1`
- if [ "$remote_version" ]; then
- echo "ok"
- echo "- remote version ............. $remote_version"
- remote_ver=`echo "$remote_version" | tr -d '.'`
- local_ver=`echo "$version" | tr -d '.'`
- echo
- echo -n "- update available ........... "
- if [ $remote_ver -gt $local_ver ]; then
- echo -e "\033[1mYES!\033[0m"
- else echo "no"; fi
- else
- echo -e "\033[1mERROR!\033[0m"
- fi
-}
-
# SCRIPT: #############################################################################
EASY_PWD=`pwd`
@@ -997,34 +1003,25 @@ accache=""
set_title
define_os_vars
read_config_files
-header
parse_args
-
+# check for script updates
+if [ "$action" == "script" ]; then
+ header
+ check_script_version
+fi
# Sanity check stuff if doing everything as user.
if [ "$asuser" ] && [ $nice_level -lt 0 ]; then
nice_level=0
fi
-
# Fix issues with a slash at the end
if [ ! "${src_path:$((${#src_path}-1)):1}" == "/" ]; then
src_path="$src_path/"
fi
-
# quit if some basic option is missing
if [ -z "$action" ] || [ -z "$install_path" ] || [ -z "$src_path" ]; then
wrong
fi
-
-# check for script updates
-if [ "$action" == "script" ]; then
- echo -e "\033[1m------------------------------\033[7m Check script version \033[0m\033[1m----------------------------\033[0m"
- check_script_version
- echo -e "\033[1m--------------------------------------------------------------------------------\033[0m"
- echo
- exit 0
-fi
-
-
+header
# run script normally
phase 1
set_title "Basic system checks"