#!/bin/sh

case "$1" in
    remove)
        # Restore default shell for accounts, if needed
        getent passwd | grep -q "^root:.*:/bin/bash" && \
            ( chsh -s /bin/sh root || exit 1 )
        getent passwd | grep -q "^user:.*:/bin/bash" && \
            ( chsh -s /bin/sh user || exit 1 )

        # Check if existing profile is patched
        if grep -q "<bash>" /etc/profile; then
            sed -e '/<bash>/,/<\/bash>/d' /etc/profile >/tmp/__maemo_bash__ && \
            mv -f /tmp/__maemo_bash__ /etc/profile
        fi
        ;;
esac

#DEBHELPER#
