You are not logged in.

#1 2004-01-12 21:39:46

whatah
Member
Registered: 2003-08-10
Posts: 114

ABS Cleanup Script

well, i noticed i had only 500 MB free on my root partition, so i decided to go and clean out my /var/abs (freeing up roughly 2 gigs). Here is a bash script i wrote to remove the src/ and pkg/ recursively from your abs root. (it also cleans out your unstable, extra and other repositories abs looks at)

#!/bin/bash
source /etc/abs/abs.conf
cd $ABSROOT
for h in $(ls /etc/abs/supfile* | sed 's/./ /g' | gawk '{print $2}'); do pushd $h
        for i in *; do pushd $i
                for j in *; do pushd $j
                        rm src/ pkg/ -rf && popd; done; popd; done; popd; done 

Oh yeah, you need gawk for it to work.

Offline

#2 2004-01-12 22:44:19

orelien
Forum Fellow
From: France
Registered: 2002-12-05
Posts: 220
Website

Re: ABS Cleanup Script

Not anymore wink

4c4
< for h in $(ls /etc/abs/supfile* | sed 's/./ /g' | gawk '{print $2}'); do pushd $h
---
> for h in "${SUPFILES[@]}"; do pushd "${h#!}"

BTW, there is no /var/abs/arch directory...

Offline

#3 2004-01-12 22:57:17

whatah
Member
Registered: 2003-08-10
Posts: 114

Re: ABS Cleanup Script

No arch in /var/abs? too bad, tongue.
I wasn't sure how to access that variable, hehe. thanks

Offline

#4 2006-02-16 00:13:12

AndyRTR
Developer
From: Magdeburg/Germany
Registered: 2005-10-07
Posts: 1,641

Re: ABS Cleanup Script

The above scripts did not work for me. So I've written my own one. It's much longer but for me as a beginner in scripting it's easier to understand and modify.

#!/bin/bash
source /etc/abs/abs.conf
echo "ABSROOT="$ABSROOT
cd $ABSROOT

before=`du -csh $ABSROOT`
echo "space used now" $before; sleep 5

# current
for toppath in `ls -1 $ABSROOT -I community -I extra -I local -I testing -I install.proto -I PKGBUILD.proto`; do
    echo "toppath is" $toppath
    cd $ABSROOT/$toppath
        for subpath in *; do
            cd $ABSROOT/$toppath/$subpath
            rm -rf pkg/ src/ filelist && echo $ABSROOT/$toppath/$subpath "clean now"
            cd ..
        done
    cd ..
done

# extra
cd $ABSROOT/extra
for toppath in `ls -1 $ABSROOT/extra`; do
    echo "toppath is" $toppath
    cd $ABSROOT/extra/$toppath
        for subpath in *; do
            cd $ABSROOT/extra/$toppath/$subpath
            rm -rf pkg/ src/ filelist && echo $ABSROOT/extra/$toppath/$subpath "clean now"
            cd ..
        done
    cd ..
done

# community
cd $ABSROOT/community
for toppath in `ls -1 $ABSROOT/community`; do
    echo "toppath is" $toppath
    cd $ABSROOT/community/$toppath
        for subpath in *; do
            cd $ABSROOT/community/$toppath/$subpath
            rm -rf pkg/ src/ filelist && echo $ABSROOT/community/$toppath/$subpath "clean now"
            cd ..
        done
    cd ..
done

# testing
cd $ABSROOT/testing
for subpath in *; do
    cd $ABSROOT/testing/$subpath
    rm -rf pkg/ src/ filelist && echo $ABSROOT/testing/$subpath "clean now"
    cd ..
done


# local / AUR
cd $ABSROOT/local
#removes the downloaded AUR build stuff 
ls -l *.tar.gz
rm -f *.tar.gz
for subpath in `ls -1 $ABSROOT/local -I install.proto -I PKGBUILD.proto`; do
    cd $ABSROOT/local/$subpath; pwd
    rm -rf pkg/ src/ filelist && echo $ABSROOT/local/$subpath "clean"
    cd ..
done

after=`du -csh $ABSROOT`
echo "used space before cleaning"        $before
echo "used  space now"               $after

Offline

#5 2006-02-16 00:56:09

hypermegachi
Member
Registered: 2004-07-25
Posts: 311

Re: ABS Cleanup Script

what happened to being super lazy?

# rm -rf /var/abs
# abs

Offline

#6 2006-02-16 01:00:22

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: ABS Cleanup Script

it may be semi - 40% - 32% - 58.9% usefull to set the PKGDEST variable in makepkg.conf so that all packages are moved to that location instead of being scattered all over your abs tree.

Offline

Board footer

Powered by FluxBB