Clean up Seafile script and use generated password instead of hard-coded password (#3)
* Fix missing admin account creation * Update seafile-install.sh * Clean up script
This commit is contained in:
parent
736c3a9cff
commit
c5ffaa4af1
@ -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="helper-scripts"
|
ADMIN_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)
|
||||||
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,26 @@ 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 "/opt/seafile/seafile-server-latest/seafile.sh start"
|
$STD su - seafile -c "bash /opt/seafile/seafile-server-latest/seafile.sh start"
|
||||||
$STD su - seafile -c "expect <<EOF
|
$STD su - seafile -c "expect <<EOF
|
||||||
spawn /opt/seafile/seafile-server-latest/seahub.sh start
|
spawn bash /opt/seafile/seafile-server-latest/seahub.sh start
|
||||||
expect {
|
expect {
|
||||||
\"email\" {
|
\"email\" {
|
||||||
send \"admin@localhost.local\r\"
|
send \"$ADMIN_EMAIL\r\"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
expect {
|
expect {
|
||||||
\"password\" {
|
\"password\" {
|
||||||
send \"helper-scripts\r\"
|
send \"$ADMIN_PASS\r\"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
expect {
|
expect {
|
||||||
\"password again\" {
|
\"password again\" {
|
||||||
send \"helper-scripts\r\"
|
send \"$ADMIN_PASS\r\"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
expect eof
|
expect eof
|
||||||
EOF"
|
EOF"
|
||||||
$STD su - seafile -c "/opt/seafile/seafile-server-latest/seahub.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"
|
||||||
@ -237,7 +235,7 @@ RestartSec=5s
|
|||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
systemctl enable -q --now seafile.service
|
systemctl enable -q seafile.service
|
||||||
msg_ok "Created Services"
|
msg_ok "Created Services"
|
||||||
|
|
||||||
msg_info "Creating External Storage script"
|
msg_info "Creating External Storage script"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user