2007-01-18 21:56:31 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# $FreeBSD$
|
|
|
|
|
|
|
|
PATH=/bin:/usr/sbin:/usr/bin:/usr/local/bin
|
2007-03-26 00:39:27 +00:00
|
|
|
USER=mythtv
|
|
|
|
GROUP=${USER}
|
|
|
|
UID=119
|
|
|
|
GID=${UID}
|
|
|
|
HOME=/home/mythtv
|
2007-01-18 21:56:31 +00:00
|
|
|
|
2007-03-26 00:39:27 +00:00
|
|
|
if pw group show "${GROUP}" 2>/dev/null; then
|
2007-01-18 21:56:31 +00:00
|
|
|
echo "You already have a group \"${GROUP}\", so I will use it."
|
2007-03-26 00:39:27 +00:00
|
|
|
else
|
2007-01-18 21:56:31 +00:00
|
|
|
if pw groupadd ${GROUP} -g ${GID}; then
|
|
|
|
echo "Added group \"${GROUP}\"."
|
|
|
|
else
|
|
|
|
echo "Adding group \"${GROUP}\" failed..."
|
|
|
|
exit 1
|
|
|
|
fi
|
2007-03-26 00:39:27 +00:00
|
|
|
fi
|
2007-01-18 21:56:31 +00:00
|
|
|
|
2007-03-26 00:39:27 +00:00
|
|
|
if pw user show "${USER}" 2>/dev/null; then
|
2007-01-18 21:56:31 +00:00
|
|
|
echo "You already have a user \"${USER}\", so I will use it."
|
2007-03-26 00:39:27 +00:00
|
|
|
else
|
2007-01-18 21:56:31 +00:00
|
|
|
if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \
|
2007-02-20 03:26:39 +00:00
|
|
|
-d ${HOME} -m -s /bin/sh -c "MythTV"
|
2007-01-18 21:56:31 +00:00
|
|
|
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
|
2007-03-26 00:39:27 +00:00
|
|
|
fi
|
2007-01-18 21:56:31 +00:00
|
|
|
|
|
|
|
# Now make the database
|
2007-03-26 00:39:27 +00:00
|
|
|
if [ -f /usr/local/etc/rc.d/mysql-server ]; then
|
2007-01-18 21:56:31 +00:00
|
|
|
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
|
2007-03-26 00:39:27 +00:00
|
|
|
else
|
2007-01-18 21:56:31 +00:00
|
|
|
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:
|
|
|
|
|
2007-03-26 00:39:27 +00:00
|
|
|
mysql < /usr/local/share/mythtv/database/mc.sql
|
2007-01-18 21:56:31 +00:00
|
|
|
EOF
|
|
|
|
|
2007-03-26 00:39:27 +00:00
|
|
|
fi
|
2007-01-18 21:56:31 +00:00
|
|
|
|
|
|
|
cat <<EOF
|
|
|
|
|
2007-02-23 04:50:33 +00:00
|
|
|
To set up mythtv, first assign a password to user mythtv, then log in
|
|
|
|
as mythtv and run
|
2007-01-18 21:56:31 +00:00
|
|
|
|
2007-03-26 00:39:27 +00:00
|
|
|
mythtv-setup
|
2007-01-18 21:56:31 +00:00
|
|
|
EOF
|