23 lines
743 B
Bash
Executable File
23 lines
743 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
TEMPLATE=/tmp/nixos.tar.xz
|
|
[ -e $TEMPLATE ] || wget -O $TEMPLATE https://hydra.nixos.org/job/nixos/release-21.05/nixos.containerTarball.x86_64-linux/latest/download-by-type/file/system-tarball
|
|
|
|
if [ $# != 2 ]; then
|
|
echo "Usage: $0 <ctid> <hostname>"
|
|
exit 1
|
|
fi
|
|
|
|
ID=$1
|
|
NAME=$2
|
|
|
|
#pct create $ID local:vztmpl/nixos-system-x86_64-linux.tar.xz --arch amd64 --hostname $NAME --ostype unmanaged --net0 name=eth0,bridge=vmbr0,tag=5 --storage vms-slow --cmode shell
|
|
pct create $ID $TEMPLATE --hostname $NAME --ostype unmanaged --arch amd64 --net0 name=eth0,bridge=vmbr0,tag=5 --storage vms-slow --cmode shell --features nesting=1
|
|
echo "lxc.init.cmd: /init" >> /etc/pve/lxc/$ID.conf
|
|
|
|
echo Done, Starting $ID
|
|
pct start $ID
|
|
|