#!/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" -lt 1000 ]; then
                        continue
                fi
                if [ ! -d "$home" -o "$username" = "root" -o "$username" = "nobody" -o "$username" = "oem" ]; then
                        continue
                fi
                for file in UserGuide_thinkstation_p2_tower_gen_2.html UserGuide_thinkstation_p3_tower_gen_2.html ; do
                        if [ -L "$home/$file" ]; then
                                sudo -Hu "$username" rm -f "$home/$file"
                        fi
                done
        done
    ;;
esac

#DEBHELPER#

exit 0
