From aa3873e35d9d6ca2b9924d9f3a14d5ac135f5872 Mon Sep 17 00:00:00 2001 From: Christopher Date: Fri, 29 Dec 2023 19:59:23 -0600 Subject: [PATCH] Add script to add LAN IP to Nextcloud config --- casaos-add-lan-ip-to-nextcloud-config/README.md | 9 +++++++++ casaos-add-lan-ip-to-nextcloud-config/run.sh | 16 ++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 casaos-add-lan-ip-to-nextcloud-config/README.md create mode 100644 casaos-add-lan-ip-to-nextcloud-config/run.sh diff --git a/casaos-add-lan-ip-to-nextcloud-config/README.md b/casaos-add-lan-ip-to-nextcloud-config/README.md new file mode 100644 index 0000000..949a40d --- /dev/null +++ b/casaos-add-lan-ip-to-nextcloud-config/README.md @@ -0,0 +1,9 @@ +# About + +This script adds your LAN IP to the nextcloud config.php. + +# Run command + +```bash +bash -c "$(wget -qLO - https://raw.githubusercontent.com/bigbeartechworld/big-bear-scripts/master/casaos-add-lan-ip-to-nextcloud-config/run.sh)" +``` diff --git a/casaos-add-lan-ip-to-nextcloud-config/run.sh b/casaos-add-lan-ip-to-nextcloud-config/run.sh new file mode 100644 index 0000000..00af058 --- /dev/null +++ b/casaos-add-lan-ip-to-nextcloud-config/run.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Get the LAN IP address +lan_ip=$(hostname -I | awk '{print $1}') + +# Backup the original config.php file +cp /DATA/AppData/big-bear-nextcloud/html/config/config.php /DATA/AppData/big-bear-nextcloud/html/config/config.php.bak + +# Add the LAN IP to the config.php file +awk -v ip="$lan_ip" '/0 => '\''localhost'\''/{print; print " 1 => '\''"ip"'\'',"; next}1' /DATA/AppData/big-bear-nextcloud/html/config/config.php.bak > /DATA/AppData/big-bear-nextcloud/html/config/config.php + +# Get the path to the docker-compose.yml file +COMPOSE_FILE="/var/lib/casaos/apps/big-bear-nextcloud/docker-compose.yml" + +# Apply changes using casaos-cli +casaos-cli app-management apply "big-bear-nextcloud" --file="$COMPOSE_FILE"