This commit is contained in:
Slaviša Arežina 2025-07-05 18:15:37 +02:00 committed by GitHub
parent 115b21f729
commit cb7d58b9b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 42 additions and 48 deletions

View File

@ -23,39 +23,39 @@ function update_script() {
header_info header_info
check_container_storage check_container_storage
check_container_resources check_container_resources
if [[ ! -d /opt/bytestash ]]; then if [[ ! -d /opt/bytestash ]]; then
msg_error "No ${APP} Installation Found!" msg_error "No ${APP} Installation Found!"
exit exit
fi fi
RELEASE=$(curl -fsSL https://api.github.com/repos/jordan-dalby/ByteStash/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') RELEASE=$(curl -fsSL https://api.github.com/repos/jordan-dalby/ByteStash/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then if [[ "${RELEASE}" != "$(cat ~/.bytestash 2>/dev/null)" ]] || [[ ! -f ~/.bytestash ]]; then
read -rp "${TAB3}Did you make a backup via application WebUI? (y/n): " backuped
if [[ "$backuped" =~ ^[Yy]$ ]]; then
msg_info "Stopping Services" msg_info "Stopping Services"
systemctl stop bytestash-backend systemctl stop bytestash-backend
systemctl stop bytestash-frontend systemctl stop bytestash-frontend
msg_ok "Services Stopped" msg_ok "Services Stopped"
msg_info "Updating ${APP} to ${RELEASE}" rm -rf /opt/bytestash
temp_file=$(mktemp) fetch_and_deploy_gh_release "bytestash" "jordan-dalby/ByteStash"
curl -fsSL "https://github.com/jordan-dalby/ByteStash/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file"
tar zxf $temp_file msg_info "Configuring ByteStash"
rm -rf /opt/bytestash/server/node_modules
rm -rf /opt/bytestash/client/node_modules
cp -rf ByteStash-${RELEASE}/* /opt/bytestash
cd /opt/bytestash/server cd /opt/bytestash/server
$STD npm install $STD npm install
cd /opt/bytestash/client cd /opt/bytestash/client
$STD npm install $STD npm install
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated ${APP}" msg_ok "Updated ${APP}"
msg_info "Starting Services" msg_info "Starting Services"
systemctl start bytestash-backend systemctl start bytestash-backend
systemctl start bytestash-frontend systemctl start bytestash-frontend
msg_ok "Started Services" msg_ok "Started Services"
else
msg_info "Cleaning Up" msg_error "PLEASE MAKE A BACKUP FIRST!"
rm -f $temp_file exit
msg_ok "Cleaned" fi
msg_ok "Updated Successfully" msg_ok "Updated Successfully"
else else
msg_ok "No update required. ${APP} is already at ${RELEASE}" msg_ok "No update required. ${APP} is already at ${RELEASE}"

View File

@ -14,22 +14,17 @@ network_check
update_os update_os
NODE_VERSION="22" setup_nodejs NODE_VERSION="22" setup_nodejs
fetch_and_deploy_gh_release "bytestash" "jordan-dalby/ByteStash"
msg_info "Installing ByteStash" msg_info "Installing ByteStash"
JWT_SECRET=$(openssl rand -base64 32 | tr -d '/+=') JWT_SECRET=$(openssl rand -base64 32 | tr -d '/+=')
temp_file=$(mktemp)
RELEASE=$(curl -fsSL https://api.github.com/repos/jordan-dalby/ByteStash/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
curl -fsSL "https://github.com/jordan-dalby/ByteStash/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file"
tar zxf $temp_file
mv ByteStash-${RELEASE} /opt/bytestash
cd /opt/bytestash/server cd /opt/bytestash/server
$STD npm install $STD npm install
cd /opt/bytestash/client cd /opt/bytestash/client
$STD npm install $STD npm install
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
msg_ok "Installed ByteStash" msg_ok "Installed ByteStash"
read -p "${TAB3}Do you want to allow registration of multiple accounts? [y/n]: " allowreg read -rp "${TAB3}Do you want to allow registration of multiple accounts? [y/n]: " allowreg
msg_info "Creating Service" msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/bytestash-backend.service cat <<EOF >/etc/systemd/system/bytestash-backend.service
@ -73,7 +68,6 @@ motd_ssh
customize customize
msg_info "Cleaning up" msg_info "Cleaning up"
rm -f $temp_file
$STD apt-get -y autoremove $STD apt-get -y autoremove
$STD apt-get -y autoclean $STD apt-get -y autoclean
msg_ok "Cleaned" msg_ok "Cleaned"