-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_ks
executable file
·24 lines (16 loc) · 924 Bytes
/
generate_ks
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
ARG="${1}"
[[ -z "${ARG}" ]] && { echo "The name of ks configuration file should be used as argument"; exit 1; }
[[ ! -e "${ARG}" ]] && { echo "ks cfg file not found"; exit 1; }
filename=$(basename -- "${ARG}")
ext="${ARG##*.}"
[[ "${ext}" != "cfg" ]] && { echo "argument file does not have .cfg extension"; exit 1; }
NAME=$(basename "${filename}" .cfg )
FILENAME="ks/${NAME}.ks"
## START CREATING KICKSTART FILE
( bash ${ARG} ) > ${FILENAME}
eval $(sed -n 's/#KSVER/KSVER/p' ${FILENAME})
[[ -n "${KSVER}" ]] && KSVALIDATEVER="-v ${KSVER}"
ksvalidator ${KSVALIDATEVER} ${FILENAME}
# [[ "$(hostname -s)" != "monitor" ]] && scp ${FILENAME} monitor_adrian:/var/www/html/ks/$(basename ${FILENAME}) || cp ${FILENAME} /var/www/html/ks/$(basename ${FILENAME})
[[ "$(hostname -s)" != "monitor" ]] && scp ${FILENAME} monitor_adrian:/var/www/html/ks/$(basename ${FILENAME}) || rsync -ahuHAXW ks/ /var/www/html/ks/