Merge pull request #4 from tteck/main

[pull] main from tteck:main
This commit is contained in:
pull[bot]
2024-04-22 13:54:04 +00:00
committed by GitHub
3 changed files with 55 additions and 41 deletions
+38 -27
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
msg_info "Stopping ${APP}"
systemctl stop dashy
msg_ok "Stopped ${APP}"
msg_info "Backing up conf.yml" RELEASE=$(curl -sL https://api.github.com/repos/Lissy93/dashy/releases/latest | grep '"tag_name":' | cut -d'"' -f4)
cd ~ if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
cp -R /opt/dashy/public/conf.yml conf.yml msg_info "Stopping ${APP}"
msg_ok "Backed up conf.yml" systemctl stop dashy
msg_ok "Stopped ${APP}"
msg_info "Updating Dashy" msg_info "Backing up conf.yml"
cd /opt/dashy cd ~
git merge &>/dev/null if [[ -f /opt/dashy/public/conf.yml ]]; then
git pull origin master &>/dev/null cp -R /opt/dashy/public/conf.yml conf.yml
yarn &>/dev/null else
yarn build &>/dev/null cp -R /opt/dashy/user-data/conf.yml conf.yml
msg_ok "Updated Dashy" fi
msg_ok "Backed up conf.yml"
msg_info "Restoring conf.yml" msg_info "Updating ${APP} to ${RELEASE}"
cd ~ rm -rf /opt/dashy
cp -R conf.yml /opt/dashy/public mkdir -p /opt/dashy
msg_ok "Restored conf.yml" 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
yarn &>/dev/null
yarn build &>/dev/null
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated ${APP} to ${RELEASE}"
msg_info "Cleaning" msg_info "Restoring conf.yml"
rm -rf conf.yml cd ~
msg_ok "Cleaned" cp -R conf.yml /opt/dashy/user-data
msg_ok "Restored conf.yml"
msg_info "Starting Dashy" msg_info "Cleaning"
systemctl start dashy rm -rf conf.yml /opt/dashy/public/conf.yml
msg_ok "Started Dashy" msg_ok "Cleaned"
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
} }
+7 -6
View File
@@ -30,19 +30,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
+10 -8
View File
@@ -33,7 +33,7 @@ GN=$(echo "\033[1;92m")
DGN=$(echo "\033[32m") DGN=$(echo "\033[32m")
CL=$(echo "\033[m") CL=$(echo "\033[m")
BFR="\\r\\033[K" BFR="\\r\\033[K"
HOLD="-" HOLD=" "
CM="${GN}${CL}" CM="${GN}${CL}"
CROSS="${RD}${CL}" CROSS="${RD}${CL}"
THIN="discard=on,ssd=1," THIN="discard=on,ssd=1,"
@@ -74,13 +74,13 @@ else
fi fi
function spinner() { function spinner() {
printf "\e[?25l" local chars="/-\|"
spinner="◐◓◑◒" local spin_i=0
spin_i=0 printf "\e[?25l"
while true; do while true; do
printf "\b%s" "${spinner:spin_i++%${#spinner}:1}" printf "\r \e[36m%s\e[0m" "${chars:spin_i++%${#chars}:1}"
sleep 0.1 sleep 0.1
done done
} }
function msg_info() { function msg_info() {
@@ -396,6 +396,8 @@ elif [ $((${#STORAGE_MENU[@]} / 3)) -eq 1 ]; then
STORAGE=${STORAGE_MENU[0]} STORAGE=${STORAGE_MENU[0]}
else else
while [ -z "${STORAGE:+x}" ]; do while [ -z "${STORAGE:+x}" ]; do
if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi
printf "\e[?25h"
STORAGE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Storage Pools" --radiolist \ STORAGE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Storage Pools" --radiolist \
"Which storage pool you would like to use for ${HN}?\nTo make a selection, use the Spacebar.\n" \ "Which storage pool you would like to use for ${HN}?\nTo make a selection, use the Spacebar.\n" \
16 $(($MSG_MAX_LENGTH + 23)) 6 \ 16 $(($MSG_MAX_LENGTH + 23)) 6 \