1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/abantecart_ynh.git synced 2024-09-03 18:06:16 +02:00

Update install

This commit is contained in:
frju365 2017-01-29 01:28:44 +01:00 committed by GitHub
parent 9db945ccd2
commit 71675545e4

View file

@ -7,6 +7,8 @@ source ./_common
domain=$1
path=$2
is_public=$3
password=$4
with_mysql=$5
app=$YNH_APP_INSTANCE_NAME
@ -16,6 +18,30 @@ if [[ ! $? -eq 0 ]]; then
exit 1
fi
# Check password strength
[[ ${#password} -gt 5 ]] || ynh_die \
"The password is too weak, it must be longer than 5 characters"
# Save app settings
user="$app"
ynh_app_setting_set "$app" is_public "$is_public"
ynh_app_setting_set "$app" with_mysql "$with_mysql"
ynh_app_setting_set "$app" password "$password"
ynh_app_setting_set "$app" user "$user"
# Initialize database as needed
if [[ $with_mysql -eq 1 ]]; then
dbname=$app
dbuser=$app
dbpass=$4
ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass"
# Store the database access
echo -e "# MySQL Database
name: ${dbname}\nuser: ${dbuser}\npass: ${dbpass}" > ../sources/db_access.txt
ynh_app_setting_set "$app" mysqlpwd "$dbpass"
fi
# Remove trailing "/" for next commands
if [[ ! "$path" == "/" ]]; then
path=${path%/}