mirror of
https://github.com/YunoHost-Apps/ampache_ynh.git
synced 2024-09-03 18:15:55 +02:00
commit
08b8366602
12 changed files with 141 additions and 143 deletions
|
@ -22,7 +22,8 @@
|
|||
Level 1=auto
|
||||
Level 2=auto
|
||||
Level 3=auto
|
||||
Level 4=auto
|
||||
# https://github.com/YunoHost-Apps/ampache_ynh/blob/a8c53c080e1f42f1b876e60fd47fdae2d8b5bcd9/conf/ampache.cfg.php#L111-L116
|
||||
Level 4=1
|
||||
Level 5=auto
|
||||
Level 6=auto
|
||||
Level 7=auto
|
||||
|
|
3
conf/app.src
Normal file
3
conf/app.src
Normal file
|
@ -0,0 +1,3 @@
|
|||
SOURCE_URL=https://github.com/ampache/ampache/archive/3.8.3.zip
|
||||
SOURCE_SUM=1bfd98defb5e4451443b899504a59ceb97e12dd2c36804318e6bfdda7a76d60d
|
||||
SOURCE_FORMAT=zip
|
|
@ -1,6 +1,7 @@
|
|||
location PATHTOCHANGE {
|
||||
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||
location __PATH__/ {
|
||||
|
||||
alias ALIASTOCHANGE;
|
||||
alias __FINALPATH__/;
|
||||
|
||||
if ($scheme = http) {
|
||||
rewrite ^ https://$server_name$request_uri? permanent;
|
||||
|
@ -8,13 +9,13 @@ location PATHTOCHANGE {
|
|||
|
||||
#enable subsonic api
|
||||
if ( !-d $request_filename ) {
|
||||
rewrite ^PATH2TOCHANGE/rest/(.*)\.view$ PATH2TOCHANGE/rest/index.php?action=$1 last;
|
||||
rewrite ^PATH2TOCHANGE/rest/fake/(.+)$ PATH2TOCHANGE/play/$1 last;
|
||||
rewrite ^__PATH__/rest/(.*)\.view$ __PATH__/rest/index.php?action=$1 last;
|
||||
rewrite ^__PATH__/rest/fake/(.+)$ __PATH__/play/$1 last;
|
||||
}
|
||||
|
||||
rewrite ^PATH2TOCHANGE/play/ssid/(.*)/type/(.*)/oid/([0-9]+)/uid/([0-9]+)/client/(.*)/noscrobble/([0-1])/player/(.*)/name/(.*)$ PATH2TOCHANGE/play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&client=$5&noscrobble=$6&player=$7&name=$8 last;
|
||||
rewrite ^PATH2TOCHANGE/play/ssid/(.*)/type/(.*)/oid/([0-9]+)/uid/([0-9]+)/client/(.*)/noscrobble/([0-1])/bitrate/([0-9]+)/player/(.*)/name/(.*)$ PATH2TOCHANGE/play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&client=$5&noscrobble=$6&bitrate=$7player=$8&name=$9 last;
|
||||
rewrite ^PATH2TOCHANGE/play/ssid/(.*)/type/(.*)/oid/([0-9]+)/uid/([0-9]+)/client/(.*)/noscrobble/([0-1])/transcode_to/(w+)/bitrate/([0-9]+)/player/(.*)/name/(.*)$ PATH2TOCHANGE/play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&client=$5&noscrobble=$6&transcode_to=$7&bitrate=$8&player=$9&name=$10 last;
|
||||
rewrite ^__PATH__/play/ssid/(.*)/type/(.*)/oid/([0-9]+)/uid/([0-9]+)/client/(.*)/noscrobble/([0-1])/player/(.*)/name/(.*)$ __PATH__/play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&client=$5&noscrobble=$6&player=$7&name=$8 last;
|
||||
rewrite ^__PATH__/play/ssid/(.*)/type/(.*)/oid/([0-9]+)/uid/([0-9]+)/client/(.*)/noscrobble/([0-1])/bitrate/([0-9]+)/player/(.*)/name/(.*)$ __PATH__/play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&client=$5&noscrobble=$6&bitrate=$7player=$8&name=$9 last;
|
||||
rewrite ^__PATH__/play/ssid/(.*)/type/(.*)/oid/([0-9]+)/uid/([0-9]+)/client/(.*)/noscrobble/([0-1])/transcode_to/(w+)/bitrate/([0-9]+)/player/(.*)/name/(.*)$ __PATH__/play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&client=$5&noscrobble=$6&transcode_to=$7&bitrate=$8&player=$9&name=$10 last;
|
||||
|
||||
index index.php;
|
||||
try_files $uri $uri/ index.php;
|
||||
|
@ -28,20 +29,20 @@ location PATHTOCHANGE {
|
|||
fastcgi_param SCRIPT_FILENAME $request_filename;
|
||||
}
|
||||
|
||||
location ^~ PATH2TOCHANGE/bin/ {
|
||||
location ^~ __PATH__/bin/ {
|
||||
deny all;
|
||||
return 403;
|
||||
}
|
||||
|
||||
location ^~ PATH2TOCHANGE/config/ {
|
||||
location ^~ __PATH__/config/ {
|
||||
deny all;
|
||||
return 403;
|
||||
}
|
||||
|
||||
rewrite ^PATH2TOCHANGE/play/ssid/(\w+)/type/(\w+)/oid/([0-9]+)/uid/([0-9]+)/name/(.*)$ PATH2TOCHANGE/play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&name=$5 last;
|
||||
rewrite ^PATH2TOCHANGE/play/ssid/(\w+)/type/(\w+)/oid/([0-9]+)/uid/([0-9]+)/client/(.*)/noscrobble/([0-1])/name/(.*)$ PATH2TOCHANGE/play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&client=$5&noscrobble=$6&name=$7 last;
|
||||
rewrite ^__PATH__/play/ssid/(\w+)/type/(\w+)/oid/([0-9]+)/uid/([0-9]+)/name/(.*)$ __PATH__/play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&name=$5 last;
|
||||
rewrite ^__PATH__/play/ssid/(\w+)/type/(\w+)/oid/([0-9]+)/uid/([0-9]+)/client/(.*)/noscrobble/([0-1])/name/(.*)$ __PATH__/play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&client=$5&noscrobble=$6&name=$7 last;
|
||||
|
||||
location PATH2TOCHANGE/rest {
|
||||
location __PATH__/rest {
|
||||
limit_except GET POST {
|
||||
deny all;
|
||||
}
|
||||
|
|
|
@ -5,16 +5,17 @@
|
|||
"en": "A web based audio/video streaming application",
|
||||
"fr": "Une application de streaming audio et vidéo"
|
||||
},
|
||||
"version": "1.0",
|
||||
"url": "http://ampache.org",
|
||||
"packaging_format": 1,
|
||||
"license": "free",
|
||||
"license": "AGPL-3.0",
|
||||
"maintainer": {
|
||||
"name": "aymhce",
|
||||
"email": "aymhce@gmail.com"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"requirements": {
|
||||
"yunohost": ">> 2.3.12.1"
|
||||
"yunohost": ">= 2.7.2"
|
||||
},
|
||||
"services" : [
|
||||
"nginx",
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copy files to the right place
|
||||
ampache_ynh_getsources () {
|
||||
version=$(cat upstream_version)
|
||||
|
||||
final_path=/var/www/$app
|
||||
sudo mkdir -p $final_path/log
|
||||
|
||||
sudo wget -O ../ampache.tar.gz https://github.com/ampache/ampache/archive/$version.tar.gz > /dev/null 2>&1
|
||||
sudo tar xvzf ../ampache.tar.gz -C .. > /dev/null 2>&1
|
||||
sudo cp -ar ../ampache-$version/. $final_path
|
||||
|
||||
sudo cp ../conf/ampache.cfg.php $final_path/config/ampache.cfg.php
|
||||
}
|
||||
|
||||
# Change variables in Ampache configuration
|
||||
ampache_ynh_prepareconfig () {
|
||||
sudo sed -i "s/yunouser/$app/g" $final_path/config/ampache.cfg.php
|
||||
sudo sed -i "s/yunopass/$db_pwd/g" $final_path/config/ampache.cfg.php
|
||||
sudo sed -i "s/yunobase/$app/g" $final_path/config/ampache.cfg.php
|
||||
sudo sed -i "s@PATHTOCHANGE@${path}@g" $final_path/config/ampache.cfg.php
|
||||
sudo sed -i "s@DOMAINTOCHANGE@$domain@g" $final_path/config/ampache.cfg.php
|
||||
}
|
||||
|
||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||
ampache_ynh_preparenginx () {
|
||||
path2=$(if [ "$path" == "/" ] ; then echo "" ; else echo "$path" ; fi)
|
||||
sed -i "s@PATHTOCHANGE@${path}@g" ../conf/nginx.conf*
|
||||
sed -i "s@PATH2TOCHANGE@${path2}@g" ../conf/nginx.conf*
|
||||
sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf*
|
||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
}
|
||||
|
||||
# Ampache installation
|
||||
ampache_ynh_install () {
|
||||
ORIPATH=$(pwd)
|
||||
cd $final_path
|
||||
sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||
sudo php composer-setup.php
|
||||
sudo php composer.phar install --prefer-source --no-interaction
|
||||
# Set permissions to ampache directory
|
||||
sudo chown -R www-data: $final_path
|
||||
cd $ORIPATH
|
||||
}
|
||||
|
||||
# Reload Nginx and regenerate SSOwat conf
|
||||
ampache_ynh_reloadservices () {
|
||||
sudo service nginx reload
|
||||
ynh_app_setting_set $app skipped_uris "/"
|
||||
sudo yunohost app ssowatconf
|
||||
}
|
||||
|
||||
# Pre config ampache
|
||||
ampache_ynh_doconfig () {
|
||||
echo "127.0.0.1 $domain #yunoampache" | sudo tee -a /etc/hosts
|
||||
sleep 1
|
||||
curl -kL -X POST http://$domain${path%/}/update.php?action=update > /dev/null 2>&1
|
||||
sleep 5
|
||||
sudo sed '/yunoampache/d' /etc/hosts > /tmp/hosts.tmp
|
||||
sudo cp /tmp/hosts.tmp /etc/hosts ; sudo rm -f /tmp/hosts.tmp
|
||||
}
|
46
scripts/_common.sh
Normal file
46
scripts/_common.sh
Normal file
|
@ -0,0 +1,46 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copy files to the right place
|
||||
ampache_ynh_getsources () {
|
||||
final_path=/var/www/$app
|
||||
mkdir -p $final_path/log
|
||||
|
||||
ynh_setup_source $final_path
|
||||
|
||||
cp ../conf/ampache.cfg.php $final_path/config/ampache.cfg.php
|
||||
}
|
||||
|
||||
# Change variables in Ampache configuration
|
||||
ampache_ynh_prepareconfig () {
|
||||
ynh_replace_string "yunouser" "$app" $final_path/config/ampache.cfg.php
|
||||
ynh_replace_string "yunopass" "$db_pwd" $final_path/config/ampache.cfg.php
|
||||
ynh_replace_string "yunobase" "$app" $final_path/config/ampache.cfg.php
|
||||
ynh_replace_string "PATHTOCHANGE" "$path_url" $final_path/config/ampache.cfg.php
|
||||
ynh_replace_string "DOMAINTOCHANGE" "$domain" $final_path/config/ampache.cfg.php
|
||||
}
|
||||
|
||||
# Ampache installation
|
||||
ampache_ynh_install () {
|
||||
(
|
||||
cd $final_path
|
||||
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||
php composer-setup.php
|
||||
php composer.phar update --no-interaction --no-dev
|
||||
php composer.phar install --prefer-source --no-interaction --no-dev
|
||||
# Set permissions to ampache directory
|
||||
chown -R www-data: $final_path
|
||||
)
|
||||
}
|
||||
|
||||
# Regenerate SSOwat conf
|
||||
ampache_ynh_reloadservices () {
|
||||
ynh_app_setting_set $app skipped_uris "/"
|
||||
yunohost app ssowatconf
|
||||
}
|
||||
|
||||
# Pre config ampache
|
||||
ampache_ynh_doconfig () {
|
||||
sleep 1
|
||||
ynh_local_curl /update.php?action=update
|
||||
sleep 5
|
||||
}
|
10
scripts/backup
Executable file → Normal file
10
scripts/backup
Executable file → Normal file
|
@ -6,7 +6,7 @@ set -eu
|
|||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
. /usr/share/yunohost/helpers
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
|
@ -20,20 +20,22 @@ ynh_abort_if_errors
|
|||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
domain=$(ynh_app_setting_get "$app" domain)
|
||||
path=$(ynh_app_setting_get "$app" path)
|
||||
path_url=$(ynh_app_setting_get "$app" path)
|
||||
admin=$(ynh_app_setting_get "$app" admin)
|
||||
|
||||
final_path=/var/www/$app
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup "/var/www/$app" "sources" 1
|
||||
ynh_backup "$final_path"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "conf/nginx.conf"
|
||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE MYSQL DATABASE
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
#=================================================
|
||||
|
@ -9,7 +7,7 @@ set -eu
|
|||
# Retrieve arguments
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path=$YNH_APP_ARG_PATH
|
||||
path_url=$YNH_APP_ARG_PATH
|
||||
admin_ampache=$YNH_APP_ARG_ADMIN
|
||||
|
||||
#=================================================
|
||||
|
@ -17,8 +15,8 @@ admin_ampache=$YNH_APP_ARG_ADMIN
|
|||
#=================================================
|
||||
|
||||
# Source helpers
|
||||
. /usr/share/yunohost/helpers
|
||||
. _common
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
|
@ -30,13 +28,10 @@ ynh_abort_if_errors
|
|||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
|
||||
# Check if admin exists
|
||||
sudo yunohost user list --json | grep -qi "\"username\": \"$admin_ampache\"" || ynh_die "wrong admin username"
|
||||
|
||||
# Check domain/path availability
|
||||
path=$(ynh_normalize_url_path $path)
|
||||
ynh_webpath_available $domain $path
|
||||
ynh_webpath_register $app $domain $path
|
||||
path_url=$(ynh_normalize_url_path $path_url)
|
||||
ynh_webpath_available $domain $path_url
|
||||
ynh_webpath_register $app $domain $path_url
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
|
@ -50,18 +45,15 @@ ynh_app_setting_set $app admin $admin_ampache
|
|||
|
||||
# get sources and copy files to the right place
|
||||
ampache_ynh_getsources
|
||||
sudo cp ../conf/admin.sql /tmp/
|
||||
cp ../conf/admin.sql /tmp/
|
||||
|
||||
#=================================================
|
||||
# CREATE A MYSQL DATABASE
|
||||
#=================================================
|
||||
|
||||
# Generate random password
|
||||
db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p')
|
||||
|
||||
# Initialize database and store mysql password for upgrade
|
||||
ynh_app_setting_set $app mysqlpwd $db_pwd
|
||||
ynh_mysql_setup_db "$app" "$app" "$db_pwd"
|
||||
ynh_mysql_setup_db "$app" "$app"
|
||||
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
||||
ynh_mysql_connect_as "$app" "$db_pwd" "$app" < "$final_path/sql/ampache.sql"
|
||||
|
||||
#=================================================
|
||||
|
@ -71,24 +63,25 @@ ynh_mysql_connect_as "$app" "$db_pwd" "$app" < "$final_path/sql/ampache.sql"
|
|||
# Change variables in Ampache configuration
|
||||
ampache_ynh_prepareconfig
|
||||
|
||||
sudo sed -i "s/yunoadmin/$admin_ampache/g" /tmp/admin.sql
|
||||
random_key=db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p')
|
||||
sudo sed -i "s@RANDOMKEYTOCHANGE@$random_key@g" $final_path/config/ampache.cfg.php
|
||||
ynh_replace_string "yunoadmin" "$admin_ampache" /tmp/admin.sql
|
||||
ynh_replace_string "RANDOMKEYTOCHANGE" $(ynh_string_random 24) $final_path/config/ampache.cfg.php
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||
ampache_ynh_preparenginx
|
||||
if [ "$path_url" != "/" ]
|
||||
then
|
||||
ynh_replace_string "^#sub_path_only" "" "../conf/nginx.conf"
|
||||
fi
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
|
||||
# Install dependency
|
||||
sudo apt-get update
|
||||
sudo apt-get install libav-tools -y
|
||||
ynh_install_app_dependencies libav-tools
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
|
@ -98,10 +91,10 @@ sudo apt-get install libav-tools -y
|
|||
ampache_ynh_install
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
# RELOAD SSOWAT
|
||||
#=================================================
|
||||
|
||||
# Reload Nginx and regenerate SSOwat conf
|
||||
# Regenerate SSOwat conf
|
||||
ampache_ynh_reloadservices
|
||||
|
||||
#=================================================
|
||||
|
@ -117,5 +110,4 @@ ynh_mysql_connect_as "$app" "$db_pwd" "$app" < /tmp/admin.sql
|
|||
#=================================================
|
||||
|
||||
# Clean install
|
||||
sudo rm -rf ../ampache-$version
|
||||
sudo rm /tmp/admin.sql
|
||||
ynh_secure_remove /tmp/admin.sql
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -u
|
||||
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
. /usr/share/yunohost/helpers
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
|
@ -15,6 +13,8 @@ set -u
|
|||
app=$YNH_APP_INSTANCE_NAME
|
||||
domain=$(ynh_app_setting_get $app domain)
|
||||
|
||||
final_path=/var/www/$app
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
|
@ -27,17 +27,17 @@ ynh_mysql_drop_user $app
|
|||
#=================================================
|
||||
|
||||
# Remove sources
|
||||
sudo rm -rf /var/www/$app
|
||||
ynh_secure_remove $final_path
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
# Remove Nginx configuration and reload Nginx conf
|
||||
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
|
||||
sudo service nginx reload
|
||||
# Remove dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
|
36
scripts/restore
Executable file → Normal file
36
scripts/restore
Executable file → Normal file
|
@ -6,7 +6,7 @@ set -eu
|
|||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
. /usr/share/yunohost/helpers
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
|
@ -20,42 +20,54 @@ ynh_abort_if_errors
|
|||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
domain=$(ynh_app_setting_get "$app" domain)
|
||||
path=$(ynh_app_setting_get "$app" path)
|
||||
path_url=$(ynh_app_setting_get "$app" path)
|
||||
admin=$(ynh_app_setting_get "$app" admin)
|
||||
|
||||
final_path=/var/www/$app
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
|
||||
# Check domain/path availability
|
||||
test ! -d /var/www/$app \
|
||||
|| ynh_die "There is already a directory: /var/www/$app "
|
||||
test ! -d $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
|
||||
#=================================================
|
||||
|
||||
path=$(ynh_normalize_url_path $path)
|
||||
path_url=$(ynh_normalize_url_path $path_url)
|
||||
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
|
||||
# Install dependency
|
||||
sudo apt-get update
|
||||
sudo apt-get install libav-tools -y
|
||||
ynh_install_app_dependencies libav-tools
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
||||
sudo cp -a ./sources "/var/www/$app"
|
||||
ynh_restore_file "$final_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
sudo cp -a ./conf/nginx.conf "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
systemctl reload nginx
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
|
@ -64,9 +76,3 @@ sudo cp -a ./conf/nginx.conf "/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
||||
ynh_mysql_setup_db $app $app $db_pwd
|
||||
ynh_mysql_connect_as $app $db_pwd $app < ./db.sql
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
|
||||
sudo service nginx reload
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
. /usr/share/yunohost/helpers
|
||||
. _common
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
|
@ -22,7 +20,7 @@ ynh_abort_if_errors
|
|||
# Retrieve arguments
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
domain=$(ynh_app_setting_get $app domain)
|
||||
path=$(ynh_app_setting_get $app path)
|
||||
path_url=$(ynh_app_setting_get $app path)
|
||||
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
||||
admin_ampache=$(ynh_app_setting_get $app admin)
|
||||
|
||||
|
@ -30,7 +28,7 @@ admin_ampache=$(ynh_app_setting_get $app admin)
|
|||
# CHECK THE PATH
|
||||
#=================================================
|
||||
|
||||
path=$(ynh_normalize_url_path $path)
|
||||
path_url=$(ynh_normalize_url_path $path_url)
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
@ -47,7 +45,18 @@ ampache_ynh_prepareconfig
|
|||
#=================================================
|
||||
|
||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||
ampache_ynh_preparenginx
|
||||
if [ "$path_url" != "/" ]
|
||||
then
|
||||
ynh_replace_string "^#sub_path_only" "" "../conf/nginx.conf"
|
||||
fi
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
|
||||
# Install dependency
|
||||
ynh_install_app_dependencies libav-tools
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
|
@ -57,10 +66,10 @@ ampache_ynh_preparenginx
|
|||
ampache_ynh_install
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
# RELOAD SSOWAT
|
||||
#=================================================
|
||||
|
||||
# Reload Nginx and regenerate SSOwat conf
|
||||
# Regenerate SSOwat conf
|
||||
ampache_ynh_reloadservices
|
||||
|
||||
#=================================================
|
||||
|
@ -75,4 +84,4 @@ ampache_ynh_doconfig
|
|||
#=================================================
|
||||
|
||||
# Clean install
|
||||
sudo rm -rf ../ampache-$version
|
||||
ynh_secure_remove ../ampache-$version
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
3.8.3
|
Loading…
Add table
Reference in a new issue