mirror of
https://github.com/YunoHost-Apps/ampache_ynh.git
synced 2024-09-03 18:15:55 +02:00
Added upgrade script
This commit is contained in:
parent
68c53e761b
commit
dd1fdca703
1 changed files with 59 additions and 0 deletions
59
scripts/upgrade
Normal file
59
scripts/upgrade
Normal file
|
@ -0,0 +1,59 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
debianversionname=$(lsb_release -a | grep Codename | awk -F' ' '{print $2}')
|
||||
|
||||
# Retrieve arguments
|
||||
domain=$(sudo yunohost app setting syncthing domain)
|
||||
path=$(sudo yunohost app setting syncthing path)
|
||||
db_user=ampache
|
||||
db_pwd=$(sudo yunohost app setting syncthing mysqlpwd)
|
||||
admin_ampache=$(sudo yunohost app setting syncthing admin)
|
||||
|
||||
# Remove trailing "/" for next commands
|
||||
path=${path%/}
|
||||
|
||||
|
||||
# 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
|
||||
|
||||
# Copy files to the right place
|
||||
final_path=/var/www/ampache
|
||||
sudo cp -a ../sources/* $final_path
|
||||
sudo cp ../conf/ampache.cfg.php $final_path/config/ampache.cfg.php
|
||||
|
||||
# Change variables in Ampache configuration
|
||||
sudo sed -i "s/yunouser/$db_user/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/$db_user/g" $final_path/config/ampache.cfg.php
|
||||
sed -i "s@PATHTOCHANGE@$path@g" $final_path/config/ampache.cfg.php
|
||||
sed -i "s@DOMAINTOCHANGE@$domain@g" $final_path/config/ampache.cfg.php
|
||||
|
||||
|
||||
# Set permissions to roundcube directory
|
||||
sudo chown -R www-data: $final_path
|
||||
|
||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||
sed -i "s@PATHTOCHANGE@$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
|
||||
|
||||
|
||||
# Reload Nginx and regenerate SSOwat conf
|
||||
sudo service nginx reload
|
||||
sudo yunohost app setting ampache skipped_uris -v "/"
|
||||
sudo yunohost app ssowatconf
|
||||
|
||||
# Ampache installation
|
||||
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
|
||||
[ "$debianversionname" == "wheezy" ] && \
|
||||
sudo sed -i 's/;transcode_cmd = "ffmpeg"/transcode_cmd = "ffmpeg"/g' /var/www/ampache/config/ampache.cfg.php && \
|
||||
sudo sed -i 's/^transcode_cmd = "avconv"/;transcode_cmd = "avconv"/g' /var/www/ampache/config/ampache.cfg.php
|
||||
sudo yunohost app setting ampache skipped_uris -d
|
||||
sudo yunohost app setting ampache skipped_uris -v "/rest"
|
||||
sudo yunohost app ssowatconf
|
||||
sudo sed '/yunoampache/d' /etc/hosts > /tmp/hosts.tmp
|
||||
sudo cp /tmp/hosts.tmp /etc/hosts ; sudo rm -f /tmp/hosts.tmp
|
Loading…
Add table
Reference in a new issue