Compare commits

...

9 Commits
main ... mhop

Author SHA1 Message Date
87f38d8b83 mhop mqtt 2025-10-20 20:51:43 +02:00
7fd661b97d mhop... 2025-10-18 19:55:45 +02:00
d05739d27e mhop... 2025-10-14 19:18:45 +02:00
e372335016 mhop... 2025-10-14 19:13:03 +02:00
2408c38b6f mhop... 2025-10-14 19:04:37 +02:00
24cd430cf4 mhop... 2025-10-14 12:22:07 +02:00
aa97eea1b1 mhop... 2025-10-14 11:55:28 +02:00
e67203ffa0 mhop... 2025-10-14 11:55:28 +02:00
59a92477c4 mhop... 2025-10-14 11:55:28 +02:00
6 changed files with 331 additions and 8 deletions

50
ct/alpine-mh.sh Normal file
View File

@@ -0,0 +1,50 @@
#!/usr/bin/env bash
myuser=mhop
mybranch=mhop
#source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
source <(curl -fsSL https://raw.githubusercontent.com/$myuser/ProxmoxVE/$mybranch/misc/build.func)
# Copyright (c) 2021-2025 tteck
# Author: tteck (tteckster)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://alpinelinux.org/
APP="Alpine"
var_tags="${var_tags:-os;alpine}"
var_cpu="${var_cpu:-1}"
var_ram="${var_ram:-512}"
var_disk="${var_disk:-1}"
var_os="${var_os:-alpine}"
var_version="${var_version:-3.22}"
var_unprivileged="${var_unprivileged:-1}"
var_ipv4_method="${var_ipv4_method:-static}"
var_ipv4_static="${var_ipv4_static:-192.168.178.235/24}"
var_gateway="${var_gateway:-192.168.178.1}"
var_ns="${var_ns:-1.1.1.1}"
var_ssh="${var_ssh:-yes}"
header_info "$APP"
variables
color
catch_errors
function update_script() {
UPD=$(
whiptail --backtitle "Proxmox VE Helper Scripts" --title "SUPPORT" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 1 \
"1" "Check for Alpine Updates" ON \
3>&1 1>&2 2>&3
)
header_info
if [ "$UPD" == "1" ]; then
$STD apk -U upgrade
exit
fi
}
start
build_container
description
msg_ok "Completed Successfully!\n"

50
ct/alpine-mqtt.sh Normal file
View File

@@ -0,0 +1,50 @@
#!/usr/bin/env bash
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
# Copyright (c) 2021-2025 tteck
# Author: tteck (tteckster)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://www.zigbee2mqtt.io/
APP="Alpine-MQTT"
var_tags="${var_tags:-alpine;zigbee;mqtt;smarthome}"
var_disk="${var_disk:-1}"
var_cpu="${var_cpu:-1}"
var_ram="${var_ram:-512}"
var_os="${var_os:-alpine}"
var_version="${var_version:-3.22}"
var_unprivileged="${var_unprivileged:-0}"
header_info "$APP"
variables
color
catch_errors
function update_script() {
if ! apk -e info newt >/dev/null 2>&1; then
apk add -q newt
fi
while true; do
CHOICE=$(
whiptail --backtitle "Proxmox VE Helper Scripts" --title "SUPPORT" --menu "Select option" 11 58 1 \
"1" "Check for MQTT Updates" 3>&2 2>&1 1>&3
)
exit_status=$?
if [ $exit_status == 1 ]; then
clear
exit-script
fi
header_info
case $CHOICE in
1)
$STD apk -U upgrade
exit
;;
esac
done
}
start
build_container
description
msg_ok "Completed Successfully!\n"

View File

@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2025 tteck
# Author: tteck (tteckster)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://alpinelinux.org/
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apk add --no-cache sudo
msg_ok "Installed Dependencies"
msg_info "Installing Gitea"
$STD apk add --no-cache gitea
msg_ok "Installed Gitea"
msg_info "Enabling Gitea Service"
$STD rc-update add gitea default
msg_ok "Enabled Gitea Service"
msg_info "Starting Gitea"
$STD service gitea start
msg_ok "Started Gitea"
~

View File

@@ -0,0 +1,172 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2025 tteck
# Author: tteck (tteckster)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://www.zigbee2mqtt.io/
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Alpine-Mosquitto_Zigbee2MQTT_haBridge"
# mosquitto -----------------
msg_info "Installing Mosquitto"
$STD apk add mosquitto
mosquitto_config=/etc/mosquitto/mosquitto.conf
sed -i -e "s/^#allow_anonymous.*$/allow_anonymous true/" $mosquitto_config
sed -i -e "s/^#listener.*$/listener 1883/" $mosquitto_config
rc-update add mosquitto
rc-service mosquitto start
# ha-bridge -----------------
msg_info "Installing haBridge"
$STD apk add openjdk11
java --version
mkdir -p /opt/habridge
cd /opt/habridge
release=$( curl -fsSL https://api.github.com/repos/bwssytems/ha-bridge/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
wget -q https://github.com/bwssytems/ha-bridge/releases/download/v${release}/ha-bridge-${release}.jar
ln -s ha-bridge-${release}.jar ha-bridge.jar
initfile=/etc/init.d/habridge
cat > $initfile <<\EOF
#!/sbin/openrc-run
command="/usr/bin/java"
command_args="-jar -Dconfig.file=/opt/habridge/data/habridge.config /opt/habridge/ha-bridge.jar"
name="habridge"
description="HA Bridge Service"
pidfile="/run/habridge.pid"
directory="/opt/habridge"
#user="habridge" # or leave as root if needed
user="root"
depend() {
need net
after firewall
}
start_pre() {
checkpath --directory --owner $user:$user /run
}
start() {
ebegin "Starting ha-bridge $pidfile"
start-stop-daemon --start --background \
--pidfile $pidfile \
--make-pidfile \
--chdir $directory \
--user $user \
--exec $command -- $command_args
eend $?
}
stop() {
ebegin "Stopping ha-bridge"
start-stop-daemon --stop --pidfile $pidfile --retry 10
eend $?
}
EOF
chmod +x $initfile
rc-update add habridge default
rc-service habridge start
rc-service habridge status
# config-file: /opt/habridge/data/habridge.config
# "mqttaddress": {
# "devices": [
# {
# "name": "habridge",
# "ip": "localhost:1883"
# }
# ]
# },
# zigbee2mqtt ----------------
set2net_ip=192.168.178.29
set2net_port=20108
ser2net_baud=115200
#mkdir -p /root/.z2m /etc/zigbee2mqtt
#$STD apk add zigbee2mqtt
#ln -s /etc/zigbee2mqtt/ /root/.z2m
#chown -R root:root /etc/zigbee2mqtt /root/.z2m
#$STD rc-update add zigbee2mqtt
#$STD rc-service zigbee2mqtt restart
#mkdir -p /etc/zigbee2mqtt
$STD apk add zigbee2mqtt
sed -i -e 's/#datadir="\/var\/lib\/zigbee2mqtt"/datadir="\/var\/lib\/zigbee2mqtt"/' -e 's/#command_user="zigbee2mqtt"/command_user="root"/' /etc/conf.d/zigbee2mqtt
cat >>/etc/conf.d/zigbee2mqtt <<EOF
export ZIGBEE2MQTT_CONFIG_MQTT_BASE_TOPIC="zigbee"
export ZIGBEE2MQTT_CONFIG_SERIAL_PORT="tcp://$ser2net_ip:$ser2net_port"
export ZIGBEE2MQTT_CONFIG_SERIAL_RTSCTS="false"
export ZIGBEE2MQTT_CONFIG_SERIAL_BAUDRATE="$ser2net_baud"
export ZIGBEE2MQTT_CONFIG_SERIAL_ADAPTER="ezsp"
export ZIGBEE2MQTT_CONFIG_FRONTEND_PORT="8089"
export ZIGBEE2MQTT_CONFIG_FRONTEND_ENABLED="true"
EOF
$STD rc-update add zigbee2mqtt default
$STD rc-service zigbee2mqtt start
$STD rc-service zigbee2mqtt status
msg_ok "Installed Alpine-Zigbee2MQTT"
# config-file: /var/lib/zigbee2mqtt/configuration.yaml
# tuya-mqtt -------------------------
$STD apk add npm git
cd /opt
git clone https://github.com/lehanspb/tuya-mqtt
cd tuya-mqtt
npm install
npm audit fix --force
# influxdb ---------------------------
# https://github.com/woahbase/alpine-influxdb/blob/master/Dockerfile
INFLUXDB_HOME=/var/lib/influxdb \
INFLUXDB_CONFIG_PATH=/etc/influxdb.conf
$STD apk add -Uu --purge --no-cache ca-certificates
# influxdb unavailable in repos since v3.17
# newer builds will not have armv7l/armhf
{ REPO=v3.17; \
echo "http://dl-cdn.alpinelinux.org/alpine/${REPO}/main"; \
echo "http://dl-cdn.alpinelinux.org/alpine/${REPO}/community"; \
} > /tmp/repo
$STD apk add --no-cache --repositories-file "/tmp/repo" influxdb
update-ca-certificates
mkdir -p defaults ${INFLUXDB_HOME}
mv ${INFLUXDB_CONFIG_PATH} /defaults/influxdb.conf.default
if [ ! -e /etc/nsswitch.conf ]; then
echo 'hosts: files dns' > /etc/nsswitch.conf
fi
# grafana --------------
msg_info "Installing Grafana"
$STD apk add grafana
$STD sed -i '/http_addr/s/127.0.0.1/0.0.0.0/g' /etc/conf.d/grafana
$STD rc-service grafana start
$STD rc-update add grafana default
msg_ok "Installed Grafana"
rm -rf /var/cache/apk/* /tmp/*
motd_ssh
customize

View File

@@ -15,13 +15,20 @@ variables() {
CT_TYPE=${var_unprivileged:-$CT_TYPE}
}
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func)
myuser=mhop
mybranch=mhop
#source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func)
#source <(curl -fsSL https://raw.githubusercontent.com/$myuser/ProxmoxVE/refs/heads/$mybranch/main/misc/api.func)
source <(curl -fsSL https://raw.githubusercontent.com/$myuser/ProxmoxVE/$mybranch/misc/api.func)
if command -v curl >/dev/null 2>&1; then
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func)
#source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func)
source <(curl -fsSL https://raw.githubusercontent.com/$myuser/ProxmoxVE/$mybranch/misc/core.func)
load_functions
elif command -v wget >/dev/null 2>&1; then
source <(wget -qO- https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func)
#source <(wget -qO- https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func)
source <(curl -fsSL https://raw.githubusercontent.com/$myuser/ProxmoxVE/$mybranch/misc/core.func)
load_functions
fi
# This function enables error handling in the script by setting options and defining a trap for the ERR signal.
@@ -210,7 +217,9 @@ base_settings() {
HN=${var_hostname:-$NSAPP}
BRG=${var_brg:-"vmbr0"}
NET=${var_net:-"dhcp"}
IPV4_METHOD=${var_ipv4_method:-"dhcp"}
IPV6_METHOD=${var_ipv6_method:-"none"}
IPV4_STATIC=${var_ipv4_static:-""}
IPV6_STATIC=${var_ipv6_static:-""}
GATE=${var_gateway:-""}
APT_CACHER=${var_apt_cacher:-""}
@@ -981,6 +990,7 @@ install_script() {
echo -e "${INFO}${HOLD} ${GN}Using Config File on node $PVEHOST_NAME${CL}"
METHOD="config_file"
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/config-file.func)
source <(curl -fsSL https://raw.githubusercontent.com/$myuser/ProxmoxVE/$mybranch/misc/config-file.func)
config_file
break
;;
@@ -1052,6 +1062,7 @@ check_container_storage() {
start() {
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/tools.func)
source <(curl -fsSL https://raw.githubusercontent.com/$myuser/ProxmoxVE/$mybranch/misc/tools.func)
if command -v pveversion >/dev/null 2>&1; then
install_script
else
@@ -1342,7 +1353,8 @@ EOF'
fi
msg_ok "Customized LXC Container"
lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/install/${var_install}.sh)"
#lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/install/${var_install}.sh)"
lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/$myuser/ProxmoxVE/$mybranch/install/${var_install}.sh)"
}
# This function sets the description of the container.

View File

@@ -4,12 +4,16 @@
# License: MIT
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
myuser=mhop
mybranch=mhop
if ! command -v curl >/dev/null 2>&1; then
printf "\r\e[2K%b" '\033[93m Setup Source \033[m' >&2
apt-get update >/dev/null 2>&1
apt-get install -y curl >/dev/null 2>&1
fi
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func)
#source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func)
source <(curl -fsSL https://raw.githubusercontent.com/$myuser/ProxmoxVE/$mybranch/misc/core.func)
load_functions
# This function enables IPv6 if it's not disabled and sets verbose mode
verb_ip6() {
@@ -29,7 +33,8 @@ catch_errors() {
# This function handles errors
error_handler() {
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func)
#source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func)
source <(curl -fsSL https://raw.githubusercontent.com/$myuser/ProxmoxVE/$mybranch/misc/api.func)
printf "\e[?25h"
local exit_code="$?"
local line_number="$1"
@@ -147,7 +152,8 @@ EOF
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
msg_ok "Updated Container OS"
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/tools.func)
#source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/tools.func)
source <(curl -fsSL https://raw.githubusercontent.com/$myuser/ProxmoxVE/$mybranch/misc/tools.func)
}
# This function modifies the message of the day (motd) and SSH settings
@@ -197,7 +203,8 @@ EOF
systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//')
msg_ok "Customized Container"
fi
echo "bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/${app}.sh)\"" >/usr/bin/update
#echo "bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/${app}.sh)\"" >/usr/bin/update
echo "bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/$myuser/ProxmoxVE/$mybranch/ct/${app}.sh)\"" >/usr/bin/update
chmod +x /usr/bin/update
if [[ -n "${SSH_AUTHORIZED_KEY}" ]]; then