mirror of
https://github.com/YunoHost-Apps/seafile_ynh.git
synced 2024-09-03 20:26:01 +02:00
don't use expect for upgrade scripts and improve upgrade stability
This commit is contained in:
parent
bc5da37539
commit
43826777fa
17 changed files with 16 additions and 182 deletions
|
@ -58,21 +58,14 @@ install_dependance() {
|
|||
done
|
||||
}
|
||||
|
||||
mv_expect_scripts() {
|
||||
expect_scripts_dir=$(mktemp -d)
|
||||
cp expect_scripts/* $expect_scripts_dir
|
||||
chmod u=rwx,o= -R $expect_scripts_dir
|
||||
chown $YNH_APP_ID -R $expect_scripts_dir
|
||||
}
|
||||
|
||||
set_permission() {
|
||||
chown -R $YNH_APP_ID:$YNH_APP_ID $install_dir
|
||||
chmod -R u+rwX,g-wx,o= $install_dir
|
||||
setfacl -m user:www-data:rX $install_dir
|
||||
setfacl -m user:www-data:rX $install_dir/seafile-server-$seafile_version
|
||||
# At install time theses directory are not available
|
||||
test -e $install_dir/seafile-server-latest/seahub && setfacl -m user:www-data:rX $install_dir/seafile-server-latest/seahub
|
||||
test -e $install_dir/seafile-server-latest/seahub/media && setfacl -R -m user:www-data:rX $install_dir/seafile-server-latest/seahub/media
|
||||
test -e $install_dir/seafile-server-$seafile_version/seahub && setfacl -m user:www-data:rX $install_dir/seafile-server-$seafile_version/seahub
|
||||
test -e $install_dir/seafile-server-$seafile_version/seahub/media && setfacl -R -m user:www-data:rX $install_dir/seafile-server-$seafile_version/seahub/media
|
||||
test -e $install_dir/seahub-data && setfacl -R -m user:www-data:rX $install_dir/seahub-data
|
||||
|
||||
find $data_dir \( \! -perm -o= \
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
#!/usr/bin/expect
|
||||
set timeout 5
|
||||
|
||||
set seafile_dir [lindex $argv 0]
|
||||
set mysql_password [lindex $argv 1]
|
||||
|
||||
spawn $seafile_dir/upgrade/minor-upgrade.sh
|
||||
|
||||
expect "to contiune"
|
||||
send "\r";
|
||||
|
||||
interact
|
|
@ -1,11 +0,0 @@
|
|||
#!/usr/bin/expect
|
||||
set timeout 5
|
||||
|
||||
set seafile_dir [lindex $argv 0]
|
||||
|
||||
spawn $seafile_dir/upgrade/upgrade_4.1_4.2.sh
|
||||
|
||||
expect "to contiune"
|
||||
send "\r";
|
||||
|
||||
interact
|
|
@ -1,11 +0,0 @@
|
|||
#!/usr/bin/expect
|
||||
set timeout 5
|
||||
|
||||
set seafile_dir [lindex $argv 0]
|
||||
|
||||
spawn $seafile_dir/upgrade/upgrade_4.2_4.3.sh
|
||||
|
||||
expect "to contiune"
|
||||
send "\r";
|
||||
|
||||
interact
|
|
@ -1,11 +0,0 @@
|
|||
#!/usr/bin/expect
|
||||
set timeout 5
|
||||
|
||||
set seafile_dir [lindex $argv 0]
|
||||
|
||||
spawn $seafile_dir/upgrade/upgrade_4.3_4.4.sh
|
||||
|
||||
expect "to contiune"
|
||||
send "\r";
|
||||
|
||||
interact
|
|
@ -1,11 +0,0 @@
|
|||
#!/usr/bin/expect
|
||||
set timeout 5
|
||||
|
||||
set seafile_dir [lindex $argv 0]
|
||||
|
||||
spawn $seafile_dir/upgrade/upgrade_4.4_5.0.sh
|
||||
|
||||
expect "to contiune"
|
||||
send "\r";
|
||||
|
||||
interact
|
|
@ -1,11 +0,0 @@
|
|||
#!/usr/bin/expect
|
||||
set timeout 5
|
||||
|
||||
set seafile_dir [lindex $argv 0]
|
||||
|
||||
spawn $seafile_dir/upgrade/upgrade_5.0_5.1.sh
|
||||
|
||||
expect "to contiune"
|
||||
send "\r";
|
||||
|
||||
interact
|
|
@ -1,11 +0,0 @@
|
|||
#!/usr/bin/expect
|
||||
set timeout 5
|
||||
|
||||
set seafile_dir [lindex $argv 0]
|
||||
|
||||
spawn $seafile_dir/upgrade/upgrade_5.1_6.0.sh
|
||||
|
||||
expect "to contiune"
|
||||
send "\r";
|
||||
|
||||
interact
|
|
@ -1,11 +0,0 @@
|
|||
#!/usr/bin/expect
|
||||
set timeout 5
|
||||
|
||||
set seafile_dir [lindex $argv 0]
|
||||
|
||||
spawn $seafile_dir/upgrade/upgrade_6.0_6.1.sh
|
||||
|
||||
expect "to contiune"
|
||||
send "\r";
|
||||
|
||||
interact
|
|
@ -1,11 +0,0 @@
|
|||
#!/usr/bin/expect
|
||||
set timeout 5
|
||||
|
||||
set seafile_dir [lindex $argv 0]
|
||||
|
||||
spawn $seafile_dir/upgrade/upgrade_6.1_6.2.sh
|
||||
|
||||
expect "to contiune"
|
||||
send "\r";
|
||||
|
||||
interact
|
|
@ -1,11 +0,0 @@
|
|||
#!/usr/bin/expect
|
||||
set timeout 5
|
||||
|
||||
set seafile_dir [lindex $argv 0]
|
||||
|
||||
spawn $seafile_dir/upgrade/upgrade_6.2_6.3.sh
|
||||
|
||||
expect "to contiune"
|
||||
send "\r";
|
||||
|
||||
interact
|
|
@ -1,11 +0,0 @@
|
|||
#!/usr/bin/expect
|
||||
set timeout 5
|
||||
|
||||
set seafile_dir [lindex $argv 0]
|
||||
|
||||
spawn $seafile_dir/upgrade/upgrade_6.3_7.0.sh
|
||||
|
||||
expect "to contiune"
|
||||
send "\r";
|
||||
|
||||
interact
|
|
@ -1,19 +0,0 @@
|
|||
#!/usr/bin/expect
|
||||
set timeout 5
|
||||
|
||||
set seafile_dir [lindex $argv 0]
|
||||
|
||||
spawn $seafile_dir/upgrade/upgrade_7.0_7.1.sh
|
||||
|
||||
expect "to contiune"
|
||||
send "\r";
|
||||
|
||||
sleep 10;
|
||||
|
||||
send "\r";
|
||||
|
||||
sleep 1;
|
||||
|
||||
send "\r";
|
||||
|
||||
interact
|
|
@ -1,11 +0,0 @@
|
|||
#!/usr/bin/expect
|
||||
set timeout 5
|
||||
|
||||
set seafile_dir [lindex $argv 0]
|
||||
|
||||
spawn $seafile_dir/upgrade/upgrade_8.0_9.0.sh
|
||||
|
||||
expect "to contiune"
|
||||
send "\r";
|
||||
|
||||
interact
|
|
@ -1,11 +0,0 @@
|
|||
#!/usr/bin/expect
|
||||
set timeout 5
|
||||
|
||||
set seafile_dir [lindex $argv 0]
|
||||
|
||||
spawn $seafile_dir/upgrade/upgrade_7.1_8.0.sh
|
||||
|
||||
expect "to contiune"
|
||||
send "\r";
|
||||
|
||||
interact
|
|
@ -45,12 +45,15 @@ $db_helper --db_user $db_user --db_name seahubdb --db_pwd "$db_pwd"
|
|||
ynh_script_progression --message="Configuring application..." --weight=3
|
||||
|
||||
# Run install script
|
||||
mv_expect_scripts
|
||||
chmod +x $install_dir/seafile-server-$seafile_version/setup-seafile-mysql.sh
|
||||
expect_scripts_dir=$(mktemp -d)
|
||||
cp expect_scripts/install.exp $expect_scripts_dir
|
||||
chmod u=rwx,o= -R $expect_scripts_dir
|
||||
chown $YNH_APP_ID -R $expect_scripts_dir
|
||||
chmod u+x $install_dir/seafile-server-$seafile_version/setup-seafile-mysql.sh
|
||||
set_permission
|
||||
sudo -u $YNH_APP_ID $expect_scripts_dir/install.exp "$install_dir/seafile-server-$seafile_version" "$server_name" "$domain" "$port_fileserver" "$db_name" "$db_pwd"
|
||||
|
||||
sleep 3
|
||||
sleep 5
|
||||
|
||||
# Retrive values from auto generated config file
|
||||
seahub_secret_key=$(grep -P 'SECRET_KEY\s*=\s*".+"' $install_dir/conf/seahub_settings.py | cut -d'"' -f2)
|
||||
|
|
|
@ -89,10 +89,7 @@ install_dependance
|
|||
ynh_script_progression --message="Configuring application..."
|
||||
|
||||
# permission to execute update script and expect helper
|
||||
mv_expect_scripts
|
||||
set_permission
|
||||
chmod u+x,o= $install_dir/seafile-server-$seafile_version/upgrade/upgrade_*.sh
|
||||
chmod u+x,o= $install_dir/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)
|
||||
case $installed_version in
|
||||
|
@ -114,7 +111,8 @@ case $installed_version in
|
|||
popd
|
||||
|
||||
# Update seafile by script
|
||||
sudo -u $YNH_APP_ID $expect_scripts_dir/upgrade_7.1.exp $install_dir/seafile-server-$seafile_version
|
||||
ynh_replace_string --match_string='read dummy' --replace_string='# patched' --target_file=$install_dir/seafile-server-$seafile_version/upgrade/upgrade_7.0_7.1.sh
|
||||
sudo -u $YNH_APP_ID bash $install_dir/seafile-server-$seafile_version/upgrade/upgrade_7.0_7.1.sh
|
||||
|
||||
# Fix seafile data link. Look like that the upgrade script of seafile don't always work correctly
|
||||
if [ -e $install_dir/seafile-data ]; then
|
||||
|
@ -124,14 +122,17 @@ case $installed_version in
|
|||
ln -s $data_dir $install_dir/seafile-data
|
||||
;&
|
||||
"7.1."* )
|
||||
sudo -u $YNH_APP_ID $expect_scripts_dir/upgrade_8.0.exp $install_dir/seafile-server-$seafile_version
|
||||
ynh_replace_string --match_string='read dummy' --replace_string='# patched' --target_file=$install_dir/seafile-server-$seafile_version/upgrade/upgrade_8.0_9.0.sh
|
||||
sudo -u $YNH_APP_ID bash $install_dir/seafile-server-$seafile_version/upgrade/upgrade_8.0_9.0.sh
|
||||
;&
|
||||
"8.0."* )
|
||||
sudo -u $YNH_APP_ID $expect_scripts_dir/upgrade_9.0.exp $install_dir/seafile-server-$seafile_version
|
||||
ynh_replace_string --match_string='read dummy' --replace_string='# patched' --target_file=$install_dir/seafile-server-$seafile_version/upgrade/upgrade_7.1_8.0.sh
|
||||
sudo -u $YNH_APP_ID bash $install_dir/seafile-server-$seafile_version/upgrade/upgrade_7.1_8.0.sh
|
||||
;&
|
||||
esac
|
||||
|
||||
sudo -u $YNH_APP_ID $expect_scripts_dir/minor-upgrade.exp $install_dir/seafile-server-$seafile_version
|
||||
ynh_replace_string --match_string='read dummy' --replace_string='# patched' --target_file=$install_dir/seafile-server-$seafile_version/upgrade/minor-upgrade.sh
|
||||
sudo -u $YNH_APP_ID bash $install_dir/seafile-server-$seafile_version/upgrade/minor-upgrade.sh
|
||||
|
||||
# Clean url in config in DB
|
||||
clean_url_in_db_config
|
||||
|
|
Loading…
Reference in a new issue