diff --git a/conf/database.php b/conf/database.php index e1ed0fa..27e1a9e 100755 --- a/conf/database.php +++ b/conf/database.php @@ -5,9 +5,9 @@ class DATABASE_CONFIG { 'datasource' => 'Database/Mysql', 'persistent' => false, 'host' => 'localhost', - 'login' => 'LOGIN1', - 'password' => 'PASSWORD1', - 'database' => 'DATABASE1', + 'login' => '__DBUSER__', + 'password' => '__DBPWD__', + 'database' => '__DBNAME__', 'encoding' => 'utf8', ]; } diff --git a/scripts/install b/scripts/install index 3cc412e..82008df 100644 --- a/scripts/install +++ b/scripts/install @@ -47,7 +47,7 @@ app=$YNH_APP_INSTANCE_NAME ### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app". ### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app" -final_path=/opt/yunohost/$app +final_path=/var/www/$app test ! -e "$final_path" || ynh_die "This path already contains a folder" # Normalize the url path syntax @@ -81,6 +81,20 @@ port=$(ynh_find_port 8096) yunohost firewall allow --no-upnp TCP $port 2>&1 ynh_app_setting_set $app port $port +#================================================= +# CREATE A MYSQL DATABASE +#================================================= +# If your app uses a MySQL database, you can use these lines to bootstrap +# a database, an associated user and save the password in app settings + +db_name=$(ynh_sanitize_dbid $app) +ynh_app_setting_set $app db_name $db_name +ynh_mysql_setup_db $db_name $db_name + + + 'login' => '', + 'password' => '', + 'database' => '', #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -89,12 +103,6 @@ ynh_app_setting_set $app final_path $final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source "$final_path" -#============================================== -# INSTALL EMBY -#============================================== - -dpkg --install $final_path/emby-server-deb* - #================================================= # NGINX CONFIGURATION #================================================= @@ -112,9 +120,12 @@ ynh_system_user_create $app #================================================= # MODIFY A CONFIG FILE #================================================= -#cp -a ../conf/onlyoffice-documentserver.conf /etc/onlyoffice/documentserver/nginx/onlyoffice-documentserver.conf -#ynh_replace_string "__NEXTCLOUDDOMAIN__" "$nextcloud_domain" "/etc/loolwsd/loolwsd.xml" -#ynh_replace_string "__PASSWORD__" "$password" "/etc/loolwsd/loolwsd.xml" + +cp -a ../conf/database.php $final_path/database.php + +ynh_replace_string "__DBUSER__" "$db_name" "$final_path/config.json" +ynh_replace_string "__DBPWD__" "$db_pwd" "$final_path/config.json" +ynh_replace_string "__DBNAME__" "$db_name" "$final_path/config.json" #================================================= # STORE THE CONFIG FILE CHECKSUM