upgrade
1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
# Retrieve arguments
domain=$(sudo yunohost app setting owncloud domain)
path=$(sudo yunohost app setting owncloud path)
#user=$(sudo yunohost app setting owncloud admin_user)
db_pwd=$(sudo yunohost app setting owncloud mysqlpwd)
# Install dependencies
#sudo apt-get install acl smbclient -y -qq
# Remove trailing "/" for next commands
path=${path%/}
# Use 'owncloud' as database name and user
db_user=owncloud
# Copy files to the right place
final_path=/var/www/owncloud
data_path=/home/yunohost.app/owncloud/data
sudo mkdir -p $final_path
sudo mkdir -p $data_path
sudo cp -a ../sources/* $final_path
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/owncloud.conf
sudo cp ../conf/php-fpm.conf /etc/php5/fpm/pool.d/owncloud.conf
sudo cp ../conf/php-fpm.ini /etc/php5/fpm/conf.d/20-owncloud.ini
sudo cp ../conf/mount.json $data_path
sudo chown -hR owncloud:www-data $final_path
sudo chown -hR owncloud:www-data $data_path
sudo chmod 755 /home/yunohost.app
sudo chmod -R 770 $data_path
sudo chmod -R 775 $final_path
# Change variables in Owncloud configuration
sudo sed -i "s@PATHTOCHANGE@$path@g" /etc/nginx/conf.d/$domain.d/owncloud.conf
sudo sed -i "s@ALIASTOCHANGE@$final_path/@g" /etc/nginx/conf.d/$domain.d/owncloud.conf
sudo sed -i "s@NAMETOCHANGE@owncloud@g" /etc/nginx/conf.d/$domain.d/owncloud.conf
sudo sed -i "s@NAMETOCHANGE@owncloud@g" /etc/php5/fpm/pool.d/owncloud.conf
# Reload Nginx and regenerate SSOwat conf
sudo service php5-fpm restart
sudo service nginx reload
sudo yunohost app setting owncloud skipped_uris -v "/"
sudo yunohost app ssowatconf
# Optionnal DB upgrade here
# Configure LDAP plugin
mysql -u $db_user -p$db_pwd $db_user < ../conf/ldap_config.sql
sudo chown -hR owncloud:owncloud $final_path
sudo chown -hR owncloud:owncloud $data_path
# Unprotect URIs
sudo yunohost app setting owncloud skipped_uris -v "/public.php,/core,/apps/files,/index.php/apps/files"
sudo yunohost app setting owncloud unprotected_uris -v "/remote.php,/cron.php,/status.php"
sudo yunohost app ssowatconf