Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions alpinelinux/install-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ is_it_running() {

install_xray() {
install -m 755 "${TMP_DIRECTORY}xray" "/usr/local/bin/xray"
install -d /usr/local/share/xray/
install -m 644 "${TMP_DIRECTORY}geoip.dat" "/usr/local/share/xray/geoip.dat"
install -m 644 "${TMP_DIRECTORY}geosite.dat" "/usr/local/share/xray/geosite.dat"
install -d -m 755 -o nobody -g nobody /usr/local/share/xray/
install -m 644 -o nobody -g nobody "${TMP_DIRECTORY}geoip.dat" "/usr/local/share/xray/geoip.dat"
install -m 644 -o nobody -g nobody "${TMP_DIRECTORY}geosite.dat" "/usr/local/share/xray/geosite.dat"
}

install_confdir() {
Expand Down
19 changes: 13 additions & 6 deletions install-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -475,16 +475,20 @@ install_file() {
if [[ "$NAME" == 'xray' ]]; then
install -m 755 "${TMP_DIRECTORY}/$NAME" "/usr/local/bin/$NAME"
elif [[ "$NAME" == 'geoip.dat' ]] || [[ "$NAME" == 'geosite.dat' ]]; then
install -m 644 "${TMP_DIRECTORY}/$NAME" "${DAT_PATH}/$NAME"
install -m 644 -o "$INSTALL_USER_UID" -g "$INSTALL_USER_GID" "${TMP_DIRECTORY}/$NAME" "${DAT_PATH}/$NAME"
fi
}

install_geodata_dir() {
install -d -m 755 -o "$INSTALL_USER_UID" -g "$INSTALL_USER_GID" "$DAT_PATH"
}

install_xray() {
# Install Xray binary to /usr/local/bin/ and $DAT_PATH
install_file xray
# If the file exists, geoip.dat and geosite.dat will not be installed or updated
if [[ "$NO_GEODATA" -eq '0' ]] && [[ ! -f "${DAT_PATH}/.undat" ]]; then
install -d "$DAT_PATH"
install_geodata_dir
install_file geoip.dat
install_file geosite.dat
GEODATA='1'
Expand Down Expand Up @@ -718,9 +722,9 @@ install_geodata() {
fi
done
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}
install_geodata_dir
install -m 644 -o "$INSTALL_USER_UID" -g "$INSTALL_USER_GID" "${dir_tmp}"/${file_dlc} "${DAT_PATH}"/${file_site}
install -m 644 -o "$INSTALL_USER_UID" -g "$INSTALL_USER_GID" "${dir_tmp}"/${file_ip} "${DAT_PATH}"/${file_ip}
rm -r "${dir_tmp}"
exit 0
}
Expand Down Expand Up @@ -840,7 +844,10 @@ main() {
[[ "$HELP" -eq '1' ]] && show_help
[[ "$CHECK" -eq '1' ]] && check_update
[[ "$REMOVE" -eq '1' ]] && remove_xray
[[ "$INSTALL_GEODATA" -eq '1' ]] && install_geodata
[[ "$INSTALL_GEODATA" -eq '1' ]] && {
check_install_user
install_geodata
}

# Check if the user is effective
check_install_user
Expand Down