mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-27 00:57:50 +00:00
65effc8736
This is necessary to maintain protocol compatibility with Linux distributions, on which we're generally dependent for tuner functionality. Unfortunately, there's no distribution for this version, and it's already been overtaken. Watch this space. Submitted by: dmlb This also fixes a build error reported by pointyhat.
92 lines
2.1 KiB
Bash
92 lines
2.1 KiB
Bash
#!/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} -m -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, first assign a password to user mythtv, then log in
|
|
as mythtv and run
|
|
|
|
mythtv-setup
|
|
EOF
|
|
;;
|
|
|
|
esac
|