Pieni skripti joka etsii kaikki tiedostot mitkä eivät ole asennettu pakettienhallinnan kautta. If-riveille voi lisätä hakemistot mistä ei etsitä. Skripti toimii rekursiivisesti eli laittaa varmana hitaammat koneet kyykkyyn...
#!/bin/bash
if [ -z "$1" ] ; then
cd /
cat /var/log/packages/* > /tmp/tmp.packages
else
cd "/$1"
fi
if [ "$1" = "home" ] ; then exit ; fi
if [ "$1" = "proc" ] ; then exit ; fi
if [ "$1" = "dev" ] ; then exit ; fi
if [ "$1" = "boot" ] ; then exit ; fi
if [ "$1" = "sys" ] ; then exit ; fi
if [ "$1" = "mnt" ] ; then exit ; fi
if [ "$1" = "root" ] ; then exit ; fi
if [ "$1" = "tmp" ] ; then exit ; fi
if [ "$1" = "lost found" ] ; then exit ; fi
if [ "$1" = "lib/modules" ] ; then exit ; fi
if [ "$1" = "usr/src" ] ; then exit ; fi
if [ "$1" = "var" ] ; then exit ; fi
for f in * ; do
if [ "$f" = "." ] ; then continue ; fi
if [ "$f" = ".." ] ; then continue ; fi
if [ "$f" = "*" ] ; then continue ; fi
if [ -h "$f" ] ; then continue ; fi
if [ -z "$1" ] ; then
FILE="$f"
else
FILE="${1}/$f"
fi
# echo "$FILE"
grep -qiF "$FILE" /tmp/tmp.packages || echo "/$FILE"
if [ -d "$f" ] ; then
findunstalled "$FILE" &
fi
done
#!/bin/bash
if [ -z "$1" ] ; then
cd /
cat /var/log/packages/* > /tmp/tmp.packages
else
cd "/$1"
fi
if [ "$1" = "home" ] ; then exit ; fi
if [ "$1" = "proc" ] ; then exit ; fi
if [ "$1" = "dev" ] ; then exit ; fi
if [ "$1" = "boot" ] ; then exit ; fi
if [ "$1" = "sys" ] ; then exit ; fi
if [ "$1" = "mnt" ] ; then exit ; fi
if [ "$1" = "root" ] ; then exit ; fi
if [ "$1" = "tmp" ] ; then exit ; fi
if [ "$1" = "lost found" ] ; then exit ; fi
if [ "$1" = "lib/modules" ] ; then exit ; fi
if [ "$1" = "usr/src" ] ; then exit ; fi
if [ "$1" = "var" ] ; then exit ; fi
for f in * ; do
if [ "$f" = "." ] ; then continue ; fi
if [ "$f" = ".." ] ; then continue ; fi
if [ "$f" = "*" ] ; then continue ; fi
if [ -h "$f" ] ; then continue ; fi
if [ -z "$1" ] ; then
FILE="$f"
else
FILE="${1}/$f"
fi
# echo "$FILE"
grep -qiF "$FILE" /tmp/tmp.packages || echo "/$FILE"
if [ -d "$f" ] ; then
findunstalled "$FILE" &
fi
done
Vastaukset 1
Vanhimmat
#!/bin/bash
cat /var/log/packages/* > /tmp/tmp.packages
find /bin -type f > /tmp/tmp.files
find /usr -type f >> /tmp/tmp.files
find /sbin -type f >> /tmp/tmp.files
find /etc -type f >> /tmp/tmp.files
find /boot -type f >> /tmp/tmp.files
find /opt -type f >> /tmp/tmp.files
find /lib -type f >> /tmp/tmp.files
cat /tmp/tmp.files | sed -n 's/^\///p' | while read f ; do
if [ -z "`grep "$f" /tmp/tmp.packages`" ] ; then
echo $f
fi
done