mirror of
https://github.com/paxed/dgamelaunch.git
synced 2025-09-25 18:58:49 +02:00
Improve the conversion script
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@380 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
parent
8ced697836
commit
60be87ff9a
@ -1,21 +1,18 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# This script converts the flat-text file password file
|
# This script converts the flat-text password file
|
||||||
# to the new sqlite3 database.
|
# to the new sqlite3 database.
|
||||||
#
|
#
|
||||||
|
|
||||||
DBFILE="dgamelaunch.db"
|
DBFILE="dgamelaunch.db"
|
||||||
|
|
||||||
sqlite3 $DBFILE "create table dglusers (id integer primary key, username text, email text, env text, password text, flags integer);"
|
if [-e "$DBFILE"]; then
|
||||||
|
echo "$DBFILE already exists.";
|
||||||
|
exit;
|
||||||
|
fi
|
||||||
|
|
||||||
for x in `cat dgl-login`; do
|
sqlite3 "$DBFILE" "create table dglusers (id integer primary key, username text, email text, env text, password text, flags integer);"
|
||||||
username="`echo $x | cut -d':' -f1`";
|
|
||||||
email="`echo $x | cut -d':' -f2`";
|
|
||||||
password="`echo $x | cut -d':' -f3`";
|
|
||||||
env="`echo $x | cut -d':' -f4`";
|
|
||||||
flags="0";
|
|
||||||
|
|
||||||
cmdstring="insert into dglusers (username, email, env, password, flags) values ('"$username"', '"$email"', '"$env"', '"$password"', "$flags")"
|
cat dgl-login | sed -e "s/'/''/g" -e "s/^\([^:]*\):\([^:]*\):\([^:]*\):/insert into dglusers (username, email, password, env, flags) values ('\1', '\2', '\3', '', 0); /g" > dgl-login.tmp
|
||||||
sqlite3 $DBFILE "$cmdstring"
|
|
||||||
done;
|
|
||||||
|
|
||||||
|
sqlite3 "$DBFILE" ".read dgl-login.tmp"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user