40-autodist-cleanold: refresh with currently in use modifications
This commit is contained in:
parent
a49c4ec447
commit
f93a093134
@ -1,44 +1,48 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
[ -e /etc/autodist/config ] && . /etc/autodist/config
|
||||||
[ -e /etc/sysconfig/autoport ] && . /etc/sysconfig/autoport
|
[ -e /etc/sysconfig/autoport ] && . /etc/sysconfig/autoport
|
||||||
|
|
||||||
RPMS_CTIME_OLD="+14"
|
RPMS_CTIME_OLD="+14"
|
||||||
BUILD_CTIME_OLD="+14"
|
BUILD_CTIME_OLD="+14"
|
||||||
SOURCES_CTIME_OLD="+14"
|
SOURCES_CTIME_OLD="+40"
|
||||||
|
SOURCES_PATH_CTIME_OLD="+730"
|
||||||
SRPMS_CTIME_OLD="+14"
|
SRPMS_CTIME_OLD="+14"
|
||||||
TMP_CTIME_OLD="+2"
|
TMP_CTIME_OLD="+2"
|
||||||
LOG_CTIME_OLD="+7"
|
|
||||||
|
|
||||||
function clean() {
|
function clean() {
|
||||||
dir=$1
|
dir=$1
|
||||||
arch=$2
|
|
||||||
[ "$VERBOSE" ] && echo "Cleaning from base directory $dir..."
|
[ "$VERBOSE" ] && echo "Cleaning from base directory $dir..."
|
||||||
[ -e $dir/ ] && find $dir/ -mindepth 1 -maxdepth 1 -name "pipe\:\[*" -exec rm -f {} \;
|
[ -e $dir/ ] && find $dir/ -mindepth 1 -maxdepth 1 -name "pipe\:\[*" -exec rm -f {} \;
|
||||||
[ -e $dir/RPM/SPECS/ ] && find $dir/RPM/SPECS/ -mindepth 1 -maxdepth 1 -type f -not -name "*.spec*" -exec rm -f {} \;
|
[ -e $dir/RPM/SPECS/ ] && find $dir/RPM/SPECS/ -mindepth 1 -maxdepth 1 -type f -not -name "*.spec*" -exec rm -f {} \;
|
||||||
[ -e $dir/RPM/RPMS/$arch/ ] && find $dir/RPM/RPMS/$arch/ -mindepth 1 -maxdepth 1 -ctime ${RPMS_CTIME_OLD} -exec rm -f {} \;
|
for arch in ${AUTODIST_ARCHS[*]}; do
|
||||||
[ -e $dir/RPM/RPMS/noarch/ ] && find $dir/RPM/RPMS/noarch/ -mindepth 1 -maxdepth 1 -ctime ${RPMS_CTIME_OLD} -exec rm -f {} \;
|
[ -e $dir/RPM/RPMS/$arch/ ] && find $dir/RPM/RPMS/$arch/ -mindepth 1 -maxdepth 1 -type f -mtime ${RPMS_CTIME_OLD} -exec rm -f {} \;
|
||||||
[ -e $dir/RPM/BUILD/ ] && find $dir/RPM/BUILD/ -mindepth 1 -maxdepth 1 -ctime ${BUILD_CTIME_OLD} -exec rm -rf {} \;
|
done
|
||||||
[ -e $dir/RPM/SOURCES/ ] && find $dir/RPM/SOURCES/ -mindepth 1 -maxdepth 1 -ctime ${SOURCES_CTIME_OLD} -a ! -name "*.patch" -exec rm -rf {} \;
|
[ -e $dir/RPM/RPMS/noarch/ ] && find $dir/RPM/RPMS/noarch/ -mindepth 1 -maxdepth 1 -type f -mtime ${RPMS_CTIME_OLD} -exec rm -f {} \;
|
||||||
[ -e $dir/RPM/SRPMS/ ] && find $dir/RPM/SRPMS/ -mindepth 1 -maxdepth 1 -ctime ${SRPMS_CTIME_OLD} -exec rm -f {} \;
|
[ -e $dir/RPM/BUILD/ ] && find $dir/RPM/BUILD/ -mindepth 1 -maxdepth 1 -type d -ctime ${BUILD_CTIME_OLD} -exec rm -rf {} \;
|
||||||
[ -e $dir/.autoport/$arch/ ] && find $dir/.autoport/$arch/ -mindepth 1 -maxdepth 1 -ctime ${LOG_CTIME_OLD} -name *.log -exec rm -f {} \;
|
[ -e $dir/RPM/SOURCES/ ] && {
|
||||||
|
find $dir/RPM/SOURCES/ -mindepth 1 -maxdepth 1 -type f -ctime ${SOURCES_CTIME_OLD} -a ! -name "*.patch" -exec rm -rf {} \;
|
||||||
|
find $dir/RPM/SOURCES/ -mindepth 1 -maxdepth 1 -type f -ctime ${SOURCES_PATH_CTIME_OLD} -a -name "*.patch" -exec rm -rf {} \;
|
||||||
|
}
|
||||||
|
[ -e $dir/RPM/SRPMS/ ] && find $dir/RPM/SRPMS/ -mindepth 1 -maxdepth 1 -type f -mtime ${SRPMS_CTIME_OLD} -exec rm -f {} \;
|
||||||
}
|
}
|
||||||
|
|
||||||
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
||||||
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
||||||
a=${AUTOPORT_CHROOT[$i]}
|
a=${AUTOPORT_CHROOT[$i]}
|
||||||
clean /var/autoport/$a/usr/src ${AUTOPORT_ARCH[$i]}
|
clean /var/autoport/$a/usr/src
|
||||||
[ -e /var/autoport/$a/var/autodist/RPM/RPMS/$arch ] && \
|
[ -e /var/autoport/$a/var/autodist/RPM/RPMS/ ] && \
|
||||||
clean /var/autoport/$a/var/autodist ${AUTOPORT_ARCH[$i]}
|
clean /var/autoport/$a/var/autodist
|
||||||
[ -e /var/autoport/$a/var/tmp/autodist ] && \
|
[ -e /var/autoport/$a/var/tmp/autodist ] && \
|
||||||
find /var/autoport/$a/var/tmp/autodist/ -mindepth 1 -maxdepth 1 -ctime ${TMP_CTIME_OLD} -exec rm -rf {} \;
|
find /var/autoport/$a/var/tmp/autodist/ -mindepth 1 -maxdepth 1 -type f -mtime ${TMP_CTIME_OLD} -exec rm -rf {} \;
|
||||||
find /var/autoport/$a/tmp/ -mindepth 1 -maxdepth 1 -ctime ${TMP_CTIME_OLD} -exec rm -rf {} \;
|
find /var/autoport/$a/tmp/ -mindepth 1 -maxdepth 1 -type f -mtime ${TMP_CTIME_OLD} -exec rm -rf {} \;
|
||||||
elif [ "${AUTOPORT_UPDATE[$i]}" ]; then
|
elif [ "${AUTOPORT_UPDATE[$i]}" ]; then
|
||||||
clean /var/autodist ${AUTOPORT_ARCH[$i]}
|
clean /var/autodist
|
||||||
find /var/autodist-tmp/ -mindepth 1 -maxdepth 1 -ctime ${TMP_CTIME_OLD} -exec rm -rf {} \;
|
find /var/autodist-tmp/ -mindepth 1 -maxdepth 1 -type f -mtime ${TMP_CTIME_OLD} -exec rm -rf {} \;
|
||||||
elif [ "${AUTOPORT_NATIVE[$i]}" -a "${AUTOPORT_CHROOT_USER[$i]}" ]; then
|
elif [ "${AUTOPORT_NATIVE[$i]}" -a "${AUTOPORT_CHROOT_USER[$i]}" ]; then
|
||||||
WORKINGHOME=`getent passwd ${AUTOPORT_CHROOT_USER[$i]} | cut -d: -f6`
|
WORKINGHOME=`getent passwd ${AUTOPORT_CHROOT_USER[$i]} | cut -d: -f6`
|
||||||
if [ -e $WORKINGHOME ]; then
|
if [ -e $WORKINGHOME ]; then
|
||||||
clean $WORKINGHOME ${AUTOPORT_ARCH[$i]}
|
clean $WORKINGHOME
|
||||||
fi
|
fi
|
||||||
find /var/autodist-tmp/ -mindepth 1 -maxdepth 1 -ctime ${TMP_CTIME_OLD} -exec rm -rf {} \;
|
find /var/autodist-tmp/ -mindepth 1 -maxdepth 1 -type f -mtime ${TMP_CTIME_OLD} -exec rm -rf {} \;
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user