Annotation of dgamelaunch-openbsd/convert_dgl-login.sh, Revision 1.1.1.1
1.1 rubenllo 1: #!/bin/sh
2: #
3: # This script converts the flat-text password file
4: # to the new sqlite3 database.
5: #
6:
7:
8: TEMPFILE="dgl-login.tmp"
9: FLATDB="dgl-login"
10: DBFILE="dgamelaunch.db"
11:
12:
13: if [ -e "$TEMPFILE" ]; then
14: echo "$TEMPFILE already exists.";
15: exit;
16: fi
17: if [ -e "$DBFILE" ]; then
18: echo "$DBFILE already exists.";
19: exit;
20: fi
21: if [ ! -e "$FLATDB" ]; then
22: echo "$FLATDB does not exist.";
23: exit;
24: fi
25:
26:
27: sqlite3 "$DBFILE" "create table dglusers (id integer primary key, username text, email text, env text, password text, flags integer);"
28:
29: cat "$FLATDB" | sed -e "s/'/''/g" -e "s/^\([^:]*\):\([^:]*\):\([^:]*\):/insert into dglusers (username, email, password, env, flags) values ('\1', '\2', '\3', '', 0); /g" > "$TEMPFILE"
30:
31: sqlite3 "$DBFILE" ".read $TEMPFILE"
32:
33: rm -f "$TEMPFILE"
CVSweb