Install local DirectAdmin plugins

This commit is contained in:
Marek Miklewicz
2026-06-13 20:16:49 +02:00
parent 76818500b1
commit 0e04667160
5 changed files with 92 additions and 14 deletions
+53 -14
View File
@@ -14,7 +14,9 @@ LOG_FILE=/var/log/dapostinstall.log
HTLINK="https://ht.zenadmin.pl"
DEFAULT_NS1=dns3.hitme.net.pl
DEFAULT_NS2=dns4.hitme.net.pl
REDIS_VERSION=8
SETUP_TXT="$DADIR/conf/setup.txt"
PLUGIN_ARCHIVE_DIR="$DAPOSTINSTALL_DIR/plugins"
BRANDING_DIR="$DAPOSTINSTALL_DIR/branding"
DA_TEMPLATES_ARCHIVE="$BRANDING_DIR/da_templates.tar"
DA_BRANDING_ARCHIVE="$BRANDING_DIR/da-branding-hitme.tar.gz"
@@ -67,6 +69,53 @@ build_php_extension() {
da build "$target"
}
install_local_plugin_archive() {
local archive="$1"
local plugin_name
local plugin_dir
plugin_name="$(basename "$archive" .tar.gz)"
plugin_dir="$DADIR/plugins/$plugin_name"
echo "Instalacja pluginu $plugin_name"
rm -rf "$plugin_dir"
mkdir -p "$plugin_dir"
tar -zxf "$archive" -C "$plugin_dir"
if [[ -f "$plugin_dir/install.sh" ]]; then
chmod 755 "$plugin_dir/install.sh"
(
cd "$plugin_dir"
./install.sh
)
else
fail "Brak wykonywalnego install.sh w $plugin_dir"
fi
if [[ "$plugin_name" == "redis-manager" ]]; then
require_file "$DADIR/plugins/redis-manager/scripts/redis_migrate.sh"
chmod 755 "$DADIR/plugins/redis-manager/scripts/redis_migrate.sh"
"$DADIR/plugins/redis-manager/scripts/redis_migrate.sh" "$REDIS_VERSION"
fi
}
install_local_plugins() {
local archive
local found=0
shopt -s nullglob
for archive in "$PLUGIN_ARCHIVE_DIR"/*.tar.gz; do
found=1
install_local_plugin_archive "$archive"
done
shopt -u nullglob
if [[ "$found" -eq 0 ]]; then
fail "Brak paczek pluginów w $PLUGIN_ARCHIVE_DIR"
fi
}
update_daupdate_tools() {
echo "update..."
wget "$HTLINK/daupdate.sh" -O /sbin/daupdate
@@ -84,6 +133,7 @@ require_dir "$DADIR"
require_dir "$CBDIR"
require_file "$CBDIR/build"
require_file "$SETUP_TXT"
require_dir "$PLUGIN_ARCHIVE_DIR"
require_file "$DA_TEMPLATES_ARCHIVE"
require_file "$DA_BRANDING_ARCHIVE"
yum -y install epel-release
@@ -365,11 +415,10 @@ build_php_extension "$opcache" "opcache" "opcache"
build_php_extension "$imap" "php_imap" "php_imap"
build_php_extension "$imagick" "imagick" "imagick"
echo "Instalacja Memcache i redis"
echo "Instalacja Memcache"
yum -y install memcached libmemcached
systemctl enable memcached
systemctl restart memcached
yum -y install redis redis-devel
echo "Instalacja rozszerzen PECL od poralixa"
cd $DADIR/scripts/custom
@@ -383,12 +432,6 @@ touch custom/php_disable_functions
echo "exec,system,passthru,shell_exec,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname" > custom/php_disable_functions
da build secure_php
# Poprawka redis dla AlmaLinux 9
if grep -q "AlmaLinux release 9" /etc/redhat-release; then
ln -s /etc/redis/redis.conf /etc/redis.conf
fi
echo "Optymalizacja MySQL"
cd $DAPOSTINSTALL_DIR
\cp -f my.cnf /etc/my.cnf
@@ -439,13 +482,9 @@ touch /etc/ssh/sshd_config_placebo
sed -i 's^/etc/ssh/sshd_config^/etc/ssh/sshd_config_placebo^g' $DADIR/conf/directadmin.conf
systemctl restart directadmin
echo "Instalacja REDISa"
cd $DADIR/scripts/custom
./php-extension.sh install redis
mkdir $DADIR/plugins/redis_management
echo "Instalacja pluginów DirectAdmin"
cd $DAPOSTINSTALL_DIR
tar -zxf redis_management.tar.gz -C $DADIR/plugins/redis_management
$DADIR/plugins/redis_management/scripts/install.sh
install_local_plugins
cd $DAPOSTINSTALL_DIR
echo "Instalacja IMAPsync"