Fix Seafile script missing admin account creation (#2)

* Fix missing admin account creation

* Update seafile-install.sh
This commit is contained in:
Dave Yap 2025-03-04 08:54:15 +08:00 committed by GitHub
parent ea801f7eca
commit 736c3a9cff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -33,7 +33,7 @@ SEAHUB_DB="seahub_db"
DB_USER="seafile" DB_USER="seafile"
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13) DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)
ADMIN_EMAIL="admin@localhost.local" ADMIN_EMAIL="admin@localhost.local"
ADMIN_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13) ADMIN_PASS="helper-scripts"
sudo -u mysql mysql -s -e "CREATE DATABASE $CCNET_DB CHARACTER SET utf8;" sudo -u mysql mysql -s -e "CREATE DATABASE $CCNET_DB CHARACTER SET utf8;"
sudo -u mysql mysql -s -e "CREATE DATABASE $SEAFILE_DB CHARACTER SET utf8;" sudo -u mysql mysql -s -e "CREATE DATABASE $SEAFILE_DB CHARACTER SET utf8;"
sudo -u mysql mysql -s -e "CREATE DATABASE $SEAHUB_DB CHARACTER SET utf8;" sudo -u mysql mysql -s -e "CREATE DATABASE $SEAHUB_DB CHARACTER SET utf8;"
@ -189,28 +189,28 @@ sed -i "0,/127.0.0.1/s/127.0.0.1/0.0.0.0/" /opt/seafile/conf/gunicorn.conf.py
msg_ok "Conf files adjusted" msg_ok "Conf files adjusted"
msg_info "Setting up Seafile" msg_info "Setting up Seafile"
$STD su - seafile -c "bash /opt/seafile/seafile-server-latest/seafile.sh start" $STD su - seafile -c "/opt/seafile/seafile-server-latest/seafile.sh start"
$STD su - seafile -c "expect <<EOF $STD su - seafile -c "expect <<EOF
spawn bash /opt/seafile/seafile-server-latest/seahub.sh start spawn /opt/seafile/seafile-server-latest/seahub.sh start
expect { expect {
\"What is the email for the admin account\" { \"email\" {
send \"$ADMIN_EMAIL\r\" send \"admin@localhost.local\r\"
} }
} }
expect { expect {
\"What is the password for the admin account\" { \"password\" {
send \"$ADMIN_PASS\r\" send \"helper-scripts\r\"
} }
} }
expect { expect {
\"Enter the password again:\" { \"password again\" {
send \"$ADMIN_PASS\r\" send \"helper-scripts\r\"
} }
} }
expect eof expect eof
EOF" EOF"
$STD su - seafile -c "bash /opt/seafile/seafile-server-latest/seahub.sh stop" $STD su - seafile -c "/opt/seafile/seafile-server-latest/seahub.sh stop"
$STD su - seafile -c "bash /opt/seafile/seafile-server-latest/seafile.sh stop" $STD su - seafile -c "/opt/seafile/seafile-server-latest/seafile.sh stop"
msg_ok "Seafile setup" msg_ok "Seafile setup"
msg_info "Creating Services" msg_info "Creating Services"
@ -260,4 +260,4 @@ msg_info "Cleaning up"
rm -rf seafile-server_11.0.13_x86-64.tar.gz rm -rf seafile-server_11.0.13_x86-64.tar.gz
$STD apt-get -y autoremove $STD apt-get -y autoremove
$STD apt-get -y autoclean $STD apt-get -y autoclean
msg_ok "Cleaned" msg_ok "Cleaned"