|
@@ -58,7 +58,6 @@ SED_ROOT_FOLDER="$(echo $ROOT_FOLDER | sed 's/\//\\\//g')"
|
|
|
|
|
|
NETWORK_INTERFACE="$(ip route | grep default | awk '{print $5}' | uniq)"
|
|
NETWORK_INTERFACE="$(ip route | grep default | awk '{print $5}' | uniq)"
|
|
INTERNAL_IP="$(ip addr show "${NETWORK_INTERFACE}" | grep "inet " | awk '{print $2}' | cut -d/ -f1)"
|
|
INTERNAL_IP="$(ip addr show "${NETWORK_INTERFACE}" | grep "inet " | awk '{print $2}' | cut -d/ -f1)"
|
|
-# INTERNAL_IP="$(hostname -I | awk '{print $1}')"
|
|
|
|
DNS_IP=9.9.9.9 # Default to Quad9 DNS
|
|
DNS_IP=9.9.9.9 # Default to Quad9 DNS
|
|
ARCHITECTURE="$(uname -m)"
|
|
ARCHITECTURE="$(uname -m)"
|
|
|
|
|
|
@@ -74,9 +73,7 @@ if [[ $UID != 0 ]]; then
|
|
fi
|
|
fi
|
|
|
|
|
|
# Configure Tipi if it isn't already configured
|
|
# Configure Tipi if it isn't already configured
|
|
-if [[ ! -f "${STATE_FOLDER}/configured" ]]; then
|
|
|
|
- "${ROOT_FOLDER}/scripts/configure.sh"
|
|
|
|
-fi
|
|
|
|
|
|
+"${ROOT_FOLDER}/scripts/configure.sh"
|
|
|
|
|
|
# Get field from json file
|
|
# Get field from json file
|
|
function get_json_field() {
|
|
function get_json_field() {
|
|
@@ -118,9 +115,6 @@ if [[ -f "/etc/resolv.conf" ]]; then
|
|
TEMP=$(grep -E -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' /etc/resolv.conf | head -n 1)
|
|
TEMP=$(grep -E -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' /etc/resolv.conf | head -n 1)
|
|
fi
|
|
fi
|
|
|
|
|
|
-# Get dns ip if pihole is installed
|
|
|
|
-str=$(get_json_field ${STATE_FOLDER}/apps.json installed)
|
|
|
|
-
|
|
|
|
# Create seed file with cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
|
|
# Create seed file with cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
|
|
if [[ ! -f "${STATE_FOLDER}/seed" ]]; then
|
|
if [[ ! -f "${STATE_FOLDER}/seed" ]]; then
|
|
echo "Generating seed..."
|
|
echo "Generating seed..."
|
|
@@ -143,6 +137,7 @@ ENV_FILE=$(mktemp)
|
|
|
|
|
|
JWT_SECRET=$(derive_entropy "jwt")
|
|
JWT_SECRET=$(derive_entropy "jwt")
|
|
POSTGRES_PASSWORD=$(derive_entropy "postgres")
|
|
POSTGRES_PASSWORD=$(derive_entropy "postgres")
|
|
|
|
+TIPI_VERSION=$(get_json_field "${ROOT_FOLDER}/package.json" version)
|
|
|
|
|
|
for template in ${ENV_FILE}; do
|
|
for template in ${ENV_FILE}; do
|
|
sed -i "s/<dns_ip>/${DNS_IP}/g" "${template}"
|
|
sed -i "s/<dns_ip>/${DNS_IP}/g" "${template}"
|
|
@@ -150,7 +145,7 @@ for template in ${ENV_FILE}; do
|
|
sed -i "s/<tz>/${TZ}/g" "${template}"
|
|
sed -i "s/<tz>/${TZ}/g" "${template}"
|
|
sed -i "s/<jwt_secret>/${JWT_SECRET}/g" "${template}"
|
|
sed -i "s/<jwt_secret>/${JWT_SECRET}/g" "${template}"
|
|
sed -i "s/<root_folder>/${SED_ROOT_FOLDER}/g" "${template}"
|
|
sed -i "s/<root_folder>/${SED_ROOT_FOLDER}/g" "${template}"
|
|
- sed -i "s/<tipi_version>/$(cat "${ROOT_FOLDER}/VERSION")/g" "${template}"
|
|
|
|
|
|
+ sed -i "s/<tipi_version>/${TIPI_VERSION}/g" "${template}"
|
|
sed -i "s/<architecture>/${ARCHITECTURE}/g" "${template}"
|
|
sed -i "s/<architecture>/${ARCHITECTURE}/g" "${template}"
|
|
sed -i "s/<nginx_port>/${NGINX_PORT}/g" "${template}"
|
|
sed -i "s/<nginx_port>/${NGINX_PORT}/g" "${template}"
|
|
sed -i "s/<proxy_port>/${PROXY_PORT}/g" "${template}"
|
|
sed -i "s/<proxy_port>/${PROXY_PORT}/g" "${template}"
|