#!/bin/sh

set -e

case "$1" in
    remove|purge)
        getent passwd |
        while IFS=: read username x uid gid gecos home shell
        do
                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 "Lenovo_Limited_Warranty.pdf" "Software_Product_License_Agreement.pdf" "Generic_Safety_and_Compliance_Notices.pdf"; do
                    if [ -L "$home/$file" ]; then
                        sudo -Hu "$username" rm -f "$home/$file"
                    fi
                done
        done
    ;;
esac

#DEBHELPER#

exit 0
