Update MagicMirror install and update scripts (#2409)
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2025 tteck
|
||||
# Author: tteck (tteckster)
|
||||
# Author: tteck (tteckster) | Co-Author Slaviša Arežina (tremor021)
|
||||
# License: MIT
|
||||
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://magicmirror.builders/
|
||||
|
||||
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
@@ -14,12 +15,11 @@ network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt-get install -y curl
|
||||
$STD apt-get install -y sudo
|
||||
$STD apt-get install -y mc
|
||||
$STD apt-get install -y git
|
||||
$STD apt-get install -y ca-certificates
|
||||
$STD apt-get install -y gnupg
|
||||
$STD apt-get install -y \
|
||||
curl \
|
||||
sudo \
|
||||
mc \
|
||||
gnupg
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Setting up Node.js Repository"
|
||||
@@ -33,14 +33,14 @@ $STD apt-get update
|
||||
$STD apt-get install -y nodejs
|
||||
msg_ok "Installed Node.js"
|
||||
|
||||
msg_info "Setting up MagicMirror Repository"
|
||||
$STD git clone https://github.com/MichMich/MagicMirror /opt/magicmirror
|
||||
msg_ok "Set up MagicMirror Repository"
|
||||
|
||||
msg_info "Installing MagicMirror"
|
||||
msg_info "Setup MagicMirror"
|
||||
temp_file=$(mktemp)
|
||||
RELEASE=$(curl -s https://api.github.com/repos/MagicMirrorOrg/MagicMirror/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
wget -q "https://github.com/MagicMirrorOrg/MagicMirror/archive/refs/tags/v${RELEASE}.tar.gz" -O "$temp_file"
|
||||
tar -xzf "$temp_file"
|
||||
mv MagicMirror-${RELEASE} /opt/magicmirror
|
||||
cd /opt/magicmirror
|
||||
$STD npm install --only=prod --omit=dev
|
||||
|
||||
$STD npm run install-mm
|
||||
cat <<EOF >/opt/magicmirror/config/config.js
|
||||
let config = {
|
||||
address: "0.0.0.0",
|
||||
@@ -130,11 +130,12 @@ let config = {
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
||||
EOF
|
||||
msg_ok "Installed MagicMirror"
|
||||
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
|
||||
msg_ok "Setup MagicMirror"
|
||||
|
||||
msg_info "Creating Service"
|
||||
service_path="/etc/systemd/system/magicmirror.service"
|
||||
echo "[Unit]
|
||||
cat <<EOF >/etc/systemd/system/magicmirror.service
|
||||
[Unit]
|
||||
Description=Magic Mirror
|
||||
After=network.target
|
||||
StartLimitIntervalSec=0
|
||||
@@ -145,17 +146,19 @@ Restart=always
|
||||
RestartSec=1
|
||||
User=root
|
||||
WorkingDirectory=/opt/magicmirror/
|
||||
ExecStart=/usr/bin/node serveronly
|
||||
ExecStart=/usr/bin/npm run server
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target" >$service_path
|
||||
$STD systemctl enable --now magicmirror
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable --now magicmirror
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
rm -rf $temp_file
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
msg_ok "Cleaned"
|
||||
|
||||
Reference in New Issue
Block a user