can be run inside student container for self evaluation

This commit is contained in:
2023-02-14 23:15:05 +01:00
parent b3ec608966
commit 029715a811

View File

@@ -1,25 +1,32 @@
#! /bin/bash #! /bin/bash
set -e #set -e
set -u
IFS=$'\n\t' IFS=$'\n\t'
source functions.sh source functions.sh
echo -ne "host;name;root history;bash history;<+CHANGEME+>\n" echo -ne "host;name;<+CHANGE+>\n"
if [ $# -ge 1 ] ; then function _process {
hostlist=/srv/lxc/epsi/b3/ fileMustExists ${root}/etc/postfix/main.cf
<+ADD SOME FUNCTIONS+>
echo
}
if [ $# -gt 0 ] ; then
root=/
host=$(hostname)
test -f ${root}/etc/motd && user="$(cat ${root}/etc/motd | xargs -0)"
echo -ne "${host};${user};"
_process
else else
hostlist=/srv/lxc/epsi/b3/* hostlist=/srv/lxc/<+CHANGEME+>
fi for host in $hostlist ; do
for host in $hostlist ; do
root=${host}/rootfs root=${host}/rootfs
host=$(basename $host) host=$(basename $host)
hostname=$(grep HOSTNAME ${root}/etc/sysconfig/network 2>/dev/null| cut -f2 -d=) hostname=$(grep HOSTNAME ${root}/etc/sysconfig/network 2>/dev/null| cut -f2 -d=)
test -z "${hostname}" && hostname=$(cat ${root}/etc/hostname) test -z "${hostname}" && hostname=$(cat ${root}/etc/hostname)
test -f ${root}/etc/motd && user="$(cat ${root}/etc/motd | xargs)" test -f ${root}/etc/motd && user="$(cat ${root}/etc/motd | xargs -0)"
test -z $user && continue test -z $user && continue
echo -ne "${hostname};${user};" echo -ne "${hostname};${user};"
# fileMTime ${root}/root/.bash_history _process
# fileMTime ${root}/home/formation/.bash_history
unset user unset user
echo
done done
fi