wmirescue/bullseye-amd64/bin/basefs_init

46 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
TARGET=$1
DEBIAN_CODENAME=$2
LANG=C
APT_PARAM=''
STDOUT='/dev/stdout'
if [ !$MKRESCUE_VERBOSE ]; then
APT_PARAM='-qq -o=Dpkg::Use-Pty=0';
STDOUT='/dev/null';
fi
mkdir ${TARGET}
debootstrap --arch=amd64 --variant=minbase ${DEBIAN_CODENAME} ${TARGET} http://httpredir.debian.org/debian > $STDOUT
cat << EOF > ${TARGET}/etc/apt/sources.list
deb http://deb.debian.org/debian ${DEBIAN_CODENAME} main contrib non-free
deb http://deb.debian.org/debian-security/ ${DEBIAN_CODENAME}-security main contrib non-free
deb http://deb.debian.org/debian ${DEBIAN_CODENAME}-updates main contrib non-free
deb http://deb.debian.org/debian ${DEBIAN_CODENAME}-backports main contrib non-free
EOF
cat << EOF > ${TARGET}/etc/apt/apt.conf.d/80small
APT::Install-Recommends '0';
APT::Install-Suggests '0';
EOF
cat << EOF > ${TARGET}/etc/apt/preferences.d/backports
Package: *
Pin: release n=buster-backports
Pin-Priority: 500
EOF
echo wmirescue > ${TARGET}/etc/hostname
echo 'root:wmi' | chroot ${TARGET} chpasswd
chroot ${TARGET} mount -t devpts devpts /dev/pts
chroot ${TARGET} apt-get $APT_PARAM update > $STDOUT
chroot ${TARGET} apt-get $APT_PARAM --yes install apt-utils > $STDOUT
chroot ${TARGET} apt-get $APT_PARAM upgrade --yes > $STDOUT
chroot ${TARGET} apt-get $APT_PARAM clean > $STDOUT
chroot ${TARGET} umount /dev/pts