Initial commit

This commit is contained in:
Kolan Sh 2012-05-20 13:37:14 +04:00
commit a020c00bdf
4 changed files with 133 additions and 0 deletions

8
Makefile Normal file
View File

@ -0,0 +1,8 @@
SHELL = /bin/sh
PREFIX = /usr
all:
install:
install -d ${DESTDIR}/usr/sbin
install --mode=755 sbin/*.sh ${DESTDIR}/usr/sbin

View File

@ -0,0 +1 @@
EBUILD findcruftfiles-9999.ebuild 825 RMD160 5a4729e96b0828f98672994828f09e49f38c4448 SHA1 907f9907a65215a5fb5f061b3391c8750240d75f SHA256 bbfd01699d8423424a4807b8db8a69de6754e3f2d371feccd5c57a4966864660

View File

@ -0,0 +1,45 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI=4
inherit eutils
if [[ ${PV} == "9999" ]] ; then
EGIT_REPO_URI=${EGIT_REPO_URI:-"git://github.com/backbone/findcruftfiles.git"}
inherit git-2
KEYWORDS=""
else
SRC_URI="ftp://backbone.ws/projects/findcruftfiles/${P}.tar.bz2"
KEYWORDS="-* ~x86 ~amd64"
fi
DESCRIPTION="Automated Gentoo upgrading"
HOMEPAGE="https://chili.backbone.ws/projects/findcruftfiles"
SLOT="0"
LICENSE="GPL-3"
IUSE=""
DEPEND=""
RDEPEND="${DEPEND}"
src_prepare() {
if [[ ${PV} == "9999" ]] ; then
# Allow user patches to be applied without modifying the ebuild
epatch_user
fi
}
src_install() {
if [[ ${PV} == "9999" ]] ; then
emake install DESTDIR="${D}"
else
emake install DESTDIR="${D}" || die
fi
}

79
sbin/findcruftfiles.sh Executable file
View File

@ -0,0 +1,79 @@
#!/bin/bash
# Finds files not registered in portage
DIRLIST="/bin /etc /lib /lib32 /lib64 /opt /sbin
`ls /usr/ | grep -vE 'portage|local|src|lost\+found' | sed 's/\(.*\)/\/usr\/\1/'`
`ls /var/ | grep -vE 'tmp|lost\+found' | sed 's/\(.*\)/\/var\/\1/'`"
EXCLUDES='\\
^/etc/make.conf|\\
^/etc/portage|\\
^/usr/opt/android-sdk-update-manager|\\
^/usr/opt/cuda|\\
^/usr/lib64/portage|\\
^/usr/lib64/portage|\\
^/usr/lib64/gedit-2|\\
^/var/db/pkg|\\
^/var/lib/layman|\\
^/var/run|\\
^/var/cache|\\
^/var/doc|\\
^/var/www|\\
^/var/log|\\
^/usr/share/mime'
REPLACES="
s~^/lib64/grub/~/lib/grub/~ ;
s~^/usr/lib64/bcc/~/usr/lib/bcc/~ ;
s~^/usr/lib64/conkeror/~/usr/lib/conkeror/~ ;
s~^/usr/lib64/debug/~/usr/lib/debug/~ ;
s~^/usr/lib64/fpc/~/usr/lib/fpc/~ ;
s~^/usr/lib64/fvwm/~/usr/lib/fvwm/~ ;
s~^/usr/lib64/gcc/~/usr/lib/gcc/~ ;
s~^/usr/lib64/gentoolkit/~/usr/lib/gentoolkit/~ ;
s~^/usr/opt/~/opt/~ ;
"
# ===========================================================
# ========================= C O D E ===========================
# ===============================================================
# summarize dirlist
DIRLIST="`echo $DIRLIST`"
echo "DIRLIST=$DIRLIST"
# exclude current python, perl, kernel modules
EXCLUDES="$EXCLUDES\|`qlist -ICev python | sed 's~[^0-9]*\([0-9]*\.[0-9]*\).*~\^\/usr\/lib64\/python\1\|\\\\~'`"
EXCLUDES="`echo $EXCLUDES | sed 's~\ ~~g ; s~\\\~~g ; s~|$~~'`"
EXCLUDES="$EXCLUDES\|`qlist -ICev perl | sed 's~[^0-9]*\([0-9]*\.[0-9]*\.[0-9]*\).*~\^\/usr\/lib64\/perl5/\1\|\\\\~'`"
EXCLUDES="`echo $EXCLUDES | sed 's~\ ~~g ; s~\\\~~g ; s~|$~~'`"
EXCLUDES="$EXCLUDES\|^`realpath /lib/modules/\`uname -r\``"
EXCLUDES="`echo $EXCLUDES | sed 's~\ ~~g ; s~\\\~~g ; s~|$~~'`"
# summarize excludes
echo "EXCLUDES=$EXCLUDES"
# summarize replaces
REPLACES="`echo $REPLACES`"
echo "REPLACES=$REPLACES"
CURRENT_LIST=/tmp/current-$RANDOM.lst
PORTAGE_LIST=/tmp/portage-$RANDOM.lst
RESULT_LIST=/tmp/result-$RANDOM.lst
echo "Gathering information from portage..."
qlist / | sort -u >$PORTAGE_LIST
echo "Gathering information from file system..."
find -P $DIRLIST -type f 2>/dev/null | grep -vE "$EXCLUDES" | sed "$REPLACES" | sort -u >$CURRENT_LIST
echo "Searching for differences..."
diff $PORTAGE_LIST $CURRENT_LIST | grep -E '^>' | sed 's/> //' >$RESULT_LIST
echo "`wc -l $RESULT_LIST | cut -d" " -f1` orphaned files found:"
echo "-------------------------------------------------------------------------"
cat $RESULT_LIST
rm -f $PORTAGE_LIST $CURRENT_LIST $RESULT_LIST
exit 0