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 "Setting up database"
|
||||
read -r -p "Forgejo uses SQLite by default. Would you like to use another database? <y/N> " prompt
|
||||
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
|
||||
PS3="Please enter your choice: "
|
||||
files="$(ls -A .)"
|
||||
select DB_CHOICE in "PostgreSQL" "MySQL" "MariaDB"; do
|
||||
msg_ok "You selected ${BL}${DB_CHOICE}${CL}"
|
||||
break
|
||||
done
|
||||
|
||||
DB_NAME=forgejodb
|
||||
DB_USER=forgejo
|
||||
DB_PASS="$(openssl rand -base64 18 | cut -c1-13)"
|
||||
DB_CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "DATABASE" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 4 \
|
||||
"1" "SQLite" ON \
|
||||
"2" "PostgreSQL " OFF \
|
||||
"3" "MySQL" OFF \
|
||||
"4" "MariaDB" OFF \
|
||||
--separate-output \
|
||||
3>&1 1>&2 2>&3)
|
||||
if [ "$DB_CHOICE" == "1" ]; then
|
||||
msg_info "SQLite will be setup automatically by Forgejo."
|
||||
fi
|
||||
if [ "$DB_CHOICE" == "2" ]; then
|
||||
if [ "$DB_CHOICE" == "PostgreSQL" ]; then
|
||||
msg_info "Setting up PostgreSQL"
|
||||
$STD apt-get install -y postgresql
|
||||
echo "" >>~/forgejo.creds
|
||||
|
@ -80,7 +79,7 @@ EOL
|
|||
msg_info "Restarted PostgreSQL"
|
||||
msg_info "Setup PostgreSQL"
|
||||
fi
|
||||
if [ "$DB_CHOICE" == "3" ]; then
|
||||
if [ "$DB_CHOICE" == "MySQL" ]; then
|
||||
msg_info "Setting up MySQL"
|
||||
$STD apt-get install -y mysql-server
|
||||
ADMIN_PASS="$(openssl rand -base64 18 | cut -c1-13)"
|
||||
|
@ -97,7 +96,7 @@ if [ "$DB_CHOICE" == "3" ]; then
|
|||
msg_info "Restarted MySQL"
|
||||
msg_info "Setup MySQL"
|
||||
fi
|
||||
if [ "$DB_CHOICE" == "4" ]; then
|
||||
if [ "$DB_CHOICE" == "MariaDB" ]; then
|
||||
msg_info "Setting up MariaDB"
|
||||
$STD apt-get install -y mariadb-server
|
||||
ADMIN_PASS="$(openssl rand -base64 18 | cut -c1-13)"
|
||||
|
@ -114,6 +113,9 @@ if [ "$DB_CHOICE" == "4" ]; then
|
|||
msg_info "Restarted MariaDB"
|
||||
msg_info "Setup MariaDB"
|
||||
fi
|
||||
else
|
||||
msg_ok "${BL}SQLite${CL} will be used"
|
||||
fi
|
||||
|
||||
read -r -p "Would you like to add Adminer? <y/N> " prompt
|
||||
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue