diff options
Diffstat (limited to 'adapt-ks-template')
| -rwxr-xr-x | adapt-ks-template | 21 |
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" |
