From 888e0b521de925a6f40424ba411116c7ac339c9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Fri, 24 Nov 2023 10:59:10 +0100 Subject: [PATCH] Remove completly expect scripts --- manifest.toml | 2 +- scripts/expect_scripts/install.exp | 54 ------------------------------ scripts/install | 20 ++++++----- scripts/upgrade | 2 ++ 4 files changed, 15 insertions(+), 63 deletions(-) delete mode 100644 scripts/expect_scripts/install.exp diff --git a/manifest.toml b/manifest.toml index 3af2d77..335bd4b 100644 --- a/manifest.toml +++ b/manifest.toml @@ -111,7 +111,7 @@ ram.runtime = "500M" armhf.sha256 = "171fcf08b726d452e1c4cd22dadb9f8f5cf6848424ebc1e04cde5be34ef3d7f6" [resources.apt] - packages = ["expect", "ffmpeg", + packages = ["ffmpeg", "python3", "python3-venv", "python3-setuptools", "python3-pip", "python3-dev", "python3-requests", "python3-scipy", "python3-matplotlib", "mariadb-server", "libmariadb-dev-compat", "libmariadb-dev", diff --git a/scripts/expect_scripts/install.exp b/scripts/expect_scripts/install.exp deleted file mode 100644 index b370f52..0000000 --- a/scripts/expect_scripts/install.exp +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/expect -set timeout 10 - -set seafile_dir [lindex $argv 0] -set server_name [lindex $argv 1] -set domain [lindex $argv 2] -set fileserver_port [lindex $argv 3] -set db_name [lindex $argv 4] -set db_pwd [lindex $argv 5] - -spawn $seafile_dir/setup-seafile-mysql.sh - -expect "Press ENTER to continue" -send "\r"; - -expect "What is the name of the server? It will be displayed on the client." -send "$server_name\r"; - -expect "What is the ip or domain of the server?" -send "$domain\r"; - -expect "Which port do you want to use for the seafile fileserver?" -send "$fileserver_port\r"; - -expect "Use existing ccnet/seafile/seahub databases" -send "2\r"; - -expect "What is the host of mysql server?" -send "localhost\r"; - -expect "What is the port of mysql server?" -send "3306\r"; - -expect "Which mysql user to use for seafile?" -send "seafile\r"; - -expect "What is the password for mysql user" -send "$db_pwd\r"; - -expect "Enter the existing database name for ccnet:" -send "ccnetdb\r"; - -expect "Enter the existing database name for seafile:" -send "$db_name\r"; - -expect "Enter the existing database name for seahub:" -send "seahubdb\r"; - -expect "Press ENTER to continue, or Ctrl-C to abort" -send "\r"; - -interact - -wait diff --git a/scripts/install b/scripts/install index 7695a70..9acee2f 100644 --- a/scripts/install +++ b/scripts/install @@ -45,15 +45,19 @@ $db_helper --db_user $db_user --db_name seahubdb --db_pwd "$db_pwd" ynh_script_progression --message="Configuring application..." --weight=3 # Run install script -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 5 +sudo -u $YNH_APP_ID bash $install_dir/seafile-server-$seafile_version/setup-seafile-mysql.sh auto \ + --server-name "$server_name" \ + --server-ip $domain \ + --fileserver-port $port_fileserver \ + --use-existing-db 0 \ + --mysql-host localhost \ + --mysql-port 3306 \ + --mysql-user $db_user \ + --mysql-user-passwd "$db_pwd" \ + --seafile-db "$db_name" \ + --seafile-db ccnetdb \ + --seahub-db seahubdb # 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) diff --git a/scripts/upgrade b/scripts/upgrade index 8b5379f..30355f2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -56,6 +56,8 @@ if mysqlshow | grep -q seafiledb; then $mysqlconn -e "RENAME TABLE seafiledb.$name to $db_name.$name"; done; $mysqlconn -e "DROP DATABASE seafiledb" + ynh_replace_string --match_string='db_name = seafiledb' --replace_string='db_name = seafile' --target_file=$install_dir/conf/seafile.conf + sed -i "s|password\s*=\s*.*^|password = $db_pwd" $install_dir/conf/seafile.conf fi # Set missing settings