Compare commits

..

No commits in common. "67cad1583bd862f558fdd29f91acf7a05f927c12" and "7ebc6ea84f402e20a706debf0a2986cf7ece84a4" have entirely different histories.

2 changed files with 33 additions and 45 deletions

View File

@ -55,49 +55,38 @@ 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
msg_info "Stopping ${APP}"
systemctl stop dashy
msg_ok "Stopped ${APP}"
RELEASE=$(curl -sL https://api.github.com/repos/Lissy93/dashy/releases/latest | grep '"tag_name":' | cut -d'"' -f4) msg_info "Backing up conf.yml"
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then cd ~
msg_info "Stopping ${APP}" cp -R /opt/dashy/public/conf.yml conf.yml
systemctl stop dashy msg_ok "Backed up conf.yml"
msg_ok "Stopped ${APP}"
msg_info "Backing up conf.yml" msg_info "Updating Dashy"
cd ~ cd /opt/dashy
if [[ -f /opt/dashy/public/conf.yml ]]; then git merge &>/dev/null
cp -R /opt/dashy/public/conf.yml conf.yml git pull origin master &>/dev/null
else yarn &>/dev/null
cp -R /opt/dashy/user-data/conf.yml conf.yml yarn build &>/dev/null
fi msg_ok "Updated Dashy"
msg_ok "Backed up conf.yml"
msg_info "Updating ${APP} to ${RELEASE}" msg_info "Restoring conf.yml"
rm -rf /opt/dashy cd ~
mkdir -p /opt/dashy cp -R conf.yml /opt/dashy/public
wget -qO- https://github.com/Lissy93/dashy/archive/refs/tags/${RELEASE}.tar.gz | tar -xz -C /opt/dashy --strip-components=1 msg_ok "Restored conf.yml"
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
yarn &>/dev/null
yarn build &>/dev/null
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated ${APP} to ${RELEASE}"
msg_info "Restoring conf.yml" msg_info "Cleaning"
cd ~ rm -rf conf.yml
cp -R conf.yml /opt/dashy/user-data msg_ok "Cleaned"
msg_ok "Restored conf.yml"
msg_info "Cleaning" msg_info "Starting Dashy"
rm -rf conf.yml /opt/dashy/public/conf.yml systemctl start dashy
msg_ok "Cleaned" msg_ok "Started Dashy"
msg_ok "Updated Successfully"
msg_info "Starting Dashy"
systemctl start dashy
msg_ok "Started Dashy"
msg_ok "Updated Successfully"
else
msg_ok "No update required. ${APP} is already at ${RELEASE}"
fi
exit exit
} }

View File

@ -29,20 +29,19 @@ 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 -g yarn $STD npm install --global 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"
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 (Patience)"
msg_info "Installing Dashy ${RELEASE} (Patience)"
mkdir -p /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 #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/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
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt msg_ok "Installed Dashy"
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