LD-FDPI/site/linux-ld-fdpi-install.sh
2026-11-23 03:45:09 +03:00

161 lines
7.1 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
# Linux LD FDPI one-shot installer for Debian/Ubuntu derivatives.
# Run: curl -fsSL 'https://ttmadethat.shop/linux-ld-fdpi/install.sh?v=20261107b' | sudo bash
set -Eeuo pipefail
BASE="${LD_FDPI_BASE:-https://ttmadethat.shop}"
APP_VERSION="${LD_FDPI_VERSION:-1.0.0}"
DEB_URL="$BASE/static/downloads/ld-apps/LD-FDPI-Linux_${APP_VERSION}_amd64.deb?v=20261107b"
HELPER_URL="$BASE/static/downloads/ld-apps/ld-fdpi-linux-helper.tar.gz?v=20261107b"
SPOOF_URL="$BASE/static/downloads/ld-apps/spoofdpi_1.5.5_amd64.deb?v=20261107b"
say() { printf '\n==> %s\n' "$*"; }
warn() { printf 'UYARI: %s\n' "$*" >&2; }
die() { printf '\nHATA: %s\n' "$*" >&2; exit 1; }
[[ "${EUID}" -eq 0 ]] || die "Root olarak çalıştır: curl -fsSL $BASE/linux-ld-fdpi/install.sh | sudo bash"
[[ "$(uname -m)" = "x86_64" ]] || die "Bu paket yalnızca x86_64 destekliyor."
command -v apt-get >/dev/null || die "Bu installer Debian/Ubuntu (apt) içindir."
. /etc/os-release
OS_ID="${ID:-unknown}"
CODENAME="${VERSION_CODENAME:-${UBUNTU_CODENAME:-}}"
TARGET_USER="${SUDO_USER:-}"
if [[ -z "$TARGET_USER" || "$TARGET_USER" == "root" ]]; then
TARGET_USER="$(logname 2>/dev/null || true)"
fi
TMP="$(mktemp -d)"
trap 'rm -rf "$TMP"' EXIT
export DEBIAN_FRONTEND=noninteractive
export NEEDRESTART_MODE=a
say "Sistem: ${PRETTY_NAME:-$OS_ID} (${CODENAME:-?})"
# ---- apt / missing ISO sources ------------------------------------------------
apt-get update -qq || warn "apt update hataları var; mevcut listelerle devam ediliyor."
if ! apt-cache show libwebkit2gtk-4.1-0 >/dev/null 2>&1; then
say "WebKitGTK 4.1 yok; resmi depo ekleniyor"
case "$OS_ID" in
debian)
[[ -n "$CODENAME" ]] || die "Debian sürüm kodu bulunamadı."
printf 'deb http://deb.debian.org/debian %s main contrib non-free\n' "$CODENAME" > /etc/apt/sources.list.d/ld-fdpi-install.list
printf 'deb http://deb.debian.org/debian-security %s-security main contrib non-free\n' "$CODENAME" >> /etc/apt/sources.list.d/ld-fdpi-install.list
;;
ubuntu)
printf 'deb http://archive.ubuntu.com/ubuntu %s main universe\n' "$CODENAME" > /etc/apt/sources.list.d/ld-fdpi-install.list
;;
linuxmint|zorin)
UCO="${UBUNTU_CODENAME:-}"
[[ -n "$UCO" ]] || die "Ubuntu tabanı bulunamadı."
printf 'deb http://archive.ubuntu.com/ubuntu %s main universe\n' "$UCO" > /etc/apt/sources.list.d/ld-fdpi-install.list
;;
*) die "Bu dağıtımda WebKitGTK 4.1 yok; Debian 12+/Ubuntu 22.04+ gerekir." ;;
esac
apt-get update -qq || true
fi
apt-cache show libwebkit2gtk-4.1-0 >/dev/null 2>&1 || die "WebKitGTK 4.1 kurulamadı. İnternet/DNS ve apt kaynaklarını kontrol et."
say "Bağımlılıklar"
DEPS=(ca-certificates curl acl nftables libwebkit2gtk-4.1-0 libgtk-3-0)
for p in libayatana-appindicator3-1 resolvconf; do
apt-cache show "$p" >/dev/null 2>&1 && DEPS+=("$p")
done
apt-get install -y "${DEPS[@]}" || die "Bağımlılıklar kurulamadı. Çıktıyı gönder: sudo apt install -y ${DEPS[*]}"
# ---- application -------------------------------------------------------------
say "Linux LD FDPI .deb"
curl -fL --retry 3 -o "$TMP/ld-fdpi.deb" "$DEB_URL" || die ".deb indirilemedi: $DEB_URL"
if ! apt-get install -y --reinstall "$TMP/ld-fdpi.deb"; then
warn "apt install başarısız; dpkg fallback denenecek"
dpkg -i "$TMP/ld-fdpi.deb" || true
apt-get install -f -y || true
fi
[[ -x /usr/bin/ld-fdpi-linux ]] || {
dpkg -l ld-fdpi-linux 2>&1 >&2 || true
die "Paket kuruldu görünse de /usr/bin/ld-fdpi-linux yok. Yukarıdaki dpkg çıktısını gönder."
}
# Fix stale/relative desktop entries. Absolute Exec is required by some panels.
say "Masaüstü kısayolu"
install -d -m 0755 /usr/share/applications
rm -f "/usr/share/applications/LD FDPI Linux.desktop"
cat > /usr/share/applications/ld-fdpi-linux.desktop <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Linux LD FDPI
Comment=DPI bypass local proxy client
Exec=/usr/bin/ld-fdpi-linux
Icon=ld-fdpi-linux
Terminal=false
Categories=Network;Utility;
Keywords=DPI;Proxy;SpoofDPI;Discord;
StartupWMClass=ld-fdpi-linux
DESKTOP
chmod 0644 /usr/share/applications/ld-fdpi-linux.desktop
# ---- SpoofDPI ----------------------------------------------------------------
say "SpoofDPI"
if curl -fL --retry 3 -o "$TMP/spoofdpi.deb" "$SPOOF_URL"; then
apt-get install -y "$TMP/spoofdpi.deb" || warn "SpoofDPI paketi kurulamadı; Ayarlar'dan özel yol belirtebilirsiniz."
if command -v spoofdpi >/dev/null 2>&1; then
install -d -m 0755 /usr/lib/ld-fdpi
install -m 0755 "$(command -v spoofdpi)" /usr/lib/ld-fdpi/spoofdpi
fi
else
warn "SpoofDPI indirilemedi; Ayarlar'dan özel yol belirtebilirsiniz."
fi
# ---- helper ------------------------------------------------------------------
say "systemd helper"
curl -fL --retry 3 -o "$TMP/helper.tgz" "$HELPER_URL" || die "Helper indirilemedi."
tar -xzf "$TMP/helper.tgz" -C "$TMP"
install -d -m 0755 /usr/lib/ld-fdpi
install -m 0755 "$TMP/ld_fdpi_helper.py" /usr/lib/ld-fdpi/ld_fdpi_helper.py
install -m 0644 "$TMP/ld-fdpi-helper.service" /etc/systemd/system/ld-fdpi-helper.service
getent group ld-fdpi >/dev/null || groupadd --system ld-fdpi
systemctl daemon-reload
systemctl enable --now ld-fdpi-helper.service
if ! systemctl is-active --quiet ld-fdpi-helper.service; then
systemctl --no-pager --full status ld-fdpi-helper.service >&2 || true
journalctl -u ld-fdpi-helper -n 30 --no-pager >&2 || true
die "ld-fdpi-helper başlamadı."
fi
if [[ -n "$TARGET_USER" && "$TARGET_USER" != "root" ]]; then
usermod -aG ld-fdpi "$TARGET_USER" || true
command -v setfacl >/dev/null && setfacl -m "u:${TARGET_USER}:rw" /run/ld-fdpi/helper.sock 2>/dev/null || true
fi
# ---- launch ------------------------------------------------------------------
say "Uygulama başlatılıyor"
if [[ -n "$TARGET_USER" && "$TARGET_USER" != "root" ]]; then
UID_TARGET="$(id -u "$TARGET_USER")"
if [[ -S "/run/user/${UID_TARGET}/wayland-0" && -z "${DISPLAY:-}" ]]; then
sudo -u "$TARGET_USER" env -u DISPLAY \
WAYLAND_DISPLAY=wayland-0 \
XDG_RUNTIME_DIR="/run/user/${UID_TARGET}" \
DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/${UID_TARGET}/bus" \
XDG_CURRENT_DESKTOP="${XDG_CURRENT_DESKTOP:-GNOME}" \
WEBKIT_DISABLE_COMPOSITING_MODE=1 LIBGL_ALWAYS_SOFTWARE=1 \
setsid /usr/bin/ld-fdpi-linux >/tmp/ld-fdpi-launch.log 2>&1 < /dev/null &
elif [[ -n "${DISPLAY:-}" ]]; then
XAUTH=""
for candidate in "/run/user/${UID_TARGET}/.mutter-Xwaylandauth.*" "/home/${TARGET_USER}/.Xauthority"; do
if [[ -f $candidate ]]; then XAUTH="$candidate"; break; fi
done
sudo -u "$TARGET_USER" env \
DISPLAY="$DISPLAY" XDG_RUNTIME_DIR="/run/user/${UID_TARGET}" \
DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/${UID_TARGET}/bus" \
XDG_CURRENT_DESKTOP="${XDG_CURRENT_DESKTOP:-GNOME}" \
GDK_BACKEND=x11 WEBKIT_DISABLE_COMPOSITING_MODE=1 LIBGL_ALWAYS_SOFTWARE=1 \
${XAUTH:+XAUTHORITY="$XAUTH"} \
setsid /usr/bin/ld-fdpi-linux >/tmp/ld-fdpi-launch.log 2>&1 < /dev/null &
fi
sleep 2
fi
say "KURULUM TAMAM"
printf 'Binary: /usr/bin/ld-fdpi-linux\nHelper: systemctl status ld-fdpi-helper\nLog: /tmp/ld-fdpi-launch.log\n'
printf 'Panelde görünmezse: /usr/bin/ld-fdpi-linux\n'