add install_adminer

This commit is contained in:
CanbiZ 2025-05-27 11:39:50 +02:00
parent dfd50adc7c
commit 7af8ae81ac
2 changed files with 31 additions and 33 deletions

View File

@ -25,15 +25,6 @@ NODE_VERSION="22" NODE_MODULE="yarn@latest" install_node_and_modules
PG_VERSION="15" install_postgresql
RUST_CRATES="monolith" install_rust_and_crates
# msg_info "Installing Rust"
# curl -fsSL https://sh.rustup.rs -o rustup-init.sh
# $STD bash rustup-init.sh -y --profile minimal
# echo 'export PATH="$HOME/.cargo/bin:$PATH"' >>~/.bashrc
# export PATH="$HOME/.cargo/bin:$PATH"
# rm rustup-init.sh
# $STD cargo install monolith
# msg_ok "Installed Rust"
msg_info "Setting up PostgreSQL DB"
DB_NAME=linkwardendb
DB_USER=linkwarden
@ -53,30 +44,10 @@ $STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC';"
} >>~/linkwarden.creds
msg_ok "Set up PostgreSQL DB"
# read -r -p "${TAB3}Would you like to add Adminer? <y/N> " prompt
# if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
# msg_info "Installing Adminer"
# $STD apt install -y adminer
# $STD a2enconf adminer
# systemctl reload apache2
# IP=$(hostname -I | awk '{print $1}')
# echo "" >>~/linkwarden.creds
# echo -e "Adminer Interface: \e[32m$IP/adminer/\e[0m" >>~/linkwarden.creds
# echo -e "Adminer System: \e[32mPostgreSQL\e[0m" >>~/linkwarden.creds
# echo -e "Adminer Server: \e[32mlocalhost:5432\e[0m" >>~/linkwarden.creds
# echo -e "Adminer Username: \e[32m$DB_USER\e[0m" >>~/linkwarden.creds
# echo -e "Adminer Password: \e[32m$DB_PASS\e[0m" >>~/linkwarden.creds
# echo -e "Adminer Database: \e[32m$DB_NAME\e[0m" >>~/linkwarden.creds
# {
# echo ""
# echo "Adminer-Credentials"
# echo "Adminer WebUI: $IP/adminer/"
# echo "Adminer Database User: $DB_USER"
# echo "Adminer Database Password: $DB_PASS"
# echo "Adminer Database Name: $DB_NAME"
# } >>~/linkwarden.creds
# msg_ok "Installed Adminer"
# fi
read -r -p "${TAB3}Would you like to add Adminer? <y/N> " prompt
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
install_adminer
fi
msg_info "Installing Linkwarden (Patience)"
cd /opt

View File

@ -1235,3 +1235,30 @@ install_rust_and_crates() {
msg_ok "All requested Rust crates processed"
fi
}
# ------------------------------------------------------------------------------
# Installs Adminer (Debian/Ubuntu via APT, Alpine via direct download).
#
# Description:
# - Adds Adminer to Apache or web root
# - Supports Alpine and Debian-based systems
# ------------------------------------------------------------------------------
install_adminer() {
if grep -qi alpine /etc/os-release; then
msg_info "Installing Adminer (Alpine)"
mkdir -p /var/www/localhost/htdocs/adminer
if ! curl -fsSL https://github.com/vrana/adminer/releases/latest/download/adminer.php \
-o /var/www/localhost/htdocs/adminer/index.php; then
msg_error "Failed to download Adminer"
return 1
fi
msg_ok "Adminer available at /adminer (Alpine)"
else
msg_info "Installing Adminer (Debian/Ubuntu)"
$STD apt-get install -y adminer
$STD a2enconf adminer
$STD systemctl reload apache2
msg_ok "Adminer available at /adminer (Debian/Ubuntu)"
fi
}