From 8c71922362ecd1eafb85ed2b701f5e10dc07f6fa Mon Sep 17 00:00:00 2001 From: Jeong Han Lee Date: Sat, 31 Dec 2016 17:41:01 +0100 Subject: [PATCH] fix a logic, order, and disable sudo --- 00_preAA.bash | 9 +++++---- 01_aaBuild.bash | 37 ++++++++++++++++++++++++++++++++----- aa_init.bash | 22 +++++++++++----------- 3 files changed, 48 insertions(+), 20 deletions(-) diff --git a/00_preAA.bash b/00_preAA.bash index 73bdeaa..95f01cf 100755 --- a/00_preAA.bash +++ b/00_preAA.bash @@ -434,10 +434,6 @@ mariadb_setup disable_virbro0 -if [ -z "$1" ]; then - printf "%s : No option is selected. Exiting ... \n" - exit; -fi printf "\nMariaDB Setup is done. And the option %s is selected \n" "$1"; printf "Before going further, we should wait for EPICS Base installation\n"; @@ -445,6 +441,11 @@ printf "The log file is shown in %s\n" "${EPICS_LOG}" ; wait "$epics_proc" +if [ -z "$1" ]; then + printf "%s : No option is selected. Exiting ... \n" + exit; +fi + case "$1" in mate) printf "Mate and lightdm are selected\n"; diff --git a/01_aaBuild.bash b/01_aaBuild.bash index 3453087..635f090 100755 --- a/01_aaBuild.bash +++ b/01_aaBuild.bash @@ -19,8 +19,8 @@ # # Author : Jeong Han Lee # email : han.lee@esss.se -# Date : -# version : 0.9.3 +# Date : Saturday, December 31 17:39:22 CET 2016 +# version : 0.9.4 # # http://www.gnu.org/software/bash/manual/bashref.html#Bash-Builtins @@ -91,21 +91,39 @@ function git_clone() { # Generic : git_selection -# - requirement : Global vairable : SC_SELECTED_GIT_SRC +# +# 1.0.4 : Saturday, December 31 17:14:42 CET 2016 +# only for archappl +# +# Require Global vairable +# - SC_SELECTED_GIT_SRC : Output # function git_selection() { + local func_name=${FUNCNAME[*]}; ini_func ${func_name}; + local git_ckoutcmd="" local checked_git_src="" + + declare -i index=0 declare -i master_index=0 declare -i list_size=0 declare -i selected_one=0 declare -a git_src_list=() + + local n_tags=${1}; + + # no set n_tags, set default 10 + + if [[ ${n_tags} -eq 0 ]]; then + n_tags=20; + fi git_src_list+=("master") - git_src_list+=($(git tag -l | sort -n)) + + git_src_list+=($(git tag -l | xargs -I@ git log --format=format:"%ai @%n" -1 @ | sort -r | head -n${n_tags} | awk '{print $4}')) for tag in "${git_src_list[@]}" do @@ -123,8 +141,10 @@ function git_selection() { # do I need this? # selected_one=${line/.*} + # Without selection number, type [ENTER], 0 is selected as default. + # selected_one=${line} - + let "list_size = ${#git_src_list[@]} - 1" if [[ "$selected_one" -gt "$list_size" ]]; then @@ -158,8 +178,15 @@ function git_selection() { $git_ckoutcmd fi + git submodule update --init --recursive + + end_func ${func_name} + } + + + # # Specific only for this script : Global variables - read-only # diff --git a/aa_init.bash b/aa_init.bash index 382a624..528f90a 100644 --- a/aa_init.bash +++ b/aa_init.bash @@ -19,7 +19,7 @@ # Author : Jeong Han Lee # email : han.lee@esss.se # Date : Monday, November 7 13:10:41 CET 2016 -# version : 0.1.3 +# version : 0.1.4 # # # Generic : Global variables - read-only @@ -35,17 +35,17 @@ declare -gr SC_LOGDATE="$(date +%Y%b%d-%H%M-%S%Z)" function pushd() { builtin pushd "$@" > /dev/null; } function popd() { builtin popd "$@" > /dev/null; } -function ini_func() { sleep 1; printf "\n>>>> You are entering in : %s\n" "${1}"; } -function end_func() { sleep 1; printf "\n<<<< You are leaving from : %s\n" "${1}"; } -function checkstr() { +function __ini_func() { printf "\n>>>> You are entering in : %s\n" "${1}"; } +function __end_func() { printf "\n<<<< You are leaving from : %s\n" "${1}"; } + +function __checkstr() { if [ -z "$1" ]; then printf "%s : input variable is not defined \n" "${FUNCNAME[*]}" exit 1; fi } - declare -gr SUDO_CMD="sudo"; declare -g SUDO_PID=""; @@ -64,7 +64,7 @@ function git_clone() { local git_src_name=$3; local tag_name=$4; - checkstr ${SC_LOGDATE}; + __checkstr ${SC_LOGDATE}; if [[ ! -d ${git_src_dir} ]]; then printf "No git source repository in the expected location %s\n" "${git_src_dir}"; @@ -83,7 +83,7 @@ function git_clone() { git clone -b "${tag_name}" --single-branch --depth 1 "${git_src_url}/${git_src_name}" "${git_src_dir}"; fi - end_func ${func_name}; + __end_func ${func_name}; } @@ -95,8 +95,8 @@ function git_clone() { # function preparation() { - local func_name=${FUNCNAME[*]}; ini_func ${func_name}; - checkstr ${SUDO_CMD}; + local func_name=${FUNCNAME[*]}; __ini_func ${func_name}; + __checkstr ${SUDO_CMD}; ${SUDO_CMD} systemctl stop packagekit ${SUDO_CMD} systemctl disable packagekit @@ -121,7 +121,7 @@ function preparation() { # ${SUDO_CMD} yum -y install epel-release git tree; - end_func ${func_name}; + __end_func ${func_name}; } ${SUDO_CMD} -v @@ -147,6 +147,6 @@ printf "# bash aaService.bash start/stop/status\n"; printf "Remove Music, Pictures, Public, Templates, and Videos directories in ${HOME}.... \n"; rm -rf ${HOME}/{Music,Pictures,Public,Templates,Videos}; - +${SUDO_CMD} -K; exit;