# Singularity recipe to build an image to run Clonezilla BT mode.
# With this recipe, you can use the following command to build debian.simg:
# sudo singularity build debian.sif singularity-debian-ocs.def
# Or use --fakeroot (might fail):
# singularity build --fakeroot debian.sif singularity-debian-ocs.def
# Then start Clonezilla BT environment by:
# singularity shell -p -e --writable-tmpfs -B /run debian.sif
Bootstrap: docker
From: debian:latest
%runscript
exec echo "Debian 10 image for using with Clonezilla BT mode"
%files
%environment
export LC_ALL=en_US.UTF-8
%labels
AUTHOR steven@clonezilla.org
%post
apt-get update; apt-get -y install wget gnupg software-properties-common cpio
wget http://drbl.org/GPG-KEY-DRBL
apt-key add GPG-KEY-DRBL
add-apt-repository -r 'deb http://cdn-fastly.deb.debian.org/debian sid main'
add-apt-repository -r 'deb http://deb.debian.org/debian sid main'
add-apt-repository 'deb http://free.nchc.org.tw/debian sid main non-free contrib'
add-apt-repository 'deb http://free.nchc.org.tw/drbl-core drbl unstable live-unstable'

# Preconfigure keyboard-configuration
echo console-common console-data/keymap/policy select Select keymap from full list | debconf-set-selections
echo console-common console-data/keymap/full   select de-latin1 | debconf-set-selections

apt-get update
apt-get -y install drbl clonezilla ezio mktorrent transmission-cli opentracker python-crypto python-libtorrent
. /etc/drbl/drbl.conf

# Remove packages not or you do not want in some version of Debian Linux:
#PKG_FROM_DBN_WHICH_OCS_LIVE_MUST_HAVE="$(echo $PKG_FROM_DBN_WHICH_OCS_LIVE_MUST_HAVE | sed -r -e "s/exfatprogs//g")"

apt-get -y install $PKG_FROM_DBN_WHICH_OCS_LIVE_MUST_HAVE
LANG=C localedef -f UTF-8 -i en_US en_US.UTF-8
mkdir -p /var/log /var/lock/ /var/lib /var/www/html /home/partimag/
# A workaround to fix this issue: https://github.com/sylabs/singularity/issues/4182
# Otherwise Partclone will fail due to block device status not found
if [ ! -e "/etc/mtab" ]; then
  (
    cd /etc/
    ln -fs ../proc/self/mounts /etc/mtab
  )
fi
