#!/bin/sh set -e # Make sure we're not working on the root directory if [ -z "$TARGET" -o "$TARGET" = "/" ]; then echo "Invalid target directory '$TARGET', aborting." 1>&2 exit 1 fi if [ "$(mountpoint -d /)" = "$(mountpoint -d "$TARGET")" ]; then echo "The target directory seems to be the root dir, aborting." 1>&2 exit 1 fi # Disable root's password, as the switch to enable shadow by default # has left root with a disabled password, preventing the initial login echo "Disabling root's password" chroot "$TARGET" passwd -d root exit 0