seafile_ynh/scripts/_common.sh

70 lines
2.8 KiB
Bash
Raw Normal View History

#=================================================
# SET ALL CONSTANTS
#=================================================
2017-07-21 14:56:41 +02:00
app=$YNH_APP_INSTANCE_NAME
2017-12-09 20:56:20 +01:00
#=================================================
# DEFINE ALL COMMON FONCTIONS
#=================================================
2018-01-19 20:55:44 +01:00
install_source() {
mkdir "$final_path/seafile-server-$seafile_version"
2018-07-31 17:46:42 +02:00
if [[ $architecture == "i386" ]]
then
2019-06-11 22:28:26 +02:00
ynh_die --message "Error : this architecture is no longer supported by the upstream. Please create en issue here : https://github.com/YunoHost-Apps/seafile_ynh/issues to ask to discuss about a support of this architecture"
2018-07-31 17:46:42 +02:00
fi
2018-01-19 20:55:44 +01:00
ynh_setup_source "$final_path/seafile-server-$seafile_version" "$architecture"
2017-01-31 23:25:17 +01:00
}
2020-05-01 15:39:29 +02:00
install_source_7_0() {
if ! [ -e $final_path/seafile-server-7.0.5 ]; then
mkdir "$final_path/seafile-server-7.0.5"
if [[ $architecture == "i386" ]]
then
ynh_die --message "Error : this architecture is no longer supported by the upstream. Please create en issue here : https://github.com/YunoHost-Apps/seafile_ynh/issues to ask to discuss about a support of this architecture"
fi
ynh_setup_source "$final_path/seafile-server-7.0.5" "$architecture"_7_0
fi
}
2017-07-21 14:56:41 +02:00
install_dependance() {
2021-03-16 16:13:43 +01:00
ynh_install_app_dependencies python3 python3-setuptools python3-pip python3-requests python3-dev libmariadb-dev-compat libmariadb-dev \
expect ffmpeg \
memcached libmemcached-dev \
python3-scipy python3-matplotlib \
2021-03-16 16:13:43 +01:00
libjpeg62-turbo-dev zlib1g-dev # For building pillow
2019-10-11 21:40:07 +02:00
ynh_add_swap 2000
2020-03-27 13:25:40 +01:00
# We need to do that because we can have some issue about the permission access to the pip cache without this
set_permission
2020-02-19 22:00:10 +01:00
# Note that we install imageio to force the dependance, without this imageio 2.8 is installed and it need python3.5
sudo -u $seafile_user pip3 install --user --upgrade django==2.2.* future mysqlclient pymysql Pillow pylibmc captcha jinja2 sqlalchemy psd-tools django-pylibmc django-simple-captcha
2019-10-11 21:40:07 +02:00
ynh_del_swap
2017-01-31 23:25:17 +01:00
}
mv_expect_scripts() {
expect_scripts_dir=$(mktemp -d)
cp expect_scripts/* $expect_scripts_dir
chmod u=rwX,o= -R $expect_scripts_dir
chown $seafile_user -R $expect_scripts_dir
}
2019-06-11 22:28:26 +02:00
set_permission() {
chown -R $seafile_user:$seafile_user $final_path
chmod -R o= $final_path
2019-08-05 15:41:26 +02:00
# check that this directory exist because in some really old install the data could still be in the main seafile directory
2020-03-27 14:44:29 +01:00
# We also check at the install time when data directory is not already initialised
if [ -e /home/yunohost.app/seafile-data ]; then
chown -R $seafile_user:$seafile_user /home/yunohost.app/seafile-data
chmod -R o= /home/yunohost.app/seafile-data
fi
2019-06-11 22:28:26 +02:00
}
2017-07-21 14:56:41 +02:00
ynh_clean_setup () {
2017-08-09 15:34:10 +02:00
pkill -f seafile-controller
pkill -f seaf-server
pkill -f ccnet-server
2019-06-11 22:28:26 +02:00
pkill -f seahub
2018-06-07 21:20:50 +02:00
}