Add installation and uninstallation scripts with updated README instructions
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -13,7 +13,7 @@ environment's system tray.
|
||||
sh -c 'curl -sL https://nextdns.io/install | sh'
|
||||
```
|
||||
|
||||
2. **Python 3 & PyQt6**: The interface is built using Python 3 and the Qt6
|
||||
1. **Python 3 & PyQt6**: The interface is built using Python 3 and the Qt6
|
||||
toolkit. (This is installed by default on (K)ubuntu.)
|
||||
|
||||
```bash
|
||||
@@ -21,10 +21,34 @@ sudo apt update
|
||||
sudo apt install python3 python3-pyqt6
|
||||
```
|
||||
|
||||
3. **Polkit Agent**: The script uses pkexec to handle start/stop commands safely. Most desktop environments (KDE, GNOME, XFCE) come with this pre-installed.
|
||||
1. **Polkit Agent**: The script uses pkexec to handle start/stop commands safely. Most desktop environments (KDE, GNOME, XFCE) come with this pre-installed.
|
||||
|
||||
## Installation
|
||||
|
||||
Preferred (single command):
|
||||
|
||||
```bash
|
||||
./install.sh
|
||||
```
|
||||
|
||||
Enable autostart during install:
|
||||
|
||||
```bash
|
||||
./install.sh --autostart
|
||||
```
|
||||
|
||||
## Uninstall
|
||||
|
||||
```bash
|
||||
./uninstall.sh
|
||||
```
|
||||
|
||||
Preview what would be removed:
|
||||
|
||||
```bash
|
||||
./uninstall.sh --dry-run
|
||||
```
|
||||
|
||||
1. **Copy the files to your home directory:**
|
||||
|
||||
```bash
|
||||
@@ -36,20 +60,23 @@ cp home/.local/share/applications/nextdns-tray.desktop ~/.local/share/applicatio
|
||||
cp home/.local/share/icons/nextdns.png ~/.local/share/icons/
|
||||
```
|
||||
|
||||
2. **Make the script executable**
|
||||
1. **Make the script executable**
|
||||
|
||||
```bash
|
||||
chmod +x ~/.local/bin/nextdns-tray
|
||||
```
|
||||
|
||||
3. **(Optional) Add to Autostart**: If you want the tray to start automatically when you log in:
|
||||
The bundled `nextdns-tray.desktop` launcher runs `nextdns-tray` directly (via `PATH`) so it is not tied to any repository location.
|
||||
If your desktop session does not include `~/.local/bin` in `PATH`, use an absolute path in `~/.local/share/applications/nextdns-tray.desktop`.
|
||||
|
||||
1. **(Optional) Add to Autostart**: If you want the tray to start automatically when you log in:
|
||||
|
||||
```bash
|
||||
mkdir -p ~/.config/autostart
|
||||
cp ~/.local/share/applications/nextdns-tray.desktop ~/.config/autostart/
|
||||
```
|
||||
|
||||
### Installation (one-liner)
|
||||
### Manual Installation (equivalent)
|
||||
|
||||
```bash
|
||||
sh -c 'curl -sL https://nextdns.io/install | sh'
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
[Desktop Entry]
|
||||
Comment=Manage NextDNS Service
|
||||
Exec=/home/hans/git-repos/nextdns-linux-trayicon/venv/bin/python /home/hans/git-repos/nextdns-linux-trayicon/home/.local/bin/nextdns-tray
|
||||
TryExec=nextdns-tray
|
||||
Exec=nextdns-tray
|
||||
Icon=nextdns
|
||||
MimeType=
|
||||
Name=NextDNS Tray Icon
|
||||
Path=/home/hans/git-repos/nextdns-linux-trayicon/home/.local/bin
|
||||
Terminal=false
|
||||
Type=Application
|
||||
X-KDE-StartupNotify=false
|
||||
|
||||
Executable
+45
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
SRC_BIN="$SCRIPT_DIR/home/.local/bin/nextdns-tray"
|
||||
SRC_DESKTOP="$SCRIPT_DIR/home/.local/share/applications/nextdns-tray.desktop"
|
||||
SRC_ICON="$SCRIPT_DIR/home/.local/share/icons/nextdns.png"
|
||||
|
||||
DEST_BIN="$HOME/.local/bin"
|
||||
DEST_APPS="$HOME/.local/share/applications"
|
||||
DEST_ICONS="$HOME/.local/share/icons"
|
||||
DEST_AUTOSTART="$HOME/.config/autostart"
|
||||
|
||||
ENABLE_AUTOSTART=0
|
||||
if [[ "${1:-}" == "--autostart" ]]; then
|
||||
ENABLE_AUTOSTART=1
|
||||
fi
|
||||
|
||||
if [[ ! -f "$SRC_BIN" || ! -f "$SRC_DESKTOP" || ! -f "$SRC_ICON" ]]; then
|
||||
echo "Error: expected files were not found under the repository home/ directory."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$DEST_BIN" "$DEST_APPS" "$DEST_ICONS"
|
||||
|
||||
install -m 0755 "$SRC_BIN" "$DEST_BIN/nextdns-tray"
|
||||
install -m 0644 "$SRC_DESKTOP" "$DEST_APPS/nextdns-tray.desktop"
|
||||
install -m 0644 "$SRC_ICON" "$DEST_ICONS/nextdns.png"
|
||||
|
||||
if [[ "$ENABLE_AUTOSTART" -eq 1 ]]; then
|
||||
mkdir -p "$DEST_AUTOSTART"
|
||||
install -m 0644 "$DEST_APPS/nextdns-tray.desktop" "$DEST_AUTOSTART/nextdns-tray.desktop"
|
||||
fi
|
||||
|
||||
if command -v update-desktop-database >/dev/null 2>&1; then
|
||||
update-desktop-database "$DEST_APPS" >/dev/null 2>&1 || true
|
||||
fi
|
||||
|
||||
echo "Installed NextDNS Tray Icon to $HOME/.local"
|
||||
if [[ "$ENABLE_AUTOSTART" -eq 1 ]]; then
|
||||
echo "Autostart enabled"
|
||||
else
|
||||
echo "Autostart not enabled (use --autostart to enable)"
|
||||
fi
|
||||
Executable
+61
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
Usage:
|
||||
./uninstall.sh [--dry-run]
|
||||
|
||||
Options:
|
||||
--dry-run Show what would be removed without deleting files.
|
||||
EOF
|
||||
}
|
||||
|
||||
DRY_RUN=0
|
||||
case "${1:-}" in
|
||||
"") ;;
|
||||
--dry-run) DRY_RUN=1 ;;
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: ${1}" >&2
|
||||
usage >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
TARGETS=(
|
||||
"$HOME/.local/bin/nextdns-tray"
|
||||
"$HOME/.local/share/applications/nextdns-tray.desktop"
|
||||
"$HOME/.local/share/icons/nextdns.png"
|
||||
"$HOME/.config/autostart/nextdns-tray.desktop"
|
||||
)
|
||||
|
||||
remove_file() {
|
||||
local path="$1"
|
||||
if [[ -e "$path" ]]; then
|
||||
if [[ "$DRY_RUN" -eq 1 ]]; then
|
||||
echo "Would remove: $path"
|
||||
else
|
||||
rm -f "$path"
|
||||
echo "Removed: $path"
|
||||
fi
|
||||
else
|
||||
echo "Not present: $path"
|
||||
fi
|
||||
}
|
||||
|
||||
for path in "${TARGETS[@]}"; do
|
||||
remove_file "$path"
|
||||
done
|
||||
|
||||
if [[ "$DRY_RUN" -eq 0 ]]; then
|
||||
if command -v update-desktop-database >/dev/null 2>&1; then
|
||||
update-desktop-database "$HOME/.local/share/applications" >/dev/null 2>&1 || true
|
||||
fi
|
||||
echo "Uninstall complete"
|
||||
else
|
||||
echo "Dry run complete"
|
||||
fi
|
||||
Reference in New Issue
Block a user