Skip to content

Commit

Permalink
Portainer and Webmin: adjust module options to match changes
Browse files Browse the repository at this point in the history
  • Loading branch information
igorpecovnik committed Dec 24, 2024
1 parent 11f3c8c commit 5bb9df1
Show file tree
Hide file tree
Showing 20 changed files with 304 additions and 206 deletions.
File renamed without changes.
150 changes: 82 additions & 68 deletions tools/json/config.software.json

Large diffs are not rendered by default.

17 changes: 13 additions & 4 deletions tools/modules/runtime/config.runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,25 +94,34 @@ fi
#plex_media_port="$(lsof -i -P -n | grep TCP | grep LISTEN | grep 'plex' | awk -F: '{print $2}' | awk '{print $1}' | head -n 1)"
#update_sub_submenu_data "Software" "Media" "SW22" "https://localhost:$plex_media_port"

# System
update_sub_submenu_data "System" "Storage" "SY220" "$(module_zfs zfs_version)"
update_sub_submenu_data "System" "Storage" "SY221" "$(module_zfs zfs_installed_version)"
update_sub_submenu_data "System" "Storage" "NFS04" "$NFS_CLIENTS_NUMBER"

# Database
update_sub_submenu_data "Software" "Database" "DAT002" "Server: $LOCALIPADD"
update_sub_submenu_data "Software" "Database" "DAT006" "http://$LOCALIPADD:${module_options["module_phpmyadmin,port"]}"

# Media
update_sub_submenu_data "Software" "Media" "MED004" "http://$LOCALIPADD:${module_options["module_emby,port"]}"
update_sub_submenu_data "Software" "Media" "MED002" "http://$LOCALIPADD:${module_options["module_plexmediaserver,port"]}"
update_sub_submenu_data "Software" "Media" "MED004" "http://$LOCALIPADD:${module_options["module_embyserver,port"]}"
update_sub_submenu_data "Software" "Media" "MED011" "http://$LOCALIPADD:${module_options["module_stirling,port"]}"
update_sub_submenu_data "Software" "Media" "MED016" "http://$LOCALIPADD:${module_options["module_syncthing,port"]}"
update_sub_submenu_data "Software" "Media" "MED016" "http://$LOCALIPADD:${module_options["module_syncthing,port"]%% *}" # removing second port from url
update_sub_submenu_data "Software" "Media" "MED021" "https://$LOCALIPADD:${module_options["module_nextcloud,port"]}"
update_sub_submenu_data "Software" "Media" "MED026" "http://$LOCALIPADD:${module_options["module_owncloud,port"]}"
update_sub_submenu_data "Software" "Containers" "CON006" "http://$LOCALIPADD:${module_options["module_portainer,port"]}"

# Containers
update_sub_submenu_data "Software" "Containers" "CON006" "http://$LOCALIPADD:${module_options["module_portainer,port"]%% *}" # removing second port from url

# Home automation
update_sub_submenu_data "Software" "HomeAutomation" "HAB002" "http://$LOCALIPADD:${module_options["module_openhab,port"]}"
update_sub_submenu_data "Software" "HomeAutomation" "HAS002" "http://$LOCALIPADD:${module_options["module_haos,port"]}"

#
# DNS
update_sub_submenu_data "Software" "DNS" "DNS003" "http://$LOCALIPADD:${module_options["module_pi_hole,port"]%% *}" # removing second port from url

# Monitoring
update_sub_submenu_data "Software" "Monitoring" "MON002" "http://$LOCALIPADD:${module_options["module_uptimekuma,port"]}"
update_sub_submenu_data "Software" "Monitoring" "MON006" "http://$LOCALIPADD:${module_options["module_netdata,port"]}"

Expand Down
24 changes: 0 additions & 24 deletions tools/modules/software/install_plexmediaserver.sh

This file was deleted.

60 changes: 0 additions & 60 deletions tools/modules/software/install_portainer.sh

This file was deleted.

27 changes: 14 additions & 13 deletions tools/modules/software/module_embyserver.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
module_options+=(
["module_emby,author"]="@schwar3kat"
["module_emby,maintainer"]="@schwar3kat"
["module_emby,feature"]="module_emby"
["module_emby,example"]="install remove purge status help"
["module_emby,desc"]="Install embyserver container"
["module_emby,status"]="Active"
["module_emby,doc_link"]="https://emby.media"
["module_emby,group"]="Media"
["module_emby,port"]="8096"
["module_emby,arch"]="x86-64 arm64"
["module_embyserver,author"]="@schwar3kat"
["module_embyserver,maintainer"]="@schwar3kat"
["module_embyserver,feature"]="module_embyserver"
["module_embyserver,example"]="install remove purge status help"
["module_embyserver,desc"]="Install embyserver container"
["module_embyserver,status"]="Active"
["module_embyserver,doc_link"]="https://emby.media"
["module_embyserver,group"]="Media"
["module_embyserver,port"]="8096"
["module_embyserver,arch"]="x86-64 arm64"
)
#
# Module Emby server
#
function module_emby () {
function module_embyserver () {
local title="emby"
local condition=$(which "$title" 2>/dev/null)

Expand All @@ -23,7 +23,7 @@ function module_emby () {
fi

local commands
IFS=' ' read -r -a commands <<< "${module_options["module_emby,example"]}"
IFS=' ' read -r -a commands <<< "${module_options["module_embyserver,example"]}"

EMBY_BASE="${SOFTWARE_FOLDER}/emby"

Expand Down Expand Up @@ -60,6 +60,7 @@ function module_emby () {
[[ "${image}" ]] && docker image rm "$image" >/dev/null
;;
"${commands[2]}")
${module_options["module_embyserver,feature"]} ${commands[1]}
[[ -n "${EMBY_BASE}" && "${EMBY_BASE}" != "/" ]] && rm -rf "${EMBY_BASE}"
;;
"${commands[3]}")
Expand All @@ -80,7 +81,7 @@ function module_emby () {
echo
;;
*)
${module_options["module_embyserver,feature"]} ${commands[4]}
${module_options["module_embyserver,feature"]} ${commands[4]}
;;
esac
}
2 changes: 1 addition & 1 deletion tools/modules/software/module_jellyseerr.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module_options+=(
["module_jellyseerr,author"]="@armbian"
["module_jellyseerr,maintainer"]="@igorpecovnik"
["module_jellyseerr,feature"]="module_jellyseerr"
["module_jellyseerr,feature"]="module_jellyseerr"
["module_jellyseerr,example"]="install remove purge status help"
["module_jellyseerr,desc"]="Install jellyseerr container"
["module_jellyseerr,status"]="Active"
Expand Down
2 changes: 1 addition & 1 deletion tools/modules/software/module_mariadb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module_options+=(
["module_mariadb,status"]="Active"
["module_mariadb,doc_link"]="https://mariadb.org/documentation/"
["module_mariadb,group"]="Database"
["module_mariadb,port"]="3306"
["module_mariadb,port"]="3306"
["module_mariadb,arch"]="x86-64 arm64"
)
#
Expand Down
4 changes: 2 additions & 2 deletions tools/modules/software/module_netdata.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module_options+=(
["module_netdata,author"]="@armbian"
["module_netdata,maintainer"]="@igorpecovnik"
["module_netdata,feature"]="module_netdata"
["module_netdata,feature"]="module_netdata"
["module_netdata,example"]="install remove purge status help"
["module_netdata,desc"]="Install netdata container"
["module_netdata,status"]="Active"
["module_netdata,doc_link"]="https://transmissionbt.com/"
["module_netdata,group"]="Monitoring"
["module_netdata,port"]="19999"
["module_netdata,port"]="19999"
["module_netdata,arch"]="x86-64 arm64"
)
#
Expand Down
6 changes: 3 additions & 3 deletions tools/modules/software/module_nextcloud.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module_options+=(
["module_nextcloud,author"]="@igorpecovnik"
["module_nextcloud,maintainer"]="@igorpecovnik"
["module_nextcloud,maintainer"]="@igorpecovnik"
["module_nextcloud,feature"]="module_nextcloud"
["module_nextcloud,example"]="install remove purge status help"
["module_nextcloud,desc"]="Install nextcloud container"
["module_nextcloud,desc"]="Install nextcloud container"
["module_nextcloud,status"]="Active"
["module_nextcloud,doc_link"]="https://nextcloud.com/support/"
["module_nextcloud,group"]="Downloaders"
["module_nextcloud,port"]="443"
["module_nextcloud,port"]="443"
["module_nextcloud,arch"]="x86-64 arm64"
)
#
Expand Down
2 changes: 1 addition & 1 deletion tools/modules/software/module_owncloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module_options+=(
["module_owncloud,status"]="Active"
["module_owncloud,doc_link"]="https://doc.owncloud.com/"
["module_owncloud,group"]="Database"
["module_owncloud,port"]="7787"
["module_owncloud,port"]="7787"
["module_owncloud,arch"]="x86-64 arm64"
)
#
Expand Down
30 changes: 18 additions & 12 deletions tools/modules/software/module_pi-hole.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module_options+=(
["module_pi_hole,author"]="@armbian"
["module_pi_hole,maintainer"]="@igorpecovnik"
["module_pi_hole,feature"]="module_pi_hole"
["module_pi_hole,feature"]="module_pi_hole"
["module_pi_hole,example"]="install remove purge password status help"
["module_pi_hole,desc"]="Install Pi-hole container"
["module_pi_hole,status"]="Active"
["module_pi_hole,doc_link"]="https://docs.pi-hole.net/"
["module_pi_hole,group"]="DNS"
["module_pi_hole,port"]="80"
["module_pi_hole,port"]="80 53"
["module_pi_hole,arch"]="x86-64 arm64"
)
#
Expand All @@ -31,16 +31,22 @@ function module_pi_hole () {
pkg_installed docker-ce || module_docker install
[[ -d "$PIHOLE_BASE" ]] || mkdir -p "$PIHOLE_BASE" || { echo "Couldn't create storage directory: $PIHOLE_BASE"; exit 1; }
# disable dns within systemd-resolved
if systemctl is-active --quiet systemd-resolved.service && ! grep -q "^DNSStubListener=no" /etc/systemd/resolved.conf; then
sed -i "s/^#\?DNSStubListener=.*/DNSStubListener=no/" /etc/systemd/resolved.conf
systemctl restart systemd-resolved.service
sleep 3
if systemctl is-active --quiet systemd-resolved.service; then
# Debian doesn't enable this file by default
[[ ! -f /etc/systemd/resolved.conf ]] && ln -s /etc/systemd/resolved.conf.real /etc/systemd/resolved.conf
if ! grep -q "^DNSStubListener=no" /etc/systemd/resolved.conf 2> /dev/null; then
sed -i "s/^#\?DNSStubListener=.*/DNSStubListener=no/" /etc/systemd/resolved.conf
systemctl restart systemd-resolved.service
sleep 3
fi
fi
# disable dns within Network manager
if systemctl is-active --quiet NetworkManager && grep -q "dns=true" /etc/NetworkManager/NetworkManager.conf; then
sed -i "s/dns=.*/dns=false/g" /etc/NetworkManager/NetworkManager.conf
systemctl restart NetworkManager
sleep 3
if systemctl is-active --quiet NetworkManager && [[ -f /etc/NetworkManager/NetworkManager.conf ]]; then
if grep -q "dns=true" /etc/NetworkManager/NetworkManager.conf; then
sed -i "s/dns=.*/dns=false/g" /etc/NetworkManager/NetworkManager.conf
systemctl restart NetworkManager
sleep 3
fi
fi
docker run -d \
--name pihole \
Expand Down Expand Up @@ -94,15 +100,15 @@ function module_pi_hole () {
echo -e "\nUsage: ${module_options["module_pi_hole,feature"]} <command>"
echo -e "Commands: ${module_options["module_pi_hole,example"]}"
echo "Available commands:"
echo -e "\tinstall\t- Install $title."
echo -e "\tinstall\t- Install $title."
echo -e "\tremove\t- Remove $title."
echo -e "\tpurge\t- Purge $title."
echo -e "\tstatus\t- Installation status $title."
echo -e "\tpassword\t- Set webadmin password $title."
echo
;;
*)
${module_options["module_pi_hole,feature"]} ${commands[4]}
${module_options["module_pi_hole,feature"]} ${commands[5]}
;;
esac
}
Expand Down
64 changes: 64 additions & 0 deletions tools/modules/software/module_plexmediaserver.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
module_options+=(
["module_plexmediaserver,author"]="@schwar3kat"
["module_plexmediaserver,maintainer"]="@igorpecovnik"
["module_plexmediaserver,feature"]="Install plexmediaserver"
["module_plexmediaserver,example"]="install remove status"
["module_plexmediaserver,desc"]="Install plexmediaserver from repo using apt"
["module_plexmediaserver,status"]="Active"
["module_plexmediaserver,doc_link"]="https://www.plex.tv/"
["module_plexmediaserver,group"]="Media"
["module_plexmediaserver,port"]="32400"
["module_plexmediaserver,arch"]="x86-64 arm64"

)
#
# Install plexmediaserver using apt
#
module_plexmediaserver() {
local title="plexmediaserver"
local condition=$(which "$title" 2>/dev/null)

local commands
IFS=' ' read -r -a commands <<< "${module_options["module_plexmediaserver,example"]}"

case "$1" in
"${commands[0]}")
if [ ! -f /etc/apt/sources.list.d/plexmediaserver.list ]; then
echo "deb [arch=$(dpkg --print-architecture) \
signed-by=/usr/share/keyrings/plexmediaserver.gpg] https://downloads.plex.tv/repo/deb public main" \
| sudo tee /etc/apt/sources.list.d/plexmediaserver.list > /dev/null 2>&1
else
sed -i "/downloads.plex.tv/s/^#//g" /etc/apt/sources.list.d/plexmediaserver.list > /dev/null 2>&1
fi
# Note: for compatibility with existing source file in some builds format must be gpg not asc
# and location must be /usr/share/keyrings
wget -qO- https://downloads.plex.tv/plex-keys/PlexSign.key | gpg --dearmor \
| sudo tee /usr/share/keyrings/plexmediaserver.gpg > /dev/null 2>&1
pkg_update
pkg_install plexmediaserver
;;
"${commands[1]}")
sed -i '/plexmediaserver.gpg/s/^/#/g' /etc/apt/sources.list.d/plexmediaserver.list
pkg_remove plexmediaserver
;;
"${commands[2]}")
if pkg_installed plexmediaserver; then
return 0
else
return 1
fi
;;
"${commands[3]}")
echo -e "\nUsage: ${module_options["module_portainer,feature"]} <command>"
echo -e "Commands: ${module_options["module_portainer,example"]}"
echo "Available commands:"
echo -e "\tinstall\t- Install $title."
echo -e "\tstatus\t- Installation status $title."
echo -e "\tremove\t- Remove $title."
echo
;;
*)
${module_options["module_plexmediaserver,feature"]} ${commands[3]}
;;
esac
}
Loading

0 comments on commit 5bb9df1

Please sign in to comment.