Changeset 92672 for trunk


Ignore:
Timestamp:
May 3, 2012, 6:10:45 PM (6 years ago)
Author:
pixilla@…
Message:

databases/mysql51:

  • Change to startupitem.executable type and remove mysql5 conflict. "port load mysql51" now works with "port mysql_select mysql5".
  • Add skip-networking to "macports-default.cnf", included in "my.cnf" by default so "port load" can load all mysql by default with fighting for tcp port 3306.
Location:
trunk/dports/databases/mysql51
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/dports/databases/mysql51/Portfile

    r92142 r92672  
    55
    66name                mysql51
    7 # Fixme: Subdir mysql5.
    8 # Conflict due to mysqld_safe finding mysql5 ports ${prefix}/libexec/mysqld.
    9 conflicts           mysql5
     7set name_mysql      ${name}
    108version             5.1.62
     9revision            1
    1110categories          databases
    1211platforms           darwin
     12license             GPL-2
    1313maintainers         pixilla openmaintainer
    14 license             GPL-2
    1514
    1615if {"darwin" == ${os.platform} && ${os.major} > 8} {
     
    2221if {$subport == $name} {
    2322
    24 # http://bugs.mysql.com/bug.php?id=47360
     23    # http://bugs.mysql.com/bug.php?id=47360
    2524    PortGroup           muniversal 1.0
    2625    PortGroup           archcheck 1.0
     
    142141            reinplace "s|/etc/my.cnf|${prefix}/etc/${name}/my.cnf|g" ${samp_conffile}
    143142        }
    144        
    145143    }
    146144   
    147145    post-install {
    148         if {![file exists ${prefix}/etc/LaunchDaemons/org.macports.${name}/org.macports.${name}.plist]} {
    149             ui_msg "The MySQL client has been installed."
    150             ui_msg "If you also want a MySQL server, install the mysql5-server port."
     146        if {![file exists ${prefix}/etc/LaunchDaemons/org.macports.${name}/org.macports.${name}-server.plist]} {
     147            ui_msg "The ${name} client has been installed."
     148            ui_msg "To install the ${name} server, install the ${name}-server port."
    151149        }
    152150    }
     
    161159    }
    162160
    163     livecheck.type          regex
    164     livecheck.version       [lindex [split ${version} -] 0]
    165     livecheck.url           http://dev.mysql.com/
    166     livecheck.regex         "<a href=\"http://dev.mysql.com/downloads/mysql/\[^\"\]+\">(${branch}(\.\[0-9.\]+)?)\[^<\]*</a>"
     161    livecheck.type      regex
     162    livecheck.version   [lindex [split ${version} -] 0]
     163    livecheck.url       http://dev.mysql.com/
     164    livecheck.regex     "<a href=\"http://dev.mysql.com/downloads/mysql/\[^\"\]+\">(${branch}(\.\[0-9.\]+)?)\[^<\]*</a>"
    167165}
    168 subport mysql51-server {
    169 
    170     license                 BSD
    171     description             Multithreaded SQL database server
    172     long_description        MySQL is an open-source, multi-threaded SQL database with a command \
    173                             syntax very similar to mSQL.
    174    
    175     homepage                http://www.mysql.com/
    176     supported_archs         noarch
     166
     167subport ${name_mysql}-server {
     168
     169    revision            1
     170    license             BSD
     171    description         Run ${name_mysql} as server
     172    long_description    ${description}
     173   
     174    supported_archs     noarch
    177175    distfiles
    178176   
    179     depends_run             port:${name}
    180    
     177    depends_run         port:${name_mysql}
     178   
     179    if {"darwin" == ${os.platform} && ${os.major} > 8} {
     180        set mysqluser       _mysql
     181    } else {
     182        set mysqluser       mysql
     183    }
    181184    add_users ${mysqluser} group=${mysqluser} realname=MySQL\ Server
    182185   
    183186    startupitem.create      yes
    184     startupitem.name        ${name}
    185     startupitem.start       "${prefix}/share/${name}/mysql/mysql.server start"
    186     startupitem.stop        "${prefix}/share/${name}/mysql/mysql.server stop"
    187    
    188     use_configure           no
     187    startupitem.executable  ${prefix}/lib/${name_mysql}/bin/mysqld --user=${mysqluser}
     188   
     189    use_configure       no
    189190   
    190191    build {}
     
    193194        xinstall -m 755 -o root -d ${destroot}${prefix}/var/run
    194195        xinstall -m 755 -o ${mysqluser} -g ${mysqluser} -d \
    195             ${destroot}${prefix}/var/db/${name} \
    196             ${destroot}${prefix}/var/log/${name} \
    197             ${destroot}${prefix}/var/run/${name}
     196            ${destroot}${prefix}/etc/${name_mysql} \
     197            ${destroot}${prefix}/var/db/${name_mysql} \
     198            ${destroot}${prefix}/var/log/${name_mysql} \
     199            ${destroot}${prefix}/var/run/${name_mysql}
    198200        destroot.keepdirs-append  \
    199             ${destroot}${prefix}/var/db/${name} \
    200             ${destroot}${prefix}/var/log/${name} \
    201             ${destroot}${prefix}/var/run/${name}
    202     }
    203    
     201            ${destroot}${prefix}/var/db/${name_mysql} \
     202            ${destroot}${prefix}/var/log/${name_mysql} \
     203            ${destroot}${prefix}/var/run/${name_mysql}
     204        set fp [open "${destroot}${prefix}/etc/${name_mysql}/macports-default.cnf" "w"]
     205        puts $fp "# WARNING! ANY CHANGES TO THIS FILE WILL BE LOST ON UNINSTALL/UPGRADES!"
     206        puts $fp "# Make your changes to ${prefix}/etc/${name_mysql}/my.cnf"
     207        puts $fp "# YOU HAVE BEEN WARNED!"
     208        puts $fp ""
     209        puts $fp "# MacPorts default options"
     210        puts $fp "\[mysqld\]"
     211        puts $fp "# skip-networking so multple mysql server ports can be loaded"
     212        puts $fp "# without each competing for port 3306."
     213        puts $fp "# One can always put the servers on different ports and"
     214        puts $fp "# remove or comment this option."
     215        puts $fp "skip-networking"
     216        close $fp
     217    }
     218   
     219    post-activate {
     220        if {![file exists ${prefix}/etc/${name_mysql}/my.cnf]} {
     221            set fp [open "${prefix}/etc/${name_mysql}/my.cnf" "w"]
     222            puts $fp "# Use default MacPorts settings"
     223            puts $fp "!include ${prefix}/etc/${name_mysql}/macports-default.cnf"
     224            close $fp
     225        }
     226    }
     227
    204228    notes "
    205229   
    206230    If this is a new install you might want to run:
    207         \$ sudo -u ${mysqluser} ${prefix}/lib/${name}/bin/mysql_install_db
     231        \$ sudo -u ${mysqluser} ${prefix}/lib/${name_mysql}/scripts/mysql_install_db
    208232   
    209233    "
  • trunk/dports/databases/mysql51/files/mysql51

    r92142 r92672  
    1919lib/mysql51/bin/mysql_fix_extensions
    2020lib/mysql51/bin/mysql_fix_privilege_tables
     21lib/mysql51/bin/mysql_install_db
    2122-
    2223lib/mysql51/bin/mysql_secure_installation
Note: See TracChangeset for help on using the changeset viewer.