Remove devuser element from dependencies

This commit is contained in:
Igor Malinovskiy 2015-06-03 12:04:18 +03:00
parent 58ebef302c
commit e47c9839d8
5 changed files with 50 additions and 6 deletions

View File

@ -8,7 +8,7 @@ DISABLE_IMG_COMPRESSION=${DISABLE_IMG_COMPRESSION:-"no"}
# Manila user settings # Manila user settings
MANILA_USER=${MANILA_USER:-"manila"} MANILA_USER=${MANILA_USER:-"manila"}
MANILA_PASSWORD=${MANILA_PASSWORD:-"manila"} MANILA_PASSWORD=${MANILA_PASSWORD:-"manila"}
MANILA_USER_AUTHORIZED_KEYS= MANILA_USER_AUTHORIZED_KEYS="None"
# Manila image settings # Manila image settings
MANILA_IMG_ARCH=${MANILA_IMG_ARCH:-"i386"} MANILA_IMG_ARCH=${MANILA_IMG_ARCH:-"i386"}
@ -23,7 +23,7 @@ MANILA_ENABLE_CIFS_SUPPORT=${MANILA_ENABLE_CIFS_SUPPORT:-"yes"}
# Verify configuration # Verify configuration
# -------------------- # --------------------
REQUIRED_ELEMENTS="manila-ssh vm $MANILA_IMG_OS dhcp-all-interfaces devuser cleanup-kernel-initrd" REQUIRED_ELEMENTS="manila-ssh vm $MANILA_IMG_OS dhcp-all-interfaces cleanup-kernel-initrd"
OPTIONAL_ELEMENTS= OPTIONAL_ELEMENTS=
OPTIONAL_DIB_ARGS= OPTIONAL_DIB_ARGS=
@ -64,10 +64,9 @@ export DIB_DEFAULT_INSTALLTYPE=package
export DIB_RELEASE=$MANILA_IMG_OS_VER export DIB_RELEASE=$MANILA_IMG_OS_VER
# User settings # User settings
export DIB_DEV_USER_USERNAME=$MANILA_USER export DIB_MANILA_USER_USERNAME=$MANILA_USER
export DIB_DEV_USER_PWDLESS_SUDO=yes export DIB_MANILA_USER_PASSWORD=$MANILA_PASSWORD
export DIB_DEV_USER_PASSWORD=$MANILA_PASSWORD export DIB_MANILA_USER_AUTHORIZED_KEYS=$MANILA_USER_AUTHORIZED_KEYS
export DIB_DEV_USER_AUTHORIZED_KEYS=$MANILA_USER_AUTHORIZED_KEYS
# Build image # Build image
# ----------- # -----------

View File

@ -0,0 +1,3 @@
export DIB_MANILA_USER_USERNAME=${DIB_MANILA_USER_USERNAME:-manila}
export DIB_MANILA_USER_AUTHORIZED_KEYS=${DIB_MANILA_USER_AUTHORIZED_KEYS:-}
export DIB_MANILA_USER_PASSWORD=${DIB_MANILA_USER_PASSWORD:-}

View File

@ -0,0 +1,13 @@
#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
if [ -n "$DIB_MANILA_USER_AUTHORIZED_KEYS" ]; then
if [ -f "$DIB_MANILA_USER_AUTHORIZED_KEYS" ]; then
cat $DIB_MANILA_USER_AUTHORIZED_KEYS >> $TMP_HOOKS_PATH/manilauser-ssh-authorized-keys
fi
fi

View File

@ -0,0 +1,29 @@
#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
useradd -m ${DIB_MANILA_USER_USERNAME}
set +x
if [ -n "${DIB_MANILA_USER_PASSWORD}" ]; then
echo "Setting password."
echo "${DIB_MANILA_USER_USERNAME}:${DIB_MANILA_USER_PASSWORD}" | chpasswd
fi
set -x
cat > /etc/sudoers.d/${DIB_MANILA_USER_USERNAME} << EOF
${DIB_MANILA_USER_USERNAME} ALL=(ALL) NOPASSWD:ALL
EOF
chmod 0440 /etc/sudoers.d/${DIB_MANILA_USER_USERNAME}
visudo -c || rm /etc/sudoers.d/${DIB_MANILA_USER_USERNAME}
if [ -f /tmp/in_target.d/devuser-ssh-authorized-keys ]; then
mkdir -p /home/${DIB_MANILA_USER_USERNAME}/.ssh
cp /tmp/in_target.d/manilauser-ssh-authorized-keys /home/${DIB_MANILA_USER_USERNAME}/.ssh/authorized_keys
fi
chown -R ${DIB_MANILA_USER_USERNAME}:${DIB_MANILA_USER_USERNAME} /home/${DIB_MANILA_USER_USERNAME}