View | Details | Raw Unified | Return to bug 6482
Collapse All | Expand All

(-)a/debian/scripts/koha-create (-6 / +16 lines)
Lines 54-63 getmysqlhost() { Link Here
54
}
54
}
55
55
56
getinstancemysqlpassword() {
56
getinstancemysqlpassword() {
57
    sed -n '/<pass>/s:.*>\(.*\)</pass>.*:\1:p' \
57
    xmlstarlet sel -t -v 'yazgfs/config/pass' "/etc/koha/sites/$1/koha-conf.xml"
58
        "/etc/koha/sites/$1/koha-conf.xml"
59
}
58
}
60
59
60
getinstancemysqluser() {
61
    xmlstarlet sel -t -v 'yazgfs/config/user' "/etc/koha/sites/$1/koha-conf.xml"
62
}
63
64
getinstancemysqldatabase() {
65
    xmlstarlet sel -t -v 'yazgfs/config/database' "/etc/koha/sites/$1/koha-conf.xml"
66
}
61
67
62
# Set defaults and read config file, if it exists.
68
# Set defaults and read config file, if it exists.
63
DOMAIN=""
69
DOMAIN=""
Lines 124-130 then Link Here
124
    koha-create-dirs "$name"
130
    koha-create-dirs "$name"
125
131
126
    # Generate Zebra database password.
132
    # Generate Zebra database password.
127
    zebrapwd="$(pwgen -1)"
133
    zebrapwd="$(pwgen -s 12 1)"
128
    # Set up MySQL database for this instance.
134
    # Set up MySQL database for this instance.
129
    if [ "$op" = create ]
135
    if [ "$op" = create ]
130
    then
136
    then
Lines 134-140 CREATE USER \`$mysqluser\`@'%' IDENTIFIED BY '$mysqlpwd'; Link Here
134
GRANT ALL PRIVILEGES ON \`$mysqldb\`.* TO \`$mysqluser\`;
140
GRANT ALL PRIVILEGES ON \`$mysqldb\`.* TO \`$mysqluser\`;
135
FLUSH PRIVILEGES;
141
FLUSH PRIVILEGES;
136
eof
142
eof
137
    fi
143
    fi #`
138
144
139
    # Generate and install Apache site-available file and log dir.
145
    # Generate and install Apache site-available file and log dir.
140
    generate_config_file apache-site.conf.in \
146
    generate_config_file apache-site.conf.in \
Lines 183-188 fi Link Here
183
189
184
if [ "$op" = create ] || [ "$op" = populate ]
190
if [ "$op" = create ] || [ "$op" = populate ]
185
then
191
then
192
    # Re-fetch the passwords from the config we've generated, allows it
193
    # to be different from what we set, in case the user had to change
194
    # something.
195
    mysqluser=$(getinstancemysqluser $name)
196
    mysqldb=$(getinstancemysqldatabase $name)
186
    # Use the default database content if that exists.
197
    # Use the default database content if that exists.
187
    if [ -e "$DEFAULTSQL" ]
198
    if [ -e "$DEFAULTSQL" ]
188
    then
199
    then
Lines 205-211 UPDATE borrowers Link Here
205
SET password = '$staffdigest' 
216
SET password = '$staffdigest' 
206
WHERE borrowernumber = 3;
217
WHERE borrowernumber = 3;
207
eof
218
eof
208
219
        #`
209
        echo "staff user password is '$staffpass' but keep that secret"
220
        echo "staff user password is '$staffpass' but keep that secret"
210
221
211
        # Upgrade the database schema, just in case the dump was from an 
222
        # Upgrade the database schema, just in case the dump was from an 
212
- 

Return to bug 6482