Skip to content

Use all your internet connections at once on Windows, macOS, Linux and Android: per-connection load balancing over Wi-Fi, Ethernet, mobile data and phone tethers

Uninstall: one line for macOS and Linux, clear steps for every way (#21)

Rohit Mahto66fcf3e0b64f
diff --git a/.github/workflows/verify-repos.yml b/.github/workflows/verify-repos.yml
index 05cf907..c80de1e 100644
--- a/.github/workflows/verify-repos.yml
+++ b/.github/workflows/verify-repos.yml
@@ -42,7 +42,14 @@ jobs:
${{ matrix.prep }}
sh /src/install.sh
sh /src/install.sh # again: an upgrade must work too
- net-merge version'
+ net-merge version
+ sh /src/install.sh uninstall
+ # (a "!" check would never fail under sh -e, so these are tests; hash -r: forget the old path)
+ hash -r; test -z "$(command -v net-merge)"
+ test ! -e /etc/apt/sources.list.d/net-merge.list
+ test ! -e /etc/yum.repos.d/net-merge.repo
+ test -z "$(grep -ls net-merge /etc/pacman.conf /etc/apk/repositories)"
+ test -z "$(zypper lr 2>/dev/null | grep net-merge)"'
script-macos:
strategy:
@@ -62,6 +69,9 @@ jobs:
/usr/local/bin/net-merge version
sudo test -f /etc/sudoers.d/net-merge
sudo -n -l "$(readlink -f /usr/local/bin/net-merge)" tray
+ sh install.sh uninstall
+ hash -r; test -z "$(command -v net-merge)"
+ sudo test ! -e /etc/sudoers.d/net-merge
script-windows:
name: install.ps1 Windows
@@ -73,6 +83,10 @@ jobs:
$env:NET_MERGE_NO_START = '1'
./install.ps1
& "$env:ProgramFiles\net-merge\net-merge.exe" version
+ # the README's uninstall line
+ & "$env:ProgramFiles\net-merge\net-merge.exe" quit; Start-Process "$env:ProgramFiles\net-merge\unins000.exe" '/SILENT' -Verb RunAs -Wait
+ for ($i = 0; $i -lt 30 -and (Test-Path "$env:ProgramFiles\net-merge\net-merge.exe"); $i++) { Start-Sleep 1 }
+ if (Test-Path "$env:ProgramFiles\net-merge\net-merge.exe") { throw 'net-merge is still installed' }
# the README's own commands, one system at a time
readme-commands:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3e46666..c850e2f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,9 @@ entry here before pushing a version tag.
- Releases also carry the downloads under names without the version (`net-merge-setup.exe`,
`net-merge-macos-universal.tar.gz`, `net-merge-linux-$(uname -m).tar.gz`), so
`releases/latest/download/...` links always give the newest one.
+- **One-line uninstall** on macOS and Linux: `curl -fsSL https://raw.githubusercontent.com/rohit267/net-merge/main/install.sh | sh -s -- uninstall`
+ stops net-merge and removes it the way it was installed, with its repository and key. The README has the
+ Windows line and every manual way.
### Fixed
- `sudo net-merge install` refused on Macs where `/usr/local/bin` is writable by your user (Intel Macs
diff --git a/README.md b/README.md
index 5cfced8..3ec76d1 100644
--- a/README.md
+++ b/README.md
@@ -160,8 +160,89 @@ Then start it with `net-merge tray` (Linux, macOS) or from the Start menu (Windo
- **Signed repositories:** apt, dnf, zypper and pacman use the key in
[`packaging/apt-signing-key.asc`](packaging/apt-signing-key.asc), fingerprint
`0168 C7AB 7772 1656 9048 11AE 904F 61E7 F4F1 C2A1`.
-- **Uninstall:** your package manager (`sudo apt remove net-merge`, `brew uninstall net-merge`, ...) or
- Windows' *Installed apps*. On macOS also `net-merge autostart off` and `sudo net-merge uninstall`.
+</details>
+
+## Uninstall
+
+**macOS and Linux**: paste this into a terminal. It stops net-merge and removes it the way it was
+installed (Homebrew, apt, dnf, zypper, apk, pacman or the download), with its repository and key.
+
+```
+curl -fsSL https://raw.githubusercontent.com/rohit267/net-merge/main/install.sh | sh -s -- uninstall
+```
+
+**Windows**: paste this into PowerShell, or use *Settings > Apps > Installed apps > net-merge > Uninstall*.
+
+```
+& "$env:ProgramFiles\net-merge\net-merge.exe" quit; Start-Process "$env:ProgramFiles\net-merge\unins000.exe" '/SILENT' -Verb RunAs -Wait
+```
+
+Your network goes back to normal as soon as net-merge stops: it removes its virtual adapter and routes
+when it quits, and even after a crash.
+
+<details>
+<summary><strong>Rather type the commands yourself?</strong> One block per way you installed it.</summary>
+<br>
+
+Each block first stops the tray and turns off start at sign-in, then removes net-merge.
+
+**Homebrew** (macOS):
+
+```
+net-merge quit; net-merge autostart off; sudo net-merge uninstall; brew uninstall net-merge && brew untap rohit267/tap
+```
+
+**macOS without Homebrew**:
+
+```
+net-merge quit; net-merge autostart off; sudo net-merge uninstall
+```
+
+**Debian, Ubuntu, Linux Mint, Pop!_OS, Raspberry Pi OS** (apt):
+
+```
+net-merge quit; net-merge autostart off; sudo apt remove -y net-merge && sudo rm -f /etc/apt/sources.list.d/net-merge.list /usr/share/keyrings/net-merge.gpg
+```
+
+**Fedora, RHEL, Rocky, Alma** (dnf):
+
+```
+net-merge quit; net-merge autostart off; sudo dnf remove -y net-merge && sudo rm -f /etc/yum.repos.d/net-merge.repo
+```
+
+**openSUSE** (zypper):
+
+```
+net-merge quit; net-merge autostart off; sudo zypper remove -y net-merge && sudo zypper removerepo net-merge
+```
+
+**Arch, Manjaro, EndeavourOS** (pacman):
+
+```
+net-merge quit; net-merge autostart off; sudo pacman -R --noconfirm net-merge && sudo sed -i '/^\[net-merge\]$/,/^Server = .*net-merge/d' /etc/pacman.conf && sudo pacman-key --delete 0168C7AB77721656904811AE904F61E7F4F1C2A1
+```
+
+**Alpine** (apk):
+
+```
+net-merge quit; net-merge autostart off; sudo apk del net-merge && sudo sed -i '\#rohit267.github.io/net-merge/apk#d' /etc/apk/repositories && sudo rm -f /etc/apk/keys/net-merge.rsa.pub
+```
+
+**Homebrew** (Linux):
+
+```
+net-merge quit; net-merge autostart off; brew uninstall net-merge && brew untap rohit267/tap
+```
+
+**Any other Linux** (the download):
+
+```
+net-merge quit; net-merge autostart off; sudo rm -f /usr/local/bin/net-merge
+```
+
+**Windows portable zip**: run `net-merge.exe autostart off` in its folder, quit the tray, then delete the folder.
+
+**NixOS**: remove `programs.net-merge` (and the `net-merge` input) from your configuration and rebuild.
</details>
### NixOS
diff --git a/install.sh b/install.sh
index 9dbb049..a965e7a 100755
--- a/install.sh
+++ b/install.sh
@@ -8,6 +8,10 @@
# macOS: Homebrew if it is installed, otherwise the release tarball.
# Then it starts the tray. NET_MERGE_METHOD=tarball skips the package managers, NET_MERGE_NO_START=1
# leaves the tray off.
+#
+# Uninstall, however it was installed:
+#
+# curl -fsSL https://raw.githubusercontent.com/rohit267/net-merge/main/install.sh | sh -s -- uninstall
set -eu
REPO=https://github.com/rohit267/net-merge
@@ -109,6 +113,71 @@ pacman_install() {
$SUDO pacman -Sy --needed --noconfirm net-merge
}
+# ---- uninstall: stop it, then remove it the way it was installed, with the repository it came from
+uninstall() {
+ say "Stopping net-merge"
+ if have net-merge; then
+ net-merge quit >/dev/null 2>&1 || true # the tray
+ $SUDO net-merge off >/dev/null 2>&1 || true # system-wide mode started from a terminal
+ net-merge autostart off >/dev/null 2>&1 || true # start at sign-in
+ sleep 2
+ fi
+ if [ "$(uname -s)" = Darwin ]; then
+ for exe in /opt/net-merge/bin/net-merge /usr/local/bin/net-merge; do
+ [ -x "$exe" ] && { $SUDO "$exe" uninstall || true; break; } # the root-owned copy and the sudoers rule
+ done
+ if have brew && brew list --formula net-merge >/dev/null 2>&1; then
+ say "Removing with Homebrew"
+ brew uninstall net-merge
+ brew untap rohit267/tap >/dev/null 2>&1 || true
+ fi
+ $SUDO rm -rf /var/run/net-merge "$HOME/Library/Logs/net-merge.log"
+ else
+ if have dpkg && dpkg -s net-merge >/dev/null 2>&1; then
+ say "Removing with apt"
+ $SUDO env DEBIAN_FRONTEND=noninteractive apt-get remove -y -qq net-merge
+ $SUDO rm -f /etc/apt/sources.list.d/net-merge.list /usr/share/keyrings/net-merge.gpg
+ elif have rpm && rpm -q net-merge >/dev/null 2>&1; then
+ if have zypper; then
+ say "Removing with zypper"
+ $SUDO zypper --non-interactive remove net-merge
+ $SUDO zypper --non-interactive removerepo net-merge >/dev/null 2>&1 || true
+ else
+ pm=dnf; have dnf || pm=yum
+ say "Removing with $pm"
+ $SUDO "$pm" remove -y net-merge
+ $SUDO rm -f /etc/yum.repos.d/net-merge.repo
+ fi
+ elif have apk && apk info -e net-merge >/dev/null 2>&1; then
+ say "Removing with apk"
+ $SUDO apk del net-merge
+ $SUDO sed -i "\#^$BASE/apk\$#d" /etc/apk/repositories
+ $SUDO rm -f /etc/apk/keys/net-merge.rsa.pub
+ elif have pacman && pacman -Q net-merge >/dev/null 2>&1; then
+ say "Removing with pacman"
+ $SUDO pacman -R --noconfirm net-merge
+ $SUDO sed -i '/^\[net-merge\]$/,/^Server = .*net-merge/d' /etc/pacman.conf
+ $SUDO pacman-key --delete "$FPR" >/dev/null 2>&1 || true
+ fi
+ if have brew && brew list --formula net-merge >/dev/null 2>&1; then
+ say "Removing with Homebrew"
+ brew uninstall net-merge
+ brew untap rohit267/tap >/dev/null 2>&1 || true
+ fi
+ $SUDO rm -f /usr/local/bin/net-merge # the tarball
+ rm -rf "${XDG_CACHE_HOME:-$HOME/.cache}/net-merge"
+ fi
+ hash -r 2>/dev/null || true
+ have net-merge && die "a net-merge is still at $(command -v net-merge); remove it by hand"
+ say "net-merge is uninstalled. Your network settings are back to normal."
+}
+
+case ${1:-} in
+ uninstall|--uninstall) uninstall; exit 0 ;;
+ '') ;;
+ *) die "unknown option $1 (use: uninstall)" ;;
+esac
+
# ---- pick the way
method=${NET_MERGE_METHOD:-auto}
if [ "$(uname -s)" = Darwin ]; then