sing-box/installation/tools/rpm-install.sh

23 lines
675 B
Bash
Raw Normal View History

2024-11-29 04:35:31 +00:00
#!/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