feat: Implement PR feedback for Upgopher script

- Update Debian version from 12 to 13
- Replace manual download/extraction with fetch_and_deploy_gh_release function
- Remove redundant curl/wget installation (already in core dependencies)
- Remove unnecessary comments
- Add apt clean -y to cleanup section
- Modernize apt-get commands to apt
- Update success message to 'Updated successfully!'
- Fix asset pattern to match release files (upgopher_*_linux_amd64.tar.gz)
This commit is contained in:
wanetty 2025-11-01 09:13:58 +01:00
parent bc3c833038
commit 88795c5722
3 changed files with 11 additions and 27 deletions

View File

@ -11,7 +11,7 @@ var_cpu="${var_cpu:-1}"
var_ram="${var_ram:-512}" var_ram="${var_ram:-512}"
var_disk="${var_disk:-4}" var_disk="${var_disk:-4}"
var_os="${var_os:-debian}" var_os="${var_os:-debian}"
var_version="${var_version:-12}" var_version="${var_version:-13}"
var_unprivileged="${var_unprivileged:-1}" var_unprivileged="${var_unprivileged:-1}"
header_info "$APP" header_info "$APP"
@ -33,18 +33,13 @@ function update_script() {
systemctl stop upgopher systemctl stop upgopher
msg_ok "Stopped Services" msg_ok "Stopped Services"
cd /opt/upgopher fetch_and_deploy_gh_release "upgopher" "wanetty/upgopher" "prebuild" "latest" "/opt/upgopher" "upgopher_*_linux_amd64.tar.gz"
RELEASE_URL=$(curl -s https://api.github.com/repos/wanetty/upgopher/releases/latest | grep "browser_download_url.*linux_amd64.tar.gz" | cut -d '"' -f 4) chmod +x /opt/upgopher/upgopher
wget -q "$RELEASE_URL"
tar -xzf upgopher_*_linux_amd64.tar.gz
mv upgopher_*_linux_amd64/* .
rmdir upgopher_*_linux_amd64
rm -f upgopher_*_linux_amd64.tar.gz
chmod +x upgopher
msg_info "Starting Services" msg_info "Starting Services"
systemctl start upgopher systemctl start upgopher
msg_ok "Started Services" msg_ok "Started Services"
msg_ok "Updated Successfully" msg_ok "Updated successfully!"
fi fi
exit exit
} }

View File

@ -23,7 +23,7 @@
"ram": 512, "ram": 512,
"hdd": 4, "hdd": 4,
"os": "Debian", "os": "Debian",
"version": "12" "version": "13"
} }
} }
], ],

View File

@ -13,25 +13,13 @@ setting_up_container
network_check network_check
update_os update_os
msg_info "Installing Dependencies"
$STD apt-get install -y curl wget
msg_ok "Installed Dependencies"
msg_info "Installing Upgopher" msg_info "Installing Upgopher"
mkdir -p /opt/upgopher mkdir -p /opt/upgopher
cd /opt/upgopher fetch_and_deploy_gh_release "upgopher" "wanetty/upgopher" "prebuild" "latest" "/opt/upgopher" "upgopher_*_linux_amd64.tar.gz"
RELEASE_URL=$(curl -s https://api.github.com/repos/wanetty/upgopher/releases/latest | grep "browser_download_url.*linux_amd64.tar.gz" | cut -d '"' -f 4) chmod +x /opt/upgopher/upgopher
wget -q "$RELEASE_URL"
tar -xzf upgopher_*_linux_amd64.tar.gz
mv upgopher_*_linux_amd64/* .
rmdir upgopher_*_linux_amd64
rm -f upgopher_*_linux_amd64.tar.gz
chmod +x upgopher
msg_ok "Installed Upgopher" msg_ok "Installed Upgopher"
msg_info "Configuring Upgopher" msg_info "Configuring Upgopher"
# Use default configuration (no authentication, HTTP, default port/directory)
# Users can modify /etc/systemd/system/upgopher.service after installation to enable features
UPGOPHER_PORT="9090" UPGOPHER_PORT="9090"
UPGOPHER_DIR="/opt/upgopher/uploads" UPGOPHER_DIR="/opt/upgopher/uploads"
mkdir -p "$UPGOPHER_DIR" mkdir -p "$UPGOPHER_DIR"
@ -62,6 +50,7 @@ motd_ssh
customize customize
msg_info "Cleaning up" msg_info "Cleaning up"
$STD apt-get -y autoremove $STD apt -y autoremove
$STD apt-get -y autoclean $STD apt -y autoclean
$STD apt clean -y
msg_ok "Cleaned" msg_ok "Cleaned"