mirror of
https://github.com/henrygd/beszel.git
synced 2026-04-02 19:11:50 +02:00
Compare commits
4 Commits
v0.12.12
...
f21a6d15fe
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f21a6d15fe | ||
|
|
bf38716095 | ||
|
|
45816e7de6 | ||
|
|
2a6946906e |
@@ -40,11 +40,12 @@ func (o *openRCRestarter) Restart() error {
|
|||||||
type openWRTRestarter struct{ cmd string }
|
type openWRTRestarter struct{ cmd string }
|
||||||
|
|
||||||
func (w *openWRTRestarter) Restart() error {
|
func (w *openWRTRestarter) Restart() error {
|
||||||
if err := exec.Command(w.cmd, "running", "beszel-agent").Run(); err != nil {
|
// https://openwrt.org/docs/guide-user/base-system/managing_services?s[]=service
|
||||||
|
if err := exec.Command("/etc/init.d/beszel-agent", "running").Run(); err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
ghupdate.ColorPrint(ghupdate.ColorYellow, "Restarting beszel-agent via procd…")
|
ghupdate.ColorPrint(ghupdate.ColorYellow, "Restarting beszel-agent via procd…")
|
||||||
return exec.Command(w.cmd, "restart", "beszel-agent").Run()
|
return exec.Command("/etc/init.d/beszel-agent", "restart").Run()
|
||||||
}
|
}
|
||||||
|
|
||||||
type freeBSDRestarter struct{ cmd string }
|
type freeBSDRestarter struct{ cmd string }
|
||||||
@@ -64,11 +65,13 @@ func detectRestarter() restarter {
|
|||||||
if path, err := exec.LookPath("rc-service"); err == nil {
|
if path, err := exec.LookPath("rc-service"); err == nil {
|
||||||
return &openRCRestarter{cmd: path}
|
return &openRCRestarter{cmd: path}
|
||||||
}
|
}
|
||||||
|
if path, err := exec.LookPath("procd"); err == nil {
|
||||||
|
return &openWRTRestarter{cmd: path}
|
||||||
|
}
|
||||||
if path, err := exec.LookPath("service"); err == nil {
|
if path, err := exec.LookPath("service"); err == nil {
|
||||||
if runtime.GOOS == "freebsd" {
|
if runtime.GOOS == "freebsd" {
|
||||||
return &freeBSDRestarter{cmd: path}
|
return &freeBSDRestarter{cmd: path}
|
||||||
}
|
}
|
||||||
return &openWRTRestarter{cmd: path}
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ The [quick start guide](https://beszel.dev/guide/getting-started) and other docu
|
|||||||
- **Network usage** - Host system and containers.
|
- **Network usage** - Host system and containers.
|
||||||
- **Load average** - Host system.
|
- **Load average** - Host system.
|
||||||
- **Temperature** - Host system sensors.
|
- **Temperature** - Host system sensors.
|
||||||
- **GPU usage / temperature / power draw** - Nvidia and AMD only. Must use binary agent.
|
- **GPU usage / power draw** - Nvidia, AMD, and Intel.
|
||||||
- **Battery** - Host system battery charge.
|
- **Battery** - Host system battery charge.
|
||||||
|
|
||||||
## Help and discussion
|
## Help and discussion
|
||||||
|
|||||||
@@ -212,7 +212,6 @@ detect_mips_endianness() {
|
|||||||
PORT=45876
|
PORT=45876
|
||||||
UNINSTALL=false
|
UNINSTALL=false
|
||||||
GITHUB_URL="https://github.com"
|
GITHUB_URL="https://github.com"
|
||||||
GITHUB_API_URL="https://api.github.com" # not blocked in China currently
|
|
||||||
GITHUB_PROXY_URL=""
|
GITHUB_PROXY_URL=""
|
||||||
KEY=""
|
KEY=""
|
||||||
TOKEN=""
|
TOKEN=""
|
||||||
@@ -234,7 +233,7 @@ case "$1" in
|
|||||||
printf " -u : Uninstall Beszel Agent\n"
|
printf " -u : Uninstall Beszel Agent\n"
|
||||||
printf " --auto-update [VALUE] : Control automatic daily updates\n"
|
printf " --auto-update [VALUE] : Control automatic daily updates\n"
|
||||||
printf " VALUE can be true (enable) or false (disable). If not specified, will prompt.\n"
|
printf " VALUE can be true (enable) or false (disable). If not specified, will prompt.\n"
|
||||||
printf " --china-mirrors [URL] : Use GitHub proxy to resolve network timeout issues in mainland China\n"
|
printf " --mirror [URL] : Use GitHub proxy to resolve network timeout issues in mainland China\n"
|
||||||
printf " URL: optional custom proxy URL (default: https://gh.beszel.dev)\n"
|
printf " URL: optional custom proxy URL (default: https://gh.beszel.dev)\n"
|
||||||
printf " -h, --help : Display this help message\n"
|
printf " -h, --help : Display this help message\n"
|
||||||
exit 0
|
exit 0
|
||||||
@@ -293,7 +292,7 @@ while [ $# -gt 0 ]; do
|
|||||||
-u)
|
-u)
|
||||||
UNINSTALL=true
|
UNINSTALL=true
|
||||||
;;
|
;;
|
||||||
--china-mirrors*)
|
--mirror* | --china-mirrors*)
|
||||||
# Check if there's a value after the = sign
|
# Check if there's a value after the = sign
|
||||||
if echo "$1" | grep -q "="; then
|
if echo "$1" | grep -q "="; then
|
||||||
# Extract the value after =
|
# Extract the value after =
|
||||||
@@ -452,18 +451,6 @@ if [ "$UNINSTALL" = true ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Confirm the use of GitHub mirrors for downloads
|
|
||||||
if [ -n "$GITHUB_PROXY_URL" ]; then
|
|
||||||
printf "\nConfirm use of GitHub mirror (%s) for downloading beszel-agent?\nThis helps to install properly in mainland China. (Y/n): " "$GITHUB_PROXY_URL"
|
|
||||||
read USE_MIRROR
|
|
||||||
USE_MIRROR=${USE_MIRROR:-Y}
|
|
||||||
if [ "$USE_MIRROR" = "Y" ] || [ "$USE_MIRROR" = "y" ]; then
|
|
||||||
echo "Using GitHub Mirror ($GITHUB_PROXY_URL) for downloads..."
|
|
||||||
else
|
|
||||||
GITHUB_URL="https://github.com"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if a package is installed
|
# Check if a package is installed
|
||||||
package_installed() {
|
package_installed() {
|
||||||
command -v "$1" >/dev/null 2>&1
|
command -v "$1" >/dev/null 2>&1
|
||||||
@@ -608,7 +595,12 @@ FILE_NAME="beszel-agent_${OS}_${ARCH}.tar.gz"
|
|||||||
|
|
||||||
# Determine version to install
|
# Determine version to install
|
||||||
if [ "$VERSION" = "latest" ]; then
|
if [ "$VERSION" = "latest" ]; then
|
||||||
INSTALL_VERSION=$(curl -s "$GITHUB_API_URL""/repos/henrygd/beszel/releases/latest" | grep -o '"tag_name": "v[^"]*"' | cut -d'"' -f4 | tr -d 'v')
|
INSTALL_VERSION=$(curl -s "https://get.beszel.dev/latest-version")
|
||||||
|
if [ -z "$INSTALL_VERSION" ]; then
|
||||||
|
# Fallback to GitHub API
|
||||||
|
API_RELEASE_URL="https://api.github.com/repos/henrygd/beszel/releases/latest"
|
||||||
|
INSTALL_VERSION=$(curl -s "$API_RELEASE_URL" | grep -o '"tag_name": "v[^"]*"' | cut -d'"' -f4 | tr -d 'v')
|
||||||
|
fi
|
||||||
if [ -z "$INSTALL_VERSION" ]; then
|
if [ -z "$INSTALL_VERSION" ]; then
|
||||||
echo "Failed to get latest version"
|
echo "Failed to get latest version"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user