This script could need some serious love, in the meanwhile
backport minor fixes from $customers_project.
if [ "$(whoami 2>/dev/null)" != "root" ] && [ "$(id -un 2>/dev/null)" != "root" ] ; then
echo " NO!
if [ "$(whoami 2>/dev/null)" != "root" ] && [ "$(id -un 2>/dev/null)" != "root" ] ; then
echo " NO!
-Error: You must be root to run this script."
+Error: You must be root to run this script." >&2
else echo " failed
Please install which-binary!
else echo " failed
Please install which-binary!
chroot not found!
Please install chroot-package/binary!
chroot not found!
Please install chroot-package/binary!
sudo not found!
Please install sudo-package/binary!
sudo not found!
Please install sudo-package/binary!
dirname not found!
Please install dirname-binary (to be found eg in the package coreutils)!
dirname not found!
Please install dirname-binary (to be found eg in the package coreutils)!
awk not found!
Please install (g)awk-package/binary!
awk not found!
Please install (g)awk-package/binary!
read MODIFYUSER
if [ "$MODIFYUSER" != "yes" ]; then
echo "
read MODIFYUSER
if [ "$MODIFYUSER" != "yes" ]; then
echo "
-Not entered yes. Exiting...."
+Not entered yes. Exiting...." >&2
read OVERWRITE
if [ "$OVERWRITE" != "yes" ]; then
echo "
read OVERWRITE
if [ "$OVERWRITE" != "yes" ]; then
echo "
-Not entered yes. Exiting...."
+Not entered yes. Exiting...." >&2
# Enter password for new account
if !(passwd $CHROOT_USERNAME);
# Enter password for new account
if !(passwd $CHROOT_USERNAME);
- then echo "Passwords are probably not the same, try again."
+ then echo "Passwords are probably not the same, try again." >&2