Blame view

scripts/upgrade 1.9 KB
b6d6452fc   Kload   Add upgrade script
1
2
3
4
5
6
7
8
9
10
  #!/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
69831d704   Alexis Gavoty   Update upgrade
11
12
  # Remove trailing "/" for next commands
  path=${path%/}
b6d6452fc   Kload   Add upgrade script
13
14
15
16
17
18
19
20
21
22
23
24
25
  # 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
ea7313151   Alexis Gavoty   Update upgrade
26
27
28
  sudo chown -hR owncloud:www-data $final_path
  sudo chown -hR owncloud:www-data $data_path
  sudo chmod 755 /home/yunohost.app
03d2b362b   Alexis Gavoty   Update upgrade
29
  sudo chmod -R 770 $data_path
ea7313151   Alexis Gavoty   Update upgrade
30
  sudo chmod -R 775 $final_path
b6d6452fc   Kload   Add upgrade script
31
32
33
34
35
36
  
  # 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
b6d6452fc   Kload   Add upgrade script
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
  # 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
  
  # 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