#!/bin/sh

set -e

case "$1" in
    remove|purge)
        getent passwd |
        while IFS=: read username x uid gid gecos home shell
        do
                # In oem image, the 1000 used for oem user.
                if [ "$uid" -le 1000 ]; then
                        continue
                fi
                if [ "$username" = root -o "$username" = "nobody" -o ! -d "$home" ]; then
                        continue
                fi
                if [ -L "$home/UserGuide.pdf" ]; then
                        sudo -Hu "$username" rm -f $home/UserGuide.pdf
                fi
        done
    ;;
esac

#DEBHELPER#

exit 0
