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:
parent
9db945ccd2
commit
71675545e4
1 changed files with 26 additions and 0 deletions
|
@ -7,6 +7,8 @@ source ./_common
|
||||||
domain=$1
|
domain=$1
|
||||||
path=$2
|
path=$2
|
||||||
is_public=$3
|
is_public=$3
|
||||||
|
password=$4
|
||||||
|
with_mysql=$5
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -16,6 +18,30 @@ if [[ ! $? -eq 0 ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
# Remove trailing "/" for next commands
|
||||||
if [[ ! "$path" == "/" ]]; then
|
if [[ ! "$path" == "/" ]]; then
|
||||||
path=${path%/}
|
path=${path%/}
|
||||||
|
|
Loading…
Add table
Reference in a new issue