2011-05-04 02:31:45 +02:00
|
|
|
#!/bin/bash
|
2012-07-09 18:49:52 +02:00
|
|
|
[ -e /etc/sysconfig/autoport ] && . /etc/sysconfig/autoport
|
|
|
|
|
|
|
|
function clean() {
|
|
|
|
dir=$1
|
|
|
|
arch=$2
|
2013-05-21 01:39:06 +02:00
|
|
|
find $dir/RPM/RPMS/$arch/ -maxdepth 1 -ctime +21 -exec rm -rf {} \;
|
|
|
|
find $dir/RPM/RPMS/noarch/ -maxdepth 1 -ctime +21 -exec rm -rf {} \;
|
|
|
|
find $dir/RPM/BUILD/ -maxdepth 1 -ctime +21 -exec rm -rf {} \;
|
|
|
|
find $dir/RPM/SOURCES/ -maxdepth 1 -ctime +120 -a ! -name "*.patch" -exec rm -rf {} \;
|
|
|
|
find $dir/RPM/SRPMS/ -maxdepth 1 -ctime +48 -exec rm -rf {} \;
|
2012-07-09 18:49:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
|
|
|
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
|
|
|
a=${AUTOPORT_CHROOT[$i]}
|
|
|
|
clean /var/autoport/$a/usr/src ${AUTOPORT_ARCH[$i]}
|
|
|
|
[ -e /var/autoport/$a/var/autodist/RPM/RPMS/$arch ] && \
|
|
|
|
clean /var/autoport/$a/var/autodist ${AUTOPORT_ARCH[$i]}
|
|
|
|
[ -e /var/autoport/$a/var/tmp/autodist ] && \
|
|
|
|
find /var/autoport/$a/var/tmp/autodist/ -maxdepth 1 -ctime +25 -exec rm -rf {} \;
|
|
|
|
find /var/autoport/$a/tmp/ -maxdepth 1 -ctime +25 -exec rm -rf {} \;
|
|
|
|
elif [ "${AUTOPORT_UPDATE[$i]}" ]; then
|
|
|
|
clean /var/autodist ${AUTOPORT_ARCH[$i]}
|
2013-11-09 14:33:39 +01:00
|
|
|
find /var/autodist-tmp/ -maxdepth 1 -ctime +25 -exec rm -rf {} \;
|
2012-09-02 13:24:26 +02:00
|
|
|
elif [ "${AUTOPORT_NATIVE[$i]}" -a "${AUTOPORT_CHROOT_USER[$i]}" ]; then
|
|
|
|
WORKINGHOME=`getent passwd ${AUTOPORT_CHROOT_USER[$i]} | cut -d: -f6`
|
|
|
|
if [ -e $WORKINGHOME ]; then
|
|
|
|
clean $WORKINGHOME ${AUTOPORT_ARCH[$i]}
|
|
|
|
fi
|
2013-11-09 14:33:39 +01:00
|
|
|
find /var/autodist-tmp/ -maxdepth 1 -ctime +25 -exec rm -rf {} \;
|
2012-07-09 18:49:52 +02:00
|
|
|
fi
|
|
|
|
done
|