code cleanup build-set

This commit is contained in:
artoo 2014-10-06 16:57:26 +02:00
parent d78e51eb32
commit 815f0eb14c
2 changed files with 16 additions and 11 deletions

View file

@ -80,10 +80,8 @@ if [[ -n ${pkgdir} ]];then
elif [[ -n $PKGDEST ]];then elif [[ -n $PKGDEST ]];then
pkgdir=$PKGDEST pkgdir=$PKGDEST
else else
pkgdir=/var/cache/manjaro-tools/pkg pkgdir='/var/cache/manjaro-tools/pkg'
if ! [[ -d ${pkgdir} ]];then prepare_dir "${pkgdir}"
mkdir -p ${pkgdir}
fi
fi fi
clean_first=false clean_first=false

View file

@ -365,6 +365,12 @@ get_user(){
echo $(ls ${chrootdir} | cut -d' ' -f1 | grep -v root | grep -v lock) echo $(ls ${chrootdir} | cut -d' ' -f1 | grep -v root | grep -v lock)
} }
prepare_dir(){
if ! [[ -d $1 ]];then
mkdir -p $1
fi
}
chroot_clean(){ chroot_clean(){
for copy in "${chrootdir}"/*; do for copy in "${chrootdir}"/*; do
[[ -d "${copy}" ]] || continue [[ -d "${copy}" ]] || continue
@ -387,9 +393,9 @@ chroot_clean(){
rm -rf --one-file-system "${chrootdir}" rm -rf --one-file-system "${chrootdir}"
} }
clean_pkg_cache(){ clean_dir(){
msg2 "Cleaning pkg cache $1 ..." msg2 "Cleaning $1 ..."
rm $1/*.${ext} rm $1/*
} }
git_clean(){ git_clean(){
@ -424,7 +430,10 @@ chroot_init(){
elif ${clean_first};then elif ${clean_first};then
msg "Creating chroot for [${branch}] (${arch})..." msg "Creating chroot for [${branch}] (${arch})..."
chroot_clean chroot_clean
clean_pkg_cache ${pkgdir} clean_dir ${pkgdir}
# if ${repo};then
# clean_dir ${repodir}
# fi
chroot_create chroot_create
else else
msg "Updating chroot for [${branch}] (${arch})..." msg "Updating chroot for [${branch}] (${arch})..."
@ -508,9 +517,7 @@ mv_pkg(){
repo_create(){ repo_create(){
msg "Creating repo ${repodir} ..." msg "Creating repo ${repodir} ..."
if ! [[ -d ${repodir}/${arch} ]];then prepare_dir "${repodir}/${arch}"
mkdir -p ${repodir}/${arch}
fi
for p in ${pkgdir}/*.${ext}; do for p in ${pkgdir}/*.${ext}; do
cp $p ${repodir}/${arch}/ cp $p ${repodir}/${arch}/
done done