Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ddev self-upgrade command, fixes #2680 #4419

Merged
merged 6 commits into from Dec 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/content/users/basics/commands.md
Expand Up @@ -977,6 +977,19 @@ ddev restart my-project my-other-project
ddev restart --all
```

## `self-upgrade`

Output instructions for updating or upgrading DDEV. The command doesn’t perform the upgrade, but tries to provide instructions relevant to your installation. Must be executed from the project context.

Example:

```
→ ddev self-upgrade

DDEV appears to have been installed with install_ddev.sh, you can run that script again to update.
curl -fsSL https://raw.githubusercontent.com/drud/ddev/master/scripts/install_ddev.sh | bash
```

## `service`

Add or remove, enable or disable [extra services](../extend/additional-services.md).
Expand Down
2 changes: 2 additions & 0 deletions docs/content/users/basics/faq.md
Expand Up @@ -109,6 +109,8 @@ Start by completely turning NFS off for your projects with `ddev config --nfs-mo

You’ll want to update DDEV using the same method you chose to install it. Since upgrading is basically the same as installing, you can follow [DDEV Installation](../install/ddev-installation.md) to upgrade.

You can use the [`self-upgrade`](../basics/commands.md#self-upgrade) command for getting instructions tailored to your installation.

rfay marked this conversation as resolved.
Show resolved Hide resolved
* On macOS you likely installed via Homebrew; run `brew update && brew upgrade ddev`.
<!-- markdownlint-disable-next-line -->
* On Linux + WSL2 using Debian/Ubuntu’s `apt install` technique, run `sudo apt update && sudo apt upgrade ddev` like any other package on your system.
Expand Down
43 changes: 43 additions & 0 deletions pkg/ddevapp/global_dotddev_assets/commands/host/self-upgrade
@@ -0,0 +1,43 @@
#!/bin/bash

#ddev-generated

## Description: Explain how to upgrade DDEV
## Usage: self-upgrade
## Example: "ddev self-upgrade"

mypath=$(which ddev)

case $mypath in
"/usr/bin/ddev")
if [[ ${OSTYPE} = "linux-gnu"* ]]; then
if command -v apt; then echo "You seem to have an apt-installed ddev, upgrade with 'sudo apt update && sudo apt upgrade -y ddev'";
elif [ -f /etc/arch-release ] && command -v yay >/dev/null ; then echo "You seem to have yay-installed ddev (AUR), upgrade with 'yay -Syu ddev'";
elif command -v dnf; then echo "You seem to have dnf-installed ddev, upgrade with 'sudo dnf install --refresh ddev'"; fi
fi
;;

"/usr/local/bin/ddev")
if [ ! -L /usr/local/bin/ddev ]; then
printf "DDEV appears to have been installed with install_ddev.sh, you can run that script again to update.\ncurl -fsSL https://raw.githubusercontent.com/drud/ddev/master/scripts/install_ddev.sh | bash\n"
elif command -v brew; then
echo "DDEV appears to have been installed with homebrew, upgrade with 'brew update && brew upgrade ddev'"
fi
;;

"/opt/homebrew/bin/ddev" | "/home/linuxbrew/.linuxbrew/bin/ddev")
if [ -L "$(which ddev)" ] && command -v brew; then
echo "DDEV appears to have been installed with homebrew, upgrade with 'brew update && brew upgrade ddev'"
fi
;;

"/c/Program Files/DDEV/ddev")
printf "DDEV was either installed with\nchoco install -y ddev\nor with the installer package.\n"
echo "You can upgrade with 'choco upgrade -y ddev'"
echo "Or by downloading the Windows installer from https://github.com/drud/ddev/releases"
;;

*)
echo "Unable to determine how you installed ddev, but you can remove $mypath and reinstall with one of the techniques in https://ddev.readthedocs.io/en/latest/users/install/ddev-installation/"

esac