summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-02-26 10:43:29 -0300
committerRenato Botelho <renato@netgate.com>2016-02-26 10:43:37 -0300
commit2f6260c5e717b6830194b7ad5990a6ce52cdd820 (patch)
tree62f1571367416971d1d266372e21b4b876f8f7cd /tools
parent02afb60b8b279c6490178e7e5d54072f3d61329a (diff)
downloadpfsense-2f6260c5e717b6830194b7ad5990a6ce52cdd820.zip
pfsense-2f6260c5e717b6830194b7ad5990a6ce52cdd820.tar.gz
Replace sed by xmlstarlet to make config.xml changes
Diffstat (limited to 'tools')
-rw-r--r--tools/builder_common.sh19
-rw-r--r--tools/builder_defaults.sh1
2 files changed, 14 insertions, 6 deletions
diff --git a/tools/builder_common.sh b/tools/builder_common.sh
index ff93700..41f80ed 100644
--- a/tools/builder_common.sh
+++ b/tools/builder_common.sh
@@ -1115,18 +1115,25 @@ clone_to_staging_area() {
local DEFAULTCONF=${STAGE_CHROOT_DIR}/conf.default/config.xml
+ # Save current WAN and LAN if value
+ local _old_wan_if=$(xml sel -t -v "${XML_ROOTOBJ}/interfaces/wan/if")
+ local _old_lan_if=$(xml sel -t -v "${XML_ROOTOBJ}/interfaces/lan/if")
+
# Change default interface names to match vmware driver
- sed -i '' -e 's,em0,vmx0,' -e 's,em1,vmx1,' ${DEFAULTCONF}
+ xml ed -P -L -u "${XML_ROOTOBJ}/interfaces/wan/if" -v "vmx0" ${DEFAULTCONF}
+ xml ed -P -L -u "${XML_ROOTOBJ}/interfaces/lan/if" -v "vmx1" ${DEFAULTCONF}
core_pkg_create default-config-vmware "" ${CORE_PKG_VERSION} ${STAGE_CHROOT_DIR}
# Restore default values to be used by serial package
- sed -i '' -e 's,vmx0,em0,' -e 's,vmx1,em1,' ${DEFAULTCONF}
+ xml ed -P -L -u "${XML_ROOTOBJ}/interfaces/wan/if" -v "${_old_wan_if}" ${DEFAULTCONF}
+ xml ed -P -L -u "${XML_ROOTOBJ}/interfaces/lan/if" -v "${_old_lan_if}" ${DEFAULTCONF}
# Activate serial console in config.xml
- # If it was there before, clear the setting to be sure we don't add it twice.
- sed -i "" -e "/ <enableserial\/>/d" ${DEFAULTCONF}
- # Enable serial in the config
- sed -i "" -e "s/ <\/system>/ <enableserial\/>\\$(echo -e \\\n) <\/system>/" ${DEFAULTCONF}
+ xml ed -L -P -d "${XML_ROOTOBJ}/system/enableserial" ${DEFAULTCONF}
+ xml ed -P -s "${XML_ROOTOBJ}/system" -t elem -n "enableserial" \
+ ${DEFAULTCONF} > ${DEFAULTCONF}.tmp
+ xml fo -t ${DEFAULTCONF}.tmp > ${DEFAULTCONF}
+ rm -f ${DEFAULTCONF}.tmp
echo force > ${STAGE_CHROOT_DIR}/cf/conf/enableserial_force
diff --git a/tools/builder_defaults.sh b/tools/builder_defaults.sh
index 5cf9918..4568d2e 100644
--- a/tools/builder_defaults.sh
+++ b/tools/builder_defaults.sh
@@ -108,6 +108,7 @@ export PRODUCT_NAME=${PRODUCT_NAME:-"nonSense"}
export PRODUCT_URL=${PRODUCT_URL:-""}
export PRODUCT_SRC=${PRODUCT_SRC:-"${BUILDER_ROOT}/src"}
export PRODUCT_EMAIL=${PRODUCT_EMAIL:-"coreteam@pfsense.org"}
+export XML_ROOTOBJ=${XML_ROOTOBJ:-$(echo "${PRODUCT_NAME}" | tr '[[:upper:]]' '[[:lower:]]')}
if [ "${PRODUCT_NAME}" = "pfSense" -a "${BUILD_AUTHORIZED_BY_ELECTRIC_SHEEP_FENCING}" != "yes" ]; then
echo ">>>ERROR: According the following license, only Electric Sheep Fencing can build genuine pfSense® software"
OpenPOWER on IntegriCloud