1. Build

  • Enter the following commands at a Command Line.

    sudo apt-get install cdebootstrap
    ARCH="amd64"
    DIST="stretch"
    cd /tmp
    sudo cdebootstrap -a $ARCH --include=sudo,locales $DIST $DIST http://deb.debian.org/debian
    sudo chroot $DIST apt-get clean
    sudo chroot $DIST /bin/bash -c "update-locale LANGUAGE=en_US.UTF-8 LC_ALL=C"                    (1)
    sudo chroot $DIST /bin/bash -c "echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && locale-gen"
    1 Ignore the warnings.
  • Contents of the $DIST/etc/profile file.

    # /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
    # and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
    
    IS_WSL=`grep -i microsoft /proc/version`
    if test "$IS_WSL" = ""; then
      if [ "`id -u`" -eq 0 ]; then
        PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
      else
        PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
      fi
    fi
    export PATH
    
    if [ "${PS1-}" ]; then
      if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
        # The file bash.bashrc already sets the default PS1.
        # PS1='\h:\w\$ '
        if [ -f /etc/bash.bashrc ]; then
          . /etc/bash.bashrc
        fi
      else
        if [ "`id -u`" -eq 0 ]; then
          PS1='# '
        else
          PS1='$ '
        fi
      fi
    fi
    
    if [ -d /etc/profile.d ]; then
      for i in /etc/profile.d/*.sh; do
        if [ -r $i ]; then
          . $i
        fi
      done
      unset i
    fi
  • Contents of the $DIST/etc/apt/sources.list file.

    deb http://deb.debian.org/debian stretch main
    deb http://deb.debian.org/debian stretch-updates main
    deb http://security.debian.org/debian-security/ stretch/updates main
  • Enter the following commands at a Command Line.

    diff -B -E -N -b -w -r /etc/profile $DIST/etc/profile
    diff -B -E -N -b -w -r /etc/apt/sources.list $DIST/etc/apt/sources.list
    cd $DIST
    sudo tar --ignore-failed-read -czf ../install.tar.gz *
    cd -
    ls -al install.tar.gz
    sudo mkdir -p /mnt/o
    sudo mount -t drvfs '\\10.10.1.2\Other$' /mnt/o
    cp install.tar.gz /mnt/o/Tmp
    sudo umount /mnt/o