Skip to content

Commit e5bea1f

Browse files
authored
Refactor (#5723)
1 parent f7e9fbc commit e5bea1f

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

ct/dashy.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function update_script() {
2929
fi
3030

3131
RELEASE=$(curl -fsSL https://api.github.com/repos/Lissy93/dashy/releases/latest | grep '"tag_name":' | cut -d'"' -f4)
32-
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
32+
if [[ "${RELEASE}" != "$(cat ~/.dashy 2>/dev/null)" ]] || [[ ! -f ~/.dashy ]]; then
3333
msg_info "Stopping ${APP}"
3434
systemctl stop dashy
3535
msg_ok "Stopped ${APP}"
@@ -43,14 +43,13 @@ function update_script() {
4343
fi
4444
msg_ok "Backed up conf.yml"
4545

46-
msg_info "Updating ${APP} to ${RELEASE}"
4746
rm -rf /opt/dashy
48-
mkdir -p /opt/dashy
49-
curl -fsSL "https://github.com/Lissy93/dashy/archive/refs/tags/${RELEASE}.tar.gz" | tar -xz -C /opt/dashy --strip-components=1
47+
fetch_and_deploy_gh_release "dashy" "Lissy93/dashy"
48+
49+
msg_info "Updating ${APP} to ${RELEASE}"
5050
cd /opt/dashy
5151
npm install
5252
npm run build
53-
echo "${RELEASE}" >/opt/${APP}_version.txt
5453
msg_ok "Updated ${APP} to ${RELEASE}"
5554

5655
msg_info "Restoring conf.yml"
@@ -65,6 +64,7 @@ function update_script() {
6564
msg_info "Starting Dashy"
6665
systemctl start dashy
6766
msg_ok "Started Dashy"
67+
6868
msg_ok "Updated Successfully"
6969
else
7070
msg_ok "No update required. ${APP} is already at ${RELEASE}"

install/dashy-install.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,12 @@ network_check
1414
update_os
1515

1616
NODE_VERSION="22" setup_nodejs
17+
fetch_and_deploy_gh_release "dashy" "Lissy93/dashy"
1718

18-
RELEASE=$(curl -fsSL https://api.github.com/repos/Lissy93/dashy/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
1919
msg_info "Installing Dashy ${RELEASE} (Patience)"
20-
mkdir -p /opt/dashy
21-
curl -fsSL "https://github.com/Lissy93/dashy/archive/refs/tags/${RELEASE}.tar.gz" | tar -xz -C /opt/dashy --strip-components=1
2220
cd /opt/dashy
2321
$STD npm install
2422
$STD npm run build
25-
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
2623
msg_ok "Installed Dashy ${RELEASE}"
2724

2825
msg_info "Creating Service"

0 commit comments

Comments
 (0)