Ticket #52144: patch_port_mariadb-server_startupitem_and_pkg_2016Sep06.diff
File patch_port_mariadb-server_startupitem_and_pkg_2016Sep06.diff, 7.1 KB (added by ctreleaven (Craig Treleaven), 8 years ago) |
---|
-
Portfile
$ svn diff
9 9 set version_branch [join [lrange [split ${version} .] 0 1] .] 10 10 # Please set revision_client and revision_server to 0 if you bump version. 11 11 set revision_client 0 12 set revision_server 012 set revision_server 4 13 13 categories databases 14 14 platforms darwin 15 15 license GPL-2 … … 202 202 revision ${revision_server} 203 203 license BSD 204 204 description Run ${name_mysql} as server 205 long_description ${description} 205 long_description MariaDB is one of the most popular database servers in the world. \ 206 It’s made by the original developers of MySQL and is a fast, scalable and robust \ 207 relational database providing an SQL interface for accessing structured data. 206 208 207 209 supported_archs noarch 208 210 distfiles 211 set plistlabel org.macports.mariadb-server 212 set plistfile ${plistlabel}.plist 213 set plistdir ${prefix}/etc/LaunchDaemons/${plistlabel} 209 214 210 215 depends_run port:${name_mysql} 211 216 217 pre-patch { 218 file mkdir ${worksrcpath}/macports 219 copy ${filespath}/${plistfile} ${worksrcpath}/macports/ 220 } 221 222 post-patch { 223 reinplace -locale C "s|@NAME@|${name_mysql}|g" \ 224 ${worksrcpath}/macports/${plistfile} 225 reinplace -locale C "s|@PREFIX@|${prefix}|g" \ 226 ${worksrcpath}/macports/${plistfile} 227 } 228 212 229 if {"darwin" eq ${os.platform} && ${os.major} > 8} { 213 230 set mysqluser _mysql 214 231 } else { … … 216 233 } 217 234 add_users ${mysqluser} group=${mysqluser} realname=MySQL\ Server 218 235 219 startupitem.create yes220 startupitem.executable ${prefix}/lib/${name_mysql}/bin/mysqld --user=${mysqluser}221 222 236 use_configure no 223 237 224 238 build {} … … 235 249 ${destroot}${prefix}/var/db/${name_mysql} \ 236 250 ${destroot}${prefix}/var/log/${name_mysql} \ 237 251 ${destroot}${prefix}/var/run/${name_mysql} 252 xinstall -d -m 0755 ${destroot}${plistdir} 253 xinstall ${worksrcpath}/macports/${plistfile} ${destroot}${plistdir} 254 } 255 256 post-activate { 257 # delete leftover file, if any 258 if [file exists /Library/LaunchDaemons/${plistfile}] { 259 file delete -force /Library/LaunchDaemons/${plistfile} 260 } 261 if {${startupitem.install} eq "yes"} { 262 ln -s ${plistdir}/${plistfile} /Library/LaunchDaemons 263 } else { 264 notes-append " 265 Installation of the startup item was prohibited due to a setting." 266 } 267 } 268 269 pre-deactivate { 270 file delete -force /Library/LaunchDaemons/${plistfile} 271 } 272 273 pre-pkg { 274 file copy ${filespath}/preinstall \ 275 ${filespath}/postinstall \ 276 ${package.scripts}/ 277 reinplace -locale C "s|@NAME@|${name_mysql}|g" \ 278 ${package.scripts}/preinstall \ 279 ${package.scripts}/postinstall 280 reinplace -locale C "s|@PREFIX@|${prefix}|g" \ 281 ${package.scripts}/preinstall \ 282 ${package.scripts}/postinstall 283 file attributes ${package.scripts}/preinstall -permissions 0755 284 file attributes ${package.scripts}/postinstall -permissions 0755 238 285 } 239 286 240 287 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> -
files/postinstall
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 11 chmod 644 @PREFIX@/etc/LaunchDaemons/org.macports.@NAME@-server/org.macports.@NAME@-server.plist || exit 1 12 if [ -f /Library/LaunchDaemons/org.macports.@NAME@-server.plist ] ; then 13 rm /Library/LaunchDaemons/org.macports.@NAME@-server.plist 14 fi 15 ln -s @PREFIX@/etc/LaunchDaemons/org.macports.@NAME@-server/org.macports.@NAME@-server.plist \ 16 /Library/LaunchDaemons/org.macports.@NAME@-server.plist || exit 1 17 18 chown _mysql:_mysql @PREFIX@/var/run/@NAME@ || exit 1 19 chown _mysql:admin @PREFIX@/var/db/@NAME@ || exit 1 20 chown _mysql:_mysql @PREFIX@/var/log/@NAME@ || exit 1 21 22 23 # standard mysql initialization 24 if [ ! -f @PREFIX@/var/db/@NAME@/mysql/db.frm ] ; then 25 @PREFIX@/lib/@NAME@/bin/mysql_install_db --user=_mysql --datadir=@PREFIX@/var/db/@NAME@ 26 fi 27 28 # we should be able to trust that preinstall did this, but... 29 # just in case still loaded, unload 30 if /bin/launchctl list "org.macports.@NAME@-server" &> /dev/null; then 31 /bin/launchctl unload "/Library/LaunchDaemons/org.macports.@NAME@-server.plist" 32 fi 33 34 # my.cnf may not be in place yet, but the server will run anyway 35 /bin/launchctl load -w /Library/LaunchDaemons/org.macports.@NAME@-server.plist -
files/preinstall
Property changes on: files/postinstall ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property
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 7 if /bin/launchctl list "org.macports.@NAME@-server" &> /dev/null; then 8 /bin/launchctl unload "/Library/LaunchDaemons/org.macports.@NAME@-server.plist" 9 fi