summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Clausen <jac@nordu.net>2018-07-19 15:38:51 +0200
committerJon Clausen <jac@nordu.net>2018-07-19 15:38:51 +0200
commit778bab9a7f84ff06095e0dab5f75f7e25bf47849 (patch)
tree186696a5c7b35a1aaf4a97281cce12e7de307d6b
parent6a0b2abfafdcb305d9b3036d0bf297dad5fc1fac (diff)
added support for using different templates
-rwxr-xr-xadapt-ks-template21
-rwxr-xr-xprep-boot-floppy-and-ks-config9
2 files changed, 27 insertions, 3 deletions
diff --git a/adapt-ks-template b/adapt-ks-template
index 137cc59..9f7640f 100755
--- a/adapt-ks-template
+++ b/adapt-ks-template
@@ -4,6 +4,7 @@
# a config for a specific host
Self=$(basename $0)
+Template="supermicro/SYS-5018D-FN8T/dtn-10g.ks"
function print_usage {
echo "usage: $Self <options>"
@@ -28,11 +29,13 @@ Options:
-M, --netmask Netmask of target system
-N, --nameserver Nameserver of target system
-P, --publish-path Path where results will be stored
+ --template Template to use. This is a relative path, plus the
+ name of the template file. Default:
+ ${Template}
--sec-ip IP of secondary interface
--sec-nm Netmask of secondary interface
-h, --help this
-
EOF
}
@@ -86,6 +89,10 @@ function parse_commadline {
Kserver="$2"
shift
;;
+ --template)
+ Template="${2}"
+ shift
+ ;;
--sec-ip)
SecIP="${2}"
shift
@@ -170,7 +177,17 @@ else
mkdir -p "${TmpDir}"
fi
-curl -o "${TmpDir}/ks-template" "https://git.nordu.net/?p=ndn-boot-img-stuffs.git;a=blob_plain;f=ks-template/hw/supermicro/SYS-5018D-FN8T/dtn-10g.ks"
+curl -o "${TmpDir}/ks-template" "https://git.nordu.net/?p=ndn-boot-img-stuffs.git;a=blob_plain;f=ks-template/hw/${Template}"
+if [ $? -ne 0 ]
+then
+ echo "failed to download template. This is bad."
+ exit 1
+fi
+if $(file "${TmpDir}/ks-template" | grep -q XML)
+then
+ echo "downloaded file (${TmpDir}/ks-template) looks wrong"
+ exit 1
+fi
# substitutions:
sed -ie "s/HOSTNAME/${Host}/g" "${TmpDir}/ks-template"
diff --git a/prep-boot-floppy-and-ks-config b/prep-boot-floppy-and-ks-config
index 61dbd64..3759e17 100755
--- a/prep-boot-floppy-and-ks-config
+++ b/prep-boot-floppy-and-ks-config
@@ -39,6 +39,9 @@ Options:
-N, --nameserver Nameserver of target system
-P, --publish-path Path where results will be stored
-S, --cosmos-hash Hash used by cosmos to verify stuff
+ --template Template to use. This is a relative path, plus the
+ name of the template file. Example:
+ supermicro/SYS-5018D-FN8T/dtn-10g.ks
--sec-ip IP of secondary interface
--sec-nm Netmask of secondary interface
-h, --help this
@@ -103,6 +106,10 @@ function parse_commadline {
SecNM="${2}"
shift
;;
+ --template)
+ TemplateOpt="-T ${2}"
+ shift
+ ;;
*)
echo "what do you mean \"$1\"?"
exit 1
@@ -190,7 +197,7 @@ ${ScriptPath}/create-boot-floppy -D ${Domain} -G ${GW} -H ${Host} \
${ScriptPath}/adapt-ks-template -D ${Domain} -G ${GW} -H ${Host} \
-I ${IP} -M ${NM} -T ${TmpDir} -P ${PublishPath} --sec-ip ${SecIP} \
- --sec-nm ${SecNM}
+ --sec-nm ${SecNM} ${TemplateOpt}
# When this script calls the other two, PublishPath *is* set, so expect
# everything of value to be evacuated, and just clean up: