-
Notifications
You must be signed in to change notification settings - Fork 0
/
check-sstate-cache.sh
executable file
·51 lines (44 loc) · 1.29 KB
/
check-sstate-cache.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
set -ueE
exec 3>/dev/null
cd $(dirname $0)
topdir=$PWD
rm -rf tmp
mkdir -p tmp
trap "rm -rf tmp" EXIT
set -- "${1:-}"
if [ "x$1" = "xrootfs" ]; then
name=$1
elif [ "x$1" = "xbootstrap" ]; then
name=$1
else
echo "USAGE: i$(basename $0) < rootfs | bootstrap >"
exit 1
fi
fname=$(find build/sstate-cache/ -name sstate:sbuild-chroot-\*${name}\*.tgz; \
find build/sstate-cache/ -name sstate:\*isar-${name}-\*${name}\*.tgz; \
find build/sstate-cache/ -name sstate:\*isar-${name}-\*${name}\*.tar.zst; \
find build/sstate-cache/ -name sstate:sbuild-chroot-\*${name}\*.tar.zst)
if [ -z "$fname" ]; then
echo -e "\n${ERROR:-ERROR}: no file about ${name}, abort.\n"
exit 1
fi
if echo "$fname" | grep -qe ".zst$"; then
zstd -do tmp/${name}.tar.tar "$fname"
tar xf tmp/${name}.tar.tar -C tmp
rm -f tmp/${name}.tar.tar
else
tar -Oxzf "$fname" >tmp/${name}.tar
fi
tar xf tmp/${name}.tar --exclude=dev/* -C tmp #2>/dev/null
rm -f tmp/${name}.tar
echo
mv -f ${name}.list ${name}.list.bak
for i in "" var usr usr/lib usr/share; do
echo "exploring tmp/rootfs/$i"
du -ms tmp/rootfs/$i/* | sort -rn | head -n5
echo
done | tee ${name}.list
echo "listing tmp/rootfs"
find tmp/rootfs -type f | sort >> ${name}.list
echo -e "\n${DONE:-DONE}: sorted list of files in ${name}.list\n"