b9dde2b9f8
* Optimize by copying old packages using cpio -dumpl (i.e. create hardlink instead of copying the file).
32 lines
625 B
Bash
Executable file
32 lines
625 B
Bash
Executable file
#!/bin/sh -x
|
|
|
|
usage () {
|
|
echo "usage: keeprestr arch branch buildid"
|
|
exit 1
|
|
}
|
|
|
|
if [ $# -ne 3 ]; then
|
|
usage
|
|
fi
|
|
|
|
arch=$1
|
|
branch=$2
|
|
buildid=$3
|
|
|
|
pb=/var/portbuild
|
|
|
|
. ${pb}/scripts/buildenv
|
|
|
|
buildid=$(resolve ${pb} ${arch} ${branch} ${buildid})
|
|
if [ -z "${buildid}" ]; then
|
|
echo "Invalid build ID ${buildid}"
|
|
exit 1
|
|
fi
|
|
|
|
builddir=${pb}/${arch}/${branch}/builds/${buildid}
|
|
cd ${builddir}
|
|
|
|
rm -rf bak/restricted
|
|
mkdir -p bak/restricted
|
|
|
|
(tr ';' '\n' < restricted.sh | grep "/bin/rm -f" | awk '{print $3}' | grep packages/ | sed -e "s,${builddir}/,," -e 's,)$,,' | xargs ls -1 2>/dev/null) | cpio -dumpl bak/restricted/
|