diff --git a/install b/install index c80b99f..6f257b7 100755 --- a/install +++ b/install @@ -207,11 +207,12 @@ wo_install_dep() { wo_linux_distro=$(lsb_release -is) if [ "$wo_linux_distro" == "Ubuntu" ]; then # install dependencies + add-apt-repository ppa:git-core/ppa -y apt-get --option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --assume-yes install \ build-essential curl gzip python3-pip python3-apt python3-venv gcc python3-dev sqlite3 git tar software-properties-common pigz \ gnupg2 cron ccze rsync apt-transport-https tree haveged ufw unattended-upgrades tzdata ntp zstd idn \ python3-distutils-extra libapt-pkg-dev bash-completion >/dev/null 2>&1 - curl -sL https://build.opensuse.org/projects/home:virtubox/public_key | apt-key add - + curl -sL https://build.opensuse.org/projects/home:virtubox/public_key | apt-key add - else # install dependencies apt-get --option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --assume-yes install \ @@ -221,7 +222,7 @@ wo_install_dep() { # add php repository gpg key [ -d /etc/apt/trusted.gpg.d ] && { wget -qO /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg; } # add nginx repository gpg key - curl -sL https://build.opensuse.org/projects/home:virtubox/public_key | apt-key add - + curl -sL https://build.opensuse.org/projects/home:virtubox/public_key | apt-key add - fi locale-gen en # enable unattended upgades @@ -481,7 +482,7 @@ wo_install() { rm -rf /usr/local/bin/wo /usr/local/lib/python3."$python_venv"/dist-packages/{etc,usr} ln -s /opt/wo/bin/wo /usr/local/bin/ deactivate - if [ ! -d /opt/wo/lib/python3."$python_ver"/site-packages/apt ];then + if [ ! -d /opt/wo/lib/python3."$python_ver"/site-packages/apt ]; then python3 -m venv --system-site-packages /opt/wo fi } @@ -562,9 +563,9 @@ wo_upgrade_nginx() { # add new Nginx repository if [ "$wo_distro_version" == "jessie" ]; then # import the respository key for updates - curl -sL https://build.opensuse.org/projects/home:virtubox/public_key | apt-key add - + curl -sL https://build.opensuse.org/projects/home:virtubox/public_key | apt-key add - else - curl -sL https://build.opensuse.org/projects/home:virtubox/public_key | apt-key add - + curl -sL https://build.opensuse.org/projects/home:virtubox/public_key | apt-key add - fi # install new nginx package @@ -785,6 +786,12 @@ wo_php_fix() { fi } +wo_git_secure_path() { + if ! grep -q "directory = *" ~/.gitconfig; then + echo -e "\n[safe]\n directory = *" >> ~/.gitconfig + fi +} + ### # 4 - WO MAIN SETUP ### @@ -851,6 +858,7 @@ else _run secure_wo_db wo sync + _run wo_git_secure_path if [ "$ee_migration" = "1" ]; then echo diff --git a/wo/core/git.py b/wo/core/git.py index 02fa004..3bebdb1 100644 --- a/wo/core/git.py +++ b/wo/core/git.py @@ -1,10 +1,8 @@ """WordOps GIT module""" import os -from pathlib import Path from sh import ErrorReturnCode, git from wo.core.logging import Log -from wo.core.fileutils import WOFileUtils class WOGit: @@ -31,11 +29,7 @@ class WOGit: Log.debug(self, "{0}".format(e)) Log.error(self, "Unable to git init at {0}" .format(path)) - if not WOFileUtils.grep(self, - "{0}/.gitconfig".format(Path.home()), - "{0}".format(path)): - git.config("--global", "--add", "safe.directory", - "{0}".format(path)) + status = wogit.status("-s") if len(status.splitlines()) > 0: try: