11#! /usr/bin/env bash
22
33# Copyright (c) 2021-2025 tteck
4- # Author: tteck (tteckster)
4+ # Author: tteck (tteckster) | Co-Author Slaviša Arežina (tremor021)
55# License: MIT
66# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
7+ # Source: https://magicmirror.builders/
78
89source /dev/stdin <<< " $FUNCTIONS_FILE_PATH"
910color
@@ -14,12 +15,11 @@ network_check
1415update_os
1516
1617msg_info " Installing Dependencies"
17- $STD apt-get install -y curl
18- $STD apt-get install -y sudo
19- $STD apt-get install -y mc
20- $STD apt-get install -y git
21- $STD apt-get install -y ca-certificates
22- $STD apt-get install -y gnupg
18+ $STD apt-get install -y \
19+ curl \
20+ sudo \
21+ mc \
22+ gnupg
2323msg_ok " Installed Dependencies"
2424
2525msg_info " Setting up Node.js Repository"
@@ -33,14 +33,14 @@ $STD apt-get update
3333$STD apt-get install -y nodejs
3434msg_ok " Installed Node.js"
3535
36- msg_info " Setting up MagicMirror Repository"
37- $STD git clone https://github.com/MichMich/MagicMirror /opt/magicmirror
38- msg_ok " Set up MagicMirror Repository"
39-
40- msg_info " Installing MagicMirror"
36+ msg_info " Setup MagicMirror"
37+ temp_file=$( mktemp)
38+ RELEASE=$( curl -s https://api.github.com/repos/MagicMirrorOrg/MagicMirror/releases/latest | grep " tag_name" | awk ' {print substr($2, 3, length($2)-4) }' )
39+ wget -q " https://github.com/MagicMirrorOrg/MagicMirror/archive/refs/tags/v${RELEASE} .tar.gz" -O " $temp_file "
40+ tar -xzf " $temp_file "
41+ mv MagicMirror-${RELEASE} /opt/magicmirror
4142cd /opt/magicmirror
42- $STD npm install --only=prod --omit=dev
43-
43+ $STD npm run install-mm
4444cat << EOF >/opt/magicmirror/config/config.js
4545let config = {
4646 address: "0.0.0.0",
@@ -130,11 +130,12 @@ let config = {
130130/*************** DO NOT EDIT THE LINE BELOW ***************/
131131if (typeof module !== "undefined") {module.exports = config;}
132132EOF
133- msg_ok " Installed MagicMirror"
133+ echo " ${RELEASE} " > " /opt/${APPLICATION} _version.txt"
134+ msg_ok " Setup MagicMirror"
134135
135136msg_info " Creating Service"
136- service_path= " /etc/systemd/system/magicmirror.service"
137- echo " [Unit]
137+ cat << EOF > /etc/systemd/system/magicmirror.service
138+ [Unit]
138139Description=Magic Mirror
139140After=network.target
140141StartLimitIntervalSec=0
@@ -145,17 +146,19 @@ Restart=always
145146RestartSec=1
146147User=root
147148WorkingDirectory=/opt/magicmirror/
148- ExecStart=/usr/bin/node serveronly
149+ ExecStart=/usr/bin/npm run server
149150
150151[Install]
151- WantedBy=multi-user.target" > $service_path
152- $STD systemctl enable --now magicmirror
152+ WantedBy=multi-user.target
153+ EOF
154+ systemctl enable --now magicmirror
153155msg_ok " Created Service"
154156
155157motd_ssh
156158customize
157159
158160msg_info " Cleaning up"
161+ rm -rf $temp_file
159162$STD apt-get -y autoremove
160163$STD apt-get -y autoclean
161164msg_ok " Cleaned"
0 commit comments