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 62-81 do Link Here
62
    fi
62
    fi
63
63
64
    echo "Removing Koha instance $name"
64
    echo "Removing Koha instance $name"
65
    mysql_hostname="localhost"
65
    REQUEST_DB=0 #we've always assumed that we have rights to do things with the database. Just carrying that forward.
66
    if [ "$keepmysql" != "1" ]
66
    if [ -e /etc/koha/sites/$name/createoptions ] ; then
67
    then
67
        #instances created after version 3.24 will have this file. Older ones will not.
68
    # The grant creates the user in case it isn't, we don't want our loop to fail if it has already being deleted.
68
        #this checks to see if the database was created with --request-db instead of --create-db, because we can't always delete remote databases.
69
    mysql --defaults-extra-file=/etc/mysql/koha-common.cnf <<eof
69
        . /etc/koha/sites/$name/createoptions
70
GRANT USAGE ON \`koha_$name\`.* TO \`koha_$name\`@\`%\`;
70
    fi
71
GRANT USAGE ON \`koha_$name\`.* TO \`koha_$name\`@\`$mysql_hostname\`;
71
     if  [ $REQUEST_DB -eq 0 ] ; then
72
DROP USER \`koha_$name\`@\`%\`;
73
DROP USER \`koha_$name\`@\`$mysql_hostname\`;
74
DROP DATABASE IF EXISTS \`koha_$name\`;
75
FLUSH PRIVILEGES;
76
eof
77
    fi #`
78
    
72
    
73
         echo "Removing local database"
74
         mysql_hostname="localhost"
75
         if [ "$keepmysql" != "1" ]
76
         then
77
         # The grant creates the user in case it isn't, we don't want our loop to fail if it has already being deleted.
78
         mysql --defaults-extra-file=/etc/mysql/koha-common.cnf <<eof
79
    GRANT USAGE ON \`koha_$name\`.* TO \`koha_$name\`@\`%\`;
80
    GRANT USAGE ON \`koha_$name\`.* TO \`koha_$name\`@\`$mysql_hostname\`;
81
    DROP USER \`koha_$name\`@\`%\`;
82
    DROP USER \`koha_$name\`@\`$mysql_hostname\`;
83
    DROP DATABASE IF EXISTS \`koha_$name\`;
84
    FLUSH PRIVILEGES;
85
eof
86
        fi #`
87
    else
88
        echo "This instance was created with --request-db and may have a remote database. Database not removed."
89
    fi
79
    # If the daemon is not running already, we don't want to fail this loop. So bin the result code if this fails.
90
    # If the daemon is not running already, we don't want to fail this loop. So bin the result code if this fails.
80
    koha-stop-zebra $name || /bin/true
91
    koha-stop-zebra $name || /bin/true
81
92
82
- 

Return to bug 15088