]> xenbits.xen.org Git - xenclient/build.git/commitdiff
Add password prompt and SSH enable prompt to installer (and answerfiles)
authorThomas Horsten <thomas.horsten@citrix.com>
Fri, 11 Dec 2009 18:36:40 +0000 (18:36 +0000)
committerThomas Horsten <thomas.horsten@citrix.com>
Fri, 11 Dec 2009 18:37:59 +0000 (18:37 +0000)
target/generic/target_xenclient_installer_skeleton/install/answers/cd-only.ans
target/generic/target_xenclient_installer_skeleton/install/answers/network.ans
target/generic/target_xenclient_installer_skeleton/install/stages/Enable-SSH [new file with mode: 0755]
target/generic/target_xenclient_installer_skeleton/install/stages/Set-password
target/generic/target_xenclient_installer_skeleton/install/stages/functions
target/generic/target_xenclient_installer_skeleton/install/stages/sequence.graph

index cd20c81550c561b97ef056785c0d8286b5f04b03..97246d0046ab852a8f5b38065777e15bc25fb12d 100644 (file)
@@ -1,7 +1,7 @@
 <interactive>true</interactive>
 <source type="local"></source>
-<password type="none"></password>
 <license-key></license-key>
+<enable-ssh>false</enable-ssh>
 <mode>fresh</mode>
 <quick-option>
 <backend></backend>
index 830b999868b0083891cd160f50f083f25d7f183d..1cbdcc55a8b0a8c6bb0cdbe0fd11b9b042007574 100644 (file)
@@ -6,7 +6,8 @@ touch /install/data/preinstall.touch
 <source type="url">http://192.168.1.7/</source>
 <primary-disk>sda</primary-disk>
 <network-interface mode="dhcp"></network-interface>
-<password>iamthewalrus</password>
+<password>*</password>
+<enable-ssh>false</enable-ssh>
 <license-key>you-can-call-me-al</license-key>
 <backend>http://192.168.1.7/backend</backend>
 <postinstall>#!/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 (executable)
index 0000000..6ae8a41
--- /dev/null
@@ -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}
index bb656827b992f2d3f7f8b6131f75339593b20618..3d64aa704028d2a0fce5d1ecc311792caeebb4c7 100755 (executable)
@@ -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 <password> : 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}
index ea1fd8370c2522e826adb1d9f3e41f239a751876..ac1336efce5f5c1c9d7372985ab8e423de1f75f0 100644 (file)
@@ -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"
index 930a653927595635fdd9a0071a7f154a6a6a8c28..5ccc13043e73d2e5254071a97b3cc0d300453e09 100644 (file)
@@ -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