From 40258051cf72c5bf9acbcf9342099b086d16dcc6 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Thu, 27 Mar 2014 11:27:57 +0100 Subject: [PATCH] If ngcpvers is unset then we should default to ngcp-installer-latest.deb The "Install sip:provider CE" boot entry in the Grml-Sipwise ISO which doesn't provide a ngcpvers kernel cmdline option doesn't work, this change is supposed to address that. --- deployment.sh | 77 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 47 insertions(+), 30 deletions(-) diff --git a/deployment.sh b/deployment.sh index 749f98b..dec6d47 100755 --- a/deployment.sh +++ b/deployment.sh @@ -1009,36 +1009,19 @@ adduser_sipwise() { chroot $TARGET adduser sipwise --gecos "Sipwise" --home ${SIPWISE_HOME} --shell /bin/bash $adduser_options } -if "$NGCP_INSTALLER" ; then - - if "$RETRIEVE_MGMT_CONFIG" ; then - password=sipwise - echo "Retrieving SSH keys from management server (using password ${password})" - - mkdir -p "${TARGET}"/root/.ssh - - wget --timeout=30 -O "${TARGET}"/root/.ssh/authorized_keys "${MANAGEMENT_IP}:3000/ssh/authorized_keys" - wget --timeout=30 -O "${TARGET}"/root/.ssh/id_rsa "${MANAGEMENT_IP}:3000/ssh/id_rsa?password=${password}" - wget --timeout=30 -O "${TARGET}"/root/.ssh/id_rsa.pub "${MANAGEMENT_IP}:3000/ssh/id_rsa_pub" - - chmod 600 "${TARGET}"/root/.ssh/authorized_keys - chmod 600 "${TARGET}"/root/.ssh/id_rsa - chmod 644 "${TARGET}"/root/.ssh/id_rsa.pub +get_installer_path() { + if [ -z "$SP_VERSION" ] && ! $TRUNK_VERSION ; then + INSTALLER=ngcp-installer-latest.deb - wget --timeout=30 -O "${TARGET}"/etc/ssh/ssh_host_dsa_key "${MANAGEMENT_IP}:3000/ssh/host_dsa_key?password=${password}" - wget --timeout=30 -O "${TARGET}"/etc/ssh/ssh_host_dsa_key.pub "${MANAGEMENT_IP}:3000/ssh/host_dsa_key_pub" - wget --timeout=30 -O "${TARGET}"/etc/ssh/ssh_host_rsa_key "${MANAGEMENT_IP}:3000/ssh/host_rsa_key?password=${password}" - wget --timeout=30 -O "${TARGET}"/etc/ssh/ssh_host_rsa_key.pub "${MANAGEMENT_IP}:3000/ssh/host_rsa_key_pub" + if $PRO_EDITION ; then + INSTALLER_PATH="http://deb.sipwise.com/sppro/" + else + INSTALLER_PATH="http://deb.sipwise.com/spce/" + fi - chmod 600 "${TARGET}"/etc/ssh/ssh_host_dsa_key - chmod 644 "${TARGET}"/etc/ssh/ssh_host_dsa_key.pub - chmod 600 "${TARGET}"/etc/ssh/ssh_host_rsa_key - chmod 644 "${TARGET}"/etc/ssh/ssh_host_rsa_key.pub + return # we don't want to run any further code from this function fi - # add sipwise user - adduser_sipwise - # use pool directory according for ngcp release if $PRO_EDITION ; then INSTALLER_PATH="http://deb.sipwise.com/sppro/${SP_VERSION}/pool/main/n/ngcp-installer/" @@ -1060,7 +1043,7 @@ if "$NGCP_INSTALLER" ; then # (e.g. during release time) the according package which includes the # $DEBIAN_RELEASE string disappears, in such a situation instead choose the # highest version number instead. - count_distri_package="$(find ./debs -type f -a -name \*\+${DEBIAN_RELEASE}\*.deb)" + local count_distri_package="$(find ./debs -type f -a -name \*\+${DEBIAN_RELEASE}\*.deb)" if [ -z "$count_distri_package" ] ; then echo "Could not find any $DEBIAN_RELEASE specific packages, going for highest version number instead." logit "Could not find any $DEBIAN_RELEASE specific packages, going for highest version number instead." @@ -1071,15 +1054,49 @@ if "$NGCP_INSTALLER" ; then find ./debs -type f -a ! -name \*\+${DEBIAN_RELEASE}\* -exec rm {} + fi - VERSION=$(dpkg-scanpackages debs /dev/null 2>/dev/null | awk '/Version/ {print $2}' | sort -ur) + local version=$(dpkg-scanpackages debs /dev/null 2>/dev/null | awk '/Version/ {print $2}' | sort -ur) - [ -n "$VERSION" ] || die "Error: installer version could not be detected." + [ -n "$version" ] || die "Error: installer version could not be detected." if $PRO_EDITION ; then INSTALLER="ngcp-installer-pro_${VERSION}_all.deb" else INSTALLER="ngcp-installer-ce_${VERSION}_all.deb" fi +} + +if "$NGCP_INSTALLER" ; then + + if "$RETRIEVE_MGMT_CONFIG" ; then + password=sipwise + echo "Retrieving SSH keys from management server (using password ${password})" + + mkdir -p "${TARGET}"/root/.ssh + + wget --timeout=30 -O "${TARGET}"/root/.ssh/authorized_keys "${MANAGEMENT_IP}:3000/ssh/authorized_keys" + wget --timeout=30 -O "${TARGET}"/root/.ssh/id_rsa "${MANAGEMENT_IP}:3000/ssh/id_rsa?password=${password}" + wget --timeout=30 -O "${TARGET}"/root/.ssh/id_rsa.pub "${MANAGEMENT_IP}:3000/ssh/id_rsa_pub" + + chmod 600 "${TARGET}"/root/.ssh/authorized_keys + chmod 600 "${TARGET}"/root/.ssh/id_rsa + chmod 644 "${TARGET}"/root/.ssh/id_rsa.pub + + wget --timeout=30 -O "${TARGET}"/etc/ssh/ssh_host_dsa_key "${MANAGEMENT_IP}:3000/ssh/host_dsa_key?password=${password}" + wget --timeout=30 -O "${TARGET}"/etc/ssh/ssh_host_dsa_key.pub "${MANAGEMENT_IP}:3000/ssh/host_dsa_key_pub" + wget --timeout=30 -O "${TARGET}"/etc/ssh/ssh_host_rsa_key "${MANAGEMENT_IP}:3000/ssh/host_rsa_key?password=${password}" + wget --timeout=30 -O "${TARGET}"/etc/ssh/ssh_host_rsa_key.pub "${MANAGEMENT_IP}:3000/ssh/host_rsa_key_pub" + + chmod 600 "${TARGET}"/etc/ssh/ssh_host_dsa_key + chmod 644 "${TARGET}"/etc/ssh/ssh_host_dsa_key.pub + chmod 600 "${TARGET}"/etc/ssh/ssh_host_rsa_key + chmod 644 "${TARGET}"/etc/ssh/ssh_host_rsa_key.pub + fi + + # add sipwise user + adduser_sipwise + + # set INSTALLER_PATH and INSTALLER depending on release/version + get_installer_path # support testing rc releases without providing an according installer package ahead if [ -n "$AUTOBUILD_RELEASE" ] ; then @@ -1138,7 +1155,7 @@ EOF fi # $MRBUILD_RELEASE -set_deploy_status "ngcp-installer" + set_deploy_status "ngcp-installer" # install and execute ngcp-installer logit "ngcp-installer: $INSTALLER"