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
|
#### Download Installation Script
|
||||||
|
|
||||||
```sh
|
```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
|
#### Run Installation Script
|
||||||
|
|
|
@ -13,7 +13,7 @@ apk add curl
|
||||||
#### 下载安装脚本
|
#### 下载安装脚本
|
||||||
|
|
||||||
```sh
|
```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
|
```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'
|
OPENRC='0'
|
||||||
if [ ! -f '/etc/init.d/xray' ]; then
|
if [ ! -f '/etc/init.d/xray' ]; then
|
||||||
mkdir "${TMP_DIRECTORY}init.d/"
|
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.'
|
echo 'error: Failed to start service file download! Please check your network or try again.'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
# https://github.com/XTLS/Xray-install
|
# https://github.com/XTLS/Xray-install
|
||||||
|
|
||||||
# The URL of the script is:
|
# 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:
|
# If the script executes incorrectly, go to:
|
||||||
# https://github.com/XTLS/Xray-install/issues
|
# https://github.com/XTLS/Xray-install/issues
|
||||||
|
@ -302,7 +302,7 @@ judgment_parameters() {
|
||||||
N_UP_SERVICE='1'
|
N_UP_SERVICE='1'
|
||||||
;;
|
;;
|
||||||
'--logrotate')
|
'--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."
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -317,13 +317,13 @@ judgment_parameters() {
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
if ((INSTALL+INSTALL_GEODATA+HELP+CHECK+REMOVE==0)); then
|
if ((INSTALL + INSTALL_GEODATA + HELP + CHECK + REMOVE == 0)); then
|
||||||
INSTALL='1'
|
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.'
|
echo 'You can only choose one action.'
|
||||||
return 1
|
return 1
|
||||||
fi
|
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."
|
echo "--version,--reinstall,--beta and --local can't be used together."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
@ -340,7 +340,7 @@ check_install_user() {
|
||||||
INSTALL_USER='nobody'
|
INSTALL_USER='nobody'
|
||||||
fi
|
fi
|
||||||
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"
|
echo "the user '$INSTALL_USER' is not effective"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -351,7 +351,7 @@ check_install_user() {
|
||||||
install_software() {
|
install_software() {
|
||||||
package_name="$1"
|
package_name="$1"
|
||||||
file_to_detect="$2"
|
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
|
if ${PACKAGE_MANAGEMENT_INSTALL} "$package_name" >/dev/null 2>&1; then
|
||||||
echo "info: $package_name is installed."
|
echo "info: $package_name is installed."
|
||||||
else
|
else
|
||||||
|
@ -495,7 +495,7 @@ install_xray() {
|
||||||
# shellcheck disable=SC2153
|
# shellcheck disable=SC2153
|
||||||
if [[ -z "$JSONS_PATH" ]] && [[ ! -d "$JSON_PATH" ]]; then
|
if [[ -z "$JSONS_PATH" ]] && [[ ! -d "$JSON_PATH" ]]; then
|
||||||
install -d "$JSON_PATH"
|
install -d "$JSON_PATH"
|
||||||
echo "{}" > "${JSON_PATH}/config.json"
|
echo "{}" >"${JSON_PATH}/config.json"
|
||||||
CONFIG_NEW='1'
|
CONFIG_NEW='1'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -503,7 +503,7 @@ install_xray() {
|
||||||
if [[ -n "$JSONS_PATH" ]] && [[ ! -d "$JSONS_PATH" ]]; then
|
if [[ -n "$JSONS_PATH" ]] && [[ ! -d "$JSONS_PATH" ]]; then
|
||||||
install -d "$JSONS_PATH"
|
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
|
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
|
done
|
||||||
CONFDIR='1'
|
CONFDIR='1'
|
||||||
fi
|
fi
|
||||||
|
@ -532,7 +532,7 @@ install_startup_service_file() {
|
||||||
temp_AmbientCapabilities="#${temp_AmbientCapabilities}"
|
temp_AmbientCapabilities="#${temp_AmbientCapabilities}"
|
||||||
temp_NoNewPrivileges="#${temp_NoNewPrivileges}"
|
temp_NoNewPrivileges="#${temp_NoNewPrivileges}"
|
||||||
fi
|
fi
|
||||||
cat > /etc/systemd/system/xray.service << EOF
|
cat >/etc/systemd/system/xray.service <<EOF
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Xray Service
|
Description=Xray Service
|
||||||
Documentation=https://github.com/xtls
|
Documentation=https://github.com/xtls
|
||||||
|
@ -552,7 +552,7 @@ LimitNOFILE=1000000
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
cat > /etc/systemd/system/xray@.service <<EOF
|
cat >/etc/systemd/system/xray@.service <<EOF
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Xray Service
|
Description=Xray Service
|
||||||
Documentation=https://github.com/xtls
|
Documentation=https://github.com/xtls
|
||||||
|
@ -645,7 +645,7 @@ install_with_logrotate() {
|
||||||
if [[ -z "$LOGROTATE_TIME" ]]; then
|
if [[ -z "$LOGROTATE_TIME" ]]; then
|
||||||
LOGROTATE_TIME="00:00:00"
|
LOGROTATE_TIME="00:00:00"
|
||||||
fi
|
fi
|
||||||
cat <<EOF > /etc/systemd/system/logrotate@.service
|
cat <<EOF >/etc/systemd/system/logrotate@.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Rotate log files
|
Description=Rotate log files
|
||||||
Documentation=man:logrotate(8)
|
Documentation=man:logrotate(8)
|
||||||
|
@ -654,7 +654,7 @@ Documentation=man:logrotate(8)
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart=/usr/sbin/logrotate /etc/logrotate.d/%i
|
ExecStart=/usr/sbin/logrotate /etc/logrotate.d/%i
|
||||||
EOF
|
EOF
|
||||||
cat <<EOF > /etc/systemd/system/logrotate@.timer
|
cat <<EOF >/etc/systemd/system/logrotate@.timer
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Run logrotate for %i logs
|
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/
|
install -d -m 700 -o "$INSTALL_USER_UID" -g "$INSTALL_USER_GID" /etc/logrotate.d/
|
||||||
LOGROTATE_DIR='1'
|
LOGROTATE_DIR='1'
|
||||||
fi
|
fi
|
||||||
cat << EOF > /etc/logrotate.d/xray
|
cat <<EOF >/etc/logrotate.d/xray
|
||||||
/var/log/xray/*.log {
|
/var/log/xray/*.log {
|
||||||
daily
|
daily
|
||||||
missingok
|
missingok
|
||||||
|
@ -711,7 +711,7 @@ install_geodata() {
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
cd - > /dev/null || exit 1
|
cd - >/dev/null || exit 1
|
||||||
install -d "$DAT_PATH"
|
install -d "$DAT_PATH"
|
||||||
install -m 644 "${dir_tmp}"/${file_dlc} "${DAT_PATH}"/${file_site}
|
install -m 644 "${dir_tmp}"/${file_dlc} "${DAT_PATH}"/${file_site}
|
||||||
install -m 644 "${dir_tmp}"/${file_ip} "${DAT_PATH}"/${file_ip}
|
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')
|
[[ -f '/etc/systemd/system/logrotate@.timer' ]] && delete_files+=('/etc/systemd/system/logrotate@.timer')
|
||||||
fi
|
fi
|
||||||
systemctl disable xray
|
systemctl disable xray
|
||||||
if [[ -f '/etc/systemd/system/logrotate@.timer' ]] ; then
|
if [[ -f '/etc/systemd/system/logrotate@.timer' ]]; then
|
||||||
if ! systemctl stop logrotate@xray.timer && systemctl disable logrotate@xray.timer ; then
|
if ! systemctl stop logrotate@xray.timer && systemctl disable logrotate@xray.timer; then
|
||||||
echo 'error: Stopping and disabling the logrotate service failed.'
|
echo 'error: Stopping and disabling the logrotate service failed.'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -762,8 +762,7 @@ remove_xray() {
|
||||||
echo 'error: Failed to remove Xray.'
|
echo 'error: Failed to remove Xray.'
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
for i in "${!delete_files[@]}"
|
for i in "${!delete_files[@]}"; do
|
||||||
do
|
|
||||||
echo "removed: ${delete_files[$i]}"
|
echo "removed: ${delete_files[$i]}"
|
||||||
done
|
done
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
|
|
Loading…
Reference in New Issue