diff --git a/buildpackage/bootstraps/bootstrap-install b/buildpackage/bootstraps/bootstrap-install index 78599a64ec5e65bc56fb9e363ed02841f4ab15fc..407528816c169514b47f85eb66c336461f5c0558 100644 --- a/buildpackage/bootstraps/bootstrap-install +++ b/buildpackage/bootstraps/bootstrap-install @@ -153,9 +153,14 @@ LOGFILE=/tmp/collected-information.log # Save stdout to file descriptor 3 and redirect all output to $LOGFILE exec 3>&1 &> ${LOGFILE} +# Remove any previous installation of the agent +rm -rf "${AGENT_DIR}" +/usr/sbin/userdel -r seed_mec +/usr/sbin/groupdel seed_mec + # Create seed_mec group and exit on error (except by the error of previous # existence of seed_mec group) -if ! groupadd -f seed_mec; then +if ! /usr/sbin/groupadd -f seed_mec; then printf "ERRO: Falha ao criar o grupo seed_mec.\n" exit 1 fi @@ -169,7 +174,7 @@ TMPSKEL=$(mktemp -d) # Create seed_mec user with seed_mec as group, BASH as default shell, # $SEED_MEC_HOME as home and $TMPSKEL as temporary skel -useradd -m -g seed_mec -s /bin/bash -d "${SEED_MEC_HOME}" \ +/usr/sbin/useradd -m -g seed_mec -s /bin/bash -d "${SEED_MEC_HOME}" \ -k "${TMPSKEL}" seed_mec RETVAL=$? @@ -184,6 +189,9 @@ fi # Remove the temporary skel, as it isn't needed anymore rmdir "${TMPSKEL}" +# Ensure seed_mec's home exists +mkdir -p "${SEED_MEC_HOME}" + # Remove old crontab of seed_mec, in case there's one, avoinding a specific # error of wrong owner/lack of permissions crontab -u seed_mec -r diff --git a/buildpackage/bootstraps/bootstrap-update b/buildpackage/bootstraps/bootstrap-update index 025af4381635be21135f5a7b723fff7e3d8a46c5..1d5c2bd2ba56e371e7df3f36eef24c5463613f34 100644 --- a/buildpackage/bootstraps/bootstrap-update +++ b/buildpackage/bootstraps/bootstrap-update @@ -102,7 +102,9 @@ if test "${ERROR}" -eq 0; then # Copy or create the md5 files from inep and proxy (test -d "${SEED_MEC_HOME}/SEED2/.md5sum" && cp -a "${SEED_MEC_HOME}/SEED2/.md5sum/client/conf/"{inep,proxy} \ - "${SEED_MEC_HOME}/update/tmp/SEED2-run/.md5sum/client/conf/") || + "${SEED_MEC_HOME}/update/tmp/SEED2-run/.md5sum/client/conf/" && + cp -a "${SEED_MEC_HOME}/SEED2/.md5sum/.backup/client/conf/"{inep,proxy} \ + "${SEED_MEC_HOME}/update/tmp/SEED2-run/.md5sum/.backup/client/conf/") || restore_inep_proxy_md5sum # Copy or create the backup files from inep and proxy diff --git a/client/common.sh b/client/common.sh index 5aacb2e69548d29461524bdd894957f4dac3f83c..0d4700dd3d85a37ef2466408fb3e356f88eb0ccd 100644 --- a/client/common.sh +++ b/client/common.sh @@ -57,6 +57,7 @@ function tryWget(){ PROXY="http://${phost}:${pport}" fi + PROXYPASSWD="--proxy-password" if which wget &> /dev/null; then WGETBIN="$(which wget)" WGETVERSION="$(${WGETBIN} --version | head -n1 | cut -d' ' -f3)" @@ -67,8 +68,6 @@ function tryWget(){ if test ${WGETVER1} -lt 1 -o ${WGETVER1} -eq 1 -a ${WGETVER2} -lt 10 then PROXYPASSWD="--proxy-passwd" - else - PROXYPASSWD="--proxy-password" fi else WGETBIN="${PREFIX}/bin/wget" diff --git a/client/conf/version b/client/conf/version index 9084fa2f716a7117829f3f32a5f4cef400e02903..88c5fb891dcf1d1647d2b84bac0630cf9570d213 100644 --- a/client/conf/version +++ b/client/conf/version @@ -1 +1 @@ -1.1.0 +1.4.0 diff --git a/client/lib/Makefile b/client/lib/Makefile index aca1f02fb0ea673d3e81ef1215864664f00d369f..432b3866a286e5ca8460f74b46981c6d8c19744f 100644 --- a/client/lib/Makefile +++ b/client/lib/Makefile @@ -16,14 +16,22 @@ win: @tar xzf $(LIBGSOAP)_$(LIBGSOAPVER).$(LIBGSOAPSVER).tar.gz soap: - @wget -nc "$(GSOAPDOWNLOADLINK)" -O "$(LIBGSOAP)_$(LIBGSOAPVER).$(LIBGSOAPSVER).tar.gz" - @tar xzf $(LIBGSOAP)_$(LIBGSOAPVER).$(LIBGSOAPSVER).tar.gz - @echo "Installing gSOAP library, wait..." - @cp -f stdsoap2.? $(LIBDIR)/$(LIBGSOAPDIR)/${LIBGSOAP}/ - @cd $(LIBDIR)/$(LIBGSOAPDIR) && ./configure -q --prefix=$(PWD)/$(LIBGSOAP) && make + @if ! test -d "$(LIBDIR)/$(LIBGSOAPDIR)"; then\ + wget -nc "$(GSOAPDOWNLOADLINK)" -O "$(LIBGSOAP)_$(LIBGSOAPVER).$(LIBGSOAPSVER).tar.gz";\ + tar xzf $(LIBGSOAP)_$(LIBGSOAPVER).$(LIBGSOAPSVER).tar.gz;\ + echo "Installing gSOAP library, wait...";\ + cp -f stdsoap2.? $(LIBDIR)/$(LIBGSOAPDIR)/${LIBGSOAP}/;\ + cd $(LIBDIR)/$(LIBGSOAPDIR) && ./configure -q --prefix=$(PWD)/$(LIBGSOAP) && make;\ + elif test -d "$(LIBDIR)/$(LIBGSOAPDIR)"; then\ + echo "Packages already downloaded";\ + fi install: - @cd $(LIBDIR)/$(LIBGSOAPDIR) && make install + @if ! test -d $(LIBGSOAP); then\ + cd $(LIBDIR)/$(LIBGSOAPDIR) && make install;\ + elif test -d $(LIBGSOAP); then\ + echo "Packages already installed";\ + fi clean: @cd $(LIBDIR)/$(LIBGSOAPDIR) && make clean diff --git a/client/run-config.sh b/client/run-config.sh index 5613960a0246a1bf44139dcbb65bf9a31207bfad..2aa374012f9599f2177ef7dd155403f4e66e730f 100755 --- a/client/run-config.sh +++ b/client/run-config.sh @@ -59,7 +59,7 @@ date +"%F %T" >> ${log} # Get common functions source ${dirname}/common.sh -url="--url=http://seed.c3sl.ufpr.br/tomcat/axis/Seed2.jws" +url="--url=http://200.17.202.187/tomcat/axis/Seed2.jws" inep=$(cat ${dirname}/conf/inep 2> /dev/null) if test ! -f "${dirname}/conf/inep" -o -z "${inep}"; then printf "WARNING: inep file not found or empty.\n" >> ${log} diff --git a/collect/integrity-checker.sh b/collect/integrity-checker.sh index 97ed9c4dd119fb7decac32030765ac38d777c4ea..5bca64a9357e5d9c57a9f75d0c84a3e15b3cc46e 100755 --- a/collect/integrity-checker.sh +++ b/collect/integrity-checker.sh @@ -96,7 +96,7 @@ try_force_update(){ update_myself(){ UPDATETRIES=3 UPDATETIMEOUT=100 - UPDATESERVER="http://seed.c3sl.ufpr.br/pacotes/download" + UPDATESERVER="http://200.17.202.187/pacotes/download" TMPDIR="${PREFIX}/tmp" # The proxy config itself @@ -118,6 +118,7 @@ update_myself(){ fi fi + PROXYPASSWD="--proxy-password" if which wget &> /dev/null; then WGETBIN="$(which wget)" WGETVERSION="$(${WGETBIN} --version | head -n1 | cut -d' ' -f3)" @@ -128,8 +129,6 @@ update_myself(){ if test ${WGETVER1} -lt 1 -o ${WGETVER1} -eq 1 -a ${WGETVER2} -lt 10 then PROXYPASSWD="--proxy-passwd" - else - PROXYPASSWD="--proxy-password" fi else WGETBIN="${PREFIX}/bin/wget" diff --git a/collect/scripts/collect/mac-address/number.string b/collect/scripts/collect/agent/version.string similarity index 64% rename from collect/scripts/collect/mac-address/number.string rename to collect/scripts/collect/agent/version.string index 52abc3e406d533e56a44f9c5c2822a6719d3c968..5951b48afe858d802fc524f73a32e4b14edb724d 100755 --- a/collect/scripts/collect/mac-address/number.string +++ b/collect/scripts/collect/agent/version.string @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (C) 2004-2009 Centro de Computacao Cientifica e Software Livre +# Copyright (C) 2009-2012 Centro de Computacao Cientifica e Software Livre # Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR # # This file is part of collect-agent @@ -19,20 +19,8 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, # USA. -PATH=${PATH}:/sbin:/usr/sbin +PREFIX="$(dirname $(readlink -f $0))" -# Include getNetworkInterface() -source ${PREFIX}/client/common.sh +cat ${PREFIX}/../../../client/conf/version -# Obtain the network interface in use -getNetworkInterface - -MACADDR=$(ifconfig ${interface} | head -n1 | awk '{print $NF}' 2> /dev/null) -MACEXPRESSION="^([a-f0-9]{2}:){5}[a-f0-9]{2}$" - -if test -n "$(egrep -i ${MACEXPRESSION} <<< ${MACADDR})"; then - printf "${MACADDR}\n" -else - printf "invalid\n" - exit 1 -fi +exit $? diff --git a/collect/scripts/collect/inventory/disk.tree b/collect/scripts/collect/inventory/disk.tree index 45e1c853fc5ddb06a1c9134fc25fa712fee08777..85add055532ac5927e622f90396a6463df43defe 100755 --- a/collect/scripts/collect/inventory/disk.tree +++ b/collect/scripts/collect/inventory/disk.tree @@ -94,6 +94,9 @@ if test -d "/dev/disk/by-id/"; then # If "/proc/mdstat" exists, than check for RAID disks test -f "/proc/mdstat" && raid=true + # Add scsi to accept machines with only scsi as disk type + diskType="${diskType}\|scsi" + # Verify every disk in "/dev/disk/by-id/", excluding all USB's, unless it's # the USB used as root by Classmate notebook for line in $(ls -l --time-style="+%F %R" /dev/disk/by-id/ | @@ -104,7 +107,7 @@ if test -d "/dev/disk/by-id/"; then disks="${disks}<hdd${number}>" disks="${disks}<model value=\"$(ls -l --time-style="+%F %R"\ /dev/disk/by-id/ | grep "$line$" | awk '{print $8}' | grep "$diskType" | - cut -d"-" -f2-)\" type=\"string\"/>" + head -n 1 | cut -d"-" -f2-)\" type=\"string\"/>" # Multiply the number of blocks by their standard size diskSize=$(($(cat /sys/block/$line/size)*512)) diff --git a/collect/scripts/collect/mac-address.tree b/collect/scripts/collect/mac-address.tree new file mode 100755 index 0000000000000000000000000000000000000000..3dd5ecce1cb94e191c620ba7214798e032706560 --- /dev/null +++ b/collect/scripts/collect/mac-address.tree @@ -0,0 +1,27 @@ +#!/bin/bash +# Copyright (C) 2009-2012 Centro de Computacao Cientifica e Software Livre +# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR +# +# This file is part of collect-agent +# +# collect-agent is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. + +while read mac; do + newTag="<mac value=\"$mac\" type=\"string\"/>" + tags="$tags$newTag" +done < <(/sbin/ifconfig 2>&1 | awk '/HW/ {print $NF}' | sort -u) + +printf "${tags}\n"