|
|
@ -47,7 +47,9 @@ function prepare_lxd { |
|
|
|
echo "bridge <lxdbr0> down, so initialization will use default preseed..." |
|
|
|
|
|
|
|
if [[ $(printenv container) == 'lxc' ]]; then |
|
|
|
echo "--------------------------------" |
|
|
|
echo "nested configuration applying..." |
|
|
|
echo "--------------------------------" |
|
|
|
cat <<EOF | sg $NEW_GROUP -c 'lxd init --preseed' |
|
|
|
config: {} |
|
|
|
networks: |
|
|
@ -82,7 +84,9 @@ EOF |
|
|
|
else |
|
|
|
empty_block_partition=$(lsblk -o NAME,FSTYPE,GROUP --noheadings -p | grep -E ^.─ | grep disk | awk '{if($3=="") print $1}' | cut -d'/' -f3) |
|
|
|
if [[ -n "$empty_block_partition" ]]; then |
|
|
|
echo "--------------------------------" |
|
|
|
echo "use empty block partition /dev/$empty_block_partition for speed and optimization" |
|
|
|
echo "--------------------------------" |
|
|
|
cat <<EOF | sudo lxd init --preseed |
|
|
|
config: {} |
|
|
|
networks: |
|
|
@ -117,7 +121,9 @@ cluster: null |
|
|
|
EOF |
|
|
|
echo OK |
|
|
|
else |
|
|
|
echo "--------------------------------" |
|
|
|
echo "use dir partition for development purpose" |
|
|
|
echo "--------------------------------" |
|
|
|
cat <<EOF | lxd init --preseed |
|
|
|
config: {} |
|
|
|
networks: |
|
|
@ -126,6 +132,21 @@ networks: |
|
|
|
config: |
|
|
|
ipv4.address: auto |
|
|
|
ipv6.address: none |
|
|
|
profiles: |
|
|
|
- config: {} |
|
|
|
description: "" |
|
|
|
devices: |
|
|
|
eth0: |
|
|
|
name: eth0 |
|
|
|
network: lxdbr0 |
|
|
|
type: nic |
|
|
|
root: |
|
|
|
path: / |
|
|
|
pool: default |
|
|
|
type: disk |
|
|
|
name: default |
|
|
|
projects: [] |
|
|
|
cluster: null |
|
|
|
EOF |
|
|
|
fi |
|
|
|
fi |
|
|
|