summaryrefslogtreecommitdiffstats
path: root/bin/schroot-create.sh
diff options
context:
space:
mode:
authorJoachim Breitner <mail@joachim-breitner.de>2014-04-16 17:25:18 +0200
committerHolger Levsen <holger@layer-acht.org>2014-04-25 12:48:46 +0200
commit8f2f36225a254ccd177b77d8ba197c9a95180b82 (patch)
tree7c9142b3fb4b50df428eb7c0db51a2eb2d83a830 /bin/schroot-create.sh
parent25ef142d96e31850fb163033d1f4555c643475a1 (diff)
downloadjenkins.debian.net-8f2f36225a254ccd177b77d8ba197c9a95180b82.tar.xz
Use sudo tee trick to write files as root
Diffstat (limited to 'bin/schroot-create.sh')
-rwxr-xr-xbin/schroot-create.sh16
1 files changed, 6 insertions, 10 deletions
diff --git a/bin/schroot-create.sh b/bin/schroot-create.sh
index 181b3972..30292e9d 100755
--- a/bin/schroot-create.sh
+++ b/bin/schroot-create.sh
@@ -60,16 +60,12 @@ export CURDIR=$(pwd)
bootstrap() {
sudo debootstrap $DISTRO $CHROOT_TARGET $MIRROR
- sudo -s <<-EOF
- set -e
- set -x
- echo -e '#!/bin/sh\nexit 101' > $CHROOT_TARGET/usr/sbin/policy-rc.d
- chmod +x $CHROOT_TARGET/usr/sbin/policy-rc.d
- echo 'Acquire::http::Proxy "$http_proxy";' > $CHROOT_TARGET/etc/apt/apt.conf.d/80proxy
- echo "deb-src $MIRROR $DISTRO main" >> $CHROOT_TARGET/etc/apt/sources.list
- echo "${BACKPORTS}" >> $CHROOT_TARGET/etc/apt/sources.list
- echo "${BACKPORTSSRC}" >> $CHROOT_TARGET/etc/apt/sources.list
- EOF
+ echo -e '#!/bin/sh\nexit 101' | sudo tee $CHROOT_TARGET/usr/sbin/policy-rc.d >/dev/null
+ sudo chmod +x $CHROOT_TARGET/usr/sbin/policy-rc.d
+ echo 'Acquire::http::Proxy "$http_proxy";' | sudo tee $CHROOT_TARGET/etc/apt/apt.conf.d/80proxy >/dev/null
+ echo "deb-src $MIRROR $DISTRO main" | sudo tee -a $CHROOT_TARGET/etc/apt/sources.list > /dev/null
+ echo "${BACKPORTS}" | sudo tee -a $CHROOT_TARGET/etc/apt/sources.list >/dev/null
+ echo "${BACKPORTSSRC}" | sudo tee -a $CHROOT_TARGET/etc/apt/sources.list >/dev/null
}
cleanup() {