diff options
-rwxr-xr-x | tools/Linux/packaging/debian/xbmc-live.postinst | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/tools/Linux/packaging/debian/xbmc-live.postinst b/tools/Linux/packaging/debian/xbmc-live.postinst index 8f5d430a11..6e21b6939c 100755 --- a/tools/Linux/packaging/debian/xbmc-live.postinst +++ b/tools/Linux/packaging/debian/xbmc-live.postinst @@ -11,16 +11,22 @@ case "$1" in # get a console session going, we're in trouble anyway. ceros sed -i.bak-xbmc-live s/allowed_users=console/allowed_users=anybody/ /etc/X11/Xwrapper.config - # Add the 'xbmc' user if the primary one is missing - xbmcUser=$(getent passwd 1000 | sed -e 's/\:.*//') - if [ ! -n "$xbmcUser" ]; then - clearTextPWD=xbmc - encryptedPWD=$(echo $clearTextPWD | mkpasswd -s) + xbmcUser=xbmc + # Read configuration variable file if it is present + [ -r /etc/default/xbmc-live ] && . /etc/default/xbmc-live - adduser --disabled-password --gecos "XBMC Live User" xbmc - usermod -p $encryptedPWD xbmc + if ! getent passwd $xbmcUser >/dev/null; then + xbmcUser=$(getent passwd 1000 | sed -e 's/\:.*//') + if [ -z "$xbmcUser" ]; then + # Add the 'xbmc' user if the primary one is missing + clearTextPWD=xbmc + encryptedPWD=$(echo $clearTextPWD | mkpasswd -s) - xbmcUser=xbmc + adduser --disabled-password --gecos "XBMC Live User" xbmc + usermod -p $encryptedPWD xbmc + + xbmcUser=xbmc + fi fi # Add 'xbmcUser' user to the appropriate groups |