1
0
mirror of https://github.com/community-scripts/ProxmoxVE.git synced 2025-03-08 13:19:05 +00:00

New Script: TasmoCompiler (#2235)

* add tasmocompiler script

* bunch of script fixes

* remove typo

* Update json/tasmocompiler.json

Co-authored-by: bvdberg01 <74251551+bvdberg01@users.noreply.github.com>

* Update ct/tasmocompiler.sh

Co-authored-by: bvdberg01 <74251551+bvdberg01@users.noreply.github.com>

* Update json/tasmocompiler.json

Co-authored-by: bvdberg01 <74251551+bvdberg01@users.noreply.github.com>

* Update ct/tasmocompiler.sh

Co-authored-by: bvdberg01 <74251551+bvdberg01@users.noreply.github.com>

---------

Co-authored-by: bvdberg01 <74251551+bvdberg01@users.noreply.github.com>
This commit is contained in:
Slaviša Arežina 2025-02-12 16:10:24 +01:00 committed by GitHub
parent 0f7ff181df
commit a5f77f23e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 192 additions and 0 deletions

71
ct/tasmocompiler.sh Normal file
View File

@ -0,0 +1,71 @@
#!/usr/bin/env bash
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
# Copyright (c) 2021-2025 community-scripts ORG
# Author: Slaviša Arežina (tremor021)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/benzino77/tasmocompiler
APP="TasmoCompiler"
TAGS="compiler"
var_cpu="2"
var_ram="2048"
var_disk="10"
var_os="debian"
var_version="12"
var_unprivileged="1"
header_info "$APP"
base_settings
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -d /opt/tasmocompiler ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
RELEASE=$(curl -s https://api.github.com/repos/benzino77/tasmocompiler/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
msg_info "Stopping $APP"
systemctl stop tasmocompiler
msg_ok "Stopped $APP"
msg_info "Updating $APP to v${RELEASE}"
cd /opt
rm -rf /opt/tasmocompiler
RELEASE=$(curl -s https://api.github.com/repos/benzino77/tasmocompiler/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
wget -q https://github.com/benzino77/tasmocompiler/archive/refs/tags/v${RELEASE}.tar.gz
tar xzf v${RELEASE}.tar.gz
mv tasmocompiler-${RELEASE}/ /opt/tasmocompiler/
cd /opt/tasmocompiler
yarn install &> /dev/null
export NODE_OPTIONS=--openssl-legacy-provider
npm i &> /dev/null
yarn build &> /dev/null
msg_ok "Updated $APP to v${RELEASE}"
msg_info "Starting $APP"
systemctl start tasmocompiler
msg_ok "Started $APP"
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_info "Cleaning up"
rm -r "/opt/v${RELEASE}.tar.gz"
msg_ok "Cleaned"
msg_ok "Update Successful"
else
msg_ok "No update required. ${APP} is already at v${RELEASE}"
fi
exit
}
start
build_container
description
msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"

View File

@ -0,0 +1,87 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2025 community-scripts ORG
# Author: Slaviša Arežina (tremor021)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/benzino77/tasmocompiler
# Import Functions und Setup
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies. Patience"
$STD apt-get install -y \
curl \
sudo \
mc \
gnupg \
git
msg_ok "Installed Dependencies"
msg_info "Setup Python3"
$STD apt-get install python3-venv
msg_ok "Setup Python3"
msg_info "Setup Node.js & yarn"
mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
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
$STD apt-get update
$STD apt-get install -y nodejs
$STD npm install -g yarn
msg_ok "Setup Node.js & yarn"
msg_info "Setup Platformio"
curl -fsSL -o get-platformio.py https://raw.githubusercontent.com/platformio/platformio-core-installer/master/get-platformio.py
$STD python3 get-platformio.py
msg_ok "Setup Platformio"
msg_info "Setup TasmoCompiler"
mkdir /tmp/Tasmota
RELEASE=$(curl -s https://api.github.com/repos/benzino77/tasmocompiler/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
wget -q https://github.com/benzino77/tasmocompiler/archive/refs/tags/v${RELEASE}.tar.gz -O /tmp/v${RELEASE}.tar.gz
cd /tmp
tar xzf /tmp/v${RELEASE}.tar.gz
mv tasmocompiler-${RELEASE}/ /opt/tasmocompiler/
cd /opt/tasmocompiler
$STD yarn install
export NODE_OPTIONS=--openssl-legacy-provider
$STD npm i
$STD yarn build
mkdir -p /usr/local/bin
ln -s ~/.platformio/penv/bin/platformio /usr/local/bin/platformio
ln -s ~/.platformio/penv/bin/pio /usr/local/bin/pio
ln -s ~/.platformio/penv/bin/piodebuggdb /usr/local/bin/piodebuggdb
echo "${RELEASE}" >"/opt/tasmocompiler_version.txt"
msg_ok "Setup TasmoCompiler"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/tasmocompiler.service
[Unit]
Description=TasmoCompiler Service
After=multi-user.target
[Service]
Type=simple
User=root
ExecStart=/usr/bin/node /opt/tasmocompiler/server/app.js
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now tasmocompiler
msg_ok "Created Service"
motd_ssh
customize
msg_info "Cleaning up"
rm -f /tmp/v${RELEASE}.tar.gz
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"

34
json/tasmocompiler.json Normal file
View File

@ -0,0 +1,34 @@
{
"name": "TasmoCompiler",
"slug": "tasmocompiler",
"categories": [
16
],
"date_created": "2025-02-10",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": 3000,
"documentation": "https://github.com/benzino77/tasmocompiler/blob/master/README.md",
"website": "https://github.com/benzino77/tasmocompiler",
"logo": "https://github.com/benzino77/tasmocompiler/raw/master/docs/logo/tasmocompiler-symbol.svg",
"description": "TasmoCompiler is a simple web GUI which allows you to compile fantastic Tasmota firmware with your own settings.",
"install_methods": [
{
"type": "default",
"script": "ct/tasmocompiler.sh",
"resources": {
"cpu": 2,
"ram": 2048,
"hdd": 10,
"os": "debian",
"version": "12"
}
}
],
"default_credentials": {
"username": null,
"password": null
},
"notes": []
}