From: Thomas Horsten Date: Fri, 11 Dec 2009 18:36:40 +0000 (+0000) Subject: Add password prompt and SSH enable prompt to installer (and answerfiles) X-Git-Url: http://xenbits.xen.org/gitweb?a=commitdiff_plain;h=c5b0318d2059db2e98bde545648c9aa95ecfe9da;p=xenclient%2Fbuild.git Add password prompt and SSH enable prompt to installer (and answerfiles) --- diff --git a/target/generic/target_xenclient_installer_skeleton/install/answers/cd-only.ans b/target/generic/target_xenclient_installer_skeleton/install/answers/cd-only.ans index cd20c81..97246d0 100644 --- a/target/generic/target_xenclient_installer_skeleton/install/answers/cd-only.ans +++ b/target/generic/target_xenclient_installer_skeleton/install/answers/cd-only.ans @@ -1,7 +1,7 @@ true - +false fresh diff --git a/target/generic/target_xenclient_installer_skeleton/install/answers/network.ans b/target/generic/target_xenclient_installer_skeleton/install/answers/network.ans index 830b999..1cbdcc5 100644 --- a/target/generic/target_xenclient_installer_skeleton/install/answers/network.ans +++ b/target/generic/target_xenclient_installer_skeleton/install/answers/network.ans @@ -6,7 +6,8 @@ touch /install/data/preinstall.touch http://192.168.1.7/ sda -iamthewalrus +* +false you-can-call-me-al http://192.168.1.7/backend #!/bin/ash diff --git a/target/generic/target_xenclient_installer_skeleton/install/stages/Enable-SSH b/target/generic/target_xenclient_installer_skeleton/install/stages/Enable-SSH new file mode 100755 index 0000000..6ae8a41 --- /dev/null +++ b/target/generic/target_xenclient_installer_skeleton/install/stages/Enable-SSH @@ -0,0 +1,26 @@ +#!/bin/ash + +set -x +. ${SCRIPT_DIR}/functions + +rm -f ${SSH_CONF} + +if answerfile_specifies "enable-ssh" ; then + SSH_ENABLED=$(read_xml_tag "${ANSWERFILE}" "enable-ssh") +elif ! interactive ; then + SSH_ENABLED=false +else + dialog --yes-label "Yes" --no-label "No" --yesno "\n Do you wish to enable the SSH server?" 7 50 + + OPT=$? + [ "$OPT" != "255" ] || exit ${Previous} + if [ "${OPT}" = 0 ] ; then + SSH_ENABLED=true + else + SSH_ENABLED=false + fi +fi + +echo "SSH_ENABLED='${SSH_ENABLED}'" >${SSH_CONF} + +exit ${Continue} diff --git a/target/generic/target_xenclient_installer_skeleton/install/stages/Set-password b/target/generic/target_xenclient_installer_skeleton/install/stages/Set-password index bb65682..3d64aa7 100755 --- a/target/generic/target_xenclient_installer_skeleton/install/stages/Set-password +++ b/target/generic/target_xenclient_installer_skeleton/install/stages/Set-password @@ -6,12 +6,10 @@ if answerfile_specifies "password" ; then PASSWORD=$(read_xml_tag "${ANSWERFILE}" "password") - PASSWORD_TYPE=$(read_xml_element "${ANSWERFILE}" "password" "type") # Do not validate. Empty is acceptable. else - PASSWORD_TYPE="standard" if ! interactive ; then echo "Answerfile omits : aborting">&2 @@ -57,11 +55,11 @@ else dialog --ok-label Continue --msgbox "ERROR: Passwords did not match. Please try again." 0 0 done + + echo "root:${PASSWORD}" | chpasswd -m + PASSWORD=$(grep ^root: /etc/shadow | cut -f2 -d:) fi -# FIXME: what to do with this new password? -# FIXME: for now, stuff it in a config file echo "PASSWORD='${PASSWORD}'" >${PASSWORD_CONF} -echo "PASSWORD_TYPE='${PASSWORD_TYPE}'" >>${PASSWORD_CONF} exit ${Continue} diff --git a/target/generic/target_xenclient_installer_skeleton/install/stages/functions b/target/generic/target_xenclient_installer_skeleton/install/stages/functions index ea1fd83..ac1336e 100644 --- a/target/generic/target_xenclient_installer_skeleton/install/stages/functions +++ b/target/generic/target_xenclient_installer_skeleton/install/stages/functions @@ -16,6 +16,7 @@ HOST_CAPABILITY_CONF="${INSTALL_DATA}/host-capability.conf" NETWORK_NIC_CONF="${INSTALL_DATA}/network-nic.conf" PASSWORD_CONF="${INSTALL_DATA}/password.conf" LICENSE_KEY_CONF="${INSTALL_DATA}/license-key.conf" +SSH_CONF="${INSTALL_DATA}/ssh.conf" BACKEND_CONF="${INSTALL_DATA}/backend.conf" CACERTS_CONF="${INSTALL_DATA}/cacerts.conf" INSTALL_STATUS_CONF="${INSTALL_DATA}/install-status.conf" diff --git a/target/generic/target_xenclient_installer_skeleton/install/stages/sequence.graph b/target/generic/target_xenclient_installer_skeleton/install/stages/sequence.graph index 930a653..5ccc130 100644 --- a/target/generic/target_xenclient_installer_skeleton/install/stages/sequence.graph +++ b/target/generic/target_xenclient_installer_skeleton/install/stages/sequence.graph @@ -16,24 +16,25 @@ Locate-optical-media, Continue:Mount-optical-media | LocateFail:Locate-optica Locate-optical-failed, Retry:Choose-install-type | Abort:Fail Mount-optical-media, Continue:Verify-optical-media | MountFail:Bad-install-choice | Abort:Fail -Verify-optical-media, Continue:Find-existing-install | VerifyFail:Bad-install-choice | Abort:Fail +Verify-optical-media, Continue:Set-password | VerifyFail:Bad-install-choice | Abort:Fail Select-NIC, Continue:DHCP-or-static | Abort:Fail DHCP-or-static, DHCP:Configure-DHCP | Static:Configure-static-IP | Abort:Fail Configure-DHCP, Continue:Configure-network-repo | NoAddress:DHCP-or-static | Abort:Fail Configure-static-IP, Continue:Configure-network-repo | Abort:Fail Configure-network-repo, Continue:Download-install-files | Abort:Fail -Download-install-files, Continue:Find-existing-install | BadTransfer:Configure-network-repo | Abort:Fail +Download-install-files, Continue:Set-password | BadTransfer:Configure-network-repo | Abort:Fail -Check-initrd-data, Continue:Find-existing-install | CheckFail:Bad-install-choice | Abort:Fail +Check-initrd-data, Continue:Set-password | CheckFail:Bad-install-choice | Abort:Fail +Set-password, Continue:Enable-SSH | Abort:Fail +Enable-SSH, Continue:Find-existing-install Bad-install-choice, Retry:Choose-install-type | Abort:Fail Find-existing-install, Install:Select-hard-disk | Upgrade:Ready-to-upgrade | Abort:Fail Select-hard-disk, Continue:Warn-disk-erasure | Abort:Fail -Warn-disk-erasure, Continue:Set-password | Abort:Fail -Set-password, Continue:Optional-backend | Abort:Fail +Warn-disk-erasure, Continue:Optional-backend | Abort:Fail Optional-backend, Backend:Configure-backend | NoBackend:Optional-license Configure-backend, Continue:Configure-cacerts