#! /bin/sh -e ### ### Construct a fresh build-chroot base ### ### (c) 2018 Mark Wooding ### ###----- Licensing notice --------------------------------------------------- ### ### This file is part of the distorted.org.uk chroot maintenance tools. ### ### distorted-chroot is free software: you can redistribute it and/or ### modify it under the terms of the GNU General Public License as ### published by the Free Software Foundation; either version 2 of the ### License, or (at your option) any later version. ### ### distorted-chroot is distributed in the hope that it will be useful, ### but WITHOUT ANY WARRANTY; without even the implied warranty of ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ### General Public License for more details. ### ### You should have received a copy of the GNU General Public License ### along with distorted-chroot. If not, write to the Free Software ### Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, ### USA. . state/config.sh # @@@config@@@ case $PROXY in nil) ;; *) http_proxy=$PROXY; export PROXY ;; esac badp=nil forcep=nil while getopts "f" opt; do case $opt in f) forcep=t ;; *) badp=t ;; esac done shift $(( $OPTIND - 1 )) case $# in 2) ;; *) badp=t ;; esac case $badp in t) echo >&2 "usage: $0 [-f] DIST ARCH"; exit 2 ;; esac d=$1 a=$2 case $d-$a in *-*-*) echo >&2 "$0: bad chroot name \`$arg'"; exit 2 ;; esac if [ ! -d /dev/$VG/ ]; then echo >&2 "$0: no volume group \`$VG'"; exit 2; fi qemup=nil dbsopts= for fa in $FOREIGN_ARCHS; do case $fa in "$a") qemup=t qbsopts=--foreign eval qhost=\$${a}_QEMUARCH qhost=\$${a}_QEMUHOST break ;; esac done lv=$LVPREFIX$d-$a mnt=mnt/$lv mkdir -p $mnt if mountpoint -q $mnt; then umount $mnt; fi if [ -b /dev/$VG/$lv ]; then case $forcep in nil) echo >&2 "$0: volume \`$lv' already exists"; exit 2 ;; t) lvremove -f $VG/$lv ;; esac fi lvcreate --yes $LVSZ -n$lv $VG mkfs -j -L$d-$a /dev/$VG/$lv mount -orelatime,data=writeback,commit=3600,barrier=0 /dev/$VG/$lv $mnt/ mkdir -m755 $mnt/fs/ chmod 750 $mnt/ pkgs=ccache,eatmydata,fakeroot,libfile-fcntllock-perl,locales,tzdata eatmydata debootstrap $dbsopts --arch=$a --variant=minbase \ --include=$pkgs $d $mnt/fs/ $DEBMIRROR case $qemup in t) install $LOCAL/cross/$d-$qhost/QEMU/qemu-$qarch-static \ $mnt/fs/usr/bin/ chroot $mnt/fs/ /debootstrap/debootstrap --second-stage ln -sf /usr/local.schroot/cross/$d-$qhost/QEMU/qemu-$qarch-static \ $mnt/fs/usr/bin/ ;; esac cd $mnt/fs/usr/ rm -rf local/; ln -s local.schroot/$a local cd $mnt/fs/etc/apt/ rm -rf apt.conf sources.list ln -s /usr/local.schroot/config/apt/conf.d/10sbuild apt.conf.d/ ln -s /usr/local.schroot/config/apt/conf.d/90local apt.conf.d/ ln -s /usr/local.schroot/config/apt/sources.$d sources.list cat >apt.conf.d/20arch <policy-rc.d <&2 "policy-rc.d: Services disabled by policy." exit 101 EOF chmod +x policy-rc.d cd $mnt/fs/etc/ld.so.conf.d/ cat >libc.conf <zzz-local.conf </dev/null 2>&1 --no-rename --help then no_rename=--no-rename else no_rename= fi dpkg-divert --package install-cross-tools \$no_rename \ --divert /usr/bin/$qemu.$a --add /usr/bin/$qemu" $STATE/bin/install-cross-tools $d $a ;; esac schroot -uroot -csource:$LVPREFIX$d-$a -- eatmydata sh -e -c ' apt-get update apt-get -y upgrade locale-gen ldconfig apt-get -y autoremove apt-get clean' ###----- That's all, folks --------------------------------------------------