summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Clausen <jac@nordu.net>2018-08-02 08:52:24 +0200
committerJon Clausen <jac@nordu.net>2018-08-02 08:52:24 +0200
commit02a92a4c737f3f3d7f5e6d18dd7f8f831a469ce6 (patch)
tree019279ef4ed3c8a8e97dfeddd6d8daca26f312ab
parent60f09074b313c94b8b1f2ebdaa4558920e10620b (diff)
record the generator commandline in the generated files
-rwxr-xr-xadapt-ks-template10
-rwxr-xr-xcreate-boot-floppy8
-rwxr-xr-xprep-boot-floppy-and-ks-config8
3 files changed, 24 insertions, 2 deletions
diff --git a/adapt-ks-template b/adapt-ks-template
index 8661a86..afc31e3 100755
--- a/adapt-ks-template
+++ b/adapt-ks-template
@@ -116,6 +116,10 @@ function parse_commadline {
KrnlCmdLineOpt="$(echo ${2} | sed -e 's/;/ /g')"
shift
;;
+ --gen-cmd)
+ GeneratorCommand="$(echo ${2} | sed -e 's/;:;/ /g')"
+ shift
+ ;;
*)
echo "what do you mean \"$1\"?"
exit 1
@@ -200,6 +204,12 @@ then
exit 1
fi
+# boilerplate:
+sed -ie '1 a #' "${TmpDir}/ks-template"
+sed -ie '2 a # This file generated with this command:' "${TmpDir}/ks-template"
+sed -ie "3 a # ${GeneratorCommand}" "${TmpDir}/ks-template"
+sed -ie '4 a #' "${TmpDir}/ks-template"
+
# substitutions:
sed -ie "s/HOSTNAME/${Host}/g" "${TmpDir}/ks-template"
sed -ie "s/DOMAIN/${Domain}/g" "${TmpDir}/ks-template"
diff --git a/create-boot-floppy b/create-boot-floppy
index 5c32862..6037a11 100755
--- a/create-boot-floppy
+++ b/create-boot-floppy
@@ -107,6 +107,10 @@ function parse_commadline {
InstCmdLineOpt="$(echo ${2} | sed -e 's/;/ /g')"
shift
;;
+ --gen-cmd)
+ GeneratorCommand="$(echo ${2} | sed -e 's/;:;/ /g')"
+ shift
+ ;;
*)
echo "what do you mean \"$1\"?"
exit 1
@@ -212,6 +216,10 @@ EOF"
sudo sh -c "cat >${WorkDir}/mnt/${Host}.ipxe <<EOF
#!ipxe
+#
+# This file generated with this command:
+# ${GeneratorCommand}
+#
echo ${Host}
ifopen net0
###
diff --git a/prep-boot-floppy-and-ks-config b/prep-boot-floppy-and-ks-config
index 5c3daf6..852545c 100755
--- a/prep-boot-floppy-and-ks-config
+++ b/prep-boot-floppy-and-ks-config
@@ -8,6 +8,8 @@
Self=$(basename $0)
+SelfCommandLine="$(echo ${0} ${@} | sed -e 's/ /;:;/g')"
+
function print_usage {
echo "usage: $Self <options>"
}
@@ -215,11 +217,13 @@ ScriptPath=$(echo $0 | sed -e "s#/${Self}##")
#echo $ScriptPath
${ScriptPath}/create-boot-floppy -D ${Domain} -G ${GW} -H ${Host} \
- -I ${IP} -M ${NM} -T ${TmpDir} -P ${PublishPath} ${InstCmdLineOpt}
+ -I ${IP} -M ${NM} -T ${TmpDir} -P ${PublishPath} ${InstCmdLineOpt} \
+ --gen-cmd ${SelfCommandLine}
${ScriptPath}/adapt-ks-template -D ${Domain} -G ${GW} -H ${Host} \
-I ${IP} -M ${NM} -T ${TmpDir} -P ${PublishPath} --sec-ip ${SecIP} \
- --sec-nm ${SecNM} ${TemplateOpt} ${KrnlCmdLineOpt}
+ --sec-nm ${SecNM} ${TemplateOpt} ${KrnlCmdLineOpt} \
+ --gen-cmd ${SelfCommandLine}
# When this script calls the other two, PublishPath *is* set, so expect
# everything of value to be evacuated, and just clean up: