Advertisement
hujuice

Untitled

Mar 19th, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.05 KB | None | 0 0
  1. # /etc/portage/bashrc
  2.  
  3. # Keep rkhunter updated
  4. RKHUNTER_FILES="/tmp/rkhunter.propfiles"
  5. RKHF=""
  6. RKHL=""
  7. if [ "${EBUILD_PHASE}" == "postinst" ];
  8. then
  9.     # Only if rkhunter is installed
  10.     if qlist -I app-forensics/rkhunter > /dev/null;
  11.     then
  12.  
  13.         if [ "${CATEGORY}/${PN}" == "rkhunter" ] || [ ! -e "$RKHUNTER_FILES" ];
  14.         then
  15.             # Generate new propfiles list
  16.             for i in $(/usr/sbin/rkhunter --list propfiles); do
  17.                 RKHF=$(/usr/bin/which ${i} 2>/dev/null)
  18.                 # Only in bash and zsh
  19.                 RKHL="${RKHL}"$'\n'"${RKHF}"
  20.             done
  21.             /bin/echo "$RKHL" | sed '/^$/d' > "$RKHUNTER_FILES"
  22.             # Cleanup
  23.             RKHF=""
  24.             RKHL=""
  25.         fi
  26.  
  27.         # Check and update
  28.         for i in $(/usr/bin/qlist "${CATEGORY}/${PN}"); do
  29.             if grep -q "$i" "$RKHUNTER_FILES";
  30.             then
  31.                 /usr/bin/logger -t rkhook "Updating rkhunter for ${i}"
  32.                 /usr/sbin/rkhunter --propupd "$i"
  33.             fi
  34.         done
  35.  
  36.     fi
  37. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement