Remove completly expect scripts

This commit is contained in:
Josué Tille 2023-11-24 10:59:10 +01:00
parent 43826777fa
commit 888e0b521d
No known key found for this signature in database
GPG key ID: 716A6C99B04194EF
4 changed files with 15 additions and 63 deletions

View file

@ -111,7 +111,7 @@ ram.runtime = "500M"
armhf.sha256 = "171fcf08b726d452e1c4cd22dadb9f8f5cf6848424ebc1e04cde5be34ef3d7f6" armhf.sha256 = "171fcf08b726d452e1c4cd22dadb9f8f5cf6848424ebc1e04cde5be34ef3d7f6"
[resources.apt] [resources.apt]
packages = ["expect", "ffmpeg", packages = ["ffmpeg",
"python3", "python3-venv", "python3-setuptools", "python3-pip", "python3-dev", "python3", "python3-venv", "python3-setuptools", "python3-pip", "python3-dev",
"python3-requests", "python3-scipy", "python3-matplotlib", "python3-requests", "python3-scipy", "python3-matplotlib",
"mariadb-server", "libmariadb-dev-compat", "libmariadb-dev", "mariadb-server", "libmariadb-dev-compat", "libmariadb-dev",

View file

@ -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

View file

@ -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 ynh_script_progression --message="Configuring application..." --weight=3
# Run install script # 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 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" sudo -u $YNH_APP_ID bash $install_dir/seafile-server-$seafile_version/setup-seafile-mysql.sh auto \
--server-name "$server_name" \
sleep 5 --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 # 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) seahub_secret_key=$(grep -P 'SECRET_KEY\s*=\s*".+"' $install_dir/conf/seahub_settings.py | cut -d'"' -f2)

View file

@ -56,6 +56,8 @@ if mysqlshow | grep -q seafiledb; then
$mysqlconn -e "RENAME TABLE seafiledb.$name to $db_name.$name"; $mysqlconn -e "RENAME TABLE seafiledb.$name to $db_name.$name";
done; done;
$mysqlconn -e "DROP DATABASE seafiledb" $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 fi
# Set missing settings # Set missing settings