mirror of
https://github.com/fankes/beszel.git
synced 2025-10-19 17:59:28 +08:00
feat: use --china-mirrors instead of -c
This commit is contained in:
@@ -9,27 +9,57 @@ GITHUB_URL="https://github.com"
|
|||||||
GITHUB_API_URL="https://api.github.com"
|
GITHUB_API_URL="https://api.github.com"
|
||||||
|
|
||||||
# Read command line options
|
# Read command line options
|
||||||
while getopts "k:p:uhc" opt; do
|
TEMP=$(getopt -o 'k:p:uh' --long 'china-mirrors,help' -n 'install-agent.sh' -- "$@")
|
||||||
case $opt in
|
|
||||||
k) KEY="$OPTARG" ;;
|
if [ $? -ne 0 ]; then
|
||||||
p) PORT="$OPTARG" ;;
|
echo 'Failed to parse command line arguments' >&2
|
||||||
u) UNINSTALL=true ;;
|
exit 1
|
||||||
c) CHINA_MAINLAND=true ;;
|
fi
|
||||||
h)
|
|
||||||
printf "Beszel Agent installation script\n\n"
|
eval set -- "$TEMP"
|
||||||
printf "Usage: ./install-agent.sh [options]\n\n"
|
unset TEMP
|
||||||
printf "Options: \n"
|
|
||||||
printf " -k : SSH key (required, or interactive if not provided)\n"
|
while true; do
|
||||||
printf " -p : Port (default: $PORT)\n"
|
case "$1" in
|
||||||
printf " -u : Uninstall Beszel Agent\n"
|
'-k')
|
||||||
printf " -c : Using GitHub mirror sources to resolve network timeout issues in mainland China\n"
|
KEY="$2"
|
||||||
printf " -h : Display this help message\n"
|
shift 2
|
||||||
exit 0
|
continue
|
||||||
;;
|
;;
|
||||||
?)
|
'-p')
|
||||||
echo "Invalid option: -$OPTARG"
|
PORT="$2"
|
||||||
exit 1
|
shift 2
|
||||||
;;
|
continue
|
||||||
|
;;
|
||||||
|
'-u')
|
||||||
|
UNINSTALL=true
|
||||||
|
shift
|
||||||
|
continue
|
||||||
|
;;
|
||||||
|
'--china-mirrors')
|
||||||
|
CHINA_MAINLAND=true
|
||||||
|
shift
|
||||||
|
continue
|
||||||
|
;;
|
||||||
|
'-h'|'--help')
|
||||||
|
printf "Beszel Agent installation script\n\n"
|
||||||
|
printf "Usage: ./install-agent.sh [options]\n\n"
|
||||||
|
printf "Options: \n"
|
||||||
|
printf " -k : SSH key (required, or interactive if not provided)\n"
|
||||||
|
printf " -p : Port (default: $PORT)\n"
|
||||||
|
printf " -u : Uninstall Beszel Agent\n"
|
||||||
|
printf " --china-mirrors : Using GitHub mirror sources to resolve network timeout issues in mainland China\n"
|
||||||
|
printf " -h, --help : Display this help message\n"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
'--')
|
||||||
|
shift
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Invalid option: $1" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user