Skip to content

Commit

Permalink
deb: update mythweb conf for document root changes in 13.10+ (LP: #13…
Browse files Browse the repository at this point in the history
…00404)
  • Loading branch information
superm1 committed Apr 11, 2014
1 parent 1055729 commit 9ae1410
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 28 deletions.
1 change: 0 additions & 1 deletion deb/debian/mythweb.links
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
usr/share/mythtv/mythweb var/www/mythweb
usr/share/javascript/prototype/prototype.js usr/share/mythtv/mythweb/js/prototype.js
usr/share/javascript/scriptaculous usr/share/mythtv/mythweb/js/scriptaculous
45 changes: 25 additions & 20 deletions deb/debian/mythweb.postinst
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,21 @@ case "$1" in
PASSWORD="$RET";
db_get mythweb/only || true
ONLY="$RET"


REL=$(lsb_release -c -s)
if [ "$REL" \> "raring" ]; then
SYMLINK="/var/www/html/mythweb"
CONFIG="000-default.conf"
CONFIG_MYTHBUNTU="000-default-mythbuntu.conf"
else
SYMLINK="/var/www/mythweb"
CONFIG="default"
CONFIG_MYTHBUNTU="default-mythbuntu"
fi
if [ ! -L $SYMLINK ]; then
ln -s /usr/share/mythtv/mythweb $SYMLINK
fi

DEFAULT_CONFIG=/etc/default/mythweb
cat > $DEFAULT_CONFIG << EOF
[cfg]
Expand Down Expand Up @@ -104,12 +118,9 @@ s/\(^[ \t]*setenv[ \t]\+db_name[ \t]\+\"\)[^\"]*\"/\1$database\"/g;
s/\(^[ \t]*setenv[ \t]\+db_login[ \t]\+\"\)[^\"]*\"/\1$mythtv_username\"/g;
s/\(^[ \t]*setenv[ \t]\+db_password[ \t]\+\"\)[^\"]*\"/\1$mythtv_password\"/g;
" > $NEW

if [ -e /var/www/mythweb ]; then
# replace /var/www/html with /var/www/mythweb
perl -pi -e 's/\/var\/www\/html/\/var\/www\/mythweb/g;' $NEW
fi

if [ "$INPUT" != "$MYTHWEBCONF" ]; then
sed "s,/var/www/html,$SYMLINK,;" -i $NEW
fi
mv -f $NEW $MYTHWEBCONF

MYTHWEBDIR=/etc/apache2/sites-available/mythwebdir
Expand All @@ -118,11 +129,6 @@ s/\(^[ \t]*setenv[ \t]\+db_password[ \t]\+\"\)[^\"]*\"/\1$mythtv_password\"/g;
mv $MYTHWEBDIR ${MYTHWEBDIR}.dpkg-old
fi

CONFIG=/etc/mythtv/mythweb-settings.php
if test -f $CONFIG; then
mv $CONFIG ${CONFIG}.dpkg-old
fi

cachedir=/var/cache/mythweb/image_cache
if ! dpkg-statoverride --list $cachedir; then
chgrp www-data $cachedir
Expand All @@ -134,7 +140,7 @@ s/\(^[ \t]*setenv[ \t]\+db_password[ \t]\+\"\)[^\"]*\"/\1$mythtv_password\"/g;
chgrp www-data $datadir
chmod 775 $datadir
fi

LINKS='
/var/lib/mythtv/music^music
/var/lib/mythtv/recordings^recordings
Expand Down Expand Up @@ -181,19 +187,18 @@ s/\(^[ \t]*setenv[ \t]\+db_password[ \t]\+\"\)[^\"]*\"/\1$mythtv_password\"/g;
BASE=/etc/apache2
DIR_AVAILABLE=${BASE}/sites-available
DIR_ENABLED=${BASE}/sites-enabled
CONFIG=default

#not enabled & we want to enable redirect
if [ ! -e ${DIR_ENABLED}/${CONFIG}-mythbuntu ] && [ "$ONLY" = true ] && \
if [ ! -e ${DIR_ENABLED}/${CONFIG_MYTHBUNTU} ] && [ "$ONLY" = true ] && \
[ -e ${DIR_AVAILABLE}/${CONFIG} ]; then
cp ${DIR_AVAILABLE}/${CONFIG} ${DIR_AVAILABLE}/${CONFIG}-mythbuntu
perl -pi -e 's/(<VirtualHost \*:80>)/$1\n\tDirectoryIndex mythweb/i' ${DIR_AVAILABLE}/${CONFIG}-mythbuntu
cp ${DIR_AVAILABLE}/${CONFIG} ${DIR_AVAILABLE}/${CONFIG_MYTHBUNTU}
perl -pi -e 's/(<VirtualHost \*:80>)/$1\n\tDirectoryIndex mythweb/i' ${DIR_AVAILABLE}/${CONFIG_MYTHBUNTU}
DISABLE=${CONFIG}
ENABLE=${CONFIG}-mythbuntu
ENABLE=${CONFIG_MYTHBUNTU}
#already enabled & we want to disable redirect
elif [ -e ${DIR_ENABLED}/${CONFIG}-mythbuntu ] && [ "$ONLY" = false ]; then
elif [ -e ${DIR_ENABLED}/${CONFIG_MYTHBUNTU} ] && [ "$ONLY" = false ]; then
ENABLE=${CONFIG}
DISABLE=${CONFIG}-mythbuntu
DISABLE=${CONFIG_MYTHBUNTU}
fi
if [ -n "${ENABLE}" ] && [ -e "${DIR_AVAILABLE}/${ENABLE}" ]; then
a2ensite ${ENABLE} > /dev/null || true
Expand Down
29 changes: 22 additions & 7 deletions deb/debian/mythweb.postrm
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,28 @@ case "$1" in
remove|purge)
#These files may have been created during installation
rm -f /etc/mythtv/mythweb-digest
rm -f /etc/apache2/sites-available/mythweb.conf
if [ -e /etc/apache2/sites-enabled/default-mythbuntu ]; then
a2dissite default-mythbuntu > /dev/null || true
a2ensite default > /dev/null || true
rm -f /etc/apache2/sites-available/default-mythbuntu
reload_apache
fi
rm -f /etc/apache2/sites-available/mythweb.conf

REL=$(lsb_release -c -s)
if [ "$REL" \> "raring" ]; then
SYMLINK="/var/www/html/mythweb"
CONFIG="000-default.conf"
CONFIG_MYTHBUNTU="000-default-mythbuntu.conf"
else
SYMLINK="/var/www/mythweb"
CONFIG="default"
CONFIG_MYTHBUNTU="default-mythbuntu"
fi
if [ -L $SYMLINK ]; then
rm -f$SYMLINK
fi

if [ -e /etc/apache2/sites-enabled/default-mythbuntu ]; then
a2dissite $CONFIG_MYTHBUNTU > /dev/null || true
a2ensite $CONFIG > /dev/null || true
rm -f /etc/apache2/sites-available/$CONFIG_MYTHBUNTU
reload_apache
fi
;;

upgrade|abort-upgrade|abort-remove|abort-deconfigure)
Expand Down

0 comments on commit 9ae1410

Please sign in to comment.