#!/bin/sh

usermod -L root

if [ ! -f /usr/bin/rescue-password-off ]; then
    echo "Looks like release configuration, disabling passwords."

    DEF_UID=$(grep "^UID_MIN" /etc/login.defs |  tr -s " " | cut -d " " -f2)
    DEVICEUSER=$(getent passwd $DEF_UID | sed 's/:.*//')

    if [ -z "$DEVICEUSER" ]; then
        echo "WARNING No deviceuser found, skipping password reset"
    else
        usermod -p "" $DEVICEUSER
        usermod -L $DEVICEUSER
    fi
fi

exit 0
