From d498be179bc3981cb507b5e2d8d9210c0a7d7790 Mon Sep 17 00:00:00 2001 From: Josue-T Date: Fri, 5 May 2017 15:47:07 +0200 Subject: [PATCH] Clean upgrade script (#26) * Clean upgrade script --- conf/minor-upgrade.exp | 12 ++++++++++ scripts/upgrade | 53 +++++++++++------------------------------- 2 files changed, 26 insertions(+), 39 deletions(-) create mode 100644 conf/minor-upgrade.exp diff --git a/conf/minor-upgrade.exp b/conf/minor-upgrade.exp new file mode 100644 index 0000000..0d3cd97 --- /dev/null +++ b/conf/minor-upgrade.exp @@ -0,0 +1,12 @@ +#!/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 diff --git a/scripts/upgrade b/scripts/upgrade index dfd0edc..e06d718 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -29,66 +29,41 @@ sudo mv seafile-server-$seafile_version/* $final_path/seafile-server-$seafile_ve sudo mv '/tmp/seafile_src.tar.gz' $final_path/installed/seafile-server_${seafile_version}.tar.gz # permission to execute update script and expect helper -sudo chmod +x ../conf/upgrade_4.1.1.exp -sudo chmod +x ../conf/upgrade_4.2.1.exp -sudo chmod +x ../conf/upgrade_4.3.2.exp -sudo chmod +x ../conf/upgrade_4.4.3.exp -sudo chmod +x ../conf/upgrade_5.0.3.exp -sudo chmod +x ../conf/upgrade_5.1.exp -sudo chmod +x ../conf/upgrade_6.0.exp -sudo chmod +x $final_path/seafile-server-$seafile_version/upgrade/upgrade_4.0_4.1.sh -sudo chmod +x $final_path/seafile-server-$seafile_version/upgrade/upgrade_4.1_4.2.sh -sudo chmod +x $final_path/seafile-server-$seafile_version/upgrade/upgrade_4.2_4.3.sh -sudo chmod +x $final_path/seafile-server-$seafile_version/upgrade/upgrade_4.3_4.4.sh -sudo chmod +x $final_path/seafile-server-$seafile_version/upgrade/upgrade_4.4_5.0.sh -sudo chmod +x $final_path/seafile-server-$seafile_version/upgrade/upgrade_5.0_5.1.sh -sudo chmod +x $final_path/seafile-server-$seafile_version/upgrade/upgrade_5.1_6.0.sh -# do the upgrade +sudo chmod +x ../conf/upgrade_*.exp +sudo chmod +x ../conf/minor-upgrade.exp +sudo chmod +x $final_path/seafile-server-$seafile_version/upgrade/upgrade_*.sh +sudo chmod +x $final_path/seafile-server-$seafile_version/upgrade/minor-upgrade.sh + +# do the upgrade ( the ";&" syntax mean when it go in the frist cas how are true it do the next case) case $installed_version in "4.0."* ) # Update seafile by script sudo ../conf/upgrade_4.1.1.exp $final_path/seafile-server-$seafile_version $root_pwd - sudo ../conf/upgrade_4.2.1.exp $final_path/seafile-server-$seafile_version $root_pwd - sudo ../conf/upgrade_4.3.2.exp $final_path/seafile-server-$seafile_version $root_pwd - sudo ../conf/upgrade_4.4.3.exp $final_path/seafile-server-$seafile_version $root_pwd - sudo ../conf/upgrade_5.0.3.exp $final_path/seafile-server-$seafile_version $root_pwd - sudo ../conf/upgrade_5.1.exp $final_path/seafile-server-$seafile_version $root_pwd - sudo ../conf/upgrade_6.0.exp $final_path/seafile-server-$seafile_version $root_pwd -;; +;& "4.1."* ) # Update seafile by script sudo ../conf/upgrade_4.2.1.exp $final_path/seafile-server-$seafile_version $root_pwd - sudo ../conf/upgrade_4.3.2.exp $final_path/seafile-server-$seafile_version $root_pwd - sudo ../conf/upgrade_4.4.3.exp $final_path/seafile-server-$seafile_version $root_pwd - sudo ../conf/upgrade_5.0.3.exp $final_path/seafile-server-$seafile_version $root_pwd - sudo ../conf/upgrade_5.1.exp $final_path/seafile-server-$seafile_version $root_pwd - sudo ../conf/upgrade_6.0.exp $final_path/seafile-server-$seafile_version $root_pwd -;; +;& "4.3."* ) # Update seafile by script sudo ../conf/upgrade_4.4.3.exp $final_path/seafile-server-$seafile_version $root_pwd - sudo ../conf/upgrade_5.0.3.exp $final_path/seafile-server-$seafile_version $root_pwd - sudo ../conf/upgrade_5.1.exp $final_path/seafile-server-$seafile_version $root_pwd - sudo ../conf/upgrade_6.0.exp $final_path/seafile-server-$seafile_version $root_pwd -;; +;& "4.4."* ) # Update seafile by script sudo ../conf/upgrade_5.0.3.exp $final_path/seafile-server-$seafile_version $root_pwd - sudo ../conf/upgrade_5.1.exp $final_path/seafile-server-$seafile_version $root_pwd - sudo ../conf/upgrade_6.0.exp $final_path/seafile-server-$seafile_version $root_pwd -;; +;& "5.0."* ) # Update seafile by script sudo ../conf/upgrade_5.1.exp $final_path/seafile-server-$seafile_version $root_pwd - sudo ../conf/upgrade_6.0.exp $final_path/seafile-server-$seafile_version $root_pwd -;; +;& "5.1."* ) # Update seafile by script - sudo ../conf/upgrade_5.1.exp $final_path/seafile-server-$seafile_version $root_pwd sudo ../conf/upgrade_6.0.exp $final_path/seafile-server-$seafile_version $root_pwd -;; +;& esac +sudo ../conf/minor-upgrade.exp $final_path/seafile-server-$seafile_version $root_pwd + ## Install webdav and logrotate if not installed if [[ $installed_version = "4.0."* ]] || [[ $installed_version = "4.1."* ]] then