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 c7e2f46
Show file tree
Hide file tree
Showing 14 changed files with 222 additions and 135 deletions.
File renamed without changes.
62 changes: 36 additions & 26 deletions tools/json/config.software.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,28 +132,28 @@
"condition": "! module_pi_hole status"
},
{
"id": "DNS002",
"description": "Pi-hole web admin password",
"id": "DNS003",
"description": "Pi-hole remove",
"command": [
"module_pi_hole password"
"module_pi_hole remove"
],
"status": "Stable",
"author": "@armbian",
"condition": "module_pi_hole status"
},
{
"id": "DNS003",
"description": "Pi-hole DNS ad blocker remove",
"id": "DNS002",
"description": "Pi-hole change web admin password",
"command": [
"module_pi_hole remove"
"module_pi_hole password"
],
"status": "Stable",
"author": "@armbian",
"condition": "module_pi_hole status"
},
{
"id": "DNS004",
"description": "Pi-hole DNS ad blocker purge",
"description": "Pi-hole purge",
"command": [
"module_pi_hole remove"
],
Expand Down Expand Up @@ -972,8 +972,8 @@
},
{
"id": "CON005",
"description": "Install Portainer",
"prompt": "This operation will install Portainer.\nWould you like to continue?",
"description": "Portainer container management platform",
"prompt": "This operation will install Portainer container management platform.",
"command": [
"module_portainer install"
],
Expand All @@ -983,10 +983,21 @@
},
{
"id": "CON006",
"description": "Remove Portainer",
"prompt": "This operation will delete Portainer container.\nWould you like to continue?",
"description": "Portainer remove",
"prompt": "This operation will remove Portainer container management platform.",
"command": [
"module_portainer remove"
],
"status": "Stable",
"author": "@armbian",
"condition": "module_portainer status"
},
{
"id": "CON007",
"description": "Portainer purge with with data folder",
"prompt": "This operation will remove Portainer container management platform.",
"command": [
"module_portainer uninstall"
"module_portainer remove"
],
"status": "Stable",
"author": "@armbian",
Expand All @@ -1000,30 +1011,29 @@
"sub": [
{
"id": "MED001",
"description": "Install Plex Media server",
"description": "Plex Media server",
"about": "This operation will install Plex Media server.",
"command": [
"install_plexmediaserver"
"module_plexmediaserver install"
],
"status": "Stable",
"status": "Disabled",
"author": "@schwar3kat",
"condition": "! pkg_installed plexmediaserver"
"condition": "! module_plexmediaserver status"
},
{
"id": "MED002",
"description": "Remove Plex Media server",
"description": "Plex Media server remove",
"about": "This operation will purge Plex Media server.",
"command": [
"pkg_remove plexmediaserver",
"sed -i '/plexmediaserver.gpg/s/^/#/g' /etc/apt/sources.list.d/plexmediaserver.list"
"module_plexmediaserver remove"
],
"status": "Stable",
"status": "Disabled",
"author": "@schwar3kat",
"condition": "pkg_installed plexmediaserver"
"condition": "module_plexmediaserver status"
},
{
"id": "MED003",
"description": "Emby server Install",
"description": "Emby organizes video, music, live TV, and photos",
"about": "This operation will install Emby server.",
"command": [
"module_emby install"
Expand All @@ -1034,8 +1044,8 @@
},
{
"id": "MED004",
"description": "Emby server Remove",
"about": "This operation will purge Emby server.",
"description": "Emby server remove",
"about": "This operation will remove Emby server",
"command": [
"module_emby remove"
],
Expand All @@ -1045,13 +1055,13 @@
},
{
"id": "MED005",
"description": "Emby server Purge data folder",
"description": "Emby server purge with data folder",
"command": [
"module_emby purge"
],
"status": "Stable",
"author": "@schwar3kat",
"condition": "! module_emby status && [[ -d \"${SOFTWARE_FOLDER}/emby\" ]]"
"condition": "module_emby status"
},
{
"id": "MED010",
Expand Down
6 changes: 5 additions & 1 deletion tools/modules/runtime/config.runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,21 @@ 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" "MED002" "http://$LOCALIPADD:${module_options["module_plexmediaserver,port"]}"
update_sub_submenu_data "Software" "Media" "MED004" "http://$LOCALIPADD:${module_options["module_emby,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" "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"]}"
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

#
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.

26 changes: 16 additions & 10 deletions tools/modules/software/module_pi-hole.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module_options+=(
["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 @@ -102,7 +108,7 @@ function module_pi_hole () {
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 c7e2f46

Please sign in to comment.