Add SUBPATH to normalsub.env if missing
This commit is contained in:
18
upgrade.sh
18
upgrade.sh
@ -52,7 +52,7 @@ echo "Removing /etc/hysteria directory"
|
||||
rm -rf /etc/hysteria/
|
||||
|
||||
echo "Cloning Hysteria2 repository"
|
||||
git clone https://github.com/ReturnFI/Hysteria2 /etc/hysteria
|
||||
git clone -b beta https://github.com/ReturnFI/Hysteria2 /etc/hysteria
|
||||
|
||||
echo "Downloading geosite.dat and geoip.dat"
|
||||
wget -O /etc/hysteria/geosite.dat https://raw.githubusercontent.com/Chocolate4U/Iran-v2ray-rules/release/geosite.dat >/dev/null 2>&1
|
||||
@ -101,6 +101,22 @@ if [[ -z "$IP6" ]]; then
|
||||
echo "IP6=${IP6:-}" >> "$CONFIG_ENV"
|
||||
fi
|
||||
|
||||
NORMALSUB_ENV="/etc/hysteria/core/scripts/normalsub/.env"
|
||||
|
||||
if [[ -f "$NORMALSUB_ENV" ]]; then
|
||||
echo "Checking if SUBPATH exists in $NORMALSUB_ENV..."
|
||||
|
||||
if ! grep -q '^SUBPATH=' "$NORMALSUB_ENV"; then
|
||||
echo "SUBPATH not found, generating a new one..."
|
||||
SUBPATH=$(pwgen -s 32 1)
|
||||
echo -e "\nSUBPATH=$SUBPATH" >> "$NORMALSUB_ENV"
|
||||
else
|
||||
echo "SUBPATH already exists, no changes made."
|
||||
fi
|
||||
else
|
||||
echo "$NORMALSUB_ENV not found. Skipping SUBPATH check."
|
||||
fi
|
||||
|
||||
echo "Setting ownership and permissions"
|
||||
chown hysteria:hysteria /etc/hysteria/ca.key /etc/hysteria/ca.crt
|
||||
chmod 640 /etc/hysteria/ca.key /etc/hysteria/ca.crt
|
||||
|
||||
Reference in New Issue
Block a user