projects
/
mirror
/
dsa-puppet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Pass --force-yes when installing using apt-get
[mirror/dsa-puppet.git]
/
modules
/
porterbox
/
files
/
setup-dchroot
diff --git
a/modules/porterbox/files/setup-dchroot
b/modules/porterbox/files/setup-dchroot
index
db27d5a
..
5050b6c
100755
(executable)
--- a/
modules/porterbox/files/setup-dchroot
+++ b/
modules/porterbox/files/setup-dchroot
@@
-38,11
+38,16
@@
usage: $0 <suite>
OPTIONS:
-a ARCH debootstrap arch [$arch]
-m MIRROR http mirror to use [$mirror]
OPTIONS:
-a ARCH debootstrap arch [$arch]
-m MIRROR http mirror to use [$mirror]
- -b basedir place where to
build the chroot/
tarball [$basedir]
+ -b basedir place where to
put the
tarball [$basedir]
-c write config only
-c write config only
+ -d dir place where to build the chroot [${builddir:-$basedir}]
-f overwrite config and target tarball
-f overwrite config and target tarball
+ -g GROUPS groups that should have access to the schroot [$groupuser]
-k KEYRING use an alternate keyring [$keyring]
-k KEYRING use an alternate keyring [$keyring]
+ -p PERS use a different sbuild personality [$personality]
+ -r GROUPS groups that should have root in the schroot [$grouproot]
-s use sbuild compatible naming scheme
-s use sbuild compatible naming scheme
+ -u Ubuntu target
-h this help
EOF
}
-h this help
EOF
}
@@
-82,16
+87,16
@@
cat << EOF
description=[${name}] Debian $suite chroot for $arch
type=file
file=$target
description=[${name}] Debian $suite chroot for $arch
type=file
file=$target
-groups=
Debian,guest
-root-groups=
adm
+groups=
$groupuser
+root-groups=
$grouproot
source-groups=adm
source-root-groups=adm
EOF
if dpkg --compare-versions "$(lsb_release --release --short)" '<' 7; then
source-groups=adm
source-root-groups=adm
EOF
if dpkg --compare-versions "$(lsb_release --release --short)" '<' 7; then
- echo "script-config=
dsa
/config"
+ echo "script-config=
$personality
/config"
else
else
- echo "profile=
dsa
"
+ echo "profile=
$personality
"
fi
if [ "$THISARCH" = "$arch" ]; then
fi
if [ "$THISARCH" = "$arch" ]; then
@@
-112,7
+117,7
@@
EOF
:
;;
*)
:
;;
*)
- if [ -z "$extra" ]; then
+ if [ -z "$extra" ]
&& [ -z "$ubuntu" ]
; then
genschrootconf "$suite" "$arch" "$target" "backports"
fi
esac
genschrootconf "$suite" "$arch" "$target" "backports"
fi
esac
@@
-130,12
+135,17
@@
mirror="${mirror:-http://cdn.debian.net/debian}"
configonly=""
force=""
basedir="/srv/chroot"
configonly=""
force=""
basedir="/srv/chroot"
+builddir=""
keyring=/usr/share/keyrings/debian-archive-keyring.gpg
keyring=/usr/share/keyrings/debian-archive-keyring.gpg
+personality="dsa"
sbuildnames=""
sbuildnames=""
+ubuntu=""
+groupuser="Debian,guest"
+grouproot="adm"
declare -a cleanup
trap do_cleanup EXIT
declare -a cleanup
trap do_cleanup EXIT
-while getopts "a:b:c
fhk:m:s
" OPTION
+while getopts "a:b:c
d:fg:hk:m:p:r:su
" OPTION
do
case $OPTION in
a)
do
case $OPTION in
a)
@@
-147,11
+157,17
@@
do
c)
configonly="1"
;;
c)
configonly="1"
;;
+ d)
+ builddir="$OPTARG"
+ ;;
f)
force="1"
;;
f)
force="1"
;;
+ g)
+ groupuser="$OPTARG"
+ ;;
h)
h)
- help
+ usage
exit 0
;;
k)
exit 0
;;
k)
@@
-160,9
+176,18
@@
do
m)
mirror="$OPTARG"
;;
m)
mirror="$OPTARG"
;;
+ p)
+ personality="$OPTARG"
+ ;;
+ r)
+ grouproot="$OPTARG"
+ ;;
s)
sbuildnames="1"
;;
s)
sbuildnames="1"
;;
+ u)
+ ubuntu="1"
+ ;;
*)
usage >&2
exit 1
*)
usage >&2
exit 1
@@
-178,7
+203,9
@@
fi
suite="$1"; shift
tuple="${suite}_${arch}"
suite="$1"; shift
tuple="${suite}_${arch}"
+builddir=${builddir:-$basedir}
[ -d "$basedir" ] || die "Error: $basedir does not exist (or is not a directory)."
[ -d "$basedir" ] || die "Error: $basedir does not exist (or is not a directory)."
+[ -d "$builddir" ] || die "Error: $builddir does not exist (or is not a directory)."
target="$basedir/$tuple.tar.gz"
! [ -e "$target" ] || [ -n "$force" ] || die "Error: $target already exists."
target="$basedir/$tuple.tar.gz"
! [ -e "$target" ] || [ -n "$force" ] || die "Error: $target already exists."
@@
-194,7
+221,7
@@
genschrootconf "$suite" "$arch" "$target" | tee "$schrootconfig"
if [ -n "$configonly" ]; then exit 0; fi
if [ -n "$configonly" ]; then exit 0; fi
-rootdir=$(mktemp -d "$b
ase
dir/create-$suite-XXXXXX")
+rootdir=$(mktemp -d "$b
uild
dir/create-$suite-XXXXXX")
cleanup+=("rm -r $rootdir")
cleanup+=("umount $rootdir/sys")
cleanup+=("rm -r $rootdir")
cleanup+=("umount $rootdir/sys")
@@
-208,7
+235,7
@@
debootstrap \
echo "$tuple" > $rootdir/etc/debian_chroot
chroot "$rootdir" apt-get update
echo "$tuple" > $rootdir/etc/debian_chroot
chroot "$rootdir" apt-get update
-chroot "$rootdir" apt-get install -y --no-install-recommends policyrcd-script-zg2
+chroot "$rootdir" apt-get install -y --
force-yes --
no-install-recommends policyrcd-script-zg2
cat > "$rootdir/usr/local/sbin/policy-rc.d" << 'EOF'
#!/bin/sh
cat > "$rootdir/usr/local/sbin/policy-rc.d" << 'EOF'
#!/bin/sh
@@
-227,8
+254,11
@@
while true; do
done
EOF
chmod +x "$rootdir/usr/local/sbin/policy-rc.d"
done
EOF
chmod +x "$rootdir/usr/local/sbin/policy-rc.d"
-chroot "$rootdir" apt-get install -y --no-install-recommends zsh locales-all build-essential less vim fakeroot devscripts gdb
+[ -z "$ubuntu" ] && chroot "$rootdir" apt-get install -y --force-yes --no-install-recommends locales-all
+chroot "$rootdir" apt-get install -y --force-yes --no-install-recommends zsh build-essential less vim fakeroot devscripts gdb
rm -f "$rootdir/etc/apt/sources.list" "$rootdir/etc/apt/sources.list.d/*"
umount "$rootdir/sys" || true
rm -f "$rootdir/etc/apt/sources.list" "$rootdir/etc/apt/sources.list.d/*"
umount "$rootdir/sys" || true
-(cd "$rootdir" && tar caf "$target" .)
+tartmp=$(tempfile --directory "$basedir" --suffix=".tar.gz")
+cleanup+=("rm -f $tartmp")
+(cd "$rootdir" && tar caf "$tartmp" . && mv "$tartmp" "$target")