Remove devuser element from dependencies
This commit is contained in:
parent
58ebef302c
commit
e47c9839d8
11
build.sh
11
build.sh
@ -8,7 +8,7 @@ DISABLE_IMG_COMPRESSION=${DISABLE_IMG_COMPRESSION:-"no"}
|
||||
# Manila user settings
|
||||
MANILA_USER=${MANILA_USER:-"manila"}
|
||||
MANILA_PASSWORD=${MANILA_PASSWORD:-"manila"}
|
||||
MANILA_USER_AUTHORIZED_KEYS=
|
||||
MANILA_USER_AUTHORIZED_KEYS="None"
|
||||
|
||||
# Manila image settings
|
||||
MANILA_IMG_ARCH=${MANILA_IMG_ARCH:-"i386"}
|
||||
@ -23,7 +23,7 @@ MANILA_ENABLE_CIFS_SUPPORT=${MANILA_ENABLE_CIFS_SUPPORT:-"yes"}
|
||||
|
||||
# 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_DIB_ARGS=
|
||||
|
||||
@ -64,10 +64,9 @@ export DIB_DEFAULT_INSTALLTYPE=package
|
||||
export DIB_RELEASE=$MANILA_IMG_OS_VER
|
||||
|
||||
# User settings
|
||||
export DIB_DEV_USER_USERNAME=$MANILA_USER
|
||||
export DIB_DEV_USER_PWDLESS_SUDO=yes
|
||||
export DIB_DEV_USER_PASSWORD=$MANILA_PASSWORD
|
||||
export DIB_DEV_USER_AUTHORIZED_KEYS=$MANILA_USER_AUTHORIZED_KEYS
|
||||
export DIB_MANILA_USER_USERNAME=$MANILA_USER
|
||||
export DIB_MANILA_USER_PASSWORD=$MANILA_PASSWORD
|
||||
export DIB_MANILA_USER_AUTHORIZED_KEYS=$MANILA_USER_AUTHORIZED_KEYS
|
||||
|
||||
# Build image
|
||||
# -----------
|
||||
|
3
elements/manila-ssh/environment.d/50-manila-user
Executable file
3
elements/manila-ssh/environment.d/50-manila-user
Executable 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:-}
|
13
elements/manila-ssh/extra-data.d/50-manila-user
Executable file
13
elements/manila-ssh/extra-data.d/50-manila-user
Executable 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
|
29
elements/manila-ssh/install.d/50-manila-user
Executable file
29
elements/manila-ssh/install.d/50-manila-user
Executable 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}
|
Loading…
Reference in New Issue
Block a user