Fix dynamic-login with grub2
Grub2 messes up arguments with double quotes in them, changing from key="value" to "key=value" [1]. Support this format as well. [1] https://bugzilla.redhat.com/show_bug.cgi?id=950760 Change-Id: Icf4c9f86009d29a342d6e0e21644af680066b0b2
This commit is contained in:
parent
c160538465
commit
19378bbd9d
@ -19,14 +19,14 @@ set -o pipefail
|
|||||||
|
|
||||||
# Reads an encrypted root password from the kernel command line and set
|
# Reads an encrypted root password from the kernel command line and set
|
||||||
# it to the root user
|
# it to the root user
|
||||||
if [[ $(</proc/cmdline) =~ rootpwd=\"([^\"]+)\" ]]; then
|
if [[ $(</proc/cmdline) =~ rootpwd=\"?([^\"]+)\" ]]; then
|
||||||
echo "root:${BASH_REMATCH[1]}" | chpasswd -e
|
echo "root:${BASH_REMATCH[1]}" | chpasswd -e
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Reads a sshkey from the kernel command line and appends it to the root
|
# Reads a sshkey from the kernel command line and appends it to the root
|
||||||
# user authorized_keys
|
# user authorized_keys
|
||||||
SSHDIR=/root/.ssh
|
SSHDIR=/root/.ssh
|
||||||
if [[ $(</proc/cmdline) =~ sshkey=\"([^\"]+)\" ]]; then
|
if [[ $(</proc/cmdline) =~ sshkey=\"?([^\"]+)\" ]]; then
|
||||||
mkdir -p $SSHDIR
|
mkdir -p $SSHDIR
|
||||||
chmod 700 $SSHDIR
|
chmod 700 $SSHDIR
|
||||||
echo "${BASH_REMATCH[1]}" > $SSHDIR/authorized_keys
|
echo "${BASH_REMATCH[1]}" > $SSHDIR/authorized_keys
|
||||||
|
Loading…
Reference in New Issue
Block a user