From 721f11379f45a7c3a1a53e346a73bc25ac92210f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20B=C3=A9dard-Couture?= Date: Thu, 13 Jun 2024 22:04:46 -0400 Subject: [PATCH] Fix update script and incorporate other feedback from tteck --- ct/peanut.sh | 13 +++++++------ install/peanut-install.sh | 7 +++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ct/peanut.sh b/ct/peanut.sh index 6759e2ad..858df141 100644 --- a/ct/peanut.sh +++ b/ct/peanut.sh @@ -57,16 +57,18 @@ function update_script() { header_info if [[ ! -f /etc/systemd/system/peanut.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi RELEASE=$(curl -sL https://api.github.com/repos/Brandawg93/PeaNUT/releases/latest | grep '"tag_name":' | cut -d'"' -f4) - if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then + if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then msg_info "Updating $APP LXC" systemctl stop peanut - RELEASE_URL=$(curl -s https://api.github.com/repos/Brandawg93/PeaNUT/releases/latest | grep "tarball_url" | awk '{print substr($2, 2, length($2)-3)}') - wget -qO peanut.tar.gz $RELEASE_URL + wget -qO peanut.tar.gz https://api.github.com/repos/Brandawg93/PeaNUT/tarball/${RELEASE} tar -xzf peanut.tar.gz -C /opt/peanut --strip-components 1 rm peanut.tar.gz + cd /opt/peanut + pnpm i &>/dev/null + pnpm run build &>/dev/null systemctl start peanut echo "${RELEASE}" >/opt/${APP}_version.txt - msg_ok "Updated $APP LXC" + msg_ok "Updated $APP to ${RELEASE}" else msg_ok "No update required. ${APP} is already at ${RELEASE}" fi @@ -83,5 +85,4 @@ pct set $CTID -cores 1 msg_ok "Set Container to Normal Resources" msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. - ${BL}http://${IP}:3000${CL} \n - ${YW}Don't forget to update the NUT configuration!${CL} \n" + ${BL}http://${IP}:3000${CL} \n" diff --git a/install/peanut-install.sh b/install/peanut-install.sh index 53414929..f32e764f 100644 --- a/install/peanut-install.sh +++ b/install/peanut-install.sh @@ -18,7 +18,6 @@ msg_info "Installing Dependencies" $STD apt-get install -y curl $STD apt-get install -y sudo $STD apt-get install -y mc -$STD apt-get install -y wget $STD apt-get install -y gpg msg_ok "Installed Dependencies" @@ -35,15 +34,15 @@ $STD apt-get install -y nut-client msg_ok "Installed NUT" msg_info "Installing Peanut" -RELEASE_URL=$(curl -s https://api.github.com/repos/Brandawg93/PeaNUT/releases/latest | grep "tarball_url" | awk '{print substr($2, 2, length($2)-3)}') -wget -qO peanut.tar.gz $RELEASE_URL +RELEASE=$(curl -sL https://api.github.com/repos/Brandawg93/PeaNUT/releases/latest | grep '"tag_name":' | cut -d'"' -f4) +wget -qO peanut.tar.gz https://api.github.com/repos/Brandawg93/PeaNUT/tarball/${RELEASE} mkdir -p /opt/peanut tar -xzf peanut.tar.gz -C /opt/peanut --strip-components 1 rm peanut.tar.gz cd /opt/peanut $STD npm install -g pnpm $STD pnpm i -$STD npm run build +$STD pnpm run build cp -r .next/static .next/standalone/.next/ msg_ok "Installed Peanut"