Adds startupitem, user/group among other tasks.

cat `port dir mysql5`/Portfile


variant server {
    # Create a startupitem to start/stop the server
    startupitem.create  yes
startupitem.start "${prefix}/share/${mysql}/mysql/mysql.server start" startupitem.stop "${prefix}/share/${mysql}/mysql/mysql.server stop"
}

pre-destroot {
    # Some directories we must have in all cases
    xinstall -m 755 -d ${destroot}${sysconfdir}
    destroot.keepdirs-append ${destroot}${sysconfdir}

    # Setup only for server
    if { [variant_isset server] } {
        addgroup ${mysqluser}
        set gid [existsgroup ${mysqluser}]
        adduser ${mysqluser} gid=${gid} realname=MySQL\ Server

# Some directories we must have only if we're running as a server
        xinstall -m 755 -o root -d ${destroot}${prefix}/var/run

        xinstall -m 755 -o ${mysqluser} -g ${mysqluser} -d \
            ${destroot}${dbdir} \
            ${destroot}${prefix}/var/run/${mysql}
        destroot.keepdirs-append  \
            ${destroot}${dbdir} \
            ${destroot}${prefix}/var/run/${mysql}
    }
}

post-destroot {
    delete ${destroot}${prefix}/mysql-test

    # Fix paths in manpages and sample configuration files
foreach manpage [glob -type f ${destroot}${prefix}/share/man/man \[1-9\]/*] {
        reinplace "s|/etc/my.cnf|${sysconfdir}/my.cnf|g" ${manpage}
    }
foreach samp_conffile [glob -type f ${destroot}${prefix}/share/$ {mysql}/mysql/my-*.cnf] { reinplace "s|/etc/my.cnf|${sysconfdir}/my.cnf|g" $ {samp_conffile}
    }

# Symlink mysql binaries into bin directory, with $ {major_version} appended to the name
    foreach f [glob -tails -directory ${destroot}${bindir} my*] {
ln -sf ${bindir}/${f} ${destroot}${prefix}/bin/${f}$ {major_version}
    }
}

post-install {
    if { [variant_isset server] } {
        ui_msg "******************************************************"
ui_msg "* In order to setup the database, you might want to run"
        ui_msg "* sudo -u ${mysqluser} mysql_install_db5"
        ui_msg "* if this is a new install"
        ui_msg "******************************************************"
    }
}


On Feb 23, 2009, at 2:08 AM, Scott Haneda wrote:

What is the +server variant for in mysql5? I looked at the port source, and am no sure. I did port variant mysql5 and it did not tell me much.
--
Scott

* If you contact me off list replace talklists@ with scott@ *





_______________________________________________
macports-users mailing list
macports-users@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macports-users

_______________________________________________
macports-users mailing list
macports-users@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macports-users

Reply via email to