Compare commits

...

2 Commits

Author SHA1 Message Date
tteckster 67cad1583b
Update dashy-install.sh
tweak
2024-04-21 23:13:45 -04:00
tteckster 1fb93b326f
Update dashy.sh
Update `function update_script()`
2024-04-21 23:11:42 -04:00
2 changed files with 45 additions and 33 deletions

View File

@ -55,38 +55,49 @@ function default_settings() {
function update_script() { function update_script() {
header_info header_info
if [[ ! -d /opt/dashy/public/ ]]; then msg_error "No ${APP} Installation Found!"; exit; fi if [[ ! -d /opt/dashy/public/ ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
msg_error "There is currently no update path available."
exit RELEASE=$(curl -sL https://api.github.com/repos/Lissy93/dashy/releases/latest | grep '"tag_name":' | cut -d'"' -f4)
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
msg_info "Stopping ${APP}" msg_info "Stopping ${APP}"
systemctl stop dashy systemctl stop dashy
msg_ok "Stopped ${APP}" msg_ok "Stopped ${APP}"
msg_info "Backing up conf.yml" msg_info "Backing up conf.yml"
cd ~ cd ~
if [[ -f /opt/dashy/public/conf.yml ]]; then
cp -R /opt/dashy/public/conf.yml conf.yml cp -R /opt/dashy/public/conf.yml conf.yml
else
cp -R /opt/dashy/user-data/conf.yml conf.yml
fi
msg_ok "Backed up conf.yml" msg_ok "Backed up conf.yml"
msg_info "Updating Dashy" msg_info "Updating ${APP} to ${RELEASE}"
rm -rf /opt/dashy
mkdir -p /opt/dashy
wget -qO- https://github.com/Lissy93/dashy/archive/refs/tags/${RELEASE}.tar.gz | tar -xz -C /opt/dashy --strip-components=1
sed -i 's/NODE_OPTIONS=--openssl-legacy-provider vue-cli-service build/NODE_OPTIONS=yarn vue-cli-service build/' /opt/dashy/package.json
cd /opt/dashy cd /opt/dashy
git merge &>/dev/null
git pull origin master &>/dev/null
yarn &>/dev/null yarn &>/dev/null
yarn build &>/dev/null yarn build &>/dev/null
msg_ok "Updated Dashy" echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated ${APP} to ${RELEASE}"
msg_info "Restoring conf.yml" msg_info "Restoring conf.yml"
cd ~ cd ~
cp -R conf.yml /opt/dashy/public cp -R conf.yml /opt/dashy/user-data
msg_ok "Restored conf.yml" msg_ok "Restored conf.yml"
msg_info "Cleaning" msg_info "Cleaning"
rm -rf conf.yml rm -rf conf.yml /opt/dashy/public/conf.yml
msg_ok "Cleaned" msg_ok "Cleaned"
msg_info "Starting Dashy" msg_info "Starting Dashy"
systemctl start dashy systemctl start dashy
msg_ok "Started Dashy" msg_ok "Started Dashy"
msg_ok "Updated Successfully" msg_ok "Updated Successfully"
else
msg_ok "No update required. ${APP} is already at ${RELEASE}"
fi
exit exit
} }

View File

@ -29,19 +29,20 @@ ln -sf /usr/local/bin/node /usr/bin/node
msg_ok "Installed Node.js" msg_ok "Installed Node.js"
msg_info "Installing Yarn" msg_info "Installing Yarn"
$STD npm install --global yarn $STD npm install -g yarn
ln -sf /usr/local/bin/yarn /usr/bin/yarn ln -sf /usr/local/bin/yarn /usr/bin/yarn
msg_ok "Installed Yarn" msg_ok "Installed Yarn"
msg_info "Installing Dashy (Patience)" RELEASE=$(curl -s https://api.github.com/repos/Lissy93/dashy/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
msg_info "Installing Dashy ${RELEASE} (Patience)"
mkdir -p /opt/dashy mkdir -p /opt/dashy
#RELEASE=$(curl -s https://api.github.com/repos/Lissy93/dashy/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') wget -qO- https://github.com/Lissy93/dashy/archive/refs/tags/${RELEASE}.tar.gz | tar -xz -C /opt/dashy --strip-components=1
#wget -qO- https://github.com/Lissy93/dashy/archive/refs/tags/${RELEASE}.tar.gz | tar -xz -C /opt/dashy --strip-components=1
wget -qO- https://github.com/Lissy93/dashy/archive/refs/tags/2.1.1.tar.gz | tar -xz -C /opt/dashy --strip-components=1
cd /opt/dashy cd /opt/dashy
sed -i 's/NODE_OPTIONS=--openssl-legacy-provider vue-cli-service build/NODE_OPTIONS=yarn vue-cli-service build/' /opt/dashy/package.json
$STD yarn $STD yarn
$STD yarn build $STD yarn build
msg_ok "Installed Dashy" echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
msg_ok "Installed Dashy ${RELEASE}"
msg_info "Creating Service" msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/dashy.service cat <<EOF >/etc/systemd/system/dashy.service