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

(-)a/debian/scripts/koha-create (+15 lines)
Lines 575-580 then Link Here
575
    zebrapwd="$(pwgen -s 16 1)"
575
    zebrapwd="$(pwgen -s 16 1)"
576
    # Future enhancement: make this configurable for when your db is on
576
    # Future enhancement: make this configurable for when your db is on
577
    # another server.
577
    # another server.
578
    touch "/etc/koha/sites/$name/createoptions"
579
    chown "$username:$username" "/etc/koha/sites/$name/createoptions"
580
578
    mysql_hostname="localhost"
581
    mysql_hostname="localhost"
579
    # Set up MySQL database for this instance.
582
    # Set up MySQL database for this instance.
580
    if [ "$op" = create ]
583
    if [ "$op" = create ]
Lines 641-646 database user: $mysqluser Link Here
641
Thank you.
644
Thank you.
642
eof
645
eof
643
646
647
        cat > "/etc/koha/sites/$name/createoptions" << eof
648
# do not edit this file, it is for record keeping purposes only
649
REQUEST_DB=1
650
eof
651
644
        echo "See $name-db-request.txt for database creation request."
652
        echo "See $name-db-request.txt for database creation request."
645
        echo "Please forward it to the right person, and then run"
653
        echo "Please forward it to the right person, and then run"
646
        echo "$0 --populate-db $name"
654
        echo "$0 --populate-db $name"
Lines 678-683 UPDATE borrowers Link Here
678
SET password = '$staffdigest' 
686
SET password = '$staffdigest' 
679
WHERE borrowernumber = $ADMINUSER;
687
WHERE borrowernumber = $ADMINUSER;
680
eof
688
eof
689
690
        cat > "/etc/koha/sites/$name/createoptions" << eof
691
# do not edit this file, it is for record keeping purposes only
692
REQUEST_DB=0
693
eof
694
695
681
        #`
696
        #`
682
        echo "staff user password is '$staffpass' but keep that secret"
697
        echo "staff user password is '$staffpass' but keep that secret"
683
698
(-)a/debian/scripts/koha-remove (-14 / +24 lines)
Lines 60-79 do Link Here
60
    fi
60
    fi
61
61
62
    echo "Removing Koha instance $name"
62
    echo "Removing Koha instance $name"
63
    mysql_hostname="localhost"
63
    REQUEST_DB=0 #we've always assumed that we have rights to do things with the database. Just carrying that forward.
64
    if [ "$keepmysql" != "1" ]
64
    if [ -e /etc/koha/sites/$name/createoptions ] ; then
65
    then
65
        #instances created after version 3.24 will have this file. Older ones will not.
66
    # The grant creates the user in case it isn't, we don't want our loop to fail if it has already being deleted.
66
        #this checks to see if the database was created with --request-db instead of --create-db, because we can't always delete remote databases.
67
    mysql --defaults-extra-file=/etc/mysql/koha-common.cnf <<eof
67
        . /etc/koha/sites/$name/createoptions
68
GRANT USAGE ON \`koha_$name\`.* TO \`koha_$name\`@\`%\`;
68
    fi
69
GRANT USAGE ON \`koha_$name\`.* TO \`koha_$name\`@\`$mysql_hostname\`;
69
     if  [ $REQUEST_DB -eq 0 ] ; then
70
DROP USER \`koha_$name\`@\`%\`;
71
DROP USER \`koha_$name\`@\`$mysql_hostname\`;
72
DROP DATABASE IF EXISTS \`koha_$name\`;
73
FLUSH PRIVILEGES;
74
eof
75
    fi #`
76
    
70
    
71
         echo "Removing local database"
72
         mysql_hostname="localhost"
73
         if [ "$keepmysql" != "1" ]
74
         then
75
         # The grant creates the user in case it isn't, we don't want our loop to fail if it has already being deleted.
76
         mysql --defaults-extra-file=/etc/mysql/koha-common.cnf <<eof
77
    GRANT USAGE ON \`koha_$name\`.* TO \`koha_$name\`@\`%\`;
78
    GRANT USAGE ON \`koha_$name\`.* TO \`koha_$name\`@\`$mysql_hostname\`;
79
    DROP USER \`koha_$name\`@\`%\`;
80
    DROP USER \`koha_$name\`@\`$mysql_hostname\`;
81
    DROP DATABASE IF EXISTS \`koha_$name\`;
82
    FLUSH PRIVILEGES;
83
eof
84
        fi #`
85
    else
86
        echo "This instance was created with --request-db and may have a remote database. Database not removed."
87
    fi
77
    # If the daemon is not running already, we don't want to fail this loop. So bin the result code if this fails.
88
    # If the daemon is not running already, we don't want to fail this loop. So bin the result code if this fails.
78
    koha-stop-zebra $name || /bin/true
89
    koha-stop-zebra $name || /bin/true
79
90
80
- 

Return to bug 15088