sudo apt-get update
sudo apt-get install schroot debootstrap -y

cat <<EOF | sudo tee /etc/schroot/chroot.d/bionic.conf
[bionic]
description=Ubuntu 18.04
directory=/srv/chroot/bionic
root-users=$USER
type=directory
users=$USER
EOF


sudo mkdir -p /srv/chroot/bionic
sudo debootstrap --no-check-gpg bionic /srv/chroot/bionic

cat <<EOF | sudo tee /srv/chroot/bionic/etc/apt/sources.list
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://us.archive.ubuntu.com/ubuntu bionic main restricted universe multiverse
EOF

schroot -c bionic -u root -- apt-get -y update
schroot -c bionic -u root -- apt-get -y upgrade

schroot -c bionic -u root -- apt-get -y install ubuntu-minimal gcc gfortran build-essential mc nano wget 

schroot -c bionic -u root -- sh -c  "mkdir /tmp/sceptre"
schroot -c bionic -u root -- sh -c  "cd /tmp/sceptre; wget https://www.simusol.org/downloads/sceptre_simusol-last.tar.gz"
schroot -c bionic -u root -- sh -c  "cd /tmp/sceptre; wget https://www.simusol.org/downloads/Makefile-schroot"
schroot -c bionic -u root -- sh -c  "cd /tmp/sceptre; tar -xvf sceptre_simusol-last.tar.gz"
schroot -c bionic -u root -- sh -c  "cd /tmp/sceptre/sceptre-simusol-2017.03.R832/src/sceptre-simusol; cp /tmp/sceptre/Makefile-schroot Makefile"
schroot -c bionic -u root -- sh -c  "cd /tmp/sceptre/sceptre-simusol-2017.03.R832/src/sceptre-simusol; make"
schroot -c bionic -u root -- sh -c  "cd /tmp/sceptre/sceptre-simusol-2017.03.R832/src/sceptre-simusol; make install"


cd /tmp; wget https://www.simusol.org/downloads/sceptre-schroot

sudo cp /tmp/sceptre-schroot  /usr/local/bin/sceptre
sudo chmod +x /usr/local/bin/sceptre



##schroot -c bionic /home/user/old-program

##cd /home/user/source-code
##schroot -c bionic make
##schroot -c bionic -u root

