1234567891011121314151617181920212223242526272829303132333435363738 |
- #!/bin/bash
- echo "Checking dependencies..."
- python -c "
- try:
- import praw
- except ImportError:
- print 'redditmodule requires praw. pybot will run fine without it.'
- try:
- import MySQLdb
- except ImportError:
- print 'pybot requires mysqldb. It will run without it; it\'ll just throw lots of errors.'
- "
- if [[ $? -ne 0 ]]; then
- echo "Dependency checks failed.
- pybot's module dependencies are available in pip, which is probably available in your package manager.
- Install dependencies with 'pip install <package name>'."
- else
- echo "Dependency checks succeeded."
- fi
- echo "The following information should be what is in your pybotrc file, for dbname, dbusername, and dbpass, respectively."
- echo
- read -p "Enter database name for bot to use: " dbname
- read -p "Enter MYSQL username bot will log in with: " username
- read -s -p "Enter user password: " password
- echo
- read -s -p "Re-enter password: " password2
- echo
- if [ -f mysql_init ]; then
- rm mysql_init
- fi
- echo "CREATE DATABASE IF NOT EXISTS $dbname;" > mysql_init
- echo "GRANT ALL ON $dbname.* TO '$username'@'localhost' IDENTIFIED BY '$password';" >> mysql_init
- echo "mysql_init file has been created. As root or otherwise mysql-privileged user, run 'mysql -p < mysql_init'"
|