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