mirror of
https://github.com/YunoHost-Apps/ampache_ynh.git
synced 2024-09-03 18:15:55 +02:00
update ampache to 3.8.2 and do yunohost 2.4 compatibility
This commit is contained in:
parent
46af7c5eed
commit
dae9885b3a
4 changed files with 46 additions and 37 deletions
|
@ -12,6 +12,9 @@
|
||||||
"email": "beudbeud@beudibox.fr"
|
"email": "beudbeud@beudibox.fr"
|
||||||
},
|
},
|
||||||
"multi_instance": "true",
|
"multi_instance": "true",
|
||||||
|
"requirements": {
|
||||||
|
"yunohost": ">> 2.3.12.1"
|
||||||
|
},
|
||||||
"services" : [
|
"services" : [
|
||||||
"nginx",
|
"nginx",
|
||||||
"php5-fpm",
|
"php5-fpm",
|
||||||
|
|
|
@ -1,14 +1,18 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$1
|
domain=$1
|
||||||
path=$2
|
path=$2
|
||||||
admin_ampache=$3
|
admin_ampache=$3
|
||||||
|
|
||||||
debianversionname=$(lsb_release -a | grep Codename | awk -F' ' '{print $2}')
|
# Source YunoHost helpers
|
||||||
|
. /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
#debianversionname=$(lsb_release -a | grep Codename | awk -F' ' '{print $2}')
|
||||||
|
|
||||||
# Check domain/path availability
|
# Check domain/path availability
|
||||||
sudo yunohost app checkurl $domain$path -a ampache
|
sudo yunohost app checkurl $domain$path -a $app
|
||||||
if [[ ! $? -eq 0 ]]; then
|
if [[ ! $? -eq 0 ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -26,14 +30,16 @@ sudo yunohost app setting ampache admin -v $admin_ampache
|
||||||
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')
|
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')
|
||||||
|
|
||||||
# Use 'ampache' as database name and user
|
# Use 'ampache' as database name and user
|
||||||
db_user=ampache
|
db_user=$app
|
||||||
|
|
||||||
# Initialize database and store mysql password for upgrade
|
# Initialize database and store mysql password for upgrade
|
||||||
sudo yunohost app initdb $db_user -p $db_pwd -s $(readlink -e ../sources/sql/ampache.sql)
|
#sudo yunohost app initdb $db_user -p $db_pwd -s $(readlink -e ../sources/sql/ampache.sql)
|
||||||
sudo yunohost app setting ampache mysqlpwd -v $db_pwd
|
sudo yunohost app setting $app mysqlpwd -v $db_pwd
|
||||||
|
ynh_mysql_create_db "$app" "$db_user" "$db_pwd"
|
||||||
|
ynh_mysql_connect_as "$db_user" "$db_pwd" "$app" < "../sources/sql/ampache.sql"
|
||||||
|
|
||||||
# Copy files to the right place
|
# Copy files to the right place
|
||||||
final_path=/var/www/ampache
|
final_path=/var/www/$app
|
||||||
sudo mkdir -p $final_path/log
|
sudo mkdir -p $final_path/log
|
||||||
sudo cp -a ../sources/* $final_path
|
sudo cp -a ../sources/* $final_path
|
||||||
sudo cp ../conf/ampache.cfg.php $final_path/config/ampache.cfg.php
|
sudo cp ../conf/ampache.cfg.php $final_path/config/ampache.cfg.php
|
||||||
|
@ -55,29 +61,32 @@ sudo chown -R www-data: $final_path
|
||||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||||
sed -i "s@PATHTOCHANGE@${path%/}@g" ../conf/nginx.conf*
|
sed -i "s@PATHTOCHANGE@${path%/}@g" ../conf/nginx.conf*
|
||||||
sed -i "s@ALIASTOCHANGE@$final_path/@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/ampache.conf
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
|
|
||||||
|
|
||||||
# Reload Nginx and regenerate SSOwat conf
|
# Reload Nginx and regenerate SSOwat conf
|
||||||
sudo service nginx reload
|
sudo service nginx reload
|
||||||
sudo yunohost app setting ampache skipped_uris -v "/"
|
sudo yunohost app setting $app skipped_uris -v "/"
|
||||||
sudo yunohost app ssowatconf
|
sudo yunohost app ssowatconf
|
||||||
|
|
||||||
# Install dependency
|
# Install dependency
|
||||||
sudo apt-get install ffmpeg -y
|
sudo apt-get install libav-tools -y
|
||||||
|
|
||||||
# Ampache installation
|
# Ampache installation
|
||||||
|
cd /var/www/$app
|
||||||
|
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
|
||||||
|
|
||||||
echo "127.0.0.1 $domain #yunoampache" | sudo tee -a /etc/hosts
|
echo "127.0.0.1 $domain #yunoampache" | sudo tee -a /etc/hosts
|
||||||
sleep 1
|
sleep 1
|
||||||
curl -kL -X POST http://$domain${path%/}/update.php?action=update > /dev/null 2>&1
|
curl -kL -X POST http://$domain${path%/}/update.php?action=update > /dev/null 2>&1
|
||||||
sleep 5
|
sleep 5
|
||||||
[ "$debianversionname" == "wheezy" ] && \
|
|
||||||
sudo sed -i 's/;transcode_cmd = "ffmpeg"/transcode_cmd = "ffmpeg"/g' /var/www/ampache/config/ampache.cfg.php && \
|
sudo yunohost app setting $app skipped_uris -d
|
||||||
sudo sed -i 's/^transcode_cmd = "avconv"/;transcode_cmd = "avconv"/g' /var/www/ampache/config/ampache.cfg.php
|
sudo yunohost app setting $app skipped_uris -v "/rest"
|
||||||
sudo yunohost app setting ampache skipped_uris -d
|
|
||||||
sudo yunohost app setting ampache skipped_uris -v "/rest"
|
|
||||||
sudo yunohost app ssowatconf
|
sudo yunohost app ssowatconf
|
||||||
sudo sed '/yunoampache/d' /etc/hosts > /tmp/hosts.tmp
|
sudo sed '/yunoampache/d' /etc/hosts > /tmp/hosts.tmp
|
||||||
sudo cp /tmp/hosts.tmp /etc/hosts ; sudo rm -f /tmp/hosts.tmp
|
sudo cp /tmp/hosts.tmp /etc/hosts ; sudo rm -f /tmp/hosts.tmp
|
||||||
mysql -u $db_user -p$db_pwd $db_user < /tmp/admin.sql
|
ynh_mysql_connect_as "$db_user" "$db_pwd" "$app" < /tmp/admin.sql
|
||||||
sudo rm /tmp/admin.sql
|
sudo rm /tmp/admin.sql
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
db_user=ampache
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
db_name=ampache
|
db_user=$app
|
||||||
|
db_name=$app
|
||||||
root_pwd=$(sudo cat /etc/yunohost/mysql)
|
root_pwd=$(sudo cat /etc/yunohost/mysql)
|
||||||
domain=$(sudo yunohost app setting ampache domain)
|
domain=$(sudo yunohost app setting $app domain)
|
||||||
|
|
||||||
# Drop MySQL database
|
# Drop MySQL database
|
||||||
mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;"
|
mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;"
|
||||||
|
|
||||||
# Remove sources
|
# Remove sources
|
||||||
sudo rm -rf /var/www/ampache
|
sudo rm -rf /var/www/$app
|
||||||
|
|
||||||
# Remove Nginx configuration and reload Nginx conf
|
# Remove Nginx configuration and reload Nginx conf
|
||||||
sudo rm -f /etc/nginx/conf.d/$domain.d/ampache.conf
|
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
sudo service nginx reload
|
sudo service nginx reload
|
||||||
|
|
|
@ -1,20 +1,18 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
debianversionname=$(lsb_release -a | grep Codename | awk -F' ' '{print $2}')
|
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$(sudo yunohost app setting ampache domain)
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
path=$(sudo yunohost app setting ampache path)
|
domain=$(sudo yunohost app setting $app domain)
|
||||||
db_user=ampache
|
path=$(sudo yunohost app setting $app path)
|
||||||
db_pwd=$(sudo yunohost app setting ampache mysqlpwd)
|
db_user=$app
|
||||||
admin_ampache=$(sudo yunohost app setting ampache admin)
|
db_pwd=$(sudo yunohost app setting $app mysqlpwd)
|
||||||
|
admin_ampache=$(sudo yunohost app setting $app admin)
|
||||||
|
|
||||||
# first make a copy of the db
|
# first make a copy of the db
|
||||||
# mysqldump -u $db_user -p$db_pwd --add-drop-table --allow-keywords ampache > $final_path/ampache-db-backup.sql
|
# mysqldump -u $db_user -p$db_pwd --add-drop-table --allow-keywords $app > $final_path/ampache-db-backup.sql
|
||||||
|
|
||||||
# Copy files to the right place
|
# Copy files to the right place
|
||||||
final_path=/var/www/ampache
|
final_path=/var/www/$app
|
||||||
sudo cp -a ../sources/* $final_path
|
sudo cp -a ../sources/* $final_path
|
||||||
sudo cp ../conf/ampache.cfg.php $final_path/config/ampache.cfg.php
|
sudo cp ../conf/ampache.cfg.php $final_path/config/ampache.cfg.php
|
||||||
|
|
||||||
|
@ -32,12 +30,12 @@ sudo chown -R www-data: $final_path
|
||||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||||
sed -i "s@PATHTOCHANGE@${path%/}@g" ../conf/nginx.conf*
|
sed -i "s@PATHTOCHANGE@${path%/}@g" ../conf/nginx.conf*
|
||||||
sed -i "s@ALIASTOCHANGE@$final_path/@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/ampache.conf
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
|
|
||||||
|
|
||||||
# Reload Nginx and regenerate SSOwat conf
|
# Reload Nginx and regenerate SSOwat conf
|
||||||
sudo service nginx reload
|
sudo service nginx reload
|
||||||
sudo yunohost app setting ampache skipped_uris -v "/"
|
sudo yunohost app setting $app skipped_uris -v "/"
|
||||||
sudo yunohost app ssowatconf
|
sudo yunohost app ssowatconf
|
||||||
|
|
||||||
# Ampache installation
|
# Ampache installation
|
||||||
|
@ -45,11 +43,9 @@ echo "127.0.0.1 $domain #yunoampache" | sudo tee -a /etc/hosts
|
||||||
sleep 1
|
sleep 1
|
||||||
curl -kL -X POST http://$domain${path%/}/update.php?action=update > /dev/null 2>&1
|
curl -kL -X POST http://$domain${path%/}/update.php?action=update > /dev/null 2>&1
|
||||||
sleep 5
|
sleep 5
|
||||||
[ "$debianversionname" == "wheezy" ] && \
|
|
||||||
sudo sed -i 's/;transcode_cmd = "ffmpeg"/transcode_cmd = "ffmpeg"/g' /var/www/ampache/config/ampache.cfg.php && \
|
sudo yunohost app setting $app skipped_uris -d
|
||||||
sudo sed -i 's/^transcode_cmd = "avconv"/;transcode_cmd = "avconv"/g' /var/www/ampache/config/ampache.cfg.php
|
sudo yunohost app setting $app skipped_uris -v "/rest"
|
||||||
sudo yunohost app setting ampache skipped_uris -d
|
|
||||||
sudo yunohost app setting ampache skipped_uris -v "/rest"
|
|
||||||
sudo yunohost app ssowatconf
|
sudo yunohost app ssowatconf
|
||||||
sudo sed '/yunoampache/d' /etc/hosts > /tmp/hosts.tmp
|
sudo sed '/yunoampache/d' /etc/hosts > /tmp/hosts.tmp
|
||||||
sudo cp /tmp/hosts.tmp /etc/hosts ; sudo rm -f /tmp/hosts.tmp
|
sudo cp /tmp/hosts.tmp /etc/hosts ; sudo rm -f /tmp/hosts.tmp
|
||||||
|
|
Loading…
Add table
Reference in a new issue