Refactor (#6548)
This commit is contained in:
parent
db86049a3e
commit
dc5fcb83e8
23
ct/nocodb.sh
23
ct/nocodb.sh
@ -27,14 +27,23 @@ function update_script() {
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
msg_info "Updating ${APP}"
|
||||
systemctl stop nocodb.service
|
||||
cd /opt/nocodb
|
||||
rm -rf nocodb
|
||||
curl -fsSL http://get.nocodb.com/linux-x64 -o nocodb -L
|
||||
chmod +x nocodb
|
||||
systemctl start nocodb.service
|
||||
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/nocodb/nocodb/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||
if [[ ! -f ~/.nocodb ]] || [[ "${RELEASE}" != "$(cat ~/.nocodb)" ]]; then
|
||||
msg_info "Stopping Service"
|
||||
systemctl stop nocodb
|
||||
msg_ok "Stopped Service"
|
||||
|
||||
fetch_and_deploy_gh_release "nocodb" "nocodb/nocodb" "singlefile" "latest" "/opt/nocodb/" "Noco-linux-x64"
|
||||
|
||||
msg_info "Starting Service"
|
||||
systemctl start nocodb
|
||||
msg_ok "Started Service"
|
||||
|
||||
msg_ok "Updated Successfully"
|
||||
else
|
||||
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
|
@ -13,15 +13,10 @@ setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing NocoDB"
|
||||
mkdir -p /opt/nocodb
|
||||
cd /opt/nocodb
|
||||
curl -fsSL http://get.nocodb.com/linux-x64 -o nocodb -L
|
||||
chmod +x nocodb
|
||||
msg_ok "Installed NocoDB"
|
||||
fetch_and_deploy_gh_release "nocodb" "nocodb/nocodb" "singlefile" "latest" "/opt/nocodb/" "Noco-linux-x64"
|
||||
|
||||
msg_info "Creating Service"
|
||||
service_path="/etc/systemd/system/nocodb.service"
|
||||
cat <<EOF >/etc/systemd/system/nocodb.service
|
||||
echo "[Unit]
|
||||
Description=nocodb
|
||||
|
||||
@ -33,7 +28,8 @@ WorkingDirectory=/opt/nocodb
|
||||
ExecStart=/opt/nocodb/./nocodb
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target" >$service_path
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now nocodb
|
||||
msg_ok "Created Service"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user