Fetches IPs
This commit is contained in:
21
upgrade.sh
21
upgrade.sh
@ -35,13 +35,28 @@ for FILE in "${FILES[@]}"; do
|
|||||||
cp "$TEMP_DIR/$FILE" "$FILE"
|
cp "$TEMP_DIR/$FILE" "$FILE"
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ ! -f /etc/hysteria/.configs.env ]; then
|
CONFIG_ENV="/etc/hysteria/.configs.env"
|
||||||
echo ".configs.env not found, creating it with default SNI=bts.com"
|
if [ ! -f "$CONFIG_ENV" ]; then
|
||||||
echo "SNI=bts.com" > /etc/hysteria/.configs.env
|
echo ".configs.env not found, creating it with default SNI=bts.com and IPs."
|
||||||
|
echo "SNI=bts.com" > "$CONFIG_ENV"
|
||||||
else
|
else
|
||||||
echo ".configs.env already exists."
|
echo ".configs.env already exists."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
export $(grep -v '^#' "$CONFIG_ENV" | xargs 2>/dev/null)
|
||||||
|
|
||||||
|
if [[ -z "$IP4" ]]; then
|
||||||
|
echo "IP4 not found, fetching from ip.gs..."
|
||||||
|
IP4=$(curl -s -4 ip.gs || echo "")
|
||||||
|
echo "IP4=${IP4:-}" >> "$CONFIG_ENV"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "$IP6" ]]; then
|
||||||
|
echo "IP6 not found, fetching from ip.gs..."
|
||||||
|
IP6=$(curl -s -6 ip.gs || echo "")
|
||||||
|
echo "IP6=${IP6:-}" >> "$CONFIG_ENV"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Setting ownership and permissions"
|
echo "Setting ownership and permissions"
|
||||||
chown hysteria:hysteria /etc/hysteria/ca.key /etc/hysteria/ca.crt
|
chown hysteria:hysteria /etc/hysteria/ca.key /etc/hysteria/ca.crt
|
||||||
chmod 640 /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