mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
* Transform into valid Python 3.x code using 2to3. * Change shebang from "/usr/bin/python2" to "/usr/bin/python3". * Invoke with "python3" instead of "python2" in "reloadtestdb.sh". Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
29 lines
698 B
Bash
Executable file
29 lines
698 B
Bash
Executable file
#!/bin/bash -e
|
|
|
|
DB_NAME=${DB_NAME:-AUR}
|
|
DB_USER=${DB_USER:-aur}
|
|
# Password should allow empty definition
|
|
DB_PASS=${DB_PASS-aur}
|
|
DB_HOST=${DB_HOST:-localhost}
|
|
DATA_FILE=${DATA_FILE:-dummy-data.sql}
|
|
|
|
echo "Using database $DB_NAME, user $DB_USER, host $DB_HOST"
|
|
|
|
mydir=$(pwd)
|
|
if [ $(basename $mydir) != "schema" ]; then
|
|
echo "you must be in the aur/support/schema directory to run this script"
|
|
exit 1
|
|
fi
|
|
|
|
echo "recreating database..."
|
|
mysql -h $DB_HOST -u $DB_USER -p$DB_PASS < aur-schema.sql
|
|
|
|
if [ ! -f $DATA_FILE ]; then
|
|
echo "creating dumy-data..."
|
|
python3 gendummydata.py $DATA_FILE
|
|
fi
|
|
|
|
echo "loading dummy-data..."
|
|
mysql -h $DB_HOST -u $DB_USER -p$DB_PASS $DB_NAME < $DATA_FILE
|
|
|
|
echo "done."
|