mirror of
https://github.com/YunoHost-Apps/seafile_ynh.git
synced 2024-09-03 20:26:01 +02:00
fix upgrade scripts and expect permission for execution
This commit is contained in:
parent
8e50e903d4
commit
49078e9ddf
4 changed files with 37 additions and 62 deletions
|
@ -43,13 +43,22 @@ install_dependance() {
|
||||||
ynh_del_swap
|
ynh_del_swap
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
set_permission() {
|
set_permission() {
|
||||||
chown -R $seafile_user:$seafile_user $final_path
|
chown -R $seafile_user:$seafile_user $final_path
|
||||||
|
chmod -R o= $final_path
|
||||||
# check that this directory exist because in some really old install the data could still be in the main seafile directory
|
# check that this directory exist because in some really old install the data could still be in the main seafile directory
|
||||||
# We also check at the install time when data directory is not already initialised
|
# We also check at the install time when data directory is not already initialised
|
||||||
test -e /home/yunohost.app/seafile-data && chown -R $seafile_user:$seafile_user /home/yunohost.app/seafile-data
|
if [ -e /home/yunohost.app/seafile-data ]; then
|
||||||
# Well need to put this here because if test return false, set_permission also return false and the install fail
|
chown -R $seafile_user:$seafile_user /home/yunohost.app/seafile-data
|
||||||
true
|
chmod -R o= /home/yunohost.app/seafile-data
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
#!/usr/bin/expect
|
|
||||||
set timeout 10
|
|
||||||
|
|
||||||
set seafile_dir [lindex $argv 0]
|
|
||||||
set admin_email [lindex $argv 1]
|
|
||||||
|
|
||||||
spawn $seafile_dir/seahub.sh start
|
|
||||||
|
|
||||||
expect "for the admin account?"
|
|
||||||
send "$admin_email\r";
|
|
||||||
|
|
||||||
expect "for the admin account?"
|
|
||||||
send {__ADMIN_PASSWORD__};
|
|
||||||
send '\r';
|
|
||||||
|
|
||||||
expect "Enter the"
|
|
||||||
send {__ADMIN_PASSWORD__};
|
|
||||||
send '\r';
|
|
||||||
|
|
||||||
expect eof
|
|
|
@ -102,9 +102,9 @@ ynh_mysql_setup_db --db_user $db_user --db_name seahubdb --db_pwd "$db_pwd"
|
||||||
ynh_script_progression --message="Configuring application..." --weight=3
|
ynh_script_progression --message="Configuring application..." --weight=3
|
||||||
|
|
||||||
# Run install script
|
# Run install script
|
||||||
chmod +x expect_scripts/install.exp
|
mv_expect_scripts
|
||||||
chmod +x $final_path/seafile-server-$seafile_version/setup-seafile-mysql.sh
|
chmod +x $final_path/seafile-server-$seafile_version/setup-seafile-mysql.sh
|
||||||
expect_scripts/install.exp "$final_path/seafile-server-$seafile_version" "$server_name" "$domain" "$seafile_data" "$fileserver_port" "$db_pwd"
|
$expect_scripts_dir/install.exp "$final_path/seafile-server-$seafile_version" "$server_name" "$domain" "$seafile_data" "$fileserver_port" "$db_pwd"
|
||||||
|
|
||||||
sleep 3
|
sleep 3
|
||||||
|
|
||||||
|
@ -182,18 +182,6 @@ ynh_add_systemd_config --service seahub --template seahub.service
|
||||||
ynh_script_progression --message="Configuring nginx..." --weight=1
|
ynh_script_progression --message="Configuring nginx..." --weight=1
|
||||||
ynh_add_nginx_config 'seahub_port fileserver_port webdav_port'
|
ynh_add_nginx_config 'seahub_port fileserver_port webdav_port'
|
||||||
|
|
||||||
# Copy first launch script
|
|
||||||
cp expect_scripts/first_launch.exp $final_path
|
|
||||||
chmod +x $final_path/first_launch.exp
|
|
||||||
|
|
||||||
# Set permissions to seafile directory
|
|
||||||
set_permission
|
|
||||||
|
|
||||||
# Sometime we have a current effect. We try to lunch seafile when not all permissions are already set.
|
|
||||||
# So wait untils all permissions are cleanly set
|
|
||||||
sleep 5
|
|
||||||
ynh_debug_exec ls /opt/yunohost/seafile/ccnet
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -114,14 +114,10 @@ install_dependance
|
||||||
ynh_script_progression --message="Configuring application..."
|
ynh_script_progression --message="Configuring application..."
|
||||||
|
|
||||||
# permission to execute update script and expect helper
|
# permission to execute update script and expect helper
|
||||||
chmod +x expect_scripts/upgrade_*.exp
|
mv_expect_scripts
|
||||||
chmod +x expect_scripts/minor-upgrade.exp
|
set_permission
|
||||||
chmod +x $final_path/seafile-server-$seafile_version/upgrade/upgrade_*.sh
|
chmod u+x,o= $final_path/seafile-server-$seafile_version/upgrade/upgrade_*.sh
|
||||||
chmod +x $final_path/seafile-server-$seafile_version/upgrade/minor-upgrade.sh
|
chmod u+x,o= $final_path/seafile-server-$seafile_version/upgrade/minor-upgrade.sh
|
||||||
chown $seafile_user expect_scripts/upgrade_*.exp
|
|
||||||
chown $seafile_user expect_scripts/minor-upgrade.exp
|
|
||||||
chown $seafile_user $final_path/seafile-server-$seafile_version/upgrade/upgrade_*.sh
|
|
||||||
chown $seafile_user $final_path/seafile-server-$seafile_version/upgrade/minor-upgrade.sh
|
|
||||||
|
|
||||||
# do the upgrade ( the ";&" syntax mean when it go in the first case which is true it do all the next case)
|
# do the upgrade ( the ";&" syntax mean when it go in the first case which is true it do all the next case)
|
||||||
case $installed_version in
|
case $installed_version in
|
||||||
|
@ -132,33 +128,33 @@ case $installed_version in
|
||||||
"4.1."* )
|
"4.1."* )
|
||||||
# Update seafile by script
|
# Update seafile by script
|
||||||
install_source_7_0
|
install_source_7_0
|
||||||
expect_scripts/upgrade_4.2.1.exp $final_path/seafile-server-7.0.5
|
$expect_scripts_dir/upgrade_4.2.1.exp $final_path/seafile-server-7.0.5
|
||||||
;&
|
;&
|
||||||
"4.3."* )
|
"4.3."* )
|
||||||
# Update seafile by script
|
# Update seafile by script
|
||||||
install_source_7_0
|
install_source_7_0
|
||||||
expect_scripts/upgrade_4.4.3.exp $final_path/seafile-server-7.0.5
|
$expect_scripts_dir/upgrade_4.4.3.exp $final_path/seafile-server-7.0.5
|
||||||
;&
|
;&
|
||||||
"4.4."* )
|
"4.4."* )
|
||||||
# Update seafile by script
|
# Update seafile by script
|
||||||
install_source_7_0
|
install_source_7_0
|
||||||
expect_scripts/upgrade_5.0.3.exp $final_path/seafile-server-7.0.5
|
$expect_scripts_dir/upgrade_5.0.3.exp $final_path/seafile-server-7.0.5
|
||||||
;&
|
;&
|
||||||
"5.0."* )
|
"5.0."* )
|
||||||
# Update seafile by script
|
# Update seafile by script
|
||||||
install_source_7_0
|
install_source_7_0
|
||||||
expect_scripts/upgrade_5.1.exp $final_path/seafile-server-7.0.5
|
$expect_scripts_dir/upgrade_5.1.exp $final_path/seafile-server-7.0.5
|
||||||
;&
|
;&
|
||||||
"5.1."* )
|
"5.1."* )
|
||||||
# Update seafile by script
|
# Update seafile by script
|
||||||
install_source_7_0
|
install_source_7_0
|
||||||
expect_scripts/upgrade_6.0.exp $final_path/seafile-server-7.0.5
|
$expect_scripts_dir/upgrade_6.0.exp $final_path/seafile-server-7.0.5
|
||||||
;&
|
;&
|
||||||
"6.0."* )
|
"6.0."* )
|
||||||
install_source_7_0
|
install_source_7_0
|
||||||
|
|
||||||
# Update seafile by script
|
# Update seafile by script
|
||||||
expect_scripts/upgrade_6.1.exp $final_path/seafile-server-7.0.5
|
$expect_scripts_dir/upgrade_6.1.exp $final_path/seafile-server-7.0.5
|
||||||
|
|
||||||
# Enable manually wiki
|
# Enable manually wiki
|
||||||
echo 'ENABLE_WIKI = True' | tee -a $final_path/conf/seahub_settings.py
|
echo 'ENABLE_WIKI = True' | tee -a $final_path/conf/seahub_settings.py
|
||||||
|
@ -166,12 +162,12 @@ case $installed_version in
|
||||||
"6.1."* )
|
"6.1."* )
|
||||||
# Update seafile by script
|
# Update seafile by script
|
||||||
install_source_7_0
|
install_source_7_0
|
||||||
expect_scripts/upgrade_6.2.exp $final_path/seafile-server-7.0.5
|
$expect_scripts_dir/upgrade_6.2.exp $final_path/seafile-server-7.0.5
|
||||||
;&
|
;&
|
||||||
"6.2."* )
|
"6.2."* )
|
||||||
# Update seafile by script
|
# Update seafile by script
|
||||||
install_source_7_0
|
install_source_7_0
|
||||||
expect_scripts/upgrade_6.3.exp $final_path/seafile-server-7.0.5
|
$expect_scripts_dir/upgrade_6.3.exp $final_path/seafile-server-7.0.5
|
||||||
|
|
||||||
# Update logrotate to have the last version
|
# Update logrotate to have the last version
|
||||||
ynh_use_logrotate --logfile $final_path/logs --nonappend
|
ynh_use_logrotate --logfile $final_path/logs --nonappend
|
||||||
|
@ -179,7 +175,7 @@ case $installed_version in
|
||||||
"6.3."* )
|
"6.3."* )
|
||||||
# Update seafile by script
|
# Update seafile by script
|
||||||
install_source_7_0
|
install_source_7_0
|
||||||
expect_scripts/upgrade_7.0.exp $final_path/seafile-server-7.0.5
|
$expect_scripts_dir/upgrade_7.0.exp $final_path/seafile-server-7.0.5
|
||||||
# SSO authentication
|
# SSO authentication
|
||||||
echo 'ENABLE_REMOTE_USER_AUTHENTICATION = True' | tee -a $final_path/conf/seahub_settings.py
|
echo 'ENABLE_REMOTE_USER_AUTHENTICATION = True' | tee -a $final_path/conf/seahub_settings.py
|
||||||
echo "REMOTE_USER_HEADER = 'HTTP_EMAIL'" | tee -a $final_path/conf/seahub_settings.py
|
echo "REMOTE_USER_HEADER = 'HTTP_EMAIL'" | tee -a $final_path/conf/seahub_settings.py
|
||||||
|
@ -190,11 +186,17 @@ case $installed_version in
|
||||||
ynh_mysql_execute_as_root --sql "DELETE FROM \`django_session\`" --database seahubdb
|
ynh_mysql_execute_as_root --sql "DELETE FROM \`django_session\`" --database seahubdb
|
||||||
|
|
||||||
ynh_print_warn --message "To be able to continue to use the SSO you probybly need to migrate your account. You can use the command 'yunohost app action run seafile migrate_user_email_to_mail_email' to migrate all of theses account. Note that after this migratation you need to reconfigure all your client with the official email of the user."
|
ynh_print_warn --message "To be able to continue to use the SSO you probybly need to migrate your account. You can use the command 'yunohost app action run seafile migrate_user_email_to_mail_email' to migrate all of theses account. Note that after this migratation you need to reconfigure all your client with the official email of the user."
|
||||||
ynh_secure_remove --file="$final_path/seafile-server-7.0.5"
|
|
||||||
;&
|
;&
|
||||||
"7.0"* )
|
"7.0"* )
|
||||||
# Fix file comment
|
# Fix file comment
|
||||||
$final_path/seafile-server-$seafile_version/seahub.sh python-env seahub/manage.py migrate_file_comment
|
pushd $final_path/seafile-server-$seafile_version
|
||||||
|
sudo -u $seafile_user $final_path/seafile-server-$seafile_version/seahub.sh python-env seahub/manage.py migrate_file_comment
|
||||||
|
popd
|
||||||
|
|
||||||
|
# Update seafile by script
|
||||||
|
sudo -u $seafile_user $expect_scripts_dir/upgrade_7.1.exp $final_path/seafile-server-$seafile_version
|
||||||
|
|
||||||
|
ynh_secure_remove --file="$final_path/seafile-server-7.0.5"
|
||||||
|
|
||||||
# Enable memcached
|
# Enable memcached
|
||||||
cat >> $final_path/conf/seahub_settings.py <<EOF
|
cat >> $final_path/conf/seahub_settings.py <<EOF
|
||||||
|
@ -205,10 +207,6 @@ CACHES = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Update seafile by script
|
|
||||||
sudo -u $seafile_user expect_scripts/upgrade_7.1.exp $final_path/seafile-server-$seafile_version
|
|
||||||
|
|
||||||
# Fix seafile data link. Look like that the upgrade script of seafile don't always work correctly
|
# Fix seafile data link. Look like that the upgrade script of seafile don't always work correctly
|
||||||
if [ -e $final_path/seafile-data ]; then
|
if [ -e $final_path/seafile-data ]; then
|
||||||
old_data_dir_path="$final_path/seafile_data$(date '+%Y%m%d.%H%M%S')"
|
old_data_dir_path="$final_path/seafile_data$(date '+%Y%m%d.%H%M%S')"
|
||||||
|
@ -217,12 +215,12 @@ EOF
|
||||||
ln -s $seafile_data $final_path/seafile-data
|
ln -s $seafile_data $final_path/seafile-data
|
||||||
;&
|
;&
|
||||||
# "7.1."* )
|
# "7.1."* )
|
||||||
# sudo -u $seafile_user expect_scripts/upgrade_8.0.exp $final_path/seafile-server-$seafile_version
|
# sudo -u $seafile_user $expect_scripts_dir/upgrade_8.0.exp $final_path/seafile-server-$seafile_version
|
||||||
# echo "FILTER = permission=cn=$app.main,ou=permission,dc=yunohost,dc=org" | tee -a $final_path/conf/ccnet.conf
|
# echo "FILTER = permission=cn=$app.main,ou=permission,dc=yunohost,dc=org" | tee -a $final_path/conf/ccnet.conf
|
||||||
# ;&
|
# ;&
|
||||||
esac
|
esac
|
||||||
|
|
||||||
sudo -u $seafile_user expect_scripts/minor-upgrade.exp $final_path/seafile-server-$seafile_version
|
sudo -u $seafile_user $expect_scripts_dir/minor-upgrade.exp $final_path/seafile-server-$seafile_version
|
||||||
|
|
||||||
## Install webdav and logrotate if not installed
|
## Install webdav and logrotate if not installed
|
||||||
if [[ $installed_version = "4.0."* ]] || [[ $installed_version = "4.1."* ]]
|
if [[ $installed_version = "4.0."* ]] || [[ $installed_version = "4.1."* ]]
|
||||||
|
|
Loading…
Add table
Reference in a new issue