Fedora 30, kickstart and user input

I am trying to install Fedora 30 using kickstart, and accept user input for a username and password during the %post section. Previously I was using whiptail in Centos 7 but it doesn’t appear to be available anymore in newer boot images or Fedora.

Would anyone have an example of how to do a kickstart install, and in the %post section prompt the user for a username, and password, and then do something with it? (For example authenticate with LDAP).

I’ve done some further testing. For some reason if I do this in the post section (below), it doesn’t seem to switch the user to a console and ask for input. But if I put the same codeblock in a “pre” section it works and accepts the user input, and then switches back to graphical install. Maybe I just have the chvt numbers backwords or wrong?

The Pre section is not ideal for me, because the authentication needs to happen after packages have been installed.

# Start Post Section
%post --interpreter=/usr/bin/bash --nochroot

exec < /dev/tty6 > /dev/tty6 > /dev/tty6
chvt 6

 unset USERNAME
 read -p "Enter Username:" USERNAME
 unset PASSWORD
 prompt="Enter Password:"
  while IFS= read -p "$prompt" -r -s -n 1 char
  do
    if [[ $char == $'\0' ]]
    then
        break
    fi
    prompt='*'
    PASSWORD+="$char"
  done
echo
sleep 1

echo "Username: $USERNAME Password: $PASSWORD" > /tmp/creds.ks


chvt 1
exec < /dev/tty1 > /dev/tty1 2> /dev/tty1

%end

I ended up moving it over to using zenity. It appears that if I include zenity in the packages section of the kickstart I can then do this in the post section (Without switching tty) which is a lot better:

# Do some additional configuration
%post --interpreter=/usr/bin/bash

IFS='|' read user pw < <( zenity --password --username )
echo $?
echo $user $pw

# Putting credentials into text file just for test.
echo "Username: ${user}" >> /root/creds.txt
echo "Password: ${pw}" >> /root/creds.txt

%end
2 Likes

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.