Update
This commit is contained in:
6166
installation/build-from-source/index.html
Normal file
6166
installation/build-from-source/index.html
Normal file
File diff suppressed because it is too large
Load Diff
5639
installation/docker/index.html
Normal file
5639
installation/docker/index.html
Normal file
File diff suppressed because it is too large
Load Diff
5958
installation/package-manager/index.html
Normal file
5958
installation/package-manager/index.html
Normal file
File diff suppressed because it is too large
Load Diff
22
installation/tools/arch-install.sh
Normal file
22
installation/tools/arch-install.sh
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e -o pipefail
|
||||
|
||||
ARCH_RAW=$(uname -m)
|
||||
case "${ARCH_RAW}" in
|
||||
'x86_64') ARCH='amd64';;
|
||||
'x86' | 'i686' | 'i386') ARCH='386';;
|
||||
'aarch64' | 'arm64') ARCH='arm64';;
|
||||
'armv7l') ARCH='armv7';;
|
||||
's390x') ARCH='s390x';;
|
||||
*) echo "Unsupported architecture: ${ARCH_RAW}"; exit 1;;
|
||||
esac
|
||||
|
||||
VERSION=$(curl -s https://api.github.com/repos/SagerNet/sing-box/releases/latest \
|
||||
| grep tag_name \
|
||||
| cut -d ":" -f2 \
|
||||
| sed 's/\"//g;s/\,//g;s/\ //g;s/v//')
|
||||
|
||||
curl -Lo sing-box.pkg.tar.zst "https://github.com/SagerNet/sing-box/releases/download/v${VERSION}/sing-box_${VERSION}_linux_${ARCH}.pkg.tar.zst"
|
||||
sudo pacman -U sing-box.pkg.tar.zst
|
||||
rm sing-box.pkg.tar.zst
|
||||
23
installation/tools/deb-install.sh
Normal file
23
installation/tools/deb-install.sh
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e -o pipefail
|
||||
|
||||
ARCH_RAW=$(uname -m)
|
||||
case "${ARCH_RAW}" in
|
||||
'x86_64') ARCH='amd64';;
|
||||
'x86' | 'i686' | 'i386') ARCH='386';;
|
||||
'aarch64' | 'arm64') ARCH='arm64';;
|
||||
'armv7l') ARCH='armv7';;
|
||||
's390x') ARCH='s390x';;
|
||||
*) echo "Unsupported architecture: ${ARCH_RAW}"; exit 1;;
|
||||
esac
|
||||
|
||||
VERSION=$(curl -s https://api.github.com/repos/SagerNet/sing-box/releases/latest \
|
||||
| grep tag_name \
|
||||
| cut -d ":" -f2 \
|
||||
| sed 's/\"//g;s/\,//g;s/\ //g;s/v//')
|
||||
|
||||
curl -Lo sing-box.deb "https://github.com/SagerNet/sing-box/releases/download/v${VERSION}/sing-box_${VERSION}_linux_${ARCH}.deb"
|
||||
sudo dpkg -i sing-box.deb
|
||||
rm sing-box.deb
|
||||
|
||||
127
installation/tools/install.sh
Normal file
127
installation/tools/install.sh
Normal file
@@ -0,0 +1,127 @@
|
||||
#!/bin/sh
|
||||
|
||||
download_beta=false
|
||||
download_version=""
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--beta)
|
||||
download_beta=true
|
||||
shift
|
||||
;;
|
||||
--version)
|
||||
shift
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Missing argument for --version"
|
||||
echo "Usage: $0 [--beta] [--version <version>]"
|
||||
exit 1
|
||||
fi
|
||||
download_version="$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Unknown argument: $1"
|
||||
echo "Usage: $0 [--beta] [--version <version>]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if command -v pacman >/dev/null 2>&1; then
|
||||
os="linux"
|
||||
arch=$(uname -m)
|
||||
package_suffix=".pkg.tar.zst"
|
||||
package_install="pacman -U --noconfirm"
|
||||
elif command -v dpkg >/dev/null 2>&1; then
|
||||
os="linux"
|
||||
arch=$(dpkg --print-architecture)
|
||||
package_suffix=".deb"
|
||||
package_install="dpkg -i"
|
||||
elif command -v dnf >/dev/null 2>&1; then
|
||||
os="linux"
|
||||
arch=$(uname -m)
|
||||
package_suffix=".rpm"
|
||||
package_install="dnf install -y"
|
||||
elif command -v rpm >/dev/null 2>&1; then
|
||||
os="linux"
|
||||
arch=$(uname -m)
|
||||
package_suffix=".rpm"
|
||||
package_install="rpm -i"
|
||||
elif command -v apk >/dev/null 2>&1 && [ -f /etc/os-release ] && grep -q OPENWRT_ARCH /etc/os-release; then
|
||||
os="openwrt"
|
||||
. /etc/os-release
|
||||
arch="$OPENWRT_ARCH"
|
||||
package_suffix=".apk"
|
||||
package_install="apk add --allow-untrusted"
|
||||
elif command -v apk >/dev/null 2>&1; then
|
||||
os="linux"
|
||||
arch=$(apk --print-arch)
|
||||
package_suffix=".apk"
|
||||
package_install="apk add --allow-untrusted"
|
||||
elif command -v opkg >/dev/null 2>&1; then
|
||||
os="openwrt"
|
||||
. /etc/os-release
|
||||
arch="$OPENWRT_ARCH"
|
||||
package_suffix=".ipk"
|
||||
package_install="opkg update && opkg install"
|
||||
else
|
||||
echo "Missing supported package manager."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$download_version" ]; then
|
||||
if [ "$download_beta" != "true" ]; then
|
||||
if [ -n "$GITHUB_TOKEN" ]; then
|
||||
latest_release=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" https://api.github.com/repos/SagerNet/sing-box/releases/latest)
|
||||
else
|
||||
latest_release=$(curl -s https://api.github.com/repos/SagerNet/sing-box/releases/latest)
|
||||
fi
|
||||
curl_exit_status=$?
|
||||
if [ $curl_exit_status -ne 0 ]; then
|
||||
exit $curl_exit_status
|
||||
fi
|
||||
if [ "$(echo "$latest_release" | grep tag_name | wc -l)" -eq 0 ]; then
|
||||
echo "$latest_release"
|
||||
exit 1
|
||||
fi
|
||||
download_version=$(echo "$latest_release" | grep tag_name | head -n 1 | awk -F: '{print $2}' | sed 's/[", v]//g')
|
||||
else
|
||||
if [ -n "$GITHUB_TOKEN" ]; then
|
||||
latest_release=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" https://api.github.com/repos/SagerNet/sing-box/releases)
|
||||
else
|
||||
latest_release=$(curl -s https://api.github.com/repos/SagerNet/sing-box/releases)
|
||||
fi
|
||||
curl_exit_status=$?
|
||||
if [ $curl_exit_status -ne 0 ]; then
|
||||
exit $curl_exit_status
|
||||
fi
|
||||
if [ "$(echo "$latest_release" | grep tag_name | wc -l)" -eq 0 ]; then
|
||||
echo "$latest_release"
|
||||
exit 1
|
||||
fi
|
||||
download_version=$(echo "$latest_release" | grep tag_name | head -n 1 | awk -F: '{print $2}' | sed 's/[", v]//g')
|
||||
fi
|
||||
fi
|
||||
|
||||
package_name="sing-box_${download_version}_${os}_${arch}${package_suffix}"
|
||||
package_url="https://github.com/SagerNet/sing-box/releases/download/v${download_version}/${package_name}"
|
||||
|
||||
echo "Downloading $package_url"
|
||||
if [ -n "$GITHUB_TOKEN" ]; then
|
||||
curl --fail -Lo "$package_name" -H "Authorization: token ${GITHUB_TOKEN}" "$package_url"
|
||||
else
|
||||
curl --fail -Lo "$package_name" "$package_url"
|
||||
fi
|
||||
|
||||
curl_exit_status=$?
|
||||
if [ $curl_exit_status -ne 0 ]; then
|
||||
exit $curl_exit_status
|
||||
fi
|
||||
|
||||
if command -v sudo >/dev/null 2>&1; then
|
||||
package_install="sudo $package_install"
|
||||
fi
|
||||
|
||||
echo "$package_install $package_name"
|
||||
sh -c "$package_install \"$package_name\""
|
||||
rm -f "$package_name"
|
||||
22
installation/tools/rpm-install.sh
Normal file
22
installation/tools/rpm-install.sh
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e -o pipefail
|
||||
|
||||
ARCH_RAW=$(uname -m)
|
||||
case "${ARCH_RAW}" in
|
||||
'x86_64') ARCH='amd64';;
|
||||
'x86' | 'i686' | 'i386') ARCH='386';;
|
||||
'aarch64' | 'arm64') ARCH='arm64';;
|
||||
'armv7l') ARCH='armv7';;
|
||||
's390x') ARCH='s390x';;
|
||||
*) echo "Unsupported architecture: ${ARCH_RAW}"; exit 1;;
|
||||
esac
|
||||
|
||||
VERSION=$(curl -s https://api.github.com/repos/SagerNet/sing-box/releases/latest \
|
||||
| grep tag_name \
|
||||
| cut -d ":" -f2 \
|
||||
| sed 's/\"//g;s/\,//g;s/\ //g;s/v//')
|
||||
|
||||
curl -Lo sing-box.rpm "https://github.com/SagerNet/sing-box/releases/download/v${VERSION}/sing-box_${VERSION}_linux_${ARCH}.rpm"
|
||||
sudo rpm -i sing-box.rpm
|
||||
rm sing-box.rpm
|
||||
7
installation/tools/sing-box.repo
Normal file
7
installation/tools/sing-box.repo
Normal file
@@ -0,0 +1,7 @@
|
||||
[sing-box]
|
||||
name=sing-box
|
||||
baseurl=https://rpm.sagernet.org/
|
||||
enabled=1
|
||||
repo_gpgcheck=1
|
||||
gpgcheck=1
|
||||
gpgkey=https://sing-box.app/gpg.key
|
||||
Reference in New Issue
Block a user