summaryrefslogtreecommitdiff
path: root/adapt-ks-template
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 /adapt-ks-template
parent6a0b2abfafdcb305d9b3036d0bf297dad5fc1fac (diff)
added support for using different templates
Diffstat (limited to 'adapt-ks-template')
-rwxr-xr-xadapt-ks-template21
1 files changed, 19 insertions, 2 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"