Commit eebbd460b8ef9a098508ecbac4d185cc15dafa70

Authored by Kload
Exists in master

Merge branch 'master' of github.com:Kloadut/owncloud_ynh

Showing 2 changed files Side-by-side Diff

1 1 {
2   - "name": "Owncloud",
  2 + "name": "OwnCloud",
3 3 "id": "owncloud",
4 4 "description": {
5 5 "en": "Sync & share your files, pictures, music, contacts, calendars, and much more !",
... ... @@ -34,12 +34,6 @@
34 34 "en": "Choose the Owncloud administrator (must be an existing YunoHost user)"
35 35 },
36 36 "example": "homer"
37   - },
38   - {
39   - "name": "password",
40   - "ask": {
41   - "en": "Owncloud administrator password (for this existing YunoHost user)"
42   - }
43 37 }
44 38 ]
45 39 }
... ... @@ -4,7 +4,6 @@
4 4 domain=$1
5 5 path=$2
6 6 user=$3
7   -password=$4
8 7  
9 8 # Check user parameter
10 9 ls /home | grep $user
... ... @@ -13,11 +12,6 @@ if [[ ! $? -eq 0 ]]; then
13 12 exit 1
14 13 fi
15 14  
16   -if [[ $password == "" ]]; then
17   - echo "Wrong password"
18   - exit 1
19   -fi
20   -
21 15 # Check domain/path availability
22 16 sudo yunohost app checkurl $domain$path -a owncloud
23 17 if [[ ! $? -eq 0 ]]; then
... ... @@ -25,10 +19,10 @@ if [[ ! $? -eq 0 ]]; then
25 19 fi
26 20  
27 21 # Install dependencies
28   -sudo apt-get install acl
  22 +sudo apt-get install acl smbclient -y -qq
29 23  
30 24 # Generate random password
31   -db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*//p')
  25 +db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9' | sed -n 's/\(.\{24\}\).*//p')
32 26  
33 27 # Use 'owncloud' as database name and user
34 28 db_user=owncloud
... ... @@ -78,12 +72,12 @@ sudo yunohost app ssowatconf
78 72 # Owncloud installation via curl
79 73 echo "127.0.0.1 $domain #yunoowncloud" | sudo tee -a /etc/hosts
80 74 sleep 1
81   -curl -kL -X POST https://$domain$path/index.php --data "install=true&adminlogin=$user&adminpass=$password&directory=/home/yunohost.app/owncloud/data&dbtype=mysql&dbuser=$db_user&dbpass=$db_pwd&dbname=$db_user&dbhost=localhost" > /dev/null 2>&1
  75 +curl -kL -X POST https://$domain$path/index.php --data "install=true&adminlogin=admin&adminpass=$db_pwd&directory=/home/yunohost.app/owncloud/data&dbtype=mysql&dbuser=$db_user&dbpass=$db_pwd&dbname=$db_user&dbhost=localhost" > /dev/null 2>&1
82 76  
83 77 # Enable plugins
84 78 sleep 5
85   -curl -kL -X POST https://$domain$path/index.php/settings/ajax/enableapp.php --data "appid=files_external" -u "$user:$password" > /dev/null 2>&1
86   -curl -kL -X POST https://$domain$path/index.php/settings/ajax/enableapp.php --data "appid=user_ldap" -u "$user:$password" > /dev/null 2>&1
  79 +curl -kL -X POST https://$domain$path/index.php/settings/ajax/enableapp.php --data "appid=files_external" -u "admin:$db_pwd" > /dev/null 2>&1
  80 +curl -kL -X POST https://$domain$path/index.php/settings/ajax/enableapp.php --data "appid=user_ldap" -u "admin:$db_pwd" > /dev/null 2>&1
87 81  
88 82 # Check if the Mysql database is initialized & running
89 83 mysql -u $db_user -p$db_pwd $db_user -e "select * from oc_appconfig;" > /dev/null 2>&1
... ... @@ -105,6 +99,9 @@ done
105 99 # Configure LDAP plugin
106 100 mysql -u $db_user -p$db_pwd $db_user < ../conf/ldap_config.sql
107 101  
  102 +# Make an LDAP user as admin
  103 +mysql -u $db_user -p$db_pwd $db_user -e "INSERT INTO oc_group_user VALUES ('admin','$user');"
  104 +
108 105 # Unprotect URIs
109 106 sudo yunohost app setting owncloud skipped_uris -v "/public.php,/core,/apps/files,/index.php/apps/files"
110 107 sudo yunohost app setting owncloud unprotected_uris -v "/remote.php,/cron.php,/status.php"