mirror of
https://github.com/tteck/Proxmox.git
synced 2025-02-15 06:09:15 +01:00
lxc-forgejo: Replace 'whiptail' for database selection with 'select'
This commit is contained in:
parent
310cc3ebe6
commit
6b222b9ab8
1 changed files with 69 additions and 67 deletions
|
@ -41,20 +41,19 @@ echo -e "Forgejo data directory: \e[32m/var/lib/forgejo\e[0m" >>~/forgejo.creds
|
||||||
msg_info "Setup Forgejo"
|
msg_info "Setup Forgejo"
|
||||||
|
|
||||||
msg_info "Setting up database"
|
msg_info "Setting up database"
|
||||||
DB_NAME=forgejodb
|
read -r -p "Forgejo uses SQLite by default. Would you like to use another database? <y/N> " prompt
|
||||||
DB_USER=forgejo
|
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
|
||||||
DB_PASS="$(openssl rand -base64 18 | cut -c1-13)"
|
PS3="Please enter your choice: "
|
||||||
DB_CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "DATABASE" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 4 \
|
files="$(ls -A .)"
|
||||||
"1" "SQLite" ON \
|
select DB_CHOICE in "PostgreSQL" "MySQL" "MariaDB"; do
|
||||||
"2" "PostgreSQL " OFF \
|
msg_ok "You selected ${BL}${DB_CHOICE}${CL}"
|
||||||
"3" "MySQL" OFF \
|
break
|
||||||
"4" "MariaDB" OFF \
|
done
|
||||||
--separate-output \
|
|
||||||
3>&1 1>&2 2>&3)
|
DB_NAME=forgejodb
|
||||||
if [ "$DB_CHOICE" == "1" ]; then
|
DB_USER=forgejo
|
||||||
msg_info "SQLite will be setup automatically by Forgejo."
|
DB_PASS="$(openssl rand -base64 18 | cut -c1-13)"
|
||||||
fi
|
if [ "$DB_CHOICE" == "PostgreSQL" ]; then
|
||||||
if [ "$DB_CHOICE" == "2" ]; then
|
|
||||||
msg_info "Setting up PostgreSQL"
|
msg_info "Setting up PostgreSQL"
|
||||||
$STD apt-get install -y postgresql
|
$STD apt-get install -y postgresql
|
||||||
echo "" >>~/forgejo.creds
|
echo "" >>~/forgejo.creds
|
||||||
|
@ -79,8 +78,8 @@ EOL
|
||||||
$STD systemctl restart postgresql
|
$STD systemctl restart postgresql
|
||||||
msg_info "Restarted PostgreSQL"
|
msg_info "Restarted PostgreSQL"
|
||||||
msg_info "Setup PostgreSQL"
|
msg_info "Setup PostgreSQL"
|
||||||
fi
|
fi
|
||||||
if [ "$DB_CHOICE" == "3" ]; then
|
if [ "$DB_CHOICE" == "MySQL" ]; then
|
||||||
msg_info "Setting up MySQL"
|
msg_info "Setting up MySQL"
|
||||||
$STD apt-get install -y mysql-server
|
$STD apt-get install -y mysql-server
|
||||||
ADMIN_PASS="$(openssl rand -base64 18 | cut -c1-13)"
|
ADMIN_PASS="$(openssl rand -base64 18 | cut -c1-13)"
|
||||||
|
@ -96,8 +95,8 @@ if [ "$DB_CHOICE" == "3" ]; then
|
||||||
$STD systemctl restart mysql
|
$STD systemctl restart mysql
|
||||||
msg_info "Restarted MySQL"
|
msg_info "Restarted MySQL"
|
||||||
msg_info "Setup MySQL"
|
msg_info "Setup MySQL"
|
||||||
fi
|
fi
|
||||||
if [ "$DB_CHOICE" == "4" ]; then
|
if [ "$DB_CHOICE" == "MariaDB" ]; then
|
||||||
msg_info "Setting up MariaDB"
|
msg_info "Setting up MariaDB"
|
||||||
$STD apt-get install -y mariadb-server
|
$STD apt-get install -y mariadb-server
|
||||||
ADMIN_PASS="$(openssl rand -base64 18 | cut -c1-13)"
|
ADMIN_PASS="$(openssl rand -base64 18 | cut -c1-13)"
|
||||||
|
@ -113,6 +112,9 @@ if [ "$DB_CHOICE" == "4" ]; then
|
||||||
$STD systemctl restart mariadb
|
$STD systemctl restart mariadb
|
||||||
msg_info "Restarted MariaDB"
|
msg_info "Restarted MariaDB"
|
||||||
msg_info "Setup MariaDB"
|
msg_info "Setup MariaDB"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
msg_ok "${BL}SQLite${CL} will be used"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
read -r -p "Would you like to add Adminer? <y/N> " prompt
|
read -r -p "Would you like to add Adminer? <y/N> " prompt
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue