mirror of
https://github.com/YunoHost-Apps/ampache_ynh.git
synced 2024-09-03 18:15:55 +02:00
apply new recommendations from #21
This commit is contained in:
parent
0b3f9e2611
commit
185dd67aec
8 changed files with 30 additions and 37 deletions
|
@ -22,7 +22,7 @@
|
||||||
Level 1=auto
|
Level 1=auto
|
||||||
Level 2=auto
|
Level 2=auto
|
||||||
Level 3=auto
|
Level 3=auto
|
||||||
Level 4=auto
|
Level 4=1
|
||||||
Level 5=auto
|
Level 5=auto
|
||||||
Level 6=auto
|
Level 6=auto
|
||||||
Level 7=auto
|
Level 7=auto
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
"version": "1.0",
|
"version": "1.0",
|
||||||
"url": "http://ampache.org",
|
"url": "http://ampache.org",
|
||||||
"packaging_format": 1,
|
"packaging_format": 1,
|
||||||
"license": "free",
|
"license": "AGPL-3.0",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
"name": "aymhce",
|
"name": "aymhce",
|
||||||
"email": "aymhce@gmail.com"
|
"email": "aymhce@gmail.com"
|
||||||
|
|
|
@ -21,14 +21,14 @@ ampache_ynh_prepareconfig () {
|
||||||
|
|
||||||
# Ampache installation
|
# Ampache installation
|
||||||
ampache_ynh_install () {
|
ampache_ynh_install () {
|
||||||
ORIPATH=$(pwd)
|
(
|
||||||
cd $final_path
|
cd $final_path
|
||||||
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||||
php composer-setup.php
|
php composer-setup.php
|
||||||
php composer.phar install --prefer-source --no-interaction
|
php composer.phar install --prefer-source --no-interaction
|
||||||
# Set permissions to ampache directory
|
# Set permissions to ampache directory
|
||||||
chown -R www-data: $final_path
|
chown -R www-data: $final_path
|
||||||
cd $ORIPATH
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Regenerate SSOwat conf
|
# Regenerate SSOwat conf
|
||||||
|
|
|
@ -6,7 +6,7 @@ set -eu
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
. /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -17,8 +15,8 @@ admin_ampache=$YNH_APP_ARG_ADMIN
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Source helpers
|
# Source helpers
|
||||||
. /usr/share/yunohost/helpers
|
source _common.sh
|
||||||
. _common.sh
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
|
@ -53,12 +51,9 @@ cp ../conf/admin.sql /tmp/
|
||||||
# CREATE A MYSQL DATABASE
|
# CREATE A MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Generate random password
|
|
||||||
db_pwd=$(ynh_string_random 24)
|
|
||||||
|
|
||||||
# Initialize database and store mysql password for upgrade
|
# Initialize database and store mysql password for upgrade
|
||||||
ynh_app_setting_set $app mysqlpwd $db_pwd
|
ynh_mysql_setup_db "$app" "$app"
|
||||||
ynh_mysql_setup_db "$app" "$app" "$db_pwd"
|
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
||||||
ynh_mysql_connect_as "$app" "$db_pwd" "$app" < "$final_path/sql/ampache.sql"
|
ynh_mysql_connect_as "$app" "$db_pwd" "$app" < "$final_path/sql/ampache.sql"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -69,8 +64,7 @@ ynh_mysql_connect_as "$app" "$db_pwd" "$app" < "$final_path/sql/ampache.sql"
|
||||||
ampache_ynh_prepareconfig
|
ampache_ynh_prepareconfig
|
||||||
|
|
||||||
ynh_replace_string "yunoadmin" "$admin_ampache" /tmp/admin.sql
|
ynh_replace_string "yunoadmin" "$admin_ampache" /tmp/admin.sql
|
||||||
random_key=db_pwd=$(ynh_string_random 24)
|
ynh_replace_string "RANDOMKEYTOCHANGE" $(ynh_string_random 24) $final_path/config/ampache.cfg.php
|
||||||
ynh_replace_string "RANDOMKEYTOCHANGE" "$random_key" $final_path/config/ampache.cfg.php
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
|
@ -112,5 +106,4 @@ ynh_mysql_connect_as "$app" "$db_pwd" "$app" < /tmp/admin.sql
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Clean install
|
# Clean install
|
||||||
ynh_secure_remove ../ampache-$version
|
|
||||||
ynh_secure_remove /tmp/admin.sql
|
ynh_secure_remove /tmp/admin.sql
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -u
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
. /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
|
|
|
@ -6,12 +6,7 @@ set -eu
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ ! -e _common.sh ]; then
|
source /usr/share/yunohost/helpers
|
||||||
cp ../settings/scripts/_common.sh ./_common.sh
|
|
||||||
chmod a+rx _common.sh
|
|
||||||
fi
|
|
||||||
. _common.sh
|
|
||||||
. /usr/share/yunohost/helpers
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
|
@ -38,6 +33,16 @@ final_path=/var/www/$app
|
||||||
test ! -d $final_path \
|
test ! -d $final_path \
|
||||||
|| ynh_die "There is already a directory: $final_path"
|
|| ynh_die "There is already a directory: $final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS AFTER YNH_DIE FOR LINTER
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
if [ ! -e _common.sh ]; then
|
||||||
|
cp ../settings/scripts/_common.sh ./_common.sh
|
||||||
|
chmod a+rx _common.sh
|
||||||
|
fi
|
||||||
|
source _common.sh
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK THE PATH
|
# CHECK THE PATH
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -71,4 +76,3 @@ systemctl reload nginx
|
||||||
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
||||||
ynh_mysql_setup_db $app $app $db_pwd
|
ynh_mysql_setup_db $app $app $db_pwd
|
||||||
ynh_mysql_connect_as $app $db_pwd $app < ./db.sql
|
ynh_mysql_connect_as $app $db_pwd $app < ./db.sql
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
. /usr/share/yunohost/helpers
|
source _common.sh
|
||||||
. _common.sh
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
|
|
Loading…
Add table
Reference in a new issue