Skip to content

Commit ad89d93

Browse files
authored
Numerous bugfixes (#2772)
1 parent 0fe3e7a commit ad89d93

File tree

8 files changed

+121
-19
lines changed

8 files changed

+121
-19
lines changed

apps/adminer.sh

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
44

55
true
6-
SCRIPT_NAME="Adminer"
7-
SCRIPT_EXPLAINER="Adminer is a full-featured database management tool written in PHP."
6+
SCRIPT_NAME="AdminNeo"
7+
SCRIPT_EXPLAINER="AdminNeo is a full-featured database management tool written in PHP.
8+
It's a continuation of Adminer development after AdminerEvo was archived.
9+
More info: https://www.adminneo.org"
810
# shellcheck source=lib.sh
911
source /var/scripts/fetch_lib.sh
1012

@@ -52,13 +54,35 @@ a2enmod ssl
5254
# Install Adminer
5355
apt-get update -q4 & spinner_loading
5456
install_if_not adminer
55-
curl_to_dir "https://download.adminerevo.org/latest/adminer" "adminer-pgsql.zip" "$ADMINERDIR"
56-
install_if_not unzip
57-
# Unzip the latest version
58-
unzip "$ADMINERDIR"/adminer-pgsql.zip -d "$ADMINERDIR"
59-
rm -f "$ADMINERDIR"/adminer-pgsql.zip
60-
# curl_to_dir "https://raw.githubusercontent.com/Niyko/Hydra-Dark-Theme-for-Adminer/master" "adminer.css" "$ADMINERDIR"
61-
mv "$ADMINERDIR"/adminer-pgsql.php "$ADMINERDIR"/adminer.php
57+
58+
# AdminerEvo project has been archived, switching to AdminNeo (www.adminneo.org)
59+
# See: https://github.com/adminneo-org/adminneo
60+
print_text_in_color "$ICyan" "Downloading AdminNeo version ${ADMINER_VERSION}..."
61+
if ! curl_to_dir "https://www.adminneo.org/files/${ADMINER_VERSION}/pgsql_en_default/" "adminneo-${ADMINER_VERSION}.php" "$ADMINERDIR"
62+
then
63+
msg_box "Failed to download AdminNeo. The download URL may have changed.
64+
65+
Please report this issue to: $ISSUES
66+
67+
Attempted to download from:
68+
$ADMINER_DOWNLOAD_URL"
69+
exit 1
70+
fi
71+
72+
# Rename to standard adminer.php name
73+
if [ -f "$ADMINERDIR/adminneo-${ADMINER_VERSION}.php" ]
74+
then
75+
mv "$ADMINERDIR/adminneo-${ADMINER_VERSION}.php" "$ADMINERDIR/adminer.php"
76+
elif [ -f "$ADMINERDIR/adminerneo-${ADMINER_VERSION}-pgsql.php" ]
77+
then
78+
# Fallback for old naming if somehow still exists
79+
mv "$ADMINERDIR/adminerneo-${ADMINER_VERSION}-pgsql.php" "$ADMINERDIR/adminer.php"
80+
else
81+
msg_box "Failed to find downloaded AdminNeo file. Please report this to $ISSUES"
82+
exit 1
83+
fi
84+
85+
print_text_in_color "$IGreen" "AdminNeo ${ADMINER_VERSION} successfully downloaded!"
6286

6387
# Only add TLS 1.3 on Ubuntu later than 22.04
6488
if version 22.04 "$DISTRO" 24.04.10

apps/imaginary.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ debug_mode
2121
root_check
2222

2323
# Check recources
24-
# If we can calculate the cpu and ram, then set it to the lowest possible, if not, then hardcode it to a recomended minimum.
24+
# If we can calculate the cpu and ram, then set it to the lowest possible, if not, then hardcode it to a recommended minimum.
2525
if which nproc >/dev/null 2>&1
2626
then
2727
ram_check 2 Imaginary

apps/talk.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ https://gitlab.com/packaging/nextcloud-spreed-signaling
247247
https://gitlab.com/packaging/janus/"
248248

249249
# Ask the user if he/she wants the HPB server as well
250-
if ! yesno_box_no "Do you want to install the $SCRIPT_NAME? Please note that using basic Talk is usally enough."
250+
if ! yesno_box_no "Do you want to install the $SCRIPT_NAME? Please note that using basic Talk is usually enough."
251251
then
252252
exit 1
253253
fi

lib.sh

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,22 @@ NOTIFY_PUSH_SERVICE_PATH="/etc/systemd/system/notify_push.service"
169169
ADMINERDIR=/usr/share/adminer
170170
ADMINER_CONF="$SITES_AVAILABLE/adminer.conf"
171171
ADMINER_CONF_PLUGIN="$ADMINERDIR/extra_plugins.php"
172+
# Get latest AdminNeo version dynamically from GitHub releases
173+
get_adminneo_version() {
174+
local version
175+
version=$(curl -s -m 30 "https://api.github.com/repos/adminneo-org/adminneo/releases/latest" | grep -oP '"tag_name":\s*"v\K[^"]+')
176+
177+
# Validate version format (X.X.X)
178+
if echo "$version" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'
179+
then
180+
echo "$version"
181+
else
182+
# Fallback to known stable version
183+
echo "5.1.1"
184+
fi
185+
}
186+
ADMINER_VERSION=$(get_adminneo_version)
187+
ADMINER_DOWNLOAD_URL="https://www.adminneo.org/files/${ADMINER_VERSION}/pgsql_en_default/adminneo-${ADMINER_VERSION}.php"
172188
# Redis
173189
REDIS_CONF=/etc/redis/redis.conf
174190
REDIS_SOCK=/var/run/redis/redis-server.sock
@@ -184,8 +200,22 @@ fulltextsearch_install() {
184200
ELASTIC_USER_PASSWORD=$(gen_passwd "$SHUF" '[:lower:]')
185201
FULLTEXTSEARCH_IMAGE_NAME=fulltextsearch_es01
186202
FULLTEXTSEARCH_SERVICE=nextcloud-fulltext-elasticsearch-worker.service
203+
187204
# Gets the version from the latest tag here: https://github.com/docker-library/official-images/blob/master/library/elasticsearch
188-
FULLTEXTSEARCH_IMAGE_NAME_LATEST_TAG="$(curl -s -m 900 https://raw.githubusercontent.com/docker-library/official-images/refs/heads/master/library/elasticsearch | grep "Tags:" | head -1 | awk '{print $2}')"
205+
# Use limit=500 to ensure we get version tags, not just SHA tags
206+
# Extract version numbers (format: X.XX.X), sort them, and get the latest
207+
FULLTEXTSEARCH_IMAGE_NAME_LATEST_TAG="$(curl -s -m 900 'https://raw.githubusercontent.com/docker-library/official-images/refs/heads/master/library/elasticsearch' | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -1)"
208+
209+
# Validate that we got a proper version number
210+
if ! echo "$FULLTEXTSEARCH_IMAGE_NAME_LATEST_TAG" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'
211+
then
212+
print_text_in_color "$IRed" "Failed to detect ElasticSearch version. Got: '$FULLTEXTSEARCH_IMAGE_NAME_LATEST_TAG'"
213+
print_text_in_color "$ICyan" "Falling back to known stable version..."
214+
FULLTEXTSEARCH_IMAGE_NAME_LATEST_TAG="8.16.1"
215+
fi
216+
217+
print_text_in_color "$ICyan" "ElasticSearch version detected: $FULLTEXTSEARCH_IMAGE_NAME_LATEST_TAG"
218+
189219
# Legacy, changed 2023-09-21
190220
DOCKER_IMAGE_NAME=es01
191221
# Legacy, not used at all

menu/documentserver.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ debug_mode
1717
root_check
1818

1919
choice=$(whiptail --title "$TITLE" --menu \
20-
"Which Documentserver for online editing do you want to install?\n\nWe recomend Collabora with Docker. The subdomain could look like this:\noffice.your-nextcloud.tld\n\nAutomatically configure and install the selected Documentserver.
20+
"Which Documentserver for online editing do you want to install?\n\nWe recommend Collabora with Docker. The subdomain could look like this:\noffice.your-nextcloud.tld\n\nAutomatically configure and install the selected Documentserver.
2121
$MENU_GUIDE\n\n$RUN_LATER_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4 \
2222
"Collabora (Docker)" "(Extra Subdomain required)" \
2323
"Collabora (Integrated)" "(No Subdomain required)" \

network/geoblock.sh

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,32 +81,68 @@ then
8181
fi
8282

8383
##### GeoIP script (Apache Setup)
84-
# Install requirements
84+
# Install requirements
8585
yes | add-apt-repository ppa:maxmind/ppa
8686
apt-get update -q4 & spinner_loading
8787
install_if_not libmaxminddb0
8888
install_if_not libmaxminddb-dev
8989
install_if_not mmdb-bin
9090
install_if_not apache2-dev
9191

92+
# Verify apxs is available after installing apache2-dev
93+
if ! command -v apxs2 >/dev/null 2>&1 && ! command -v apxs >/dev/null 2>&1
94+
then
95+
msg_box "Error: apxs/apxs2 tool not found even after installing apache2-dev.
96+
97+
This tool is required to compile the MaxMindDB Apache module.
98+
Please report this issue to: $ISSUES"
99+
exit 1
100+
fi
101+
92102
# maxminddb_module https://github.com/maxmind/mod_maxminddb
93103
cd /tmp
94104
curl_to_dir https://github.com/maxmind/mod_maxminddb/releases/download/1.2.0/ mod_maxminddb-1.2.0.tar.gz /tmp
95105
tar -xzf mod_maxminddb-1.2.0.tar.gz
96106
cd mod_maxminddb-1.2.0
107+
108+
print_text_in_color "$ICyan" "Compiling MaxMindDB Apache module..."
97109
if ./configure
98110
then
99-
make install
111+
if make
112+
then
113+
if make install
114+
then
115+
print_text_in_color "$IGreen" "MaxMindDB Apache module compiled and installed successfully!"
116+
else
117+
msg_box "Failed to install MaxMindDB module. Please report this to $ISSUES"
118+
exit 1
119+
fi
120+
else
121+
msg_box "Failed to compile MaxMindDB module. Please report this to $ISSUES"
122+
exit 1
123+
fi
124+
100125
# Delete conf made by module
101126
rm -f /etc/apache2/mods-enabled/maxminddb.conf
127+
102128
# Check if module is enabled
103129
if ! apachectl -M | grep -i "maxminddb"
104130
then
105-
msg_box "Couldn't install the Apache module for MaxMind. Please report this to $ISSUES"
131+
msg_box "Couldn't load the Apache module for MaxMind after installation. Please report this to $ISSUES"
106132
exit 1
107133
fi
134+
135+
print_text_in_color "$IGreen" "MaxMindDB module loaded in Apache successfully!"
136+
108137
# Cleanup
138+
cd /tmp
109139
rm -rf mod_maxminddb-1.2.0 mod_maxminddb-1.2.0.tar.gz
140+
else
141+
msg_box "Failed to configure MaxMindDB module compilation.
142+
143+
This usually means apxs/apxs2 is not properly installed.
144+
Please report this issue to: $ISSUES"
145+
exit 1
110146
fi
111147

112148
# Enable modules

nextcloud_install_production.sh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,13 +362,25 @@ done
362362
apt-get update -q4 & spinner_loading
363363
install_if_not postgresql
364364

365-
# Create DB
365+
# Create DB with proper permissions for Nextcloud 30+
366+
# PostgreSQL 15+ requires explicit schema permissions
366367
cd /tmp
367-
sudo -u postgres psql <<END
368+
if ! sudo -u postgres psql <<END
368369
CREATE USER $PGDB_USER WITH PASSWORD '$PGDB_PASS';
369370
CREATE DATABASE nextcloud_db WITH OWNER $PGDB_USER TEMPLATE template0 ENCODING 'UTF8';
371+
\c nextcloud_db
372+
GRANT CREATE ON SCHEMA public TO $PGDB_USER;
373+
GRANT ALL ON SCHEMA public TO $PGDB_USER;
374+
ALTER DATABASE nextcloud_db OWNER TO $PGDB_USER;
370375
END
376+
then
377+
print_text_in_color "$IRed" "Failed to create PostgreSQL database with proper permissions!"
378+
print_text_in_color "$ICyan" "Please report this to $ISSUES"
379+
exit 1
380+
fi
381+
371382
print_text_in_color "$ICyan" "PostgreSQL password: $PGDB_PASS"
383+
print_text_in_color "$IGreen" "PostgreSQL database created with schema permissions for Nextcloud 30+"
372384
systemctl restart postgresql.service
373385

374386
# Install Apache

torrent/create.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#########
88

99
## This script will install Transmission, download the latest version of the VM, create a torrent of the file and seed it using Transmission
10-
## Improvments to the script are welcome!
10+
## Improvements to the script are welcome!
1111

1212
# shellcheck source=lib.sh
1313
# shellcheck disable=SC2046

0 commit comments

Comments
 (0)