2 [ "$(id | awk '{print $1}')" != 'uid=0(root)' ] && exec sudo "$0" "$@"
4 dir="$(realpath "$(dirname "$0")/../alpine")"
5 aports="$(realpath "$dir/../aports")"
21 mount $@ "$src" "$dst"
26 if [ $# -gt 0 -a "x$(echo "$1" | cut -c 1)" = x/ ]; then
31 src="$(realpath $src)"
32 [ ! -e "$src" ] && return
33 m "$src" "$dst" --bind --slave $@
40 m none "$dir/proc" -t proc
42 ln -f /etc/resolv.conf "$dir/etc/resolv.conf"
43 mb "$aports" /home/abuild/aports
44 mb /srv/alpine/edge /home/abuild/packages
45 mb /var/cache/distfiles
48 f="$(chroot "$dir" mktemp -p/tmp/)"
51 chrdir="${chrdir%/aports/*}"
52 if [ "$chrdir" != "$PWD/" ]; then
53 cmd="cd \"/home/abuild${PWD#$chrdir}\" && $cmd"
56 echo "$cmd" | tee "$dir/$f"
58 chroot "$dir" /bin/su abuild -l "$f"
62 for x in $(seq $um -1 1); do