]> Frank Brehm's Git Trees - pixelpark/create-vmware-tpl.git/commitdiff
Adding and using snippets/tpl.300.create-motd.sh
authorFrank Brehm <frank.brehm@pixelpark.com>
Wed, 17 Jun 2020 14:41:35 +0000 (16:41 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Wed, 17 Jun 2020 14:41:35 +0000 (16:41 +0200)
kickstart/template-centos8.ks
snippets/tpl.210.bashrc-centos8.sh
snippets/tpl.300.create-motd.sh [new file with mode: 0644]

index f6b82944e7de8eea5e7418daa81db7c629262c97..5bf9bf23c07ecf3c1bd27770f1f7bc14f83e8fdd 100644 (file)
@@ -205,6 +205,11 @@ echo
 echo "Using snippet $pkgs_snippet"
 $SNIPPET($pkgs_snippet)
 
+#set $create_motd_snippet = "per_status/" + $SYSTEM_STATUS + "/tpl.300.create-motd.sh"
+echo
+echo "Using snippet $create_motd_snippet"
+$SNIPPET($create_motd_snippet)
+
 
 
 
index 2124f04a94a0ab7c49ee93008c649c95c4bfca14..dd4441d20d754ed20d007d04ef424d8634737a5d 100644 (file)
@@ -10,6 +10,9 @@ set_bashrc_centos8() {
     echo
     local url="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/bashrc-centos8"
 
+    echo
+    log "Rewriting /etc/bashrc ..."
+
     local tmp_file=$( mktemp )
     wget -O "${tmp_file}" --dns-timeout=2 --connect-timeout=3 --read-timeout=3 "${url}" || true
     if [[ -s "${tmp_file}" ]] ; then
diff --git a/snippets/tpl.300.create-motd.sh b/snippets/tpl.300.create-motd.sh
new file mode 100644 (file)
index 0000000..77d60b9
--- /dev/null
@@ -0,0 +1,30 @@
+## !/bin/bash
+#raw
+
+#-----------------------------------------------------------
+create_motd() {
+
+    echo
+    echo "${HASH_LINE}"
+    echo "Calling create_motd() ..."
+    echo
+    local url="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/create-motd.sh"
+
+    echo
+    log "Creating initial /etc/motd ..."
+
+    local mk_script=$( mktemp -p /tmp "mk_create_motd.XXXXXXXXXX.ksh" )
+    if wget -O "${mk_script}" --dns-timeout=2 --connect-timeout=3 --read-timeout=3 "${url}" ; then
+        chmod 0755 "${mk_script}"
+        "${mk_script}" > /etc/motd
+    else
+        echo "[$(date)]: Could not get 'mk_create_motd.ksh' from '${url}'." | tee -a "${ERROR_POINTER}"
+    fi
+    rm -fv "${mk_script}"
+
+}
+
+create_motd
+
+#end raw
+## vim: ts=4 et list