2019-01-11 11:10:46 -05:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
|
2019-01-22 13:07:20 -05:00
|
|
|
all: create_container setup_container push_payload
|
2019-01-11 11:10:46 -05:00
|
|
|
|
|
|
|
|
destroy_container:
|
|
|
|
|
lxc list | grep safecontainer && lxc delete --force safecontainer || true
|
|
|
|
|
|
|
|
|
|
create_container:
|
|
|
|
|
# create the container
|
|
|
|
|
lxc list | grep safecontainer || \
|
|
|
|
|
(lxc launch ubuntu:`cat /etc/issue | cut -d ' ' -f2 | cut -d '.' -f 1-2` safecontainer -s default && \
|
|
|
|
|
# wait a bit to allow network to come up \
|
2019-02-06 15:01:42 -05:00
|
|
|
sleep 5 ; lxc config set safecontainer limits.processes 300 )
|
2019-01-11 11:10:46 -05:00
|
|
|
|
|
|
|
|
setup_container:
|
|
|
|
|
# install this first!
|
|
|
|
|
lxc exec safecontainer -- apt install make
|
|
|
|
|
|
2019-01-22 13:07:20 -05:00
|
|
|
push_payload:
|
2019-01-11 11:10:46 -05:00
|
|
|
# push the payload
|
2019-01-22 13:07:20 -05:00
|
|
|
lxc file push --recursive container_payload/ safecontainer/root/
|
2019-01-11 11:10:46 -05:00
|
|
|
|
|
|
|
|
# run the makefile on the container
|
|
|
|
|
lxc exec safecontainer -- bash -c "cd /root/container_payload ; make -f Makefile.safecontainer"
|