mirror of
https://github.com/YunoHost-Apps/seafile_ynh.git
synced 2024-09-03 20:26:01 +02:00
Implement some best practices
This commit is contained in:
parent
9fc420b002
commit
54e879cdbe
2 changed files with 20 additions and 14 deletions
|
@ -1,4 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
app=seafile
|
||||
|
||||
# Retrieve arguments
|
||||
domain=$1
|
||||
path=$2
|
||||
|
@ -7,7 +12,7 @@ admin=$4
|
|||
admin_password=$5
|
||||
is_public=$6
|
||||
architecture=$7
|
||||
final_path=/var/www/seafile
|
||||
final_path=/var/www/$app
|
||||
seafile_data=/home/yunohost.app/seafile-data
|
||||
seafile_version=4.4.3
|
||||
|
||||
|
@ -29,10 +34,8 @@ findPort () {
|
|||
}
|
||||
|
||||
# Check domain/path availability
|
||||
sudo yunohost app checkurl $domain$path -a seafile
|
||||
if [[ ! $? -eq 0 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
sudo yunohost app checkurl $domain$path -a $app \
|
||||
|| (echo "Path not available: $domain$path" && exit 1)
|
||||
|
||||
# Check dependencies
|
||||
sudo apt-get install -qq python2.7 python-setuptools python-simplejson python-imaging python-mysqldb python-flup expect
|
||||
|
@ -44,7 +47,7 @@ sudo mkdir -p $final_path/logs
|
|||
sudo mkdir -p $final_path/seafile-data
|
||||
sudo mkdir -p $final_path/seafile-server-$seafile_version
|
||||
sudo tar xzf ../sources/'seafile-server_'$seafile_version'_'$architecture'.tar'
|
||||
sudo mv seafile-server-$seafile_version/* $final_path/seafile-server-$seafile_version
|
||||
sudo mv seafile-server-$seafile_version/. $final_path/seafile-server-$seafile_version
|
||||
sudo mv ../sources/'seafile-server_'$seafile_version'_'$architecture'.tar' $final_path/installed
|
||||
|
||||
# Find available ports
|
||||
|
@ -56,16 +59,16 @@ findPort 8080
|
|||
webdav_port=$port
|
||||
|
||||
# store config in yunohost
|
||||
sudo yunohost app setting seafile seahub_port -v $seahub_port
|
||||
sudo yunohost app setting seafile fileserver_port -v $fileserver_port
|
||||
sudo yunohost app setting seafile webdav_port -v $webdav_port
|
||||
sudo yunohost app setting seafile is_public -v $is_public
|
||||
sudo yunohost app setting seafile architecture -v $architecture
|
||||
sudo yunohost app setting seafile installed_version -v $seafile_version
|
||||
sudo yunohost app setting $app seahub_port -v $seahub_port
|
||||
sudo yunohost app setting $app fileserver_port -v $fileserver_port
|
||||
sudo yunohost app setting $app webdav_port -v $webdav_port
|
||||
sudo yunohost app setting $app is_public -v $is_public
|
||||
sudo yunohost app setting $app architecture -v $architecture
|
||||
sudo yunohost app setting $app installed_version -v $seafile_version
|
||||
|
||||
# init databases
|
||||
db_user=seafile
|
||||
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_user=$app
|
||||
db_pwd=$(openssl rand -hex 15)
|
||||
sudo yunohost app initdb -d ccnetdb -p $db_pwd $db_user
|
||||
sudo yunohost app initdb -d seafiledb -p $db_pwd $db_user
|
||||
sudo yunohost app initdb -d seahubdb -p $db_pwd $db_user
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
app=seafile
|
||||
|
||||
# Retrieve settings
|
||||
|
|
Loading…
Reference in a new issue