]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Add debconf support for creating a default superuser account upon tvheadend install.
authorAndreas Öman <andreas@lonelycoder.com>
Thu, 28 May 2009 21:16:37 +0000 (21:16 +0000)
committerAndreas Öman <andreas@lonelycoder.com>
Thu, 28 May 2009 21:16:37 +0000 (21:16 +0000)
debian/changelog
debian/copyright [moved from debian/createcopyright.sh with 57% similarity]
debian/hts-tvheadend.config [new file with mode: 0644]
debian/hts-tvheadend.postinst
debian/hts-tvheadend.templates [new file with mode: 0644]
debian/rules

index 7d844f1db03236e94116908c50946b88cd683519..f10bba524396679c6212f36a83028dd66fe312b4 100644 (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
 
similarity index 57%
rename from debian/createcopyright.sh
rename to debian/copyright
index e70edf4b3ff201d36fb2578ee7687c49123ffcfd..1946627710292d417ab80a4620b9d5b4f573c181 100644 (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
\ No newline at end of file
diff --git a/debian/hts-tvheadend.config b/debian/hts-tvheadend.config
new file mode 100644 (file)
index 0000000..cffd8a5
--- /dev/null
@@ -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
+
index 6324fcc048bf68ae646f8b0b3e93b426cbe95d6c..168497cc32cbf1b95b1df11c3b5eae398c8dafba 100644 (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
diff --git a/debian/hts-tvheadend.templates b/debian/hts-tvheadend.templates
new file mode 100644 (file)
index 0000000..79ffea2
--- /dev/null
@@ -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/
index 6588de67f28ad47131469e82019971c51d6ce22f..ac4a519aca34e657b395da146bfdc9aab4871eb7 100755 (executable)
@@ -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