mirror of
https://github.com/paxed/dgamelaunch.git
synced 2025-07-27 23:54:25 +02:00
Improve the flat text db -> sqlite3 db conversion script.
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@456 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
parent
e08465fa22
commit
24189a955a
@ -4,15 +4,30 @@
|
|||||||
# to the new sqlite3 database.
|
# to the new sqlite3 database.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
|
TEMPFILE="dgl-login.tmp"
|
||||||
|
FLATDB="dgl-login"
|
||||||
DBFILE="dgamelaunch.db"
|
DBFILE="dgamelaunch.db"
|
||||||
|
|
||||||
|
|
||||||
|
if [ -e "$TEMPFILE" ]; then
|
||||||
|
echo "$TEMPFILE already exists.";
|
||||||
|
exit;
|
||||||
|
fi
|
||||||
if [ -e "$DBFILE" ]; then
|
if [ -e "$DBFILE" ]; then
|
||||||
echo "$DBFILE already exists.";
|
echo "$DBFILE already exists.";
|
||||||
exit;
|
exit;
|
||||||
fi
|
fi
|
||||||
|
if [ ! -e "$FLATDB" ]; then
|
||||||
|
echo "$FLATDB does not exist.";
|
||||||
|
exit;
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
sqlite3 "$DBFILE" "create table dglusers (id integer primary key, username text, email text, env text, password text, flags integer);"
|
sqlite3 "$DBFILE" "create table dglusers (id integer primary key, username text, email text, env text, password text, flags integer);"
|
||||||
|
|
||||||
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
|
cat "$FLATDB" | sed -e "s/'/''/g" -e "s/^\([^:]*\):\([^:]*\):\([^:]*\):/insert into dglusers (username, email, password, env, flags) values ('\1', '\2', '\3', '', 0); /g" > "$TEMPFILE"
|
||||||
|
|
||||||
sqlite3 "$DBFILE" ".read dgl-login.tmp"
|
sqlite3 "$DBFILE" ".read $TEMPFILE"
|
||||||
|
|
||||||
|
rm -f "$TEMPFILE"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user