Skip to content
Snippets Groups Projects
Commit 896c436e authored by Natanael Copa's avatar Natanael Copa
Browse files

buildrepo: check if all files exist before try copy anything

seems like copy removes destination if source does not exist so
we ended up with a buildrepo that removed all packages
parent 494960f2
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,14 @@ listpackages() {
done
}
all_exist() {
while [ $# -gt 0 ]; do
[ -e "$1" ] || return 1
shift 1
done
return 0
}
build() {
local repo="$1" i indexupdate needbuild
......@@ -47,15 +55,18 @@ build() {
continue
fi
indexupdate="$indexupdate $i"
# try link or copy the files if they are in the ports dir
pkgs=$(abuild listpkg)
if cp -p -l $pkgs "$repodir/$repo"/ 2>/dev/null \
|| cp -p $pkgs "$repodir/$repo"/ 2>/dev/null; then
if all_exist $pkgs; then
echo ">>> Copying " $pkgs
cp -p -l $pkgs "$repodir/$repo"/ 2>/dev/null \
|| cp -p $pkgs "$repodir/$repo"/ \
|| needbuild="$needbuild $i"
else
needbuild="$needbuild $i"
fi
indexupdate="$indexupdate $i"
done
# build the postponed packages if any
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment