diff --git a/installation/includes/02_helpers.sh b/installation/includes/02_helpers.sh index 5c98e281b..2892ab411 100644 --- a/installation/includes/02_helpers.sh +++ b/installation/includes/02_helpers.sh @@ -80,6 +80,25 @@ verify_chmod_chown() { done } +# Check if the dir(s) has/have the expected owner and modifications +verify_dir_chmod_chown() { + local mod_expected=$1 + local user_expected=$2 + local group_expected=$3 + + for dir in "$@" + do + test ! -f ${dir} && exit_on_error "ERROR: ${dir} does not exists or is not a dir!" + + mod_actual=$(stat --format '%a' "${dir}") + user_actual=$(stat -c '%U' "${dir}") + group_actual=$(stat -c '%G' "${dir}") + test ! "${mod_expected}" -eq "${mod_actual}" && exit_on_error "ERROR: ${dir} actual mod (${mod_actual}) differs from expected (${mod_expected})!" + test ! "${user_expected}" == "${user_actual}" && exit_on_error "ERROR: ${dir} actual owner (${user_actual}) differs from expected (${user_expected})!" + test ! "${group_expected}" == "${group_actual}" && exit_on_error "ERROR: ${dir} actual group (${group_actual}) differs from expected (${group_expected})!" + done +} + verify_file_contains_string() { local string="$1" local file="$2" diff --git a/installation/routines/setup_git.sh b/installation/routines/setup_git.sh index 740d43ae3..afd47adcf 100644 --- a/installation/routines/setup_git.sh +++ b/installation/routines/setup_git.sh @@ -115,7 +115,7 @@ _git_convert_tardir_git_repo() { if [[ "${HASH_BRANCH}" != "${HASH_HEAD}" ]]; then echo "*** IMPORTANT NOTICE *******************************" echo "* Your requested branch has moved on while you were installing." - echo "* Don't worry! We will stay within the the exact download version!" + echo "* Don't worry! We will stay within the exact download version!" echo "* But we set up the git repo to be ready for updating." echo "* To start updating (observe updating guidelines!), do:" echo "* $ git pull origin $GIT_BRANCH" @@ -137,12 +137,20 @@ _git_convert_tardir_git_repo() { unset HASH_BRANCH } +_jukebox_core_check () { + echo "Check Git & repository installation" | tee /dev/fd/3 + + verify_apt_packages git + verify_dir_chmod_chown "${INSTALLATION_PATH}/.git" +} + init_git_repo_from_tardir() { echo "Install Git & init repository" | tee /dev/fd/3 cd "${INSTALLATION_PATH}" || exit_on_error _git_install_os_dependencies _git_convert_tardir_git_repo + _jukebox_core_check echo "DONE: init_git_repo_from_tardir" }