Ticket #52144: patch_port_mariadb-server_support_packaging.diff

File patch_port_mariadb-server_support_packaging.diff, 3.8 KB (added by ctreleaven (Craig Treleaven), 7 years ago)

complete patch (git tried to trip me up!)

  • databases/mariadb/Portfile

    diff --git a/databases/mariadb/Portfile b/databases/mariadb/Portfile
    index 78a5fee026..3ac7a3ea8b 100644
    a b subport ${name_mysql}-server { 
    259259            ${destroot}${prefix}/var/run/${name_mysql}
    260260    }
    261261
     262    pre-pkg {
     263        file copy ${filespath}/preinstall \
     264            ${filespath}/postinstall \
     265            ${package.scripts}/
     266        reinplace -locale C "s|@SUBPORT@|${subport}|g" \
     267            ${package.scripts}/preinstall \
     268            ${package.scripts}/postinstall
     269        reinplace -locale C "s|@NAMEMYSQL@|${name_mysql}|g" \
     270            ${package.scripts}/preinstall \
     271            ${package.scripts}/postinstall
     272        reinplace -locale C "s|@PREFIX@|${prefix}|g" \
     273            ${package.scripts}/preinstall \
     274            ${package.scripts}/postinstall
     275        reinplace -locale C "s|@USER@|${mysqluser}|g" \
     276            ${package.scripts}/postinstall
     277        file attributes ${package.scripts}/preinstall -permissions 0755
     278        file attributes ${package.scripts}/postinstall -permissions 0755
     279
     280        # give installer splash screen a friendly message
     281        long_description \
     282            MariaDB is a fast, scalable and robust relational database providing an SQL \
     283            interface for accessing structured data and is made by the original developers \
     284            of MySQL.  Install prefix: ${prefix}
     285
     286    }
     287
    262288    notes "
    263289If this is a new install you might want to run:
    264290
  • new file databases/mariadb/files/postinstall

    diff --git a/databases/mariadb/files/postinstall b/databases/mariadb/files/postinstall
    new file mode 100755
    index 0000000000..938cfb2d9b
    - +  
     1#!/bin/sh
     2
     3# MariaDB installer support, postinstall script
     4# runs as root after installer successfully copies payload to destination
     5# Adapted from https://github.com/MariaDB/server/blob/5.5/support-files/MacOSX/postflight.sh
     6
     7# Have experienced cases where installed directories/files have different
     8# ownership or permissions than what was fed to PackageMaker.
     9# Just use blunt force to set the required permissions
     10
     11chmod 644 @PREFIX@/etc/LaunchDaemons/org.macports.@SUBPORT@/org.macports.@SUBPORT@.plist || exit 1
     12if [ -f /Library/LaunchDaemons/org.macports.@SUBPORT@.plist ] ; then
     13   rm /Library/LaunchDaemons/org.macports.@SUBPORT@.plist
     14fi
     15ln -s @PREFIX@/etc/LaunchDaemons/org.macports.@SUBPORT@/org.macports.@SUBPORT@.plist \
     16    /Library/LaunchDaemons/org.macports.@SUBPORT@.plist || exit 1
     17
     18chown _mysql:_mysql @PREFIX@/var/run/@NAMEMYSQL@ || exit 1
     19chown _mysql:_mysql @PREFIX@/var/db/@NAMEMYSQL@ || exit 1
     20chown _mysql:_mysql @PREFIX@/var/log/@NAMEMYSQL@ || exit 1
     21
     22
     23# standard mysql initialization
     24if [ ! -f @PREFIX@/var/db/@NAMEMYSQL@/mysql/db.frm ] ; then
     25    @PREFIX@/lib/@NAMEMYSQL@/bin/mysql_install_db --user=@USER@ \
     26    --datadir=@PREFIX@/var/db/@NAMEMYSQL@ \
     27    --tmpdir=@PREFIX@/var/db/@NAMEMYSQL@
     28fi
     29
     30# we should be able to trust that preinstall did this, but...
     31# just in case still loaded, unload
     32if /bin/launchctl list "org.macports.@SUBPORT@" &> /dev/null; then
     33    /bin/launchctl unload "/Library/LaunchDaemons/org.macports.@SUBPORT@.plist"
     34fi
     35
     36# my.cnf may not be in place yet, but the server will run anyway
     37/bin/launchctl load -w /Library/LaunchDaemons/org.macports.@SUBPORT@.plist
  • new file databases/mariadb/files/preinstall

    diff --git a/databases/mariadb/files/preinstall b/databases/mariadb/files/preinstall
    new file mode 100644
    index 0000000000..6cc150fb08
    - +  
     1#!/bin/sh
     2
     3# MariaDB installer support, preinstall script
     4# runs as root just after user clicks "Install"
     5
     6# if daemon loaded, unload
     7if /bin/launchctl list "org.macports.@SUBPORT@" &> /dev/null; then
     8    /bin/launchctl unload "/Library/LaunchDaemons/org.macports.@SUBPORT@.plist"
     9fi