Add debconf support for creating a default superuser account upon tvheadend install.

This commit is contained in:
Andreas Öman 2009-05-28 21:16:37 +00:00
parent 0da8123862
commit ac08f6a9e6
6 changed files with 88 additions and 31 deletions

18
debian/changelog vendored
View file

@ -1,5 +1,7 @@
hts-tvheadend (current) hts; urgency=low
hts-tvheadend (2.1) hts; urgency=low
* Add debconf setup scripts to create a superuser account.
* HTSP server slightly modified. Now also supports the XBMC HTSP client.
* tvheadend and showtime went separate ways.
@ -9,9 +11,9 @@ hts-tvheadend (current) hts; urgency=low
* tvheadend: Fix characterset translation bug introduced in r1902.
-- Andreas Öman <andreas@lonelycoder.com> xxx, xx xxx xxxx xx:xx:xx +xxxx
-- Andreas Öman <andreas@lonelycoder.com> Thu, 28 May 2009 21:07:44 +0200
hts (2.0) unstable; urgency=low
hts-tvheadend (2.0) unstable; urgency=low
* showtime: New fully customable theme markup language.
@ -33,13 +35,13 @@ hts (2.0) unstable; urgency=low
-- Andreas Öman <andreas@lonelycoder.com> Thu, 16 Oct 2008 19:47:23 +0200
hts (1.4) unstable; urgency=low
hts-tvheadend (1.4) unstable; urgency=low
* tvheadend: Add support for DVB-S (still in experimenal state)
-- Andreas Öman <andreas@lonelycoder.com> Sat, 30 Mar 2008 18:00:00 +0100
hts (1.3) unstable; urgency=low
hts-tvheadend (1.3) unstable; urgency=low
* tvheadend: Add support for executing a post processing script after
recording is completed.
@ -51,13 +53,13 @@ hts (1.3) unstable; urgency=low
-- Andreas Öman <andreas@lonelycoder.com> Thu, 28 Mar 2008 18:00:00 +0100
hts (1.2) unstable; urgency=low
hts-tvheadend (1.2) unstable; urgency=low
* Tvheadend has been rewritten from scratch
-- Andreas Öman <andreas@lonelycoder.com> Thu, 28 Feb 2008 17:30:00 +0100
hts (1.1) unstable; urgency=low
hts-tvheadend (1.1) unstable; urgency=low
* Bugfix: Tvheadend: Do not crash if event name is NULL
@ -73,7 +75,7 @@ hts (1.1) unstable; urgency=low
-- Andreas Öman <andreas@lonelycoder.com> Sat, 24 Nov 2007 08:11:00 +0100
hts (1.0) unstable; urgency=low
hts-tvheadend (1.0) unstable; urgency=low
* Initial release

View file

@ -1,12 +1,4 @@
now=`date`
source=`svn info | grep "URL:" | sed "s/URL: //"`
rev=`svn info | grep "Revision:" | sed "s/Revision: //"`
cat <<EOF
This package was automatically debianized on ${now}
It was downloaded from ${source} revision ${rev}
HTS Showtime and HTS Tvheadend is copyright (c) Andreas Öman 2007
HTS Tvheadend is copyright (c) Andreas Öman 2006 - 2009
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -20,10 +12,3 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
The Debian packaging is (C) 2007, Andreas Öman <andreas@lonelycoder.com> and
is licensed under the GPL, see "/usr/share/common-licenses/GPL".
EOF

35
debian/hts-tvheadend.config vendored Normal file
View file

@ -0,0 +1,35 @@
#!/bin/sh -e
# Source debconf library.
. /usr/share/debconf/confmodule
db_version 2.0
# This conf script is capable of backing up
db_capb backup
STATE=1
while [ "$STATE" != 0 -a "$STATE" != 4 ]; do
case "$STATE" in
1)
# Ask for username
db_input high hts-tvheadend/admin_username || true
;;
2)
# Ask for password
db_input high hts-tvheadend/admin_password || true
;;
3)
# Display a final note
db_input high hts-tvheadend/webinterface || true
;;
esac
if db_go; then
STATE=$(($STATE + 1))
else
STATE=$(($STATE - 1))
fi
done

View file

@ -1,4 +1,4 @@
#! /bin/sh -e
#!/bin/sh -e
HTS_USER=hts
@ -9,14 +9,31 @@ case "$1" in
configure)
if ! getent passwd $HTS_USER >/dev/null; then
echo "Creating user: $HTS_USER..."
echo >&2 "Creating user: $HTS_USER..."
adduser --quiet --system --group --shell /bin/bash $HTS_USER
fi
HTS_HOME=`getent passwd $HTS_USER | cut -d':' -f6`
mkdir -p "${HTS_HOME}/.hts/tvheadend"
HTS_SUPERUSERCONF="${HTS_HOME}/.hts/tvheadend/superuser"
rm -f "${HTS_SUPERUSERCONF}"
touch "${HTS_SUPERUSERCONF}"
chmod 600 "${HTS_SUPERUSERCONF}"
echo >>"${HTS_SUPERUSERCONF}" "{"
if db_get hts-tvheadend/admin_username; then
echo >>"${HTS_SUPERUSERCONF}" '"username": "'$RET'",'
fi
if db_get hts-tvheadend/admin_password; then
echo >>"${HTS_SUPERUSERCONF}" '"password": "'$RET'"'
fi
echo >>"${HTS_SUPERUSERCONF}" "}"
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 0
;;
esac
db_stop

17
debian/hts-tvheadend.templates vendored Normal file
View file

@ -0,0 +1,17 @@
Template: hts-tvheadend/admin_username
Type: string
Description: Choose a username for Tvheadend administrator.
Tvheadend is accessed via a world reachable web interface (assuming your
host is reachable from the internet). To protect from malicious use you
must create an initial account to be able to login to Tvheadend.
This account can not be changed nor deleted from within Tvheadend itself.
If you want to change the superuser account you need to reconfigure the
Tvheadend package.
Template: hts-tvheadend/admin_password
Type: password
Description: Administrator password.
Template: hts-tvheadend/webinterface
Type: note
Description: After installation Tvheadend can be accessed via HTTP on port 9981. From this machine you can point your web-browser to http://localhost:9981/

3
debian/rules vendored
View file

@ -14,7 +14,7 @@ clean:
build: config.mak
make
$(MAKE)
binary:
dh_testdir
@ -25,6 +25,7 @@ binary:
dh_installchangelogs
dh_installinit --name tvheadend
dh_installdocs
dh_installdebconf
dh_link
dh_strip
dh_compress