Comment Unnecessary Parts
This commit is contained in:
60
upgrade.sh
60
upgrade.sh
@ -26,27 +26,27 @@ for FILE in "${FILES[@]}"; do
|
|||||||
cp "$FILE" "$TEMP_DIR/$FILE"
|
cp "$FILE" "$TEMP_DIR/$FILE"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Checking and renaming old systemd service files"
|
# echo "Checking and renaming old systemd service files"
|
||||||
declare -A SERVICE_MAP=(
|
# declare -A SERVICE_MAP=(
|
||||||
["/etc/systemd/system/hysteria-bot.service"]="hysteria-telegram-bot.service"
|
# ["/etc/systemd/system/hysteria-bot.service"]="hysteria-telegram-bot.service"
|
||||||
["/etc/systemd/system/singbox.service"]="hysteria-singbox.service"
|
# ["/etc/systemd/system/singbox.service"]="hysteria-singbox.service"
|
||||||
["/etc/systemd/system/normalsub.service"]="hysteria-normal-sub.service"
|
# ["/etc/systemd/system/normalsub.service"]="hysteria-normal-sub.service"
|
||||||
)
|
# )
|
||||||
|
|
||||||
for OLD_SERVICE in "${!SERVICE_MAP[@]}"; do
|
# for OLD_SERVICE in "${!SERVICE_MAP[@]}"; do
|
||||||
NEW_SERVICE="/etc/systemd/system/${SERVICE_MAP[$OLD_SERVICE]}"
|
# NEW_SERVICE="/etc/systemd/system/${SERVICE_MAP[$OLD_SERVICE]}"
|
||||||
|
|
||||||
if [[ -f "$OLD_SERVICE" ]]; then
|
# if [[ -f "$OLD_SERVICE" ]]; then
|
||||||
echo "Stopping old service: $(basename "$OLD_SERVICE")"
|
# echo "Stopping old service: $(basename "$OLD_SERVICE")"
|
||||||
systemctl stop "$(basename "$OLD_SERVICE")" 2>/dev/null
|
# systemctl stop "$(basename "$OLD_SERVICE")" 2>/dev/null
|
||||||
|
|
||||||
echo "Renaming $OLD_SERVICE to $NEW_SERVICE"
|
# echo "Renaming $OLD_SERVICE to $NEW_SERVICE"
|
||||||
mv "$OLD_SERVICE" "$NEW_SERVICE"
|
# mv "$OLD_SERVICE" "$NEW_SERVICE"
|
||||||
|
|
||||||
echo "Reloading systemd daemon"
|
# echo "Reloading systemd daemon"
|
||||||
systemctl daemon-reload
|
# systemctl daemon-reload
|
||||||
fi
|
# fi
|
||||||
done
|
# done
|
||||||
|
|
||||||
echo "Removing /etc/hysteria directory"
|
echo "Removing /etc/hysteria directory"
|
||||||
rm -rf /etc/hysteria/
|
rm -rf /etc/hysteria/
|
||||||
@ -63,22 +63,22 @@ for FILE in "${FILES[@]}"; do
|
|||||||
cp "$TEMP_DIR/$FILE" "$FILE"
|
cp "$TEMP_DIR/$FILE" "$FILE"
|
||||||
done
|
done
|
||||||
|
|
||||||
CADDYFILE="/etc/hysteria/core/scripts/webpanel/Caddyfile"
|
# CADDYFILE="/etc/hysteria/core/scripts/webpanel/Caddyfile"
|
||||||
|
|
||||||
if [ -f "$CADDYFILE" ]; then
|
# if [ -f "$CADDYFILE" ]; then
|
||||||
echo "Updating Caddyfile port from 8080 to 28260"
|
# echo "Updating Caddyfile port from 8080 to 28260"
|
||||||
|
|
||||||
sed -i 's/\(:[[:space:]]*\)8080/\128260/g' "$CADDYFILE"
|
# sed -i 's/\(:[[:space:]]*\)8080/\128260/g' "$CADDYFILE"
|
||||||
sed -i 's/0\.0\.0\.0:8080/0.0.0.0:28260/g' "$CADDYFILE"
|
# sed -i 's/0\.0\.0\.0:8080/0.0.0.0:28260/g' "$CADDYFILE"
|
||||||
sed -i 's/127\.0\.0\.1:8080/127.0.0.1:28260/g' "$CADDYFILE"
|
# sed -i 's/127\.0\.0\.1:8080/127.0.0.1:28260/g' "$CADDYFILE"
|
||||||
|
|
||||||
|
|
||||||
if ! grep -q ':28260' "$CADDYFILE"; then
|
# if ! grep -q ':28260' "$CADDYFILE"; then
|
||||||
echo "Warning: Caddyfile does not contain port 8080 in expected formats. Port replacement may have already been done."
|
# echo "Warning: Caddyfile does not contain port 8080 in expected formats. Port replacement may have already been done."
|
||||||
fi
|
# fi
|
||||||
else
|
# else
|
||||||
echo "Error: Caddyfile not found at $CADDYFILE. Cannot update port."
|
# echo "Error: Caddyfile not found at $CADDYFILE. Cannot update port."
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
|
|
||||||
CONFIG_ENV="/etc/hysteria/.configs.env"
|
CONFIG_ENV="/etc/hysteria/.configs.env"
|
||||||
@ -155,7 +155,7 @@ systemctl restart hysteria-caddy.service
|
|||||||
echo "Restarting other hysteria services"
|
echo "Restarting other hysteria services"
|
||||||
systemctl restart hysteria-server.service
|
systemctl restart hysteria-server.service
|
||||||
systemctl restart hysteria-telegram-bot.service
|
systemctl restart hysteria-telegram-bot.service
|
||||||
systemctl restart hysteria-singbox.service
|
# systemctl restart hysteria-singbox.service
|
||||||
systemctl restart hysteria-normal-sub.service
|
systemctl restart hysteria-normal-sub.service
|
||||||
systemctl restart hysteria-webpanel.service
|
systemctl restart hysteria-webpanel.service
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user