Compare commits

...

5 Commits

2 changed files with 16 additions and 20 deletions

View File

@ -25,6 +25,10 @@ color
catch_errors catch_errors
function update_script() { function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -d /opt/ps5-mqtt ]]; then if [[ ! -d /opt/ps5-mqtt ]]; then
msg_error "No ${APP} installation found!" msg_error "No ${APP} installation found!"
exit exit
@ -32,22 +36,17 @@ function update_script() {
RELEASE=$(curl -s https://api.github.com/repos/FunkeyFlo/ps5-mqtt/releases/latest | jq -r '.tag_name') RELEASE=$(curl -s https://api.github.com/repos/FunkeyFlo/ps5-mqtt/releases/latest | jq -r '.tag_name')
header_info
check_container_storage
check_container_resources
if [[ "${RELEASE}" != "$(cat /opt/ps5-mqtt_version.txt)" ]]; then if [[ "${RELEASE}" != "$(cat /opt/ps5-mqtt_version.txt)" ]]; then
msg_info "Stopping service" msg_info "Stopping service"
systemctl stop ps5-mqtt.service systemctl stop ps5-mqtt
msg_ok "Stopped service" msg_ok "Stopped service"
msg_info "Updating PS5-MQTT to ${RELEASE}" msg_info "Updating PS5-MQTT to ${RELEASE}"
cd ~ wget -P /tmp -q https://github.com/FunkeyFlo/ps5-mqtt/archive/refs/tags/${RELEASE}.tar.gz
wget -q https://github.com/FunkeyFlo/ps5-mqtt/archive/refs/tags/${RELEASE}.tar.gz
tar zxf ${RELEASE}.tar.gz
rm -rf /opt/ps5-mqtt rm -rf /opt/ps5-mqtt
mv ps5-mqtt-* /opt/ps5-mqtt tar zxf /tmp/${RELEASE}.tar.gz -C /opt
rm ${RELEASE}.tar.gz mv /opt/ps5-mqtt-* /opt/ps5-mqtt
rm /tmp/${RELEASE}.tar.gz
echo ${RELEASE} > /opt/ps5-mqtt_version.txt echo ${RELEASE} > /opt/ps5-mqtt_version.txt
msg_ok "Updated PS5-MQTT" msg_ok "Updated PS5-MQTT"
@ -58,9 +57,8 @@ function update_script() {
msg_ok "Built new PS5-MQTT version" msg_ok "Built new PS5-MQTT version"
msg_info "Starting service" msg_info "Starting service"
systemctl start ps5-mqtt.service systemctl start ps5-mqtt
msg_ok "Started service" msg_ok "Started service"
else else
msg_ok "No update required. ${APP} is already at ${RELEASE}" msg_ok "No update required. ${APP} is already at ${RELEASE}"
fi fi

View File

@ -24,16 +24,15 @@ $STD apt-get install -y \
$STD npm i -g playactor $STD npm i -g playactor
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
RELEASE=$(curl -s https://api.github.com/repos/FunkeyFlo/ps5-mqtt/releases/latest | jq -r '.tag_name')
msg_info "Installing PS5-MQTT" msg_info "Installing PS5-MQTT"
wget -q https://github.com/FunkeyFlo/ps5-mqtt/archive/refs/tags/${RELEASE}.tar.gz RELEASE=$(curl -s https://api.github.com/repos/FunkeyFlo/ps5-mqtt/releases/latest | jq -r '.tag_name')
tar zxf ${RELEASE}.tar.gz wget -P /tmp -q https://github.com/FunkeyFlo/ps5-mqtt/archive/refs/tags/${RELEASE}.tar.gz
mv ps5-mqtt-* /opt/ps5-mqtt tar zxf /tmp/${RELEASE}.tar.gz -C /opt
echo ${RELEASE} > /opt/ps5-mqtt_version.txt mv /opt/ps5-mqtt-* /opt/ps5-mqtt
cd /opt/ps5-mqtt/ps5-mqtt/ cd /opt/ps5-mqtt/ps5-mqtt/
$STD npm install $STD npm install
$STD npm run build $STD npm run build
echo ${RELEASE} > /opt/ps5-mqtt_version.txt
msg_ok "Installed PS5-MQTT" msg_ok "Installed PS5-MQTT"
msg_info "Creating Service" msg_info "Creating Service"
@ -94,8 +93,7 @@ motd_ssh
customize customize
msg_info "Cleaning up" msg_info "Cleaning up"
cd /
$STD apt-get -y autoremove $STD apt-get -y autoremove
$STD apt-get -y autoclean $STD apt-get -y autoclean
rm ${RELEASE}.tar.gz rm /tmp/${RELEASE}.tar.gz
msg_ok "Cleaned" msg_ok "Cleaned"