aboutsummaryrefslogtreecommitdiffstats
path: root/multimedia/mythtv/pkg-install
diff options
context:
space:
mode:
authorgrog <grog@FreeBSD.org>2007-01-19 05:56:31 +0800
committergrog <grog@FreeBSD.org>2007-01-19 05:56:31 +0800
commite659286041225ba3df9143dec46b770a3847fb18 (patch)
tree794d5a14796ad16477bab323db8c01ec3bb1fef2 /multimedia/mythtv/pkg-install
parent7b01a30ef73fcefa885408c88906b6e23aa987b3 (diff)
downloadfreebsd-ports-gnome-e659286041225ba3df9143dec46b770a3847fb18.tar.gz
freebsd-ports-gnome-e659286041225ba3df9143dec46b770a3847fb18.tar.zst
freebsd-ports-gnome-e659286041225ba3df9143dec46b770a3847fb18.zip
Add missing file.
PR: ports/108082
Diffstat (limited to 'multimedia/mythtv/pkg-install')
-rw-r--r--multimedia/mythtv/pkg-install90
1 files changed, 90 insertions, 0 deletions
diff --git a/multimedia/mythtv/pkg-install b/multimedia/mythtv/pkg-install
new file mode 100644
index 000000000000..0c849360d8c1
--- /dev/null
+++ b/multimedia/mythtv/pkg-install
@@ -0,0 +1,90 @@
+#!/bin/sh
+# $FreeBSD$
+
+PATH=/bin:/usr/sbin:/usr/bin:/usr/local/bin
+case $2 in
+POST-INSTALL)
+ USER=mythtv
+ GROUP=${USER}
+ UID=119
+ GID=${UID}
+ HOME=/home/mythtv
+
+ if pw group show "${GROUP}" 2>/dev/null; then
+ echo "You already have a group \"${GROUP}\", so I will use it."
+ else
+ if pw groupadd ${GROUP} -g ${GID}; then
+ echo "Added group \"${GROUP}\"."
+ else
+ echo "Adding group \"${GROUP}\" failed..."
+ exit 1
+ fi
+ fi
+
+ if pw user show "${USER}" 2>/dev/null; then
+ echo "You already have a user \"${USER}\", so I will use it."
+ else
+ if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \
+ -d ${HOME} -s /bin/sh -c "MythTV"
+ then
+ echo "Added user \"${USER}\"."
+ mkdir -p ${HOME}
+ if [ $? -ne 0 ]; then
+ echo '*** Unable to create' ${HOME} '***'
+ fi
+ else
+ echo "Adding user \"${USER}\" failed..."
+ exit 1
+ fi
+ fi
+
+# Now make the database
+ if [ -f /usr/local/etc/rc.d/mysql-server ]; then
+ pgrep mysqld > /dev/null
+ if [ $? -ne 0 ]; then
+ /usr/local/etc/rc.d/mysql-server start
+ if [ $? -ne 0 ]; then
+ echo '*** Unable to start mysqld'
+ exit 1
+ else
+ pgrep mysqld > /dev/null
+ if [ $? -ne 0 ]; then
+ echo '*** Unable to start mysqld'
+ exit 1
+ fi
+ fi
+ fi
+ # Try to create the database
+ mysql < /usr/local/share/mythtv/database/mc.sql
+ if [ $? -ne 0 ]; then
+ cat <<EOF
+*********************************************************************
+Database creation failed. Please read the output above and create it
+manually. The commands to create the database are in
+/usr/local/share/mythtv/database/mc.sql.
+*********************************************************************
+EOF
+ else
+ echo Created database mythconverg.
+ fi
+ else
+ cat <<EOF
+
+No MySQL server found. If you want to run the database on this
+machine, please install the latest MySQL server and then create the
+database with this command:
+
+ mysql < /usr/local/share/mythtv/database/mc.sql
+EOF
+
+ fi
+
+cat <<EOF
+
+To set up mythtv, run
+
+ mythtv-setup
+EOF
+ ;;
+
+esac