Skip to content
This repository has been archived by the owner on Aug 28, 2020. It is now read-only.

Commit

Permalink
fix a logic, order, and disable sudo
Browse files Browse the repository at this point in the history
  • Loading branch information
jeonghanlee committed Dec 31, 2016
1 parent 326e47c commit 8c71922
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 20 deletions.
9 changes: 5 additions & 4 deletions 00_preAA.bash
Original file line number Diff line number Diff line change
Expand Up @@ -434,17 +434,18 @@ 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";
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";
Expand Down
37 changes: 32 additions & 5 deletions 01_aaBuild.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
#
Expand Down
22 changes: 11 additions & 11 deletions aa_init.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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="";

Expand All @@ -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}";
Expand All @@ -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};
}


Expand All @@ -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
Expand All @@ -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
Expand All @@ -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;

0 comments on commit 8c71922

Please sign in to comment.