Update phpmyadmin.sh
This commit is contained in:
parent
687dbf3575
commit
b22276cd19
@ -67,6 +67,14 @@ function check_internet() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function is_phpmyadmin_installed() {
|
||||||
|
if [[ "$OS" == "Debian" ]]; then
|
||||||
|
[[ -f "$INSTALL_DIR/config.inc.php" ]]
|
||||||
|
else
|
||||||
|
[[ -d "$INSTALL_DIR" ]] && rc-service lighttpd status &>/dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function install_php_and_modules() {
|
function install_php_and_modules() {
|
||||||
msg_info "Checking existing PHP installation"
|
msg_info "Checking existing PHP installation"
|
||||||
if command -v php >/dev/null 2>&1; then
|
if command -v php >/dev/null 2>&1; then
|
||||||
@ -245,9 +253,10 @@ function update_phpmyadmin() {
|
|||||||
configure_phpmyadmin
|
configure_phpmyadmin
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ -f "$INSTALL_DIR/config.inc.php" ]]; then
|
if is_phpmyadmin_installed; then
|
||||||
echo -e "${YW}⚠️ ${APP} is already installed at ${INSTALL_DIR}.${CL}"
|
echo -e "${YW}⚠️ ${APP} is already installed at ${INSTALL_DIR}.${CL}"
|
||||||
read -r -p "Would you like to Update (1), Uninstall (2) or Cancel (3)? [1/2/3]: " action
|
read -r -p "Would you like to Update (1), Uninstall (2) or Cancel (3)? [1/2/3]: " action
|
||||||
|
action="${action//[[:space:]]/}" # Eingabe bereinigen
|
||||||
case "$action" in
|
case "$action" in
|
||||||
1)
|
1)
|
||||||
check_internet
|
check_internet
|
||||||
@ -256,19 +265,28 @@ if [[ -f "$INSTALL_DIR/config.inc.php" ]]; then
|
|||||||
2)
|
2)
|
||||||
uninstall_phpmyadmin
|
uninstall_phpmyadmin
|
||||||
;;
|
;;
|
||||||
*)
|
3)
|
||||||
echo -e "${YW}⚠️ Action cancelled. Exiting.${CL}"
|
echo -e "${YW}⚠️ Action cancelled. Exiting.${CL}"
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
*)
|
||||||
|
echo -e "${YW}⚠️ Invalid input. Exiting.${CL}"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
read -r -p "Would you like to install ${APP}? (y/n): " install_prompt
|
read -r -p "Would you like to install ${APP}? (y/n): " install_prompt
|
||||||
|
install_prompt="${install_prompt//[[:space:]]/}" # Eingabe bereinigen
|
||||||
if [[ "${install_prompt,,}" =~ ^(y|yes)$ ]]; then
|
if [[ "${install_prompt,,}" =~ ^(y|yes)$ ]]; then
|
||||||
check_internet
|
check_internet
|
||||||
install_php_and_modules
|
install_php_and_modules
|
||||||
install_phpmyadmin
|
install_phpmyadmin
|
||||||
configure_phpmyadmin
|
configure_phpmyadmin
|
||||||
|
if [[ "$OS" == "Debian" ]]; then
|
||||||
echo -e "${CM} ${GN}${APP} is reachable at: ${BL}http://${IP}/phpMyAdmin${CL}"
|
echo -e "${CM} ${GN}${APP} is reachable at: ${BL}http://${IP}/phpMyAdmin${CL}"
|
||||||
|
else
|
||||||
|
echo -e "${CM} ${GN}${APP} is reachable at: ${BL}http://${IP}/${CL}"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo -e "${YW}⚠️ Installation skipped. Exiting.${CL}"
|
echo -e "${YW}⚠️ Installation skipped. Exiting.${CL}"
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user