|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# Copyright (c) 2021-2025 community-scripts ORG |
| 4 | +# Author: Slaviša Arežina (tremor021) |
| 5 | +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE |
| 6 | +# Source: https://github.com/hakimel/reveal.js |
| 7 | + |
| 8 | +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" |
| 9 | +color |
| 10 | +verb_ip6 |
| 11 | +catch_errors |
| 12 | +setting_up_container |
| 13 | +network_check |
| 14 | +update_os |
| 15 | + |
| 16 | +msg_info "Installing Dependencies" |
| 17 | +$STD apt-get install -y \ |
| 18 | + curl \ |
| 19 | + sudo \ |
| 20 | + mc \ |
| 21 | + gnupg |
| 22 | +msg_ok "Installed Dependencies" |
| 23 | + |
| 24 | +msg_info "Setting up Node.js Repository" |
| 25 | +mkdir -p /etc/apt/keyrings |
| 26 | +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg |
| 27 | +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" >/etc/apt/sources.list.d/nodesource.list |
| 28 | +msg_ok "Set up Node.js Repository" |
| 29 | + |
| 30 | +msg_info "Setup Node.js" |
| 31 | +$STD apt-get update |
| 32 | +$STD apt-get install -y nodejs |
| 33 | +msg_ok "Setup Node.js" |
| 34 | + |
| 35 | +msg_info "Setup ${APPLICATION}" |
| 36 | +temp_file=$(mktemp) |
| 37 | +RELEASE=$(curl -s https://api.github.com/repos/hakimel/reveal.js/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') |
| 38 | +wget -q "https://github.com/hakimel/reveal.js/archive/refs/tags/${RELEASE}.tar.gz" -O $temp_file |
| 39 | +tar zxf $temp_file |
| 40 | +mv reveal.js-${RELEASE}/ /opt/revealjs |
| 41 | +cd /opt/revealjs |
| 42 | +$STD npm install |
| 43 | +sed -i '25s/localhost/0.0.0.0/g' /opt/revealjs/gulpfile.js |
| 44 | +echo "${RELEASE}" >/opt/${APPLICATION}_version.txt |
| 45 | +msg_ok "Setup ${APPLICATION}" |
| 46 | + |
| 47 | +msg_info "Creating Service" |
| 48 | +cat <<EOF >/etc/systemd/system/revealjs.service |
| 49 | +[Unit] |
| 50 | +Description=Reveal.js Service |
| 51 | +After=network.target |
| 52 | +
|
| 53 | +[Service] |
| 54 | +Type=simple |
| 55 | +User=root |
| 56 | +WorkingDirectory=/opt/revealjs |
| 57 | +ExecStart=/usr/bin/npm start |
| 58 | +Restart=always |
| 59 | +
|
| 60 | +[Install] |
| 61 | +WantedBy=multi-user.target |
| 62 | +EOF |
| 63 | +systemctl enable -q --now revealjs |
| 64 | +msg_ok "Created Service" |
| 65 | + |
| 66 | +motd_ssh |
| 67 | +customize |
| 68 | + |
| 69 | +msg_info "Cleaning up" |
| 70 | +rm -f $temp_file |
| 71 | +$STD apt-get -y autoremove |
| 72 | +$STD apt-get -y autoclean |
| 73 | +msg_ok "Cleaned" |
0 commit comments