mirror of https://github.com/XTLS/Xray-install
Alpine Linux: Replace raw.githubusercontent.com with github.com/xxx/raw (#89)
parent
3292b9eeae
commit
0529a022f9
|
@ -13,7 +13,7 @@ apk add curl
|
|||
#### Download Installation Script
|
||||
|
||||
```sh
|
||||
curl -O https://raw.githubusercontent.com/XTLS/Xray-install/main/alpinelinux/install-release.sh
|
||||
curl -O https://github.com/XTLS/Xray-install/raw/main/alpinelinux/install-release.sh
|
||||
```
|
||||
|
||||
#### Run Installation Script
|
||||
|
|
|
@ -13,7 +13,7 @@ apk add curl
|
|||
#### 下载安装脚本
|
||||
|
||||
```sh
|
||||
curl -O https://raw.githubusercontent.com/XTLS/Xray-install/main/alpinelinux/install-release.sh
|
||||
curl -O https://github.com/XTLS/Xray-install/raw/main/alpinelinux/install-release.sh
|
||||
```
|
||||
|
||||
#### 运行安装脚本
|
||||
|
|
|
@ -13,7 +13,7 @@ apk add curl
|
|||
#### 下載安裝腳本
|
||||
|
||||
```sh
|
||||
curl -O https://raw.githubusercontent.com/XTLS/Xray-install/main/alpinelinux/install-release.sh
|
||||
curl -O https://github.com/XTLS/Xray-install/raw/main/alpinelinux/install-release.sh
|
||||
```
|
||||
|
||||
#### 執行安裝腳本
|
||||
|
|
|
@ -165,7 +165,7 @@ install_startup_service_file() {
|
|||
OPENRC='0'
|
||||
if [ ! -f '/etc/init.d/xray' ]; then
|
||||
mkdir "${TMP_DIRECTORY}init.d/"
|
||||
if ! curl -f -L -o "${TMP_DIRECTORY}init.d/xray" https://raw.githubusercontent.com/XTLS/Xray-install/main/alpinelinux/init.d/xray -sS; then
|
||||
if ! curl -f -L -o "${TMP_DIRECTORY}init.d/xray" https://github.com/XTLS/Xray-install/raw/main/alpinelinux/init.d/xray -sS; then
|
||||
echo 'error: Failed to start service file download! Please check your network or try again.'
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
# https://github.com/XTLS/Xray-install
|
||||
|
||||
# The URL of the script is:
|
||||
# https://raw.githubusercontent.com/XTLS/Xray-install/main/install-release.sh
|
||||
# https://github.com/XTLS/Xray-install/raw/main/install-release.sh
|
||||
|
||||
# If the script executes incorrectly, go to:
|
||||
# https://github.com/XTLS/Xray-install/issues
|
||||
|
@ -302,7 +302,7 @@ judgment_parameters() {
|
|||
N_UP_SERVICE='1'
|
||||
;;
|
||||
'--logrotate')
|
||||
if ! grep -qE '\b([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]\b' <<< "$2";then
|
||||
if ! grep -qE '\b([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]\b' <<<"$2"; then
|
||||
echo "error: Wrong format of time, it should be in the format of 12:34:56, under 10:00:00 should be start with 0, e.g. 01:23:45."
|
||||
exit 1
|
||||
fi
|
||||
|
@ -317,13 +317,13 @@ judgment_parameters() {
|
|||
esac
|
||||
shift
|
||||
done
|
||||
if ((INSTALL+INSTALL_GEODATA+HELP+CHECK+REMOVE==0)); then
|
||||
if ((INSTALL + INSTALL_GEODATA + HELP + CHECK + REMOVE == 0)); then
|
||||
INSTALL='1'
|
||||
elif ((INSTALL+INSTALL_GEODATA+HELP+CHECK+REMOVE>1)); then
|
||||
elif ((INSTALL + INSTALL_GEODATA + HELP + CHECK + REMOVE > 1)); then
|
||||
echo 'You can only choose one action.'
|
||||
return 1
|
||||
fi
|
||||
if [[ "$INSTALL" -eq '1' ]] && ((temp_version+local_install+REINSTALL+BETA>1)); then
|
||||
if [[ "$INSTALL" -eq '1' ]] && ((temp_version + local_install + REINSTALL + BETA > 1)); then
|
||||
echo "--version,--reinstall,--beta and --local can't be used together."
|
||||
return 1
|
||||
fi
|
||||
|
@ -340,7 +340,7 @@ check_install_user() {
|
|||
INSTALL_USER='nobody'
|
||||
fi
|
||||
fi
|
||||
if ! id "$INSTALL_USER" > /dev/null 2>&1; then
|
||||
if ! id "$INSTALL_USER" >/dev/null 2>&1; then
|
||||
echo "the user '$INSTALL_USER' is not effective"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -351,7 +351,7 @@ check_install_user() {
|
|||
install_software() {
|
||||
package_name="$1"
|
||||
file_to_detect="$2"
|
||||
type -P "$file_to_detect" > /dev/null 2>&1 && return
|
||||
type -P "$file_to_detect" >/dev/null 2>&1 && return
|
||||
if ${PACKAGE_MANAGEMENT_INSTALL} "$package_name" >/dev/null 2>&1; then
|
||||
echo "info: $package_name is installed."
|
||||
else
|
||||
|
@ -495,7 +495,7 @@ install_xray() {
|
|||
# shellcheck disable=SC2153
|
||||
if [[ -z "$JSONS_PATH" ]] && [[ ! -d "$JSON_PATH" ]]; then
|
||||
install -d "$JSON_PATH"
|
||||
echo "{}" > "${JSON_PATH}/config.json"
|
||||
echo "{}" >"${JSON_PATH}/config.json"
|
||||
CONFIG_NEW='1'
|
||||
fi
|
||||
|
||||
|
@ -503,7 +503,7 @@ install_xray() {
|
|||
if [[ -n "$JSONS_PATH" ]] && [[ ! -d "$JSONS_PATH" ]]; then
|
||||
install -d "$JSONS_PATH"
|
||||
for BASE in 00_log 01_api 02_dns 03_routing 04_policy 05_inbounds 06_outbounds 07_transport 08_stats 09_reverse; do
|
||||
echo '{}' > "${JSONS_PATH}/${BASE}.json"
|
||||
echo '{}' >"${JSONS_PATH}/${BASE}.json"
|
||||
done
|
||||
CONFDIR='1'
|
||||
fi
|
||||
|
@ -532,7 +532,7 @@ install_startup_service_file() {
|
|||
temp_AmbientCapabilities="#${temp_AmbientCapabilities}"
|
||||
temp_NoNewPrivileges="#${temp_NoNewPrivileges}"
|
||||
fi
|
||||
cat > /etc/systemd/system/xray.service << EOF
|
||||
cat >/etc/systemd/system/xray.service <<EOF
|
||||
[Unit]
|
||||
Description=Xray Service
|
||||
Documentation=https://github.com/xtls
|
||||
|
@ -552,7 +552,7 @@ LimitNOFILE=1000000
|
|||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
cat > /etc/systemd/system/xray@.service <<EOF
|
||||
cat >/etc/systemd/system/xray@.service <<EOF
|
||||
[Unit]
|
||||
Description=Xray Service
|
||||
Documentation=https://github.com/xtls
|
||||
|
@ -645,7 +645,7 @@ install_with_logrotate() {
|
|||
if [[ -z "$LOGROTATE_TIME" ]]; then
|
||||
LOGROTATE_TIME="00:00:00"
|
||||
fi
|
||||
cat <<EOF > /etc/systemd/system/logrotate@.service
|
||||
cat <<EOF >/etc/systemd/system/logrotate@.service
|
||||
[Unit]
|
||||
Description=Rotate log files
|
||||
Documentation=man:logrotate(8)
|
||||
|
@ -654,7 +654,7 @@ Documentation=man:logrotate(8)
|
|||
Type=oneshot
|
||||
ExecStart=/usr/sbin/logrotate /etc/logrotate.d/%i
|
||||
EOF
|
||||
cat <<EOF > /etc/systemd/system/logrotate@.timer
|
||||
cat <<EOF >/etc/systemd/system/logrotate@.timer
|
||||
[Unit]
|
||||
Description=Run logrotate for %i logs
|
||||
|
||||
|
@ -669,7 +669,7 @@ EOF
|
|||
install -d -m 700 -o "$INSTALL_USER_UID" -g "$INSTALL_USER_GID" /etc/logrotate.d/
|
||||
LOGROTATE_DIR='1'
|
||||
fi
|
||||
cat << EOF > /etc/logrotate.d/xray
|
||||
cat <<EOF >/etc/logrotate.d/xray
|
||||
/var/log/xray/*.log {
|
||||
daily
|
||||
missingok
|
||||
|
@ -711,7 +711,7 @@ install_geodata() {
|
|||
exit 1
|
||||
fi
|
||||
done
|
||||
cd - > /dev/null || exit 1
|
||||
cd - >/dev/null || exit 1
|
||||
install -d "$DAT_PATH"
|
||||
install -m 644 "${dir_tmp}"/${file_dlc} "${DAT_PATH}"/${file_site}
|
||||
install -m 644 "${dir_tmp}"/${file_ip} "${DAT_PATH}"/${file_ip}
|
||||
|
@ -751,8 +751,8 @@ remove_xray() {
|
|||
[[ -f '/etc/systemd/system/logrotate@.timer' ]] && delete_files+=('/etc/systemd/system/logrotate@.timer')
|
||||
fi
|
||||
systemctl disable xray
|
||||
if [[ -f '/etc/systemd/system/logrotate@.timer' ]] ; then
|
||||
if ! systemctl stop logrotate@xray.timer && systemctl disable logrotate@xray.timer ; then
|
||||
if [[ -f '/etc/systemd/system/logrotate@.timer' ]]; then
|
||||
if ! systemctl stop logrotate@xray.timer && systemctl disable logrotate@xray.timer; then
|
||||
echo 'error: Stopping and disabling the logrotate service failed.'
|
||||
exit 1
|
||||
fi
|
||||
|
@ -762,8 +762,7 @@ remove_xray() {
|
|||
echo 'error: Failed to remove Xray.'
|
||||
exit 1
|
||||
else
|
||||
for i in "${!delete_files[@]}"
|
||||
do
|
||||
for i in "${!delete_files[@]}"; do
|
||||
echo "removed: ${delete_files[$i]}"
|
||||
done
|
||||
systemctl daemon-reload
|
||||
|
|
Loading…
Reference in New Issue