Ticket #52144: patch_port_mariadb-server_startupitem_2016Aug31.diff

File patch_port_mariadb-server_startupitem_2016Aug31.diff, 3.2 KB (added by ctreleaven (Craig Treleaven), 8 years ago)
  • Portfile

    $ svn diff
     
    99set version_branch  [join [lrange [split ${version} .] 0 1] .]
    1010# Please set revision_client and revision_server to 0 if you bump version.
    1111set revision_client 0
    12 set revision_server 0
     12set revision_server 1
    1313categories          databases
    1414platforms           darwin
    1515license             GPL-2
     
    206206
    207207    supported_archs     noarch
    208208    distfiles
     209    set plistlabel      org.macports.mariadb-server
     210    set plistfile       ${plistlabel}.plist
     211    set plistdir        ${prefix}/etc/LaunchDaemons/${plistlabel}
    209212
    210213    depends_run         port:${name_mysql}
    211214
     215    pre-patch {
     216        file mkdir ${worksrcpath}/macports
     217        copy ${filespath}/${plistfile} ${worksrcpath}/macports/
     218    }
     219
     220    post-patch {
     221        reinplace "s|@NAME@|${name_mysql}|g" \
     222            ${worksrcpath}/macports/${plistfile}
     223        reinplace "s|@PREFIX@|${prefix}|g" \
     224            ${worksrcpath}/macports/${plistfile}
     225    }
     226
    212227    if {"darwin" eq ${os.platform} && ${os.major} > 8} {
    213228        set mysqluser       _mysql
    214229    } else {
     
    216231    }
    217232    add_users ${mysqluser} group=${mysqluser} realname=MySQL\ Server
    218233
    219     startupitem.create      yes
    220     startupitem.executable  ${prefix}/lib/${name_mysql}/bin/mysqld --user=${mysqluser}
    221 
    222234    use_configure       no
    223235
    224236    build {}
     
    235247            ${destroot}${prefix}/var/db/${name_mysql} \
    236248            ${destroot}${prefix}/var/log/${name_mysql} \
    237249            ${destroot}${prefix}/var/run/${name_mysql}
     250        xinstall -d -m 0755 ${destroot}${plistdir}
     251        xinstall ${worksrcpath}/macports/${plistfile} ${destroot}${plistdir}
     252    }
     253
     254    post-activate {
     255        ln -s ${plistdir}/${plistfile} /Library/LaunchDaemons
    238256    }
    239257
    240258    notes "
  • files/org.macports.mariadb-server.plist

     
     1<?xml version="1.0" encoding="UTF-8"?>
     2<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
     3<plist version="1.0">
     4<dict>
     5    <key>Label</key>             <string>org.macports.@NAME@-server</string>
     6    <key>ProcessType</key>       <string>Interactive</string>
     7    <key>Disabled</key>          <false/>
     8    <key>RunAtLoad</key>         <true/>
     9    <key>KeepAlive</key>         <true/>
     10    <key>SessionCreate</key>     <true/>
     11    <key>LaunchOnlyOnce</key>    <false/>
     12    <key>UserName</key>          <string>_mysql</string>
     13    <key>GroupName</key>         <string>_mysql</string>
     14    <key>ExitTimeOut</key>       <integer>600</integer>
     15    <key>ProgramArguments</key>
     16        <array>
     17            <string>@PREFIX@/lib/@NAME@/bin/mysqld</string>
     18            <string>--datadir=@PREFIX@/var/db/@NAME@</string>
     19            <string>--plugin-dir=@PREFIX@/lib/@NAME@/plugin</string>
     20            <string>--log-error=@PREFIX@/var/log/@NAME@/mysqld.local.err</string>
     21            <string>--pid-file=@PREFIX@/var/run/@NAME@/mysqld.local.pid</string>
     22        </array>
     23</dict>
     24</plist>