<pre style='margin:0'>
Craig Treleaven (ctreleaven) pushed a commit to branch master
in repository macports-ports.
</pre>
<p><a href="https://github.com/macports/macports-ports/commit/ee8796423f4323ecb37681cd9dfa06c820deeacf">https://github.com/macports/macports-ports/commit/ee8796423f4323ecb37681cd9dfa06c820deeacf</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit ee8796423f4323ecb37681cd9dfa06c820deeacf
</span>Author: Craig Treleaven <ctreleaven@macports.org>
AuthorDate: Mon Feb 13 07:50:41 2017 -0500
<span style='display:block; white-space:pre;color:#404040;'> mythtv.28: add packaging support
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> add preinstall and postinstall scripts to gracefully either intall or
</span><span style='display:block; white-space:pre;color:#404040;'> reinstall Myth. Makes sure that initial configuration of Myth's database
</span><span style='display:block; white-space:pre;color:#404040;'> (mythconverg) is done including time zone support.
</span>---
multimedia/mythtv.28/Portfile | 8 ++++++++
multimedia/mythtv.28/files/postinstall | 33 +++++++++++++++++++++++++++++++++
multimedia/mythtv.28/files/preinstall | 17 +++++++++++++++++
3 files changed, 58 insertions(+)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/multimedia/mythtv.28/Portfile b/multimedia/mythtv.28/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index 21d7498..779604f 100755
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/multimedia/mythtv.28/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/multimedia/mythtv.28/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -638,4 +638,12 @@ if {$subport eq "mythtv${majorversion}"} {
</span> xinstall -m 0755 ${filespath}/README_mythtv${majorversion}_MacPorts.txt \
${destroot}${prefix}/share/mythtv-readme
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pre-pkg {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -m 0755 ${filespath}/preinstall ${filespath}/postinstall \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${package.scripts}/
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace -locale C "s|@PREFIX@|${prefix}|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${package.scripts}/preinstall \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${package.scripts}/postinstall
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span> }
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/multimedia/mythtv.28/files/postinstall b/multimedia/mythtv.28/files/postinstall
</span>new file mode 100755
<span style='display:block; white-space:pre;color:#808080;'>index 0000000..99d3c8d
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/multimedia/mythtv.28/files/postinstall
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,33 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#!/bin/sh
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# MythTV installer support, postinstall script
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# runs as root after installer successfully copies payload to destination
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# assume database installer package has initialized and started db server
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+DB_BIN=@PREFIX@/lib/mariadb/bin
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+echo $0 Starting
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+echo make sure database has a config
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if [ ! -f @PREFIX@/etc/mariadb/my.cnf ] ; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cp @PREFIX@/share/mythtv/database/my.cnf @PREFIX@/etc/mariadb
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ echo start/restart db for pick up our config
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if /bin/launchctl list "org.macports.mariadb-server" &> /dev/null; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ echo Unload db server...
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /bin/launchctl unload "/Library/LaunchDaemons/org.macports.mariadb-server.plist"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ echo Load the db server
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /bin/launchctl load -w /Library/LaunchDaemons/org.macports.mariadb-server.plist
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+echo MariaDB server may be starting...
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+sleep 6
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+echo ...should be up now
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Check mythconverg database
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if [ ! -d "/opt/local/var/db/mariadb/mythconverg" ] ; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ echo Set up mythconverg db and mythtv user
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $DB_BIN/mysql -u root < @PREFIX@/share/mythtv/database/mythconverg_init.sql
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ echo Add time zone support tables
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $DB_BIN/mysql_tzinfo_to_sql /usr/share/zoneinfo | $DB_BIN/mysql -u root mysql
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+echo $0 Finished
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/multimedia/mythtv.28/files/preinstall b/multimedia/mythtv.28/files/preinstall
</span>new file mode 100755
<span style='display:block; white-space:pre;color:#808080;'>index 0000000..21949b5
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/multimedia/mythtv.28/files/preinstall
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,17 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#!/bin/sh
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# MythTV installer support, preinstall script
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Note that all the preinstall scripts are run (as root), then the payload is 'shove'd into place
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# After that, all the postinstall scripts are run.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Script also runs in a sandbox with no access to /Private and other directories
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# note that launchctl requires sudo
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+echo mythtv.28 preinstall script starting
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+echo if backend loaded, unload before continuing install
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if /bin/launchctl list "org.mythtv.mythbackend" &> /dev/null; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /bin/launchctl unload "/Library/LaunchDaemons/org.mythtv.mythbackend.plist"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ echo ...backend now unloaded
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+echo mythtv.28 preinstall script finished
</span></pre><pre style='margin:0'>
</pre>