From d41583c50996074c50c42aecd9fe296080337e1d Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Mon, 11 Aug 2014 15:44:12 +0530 Subject: [PATCH 1/3] check directory before cd --- src/lib/ee_lib_git.sh | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/lib/ee_lib_git.sh b/src/lib/ee_lib_git.sh index 7f050dc4..3467c90e 100644 --- a/src/lib/ee_lib_git.sh +++ b/src/lib/ee_lib_git.sh @@ -3,22 +3,24 @@ function ee_lib_git() { for ee_git_dir in ${@:1:$(($#-1))}; do - # Change directory - cd $ee_git_dir || ee_lib_error "Unable to change directory $ee_git_dir, exit status = " $? + if [ -d $ee_git_dir ]; then + # Change directory + cd $ee_git_dir - # Check .git - if [ ! -d .git ]; then - # ee_lib_echo "Initialize Git on ${ee_git_dir}" - git init &>> $EE_COMMAND_LOG \ - || ee_lib_error "Unable to initialize Git on $ee_git_dir, exit status = " $? - fi + # Check .git + if [ ! -d .git ]; then + # ee_lib_echo "Initialize Git on ${ee_git_dir}" + git init &>> $EE_COMMAND_LOG \ + || ee_lib_error "Unable to initialize Git on $ee_git_dir, exit status = " $? + fi - # Check for untracked files - if [ $(git status -s | wc -l) -ne 0 ]; then - # Add files in Git version control - ee_lib_echo "Git commit on $ee_git_dir, please wait..." - git add --all && git commit -am "${@: -1}" &>> $EE_COMMAND_LOG \ - || ee_lib_error "Unable to Git commit on $ee_git_dir, exit status = " $? + # Check for untracked files + if [ $(git status -s | wc -l) -ne 0 ]; then + # Add files in Git version control + ee_lib_echo "Git commit on $ee_git_dir, please wait..." + git add --all && git commit -am "${@: -1}" &>> $EE_COMMAND_LOG \ + || ee_lib_error "Unable to Git commit on $ee_git_dir, exit status = " $? + fi fi done } From cdcbbfdbc59e3ea74e2574fffd76690c7eea0b41 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Mon, 11 Aug 2014 16:06:36 +0530 Subject: [PATCH 2/3] Avoid mysql match on php5-mysqlnd --- src/lib/ee_lib_service.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/ee_lib_service.sh b/src/lib/ee_lib_service.sh index 55660ddb..441c9419 100644 --- a/src/lib/ee_lib_service.sh +++ b/src/lib/ee_lib_service.sh @@ -7,7 +7,7 @@ function ee_lib_service() { for ee_service_name in ${@:1:$(($#-1))}; do - dpkg --get-selections | grep -v deinstall | grep $ee_service_name &>> $EE_COMMAND_LOG + dpkg --get-selections | grep -v deinstall | grep ^$ee_service_name &>> $EE_COMMAND_LOG if [ $? -eq 0 ];then # Display message ee_lib_echo "Executing service $ee_service_name ${@: -1}, please wait..." From 5e43b29b32dbc6afc4fe653c89f3e062fadb5caf Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Mon, 11 Aug 2014 16:18:59 +0530 Subject: [PATCH 3/3] Better way to detect service is available to reload/restart/stop/start --- src/lib/ee_lib_service.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lib/ee_lib_service.sh b/src/lib/ee_lib_service.sh index 441c9419..6ec5dcc2 100644 --- a/src/lib/ee_lib_service.sh +++ b/src/lib/ee_lib_service.sh @@ -7,8 +7,7 @@ function ee_lib_service() { for ee_service_name in ${@:1:$(($#-1))}; do - dpkg --get-selections | grep -v deinstall | grep ^$ee_service_name &>> $EE_COMMAND_LOG - if [ $? -eq 0 ];then + if [ -f /etc/init.d/$ee_service_name ];then # Display message ee_lib_echo "Executing service $ee_service_name ${@: -1}, please wait..."