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
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
app=seafile
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$1
|
domain=$1
|
||||||
path=$2
|
path=$2
|
||||||
|
@ -7,7 +12,7 @@ admin=$4
|
||||||
admin_password=$5
|
admin_password=$5
|
||||||
is_public=$6
|
is_public=$6
|
||||||
architecture=$7
|
architecture=$7
|
||||||
final_path=/var/www/seafile
|
final_path=/var/www/$app
|
||||||
seafile_data=/home/yunohost.app/seafile-data
|
seafile_data=/home/yunohost.app/seafile-data
|
||||||
seafile_version=4.4.3
|
seafile_version=4.4.3
|
||||||
|
|
||||||
|
@ -29,10 +34,8 @@ findPort () {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check domain/path availability
|
# Check domain/path availability
|
||||||
sudo yunohost app checkurl $domain$path -a seafile
|
sudo yunohost app checkurl $domain$path -a $app \
|
||||||
if [[ ! $? -eq 0 ]]; then
|
|| (echo "Path not available: $domain$path" && exit 1)
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check dependencies
|
# Check dependencies
|
||||||
sudo apt-get install -qq python2.7 python-setuptools python-simplejson python-imaging python-mysqldb python-flup expect
|
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-data
|
||||||
sudo mkdir -p $final_path/seafile-server-$seafile_version
|
sudo mkdir -p $final_path/seafile-server-$seafile_version
|
||||||
sudo tar xzf ../sources/'seafile-server_'$seafile_version'_'$architecture'.tar'
|
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
|
sudo mv ../sources/'seafile-server_'$seafile_version'_'$architecture'.tar' $final_path/installed
|
||||||
|
|
||||||
# Find available ports
|
# Find available ports
|
||||||
|
@ -56,16 +59,16 @@ findPort 8080
|
||||||
webdav_port=$port
|
webdav_port=$port
|
||||||
|
|
||||||
# store config in yunohost
|
# store config in yunohost
|
||||||
sudo yunohost app setting seafile seahub_port -v $seahub_port
|
sudo yunohost app setting $app seahub_port -v $seahub_port
|
||||||
sudo yunohost app setting seafile fileserver_port -v $fileserver_port
|
sudo yunohost app setting $app fileserver_port -v $fileserver_port
|
||||||
sudo yunohost app setting seafile webdav_port -v $webdav_port
|
sudo yunohost app setting $app webdav_port -v $webdav_port
|
||||||
sudo yunohost app setting seafile is_public -v $is_public
|
sudo yunohost app setting $app is_public -v $is_public
|
||||||
sudo yunohost app setting seafile architecture -v $architecture
|
sudo yunohost app setting $app architecture -v $architecture
|
||||||
sudo yunohost app setting seafile installed_version -v $seafile_version
|
sudo yunohost app setting $app installed_version -v $seafile_version
|
||||||
|
|
||||||
# init databases
|
# init databases
|
||||||
db_user=seafile
|
db_user=$app
|
||||||
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_pwd=$(openssl rand -hex 15)
|
||||||
sudo yunohost app initdb -d ccnetdb -p $db_pwd $db_user
|
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 seafiledb -p $db_pwd $db_user
|
||||||
sudo yunohost app initdb -d seahubdb -p $db_pwd $db_user
|
sudo yunohost app initdb -d seahubdb -p $db_pwd $db_user
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
app=seafile
|
app=seafile
|
||||||
|
|
||||||
# Retrieve settings
|
# Retrieve settings
|
||||||
|
|
Loading…
Reference in a new issue