--- tools/greenbone-scapdata-sync.in.orig 2015-12-08 07:09:31 UTC +++ tools/greenbone-scapdata-sync.in @@ -962,7 +962,7 @@ update_scap_db_private () { then for ovalfile in $oval_files_sorted_private do - filedate=`stat -c "%Y" "$ovalfile" | cut -d " " -f 1 | tr -d "-"` + filedate=`stat -f "%m" "$ovalfile" | cut -d " " -f 1 | tr -d "-"` filedate=$(( $filedate - ( $filedate % 60 ) )) if [ $filedate -gt $DB_LASTUPDATE ] || [ 1 = "$REBUILD_OVAL" ] then @@ -1090,12 +1090,12 @@ update_scap_db() { CPEBASE="$SCAP_DIR/official-cpe-dictionary_v2.2.xml" if [ -e $CPEBASE ] then - filedate=`stat -c "%Y" "$CPEBASE" | cut -d " " -f 1 | tr -d "-"` + filedate=`stat -f "%m" "$CPEBASE" | cut -d " " -f 1 | tr -d "-"` filedate=$(( $filedate - ( $filedate % 60 ) )) if [ $filedate -gt $DB_LASTUPDATE ] then log_info "Updating CPEs" - filesize=`stat -c "%s" "$CPEBASE"` + filesize=`stat -f "%z" "$CPEBASE"` if [ "0" -ne "$SPLIT_PART_SIZE" ] && [ "$filesize" -gt $(($SPLIT_PART_SIZE * 1024)) ] then log_info "File is larger than ${SPLIT_PART_SIZE}k. Splitting into multiple parts" @@ -1152,13 +1152,13 @@ update_scap_db() { then for cvefile in `ls $SCAP_DIR/nvdcve-2.0-*.xml` do - filedate=`stat -c "%Y" "$cvefile" | cut -d " " -f 1 | tr -d "-"` + filedate=`stat -f "%m" "$cvefile" | cut -d " " -f 1 | tr -d "-"` filedate=$(( $filedate - ( $filedate % 60 ) )) if [ $filedate -gt $DB_LASTUPDATE ] then log_info "Updating $cvefile" - filesize=`stat -c "%s" "$cvefile"` + filesize=`stat -f "%z" "$cvefile"` if [ "0" -ne "$SPLIT_PART_SIZE" ] && [ "$filesize" -gt $(($SPLIT_PART_SIZE * 1024)) ] then log_info "File is larger than ${SPLIT_PART_SIZE}k. Splitting into multiple parts" @@ -1228,7 +1228,7 @@ update_scap_db() { for ovalfile in $oval_files_sorted do - filedate=`stat -c "%Y" "$ovalfile" | cut -d " " -f 1 | tr -d "-"` + filedate=`stat -f "%m" "$ovalfile" | cut -d " " -f 1 | tr -d "-"` filedate=$(( $filedate - ( $filedate % 60 ) )) if [ $filedate -gt $DB_LASTUPDATE ] || [ 1 = "$REBUILD_OVAL" ] then @@ -1469,7 +1469,7 @@ then exit 1 fi -if [ $(id -u) -ne $(stat -c %u $SCAP_DB) ] +if [ $(id -u) -ne $(stat -f %u $SCAP_DB) ] then log_err "Not synchronizing or updating the database since the current user is not the owner of the database." echo "Not synchronizing or updating the database since the current user is not the owner of the database."