@@ -1484,6 +1484,34 @@ do_uninstall() {
14841484 echo " "
14851485}
14861486
1487+ # ─── Architecture Detection ────────────────────────────────────────────────────
1488+
1489+ detect_architecture () {
1490+ # Detect system architecture using uname and map it to binary suffix
1491+ # Supports: 386, amd64, arm64, armv7
1492+ local machine_arch
1493+ machine_arch=$( uname -m)
1494+
1495+ case " $machine_arch " in
1496+ x86_64|amd64)
1497+ echo " amd64"
1498+ ;;
1499+ i386|i686)
1500+ echo " 386"
1501+ ;;
1502+ aarch64|arm64)
1503+ echo " arm64"
1504+ ;;
1505+ armv7l|armv7)
1506+ echo " armv7"
1507+ ;;
1508+ * )
1509+ print_warn " Unsupported architecture: $machine_arch (defaulting to amd64)"
1510+ echo " amd64"
1511+ ;;
1512+ esac
1513+ }
1514+
14871515# ─── User Management TUI ──────────────────────────────────────────────────────
14881516
14891517do_manage_users () {
@@ -1499,11 +1527,13 @@ do_manage_users() {
14991527 # Install sshtun-user if not present
15001528 if ! command -v sshtun-user & > /dev/null; then
15011529 print_info " sshtun-user not found. Installing..."
1502- if curl -fsSL -o /usr/local/bin/sshtun-user https://github.com/net2share/sshtun-user/releases/latest/download/sshtun-user-linux-amd64; then
1530+ local arch
1531+ arch=$( detect_architecture)
1532+ if curl -fsSL -o /usr/local/bin/sshtun-user " https://github.com/net2share/sshtun-user/releases/latest/download/sshtun-user-linux-${arch} " ; then
15031533 chmod +x /usr/local/bin/sshtun-user
1504- print_ok " Downloaded sshtun-user"
1534+ print_ok " Downloaded sshtun-user for ${arch} "
15051535 else
1506- print_fail " Failed to download sshtun-user. Check your internet connection."
1536+ print_fail " Failed to download sshtun-user for ${arch} architecture . Check your internet connection."
15071537 exit 1
15081538 fi
15091539
@@ -2054,11 +2084,13 @@ step_install_dnstm() {
20542084
20552085 # Download binary
20562086 print_info " Downloading dnstm..."
2057- if curl -fsSL -o /usr/local/bin/dnstm https://github.com/net2share/dnstm/releases/latest/download/dnstm-linux-amd64; then
2087+ local arch
2088+ arch=$( detect_architecture)
2089+ if curl -fsSL -o /usr/local/bin/dnstm " https://github.com/net2share/dnstm/releases/latest/download/dnstm-linux-${arch} " ; then
20582090 chmod +x /usr/local/bin/dnstm
2059- print_ok " Downloaded dnstm binary"
2091+ print_ok " Downloaded dnstm binary for ${arch} "
20602092 else
2061- print_fail " Failed to download dnstm"
2093+ print_fail " Failed to download dnstm for ${arch} architecture "
20622094 exit 1
20632095 fi
20642096
@@ -2543,11 +2575,13 @@ step_ssh_user() {
25432575 # Install sshtun-user if not present
25442576 if ! command -v sshtun-user & > /dev/null; then
25452577 print_info " Downloading sshtun-user..."
2546- if curl -fsSL -o /usr/local/bin/sshtun-user https://github.com/net2share/sshtun-user/releases/latest/download/sshtun-user-linux-amd64; then
2578+ local arch
2579+ arch=$( detect_architecture)
2580+ if curl -fsSL -o /usr/local/bin/sshtun-user " https://github.com/net2share/sshtun-user/releases/latest/download/sshtun-user-linux-${arch} " ; then
25472581 chmod +x /usr/local/bin/sshtun-user
2548- print_ok " Downloaded sshtun-user"
2582+ print_ok " Downloaded sshtun-user for ${arch} "
25492583 else
2550- print_fail " Failed to download sshtun-user"
2584+ print_fail " Failed to download sshtun-user for ${arch} architecture "
25512585 return
25522586 fi
25532587 else
0 commit comments