: ${PACKAGE_NAME=''}
: ${NETWORKING=false}
: ${TRACING=false}
-: ${TMPFS=true}
+: ${TMPFS="4G"}
dir=$(pwd)
image=registry.gitlab.com/pld-linux/cleanbuild
topdir=$dir/rpm
home=/home/builder
-buildsize="4G"
die() {
echo >&2 "$0: $*"
exit 1
}
+is_no() {
+ # Test syntax
+ if [ $# = 0 ]; then
+ return 2
+ fi
+
+ case "$1" in
+ no|No|NO|false|False|FALSE|off|Off|OFF|N|n|0)
+ # true returns zero
+ return 0
+ ;;
+ *)
+ # false returns one
+ return 1
+ ;;
+ esac
+}
+
+tmpfs() {
+ if is_no "${TMPFS:-true}" || [ "$TMPFS" -le 0 ]; then
+ return
+ fi
+
+ echo "--tmpfs $home/rpm/BUILD:rw,exec,nosuid,size=$TMPFS"
+}
+
create_container() {
# cleanup first
docker kill $name >/dev/null 2>&1 || :
-v $dir:$home/cleanbuild \
-v $dir/cache/poldek:/var/cache/poldek \
-v $dir/cache/ccache/$PACKAGE_NAME:$home/.ccache \
- $($TMPFS && echo "--tmpfs $home/rpm/BUILD:rw,exec,nosuid,size=$buildsize") \
+ $(tmpfs) \
$image
# set the homedir
parse_options() {
local t
- t=$(getopt -o 'x' --long 'network,no-tmpfs,notmpfs' -n "$PROGRAM" -- "$@")
+ t=$(getopt -o 'x' --long 'network,no-tmpfs,notmpfs,tmpfs:' -n "$PROGRAM" -- "$@")
[ $? != 0 ] && exit $?
eval set -- "$t"
--no-tmpfs|--notmpfs)
TMPFS=false
;;
+ --tmpfs)
+ shift
+ TMPFS="$1"
+ ;;
--)
shift
break