summaryrefslogtreecommitdiff
path: root/scripts/vyos
diff options
context:
space:
mode:
authorRoberto Berto <463349+robertoberto@users.noreply.github.com>2024-05-15 00:51:46 +0000
committerRoberto Berto <463349+robertoberto@users.noreply.github.com>2024-05-15 00:51:46 +0000
commit1f67acf077af435f9770d58c5331983c00ede7d3 (patch)
treec06d068d99c67aba5eb98307e7345931752f5280 /scripts/vyos
parent8e90d13f6d762bbd0167ddfe26dddd2884ab3dfe (diff)
downloadpacker-vyos-1f67acf077af435f9770d58c5331983c00ede7d3.tar.gz
packer-vyos-1f67acf077af435f9770d58c5331983c00ede7d3.zip
vyos installer in 2 stages image1 and image2
Diffstat (limited to 'scripts/vyos')
-rw-r--r--scripts/vyos/cleanup.sh (renamed from scripts/vyos/vyos-install-pre.sh)4
-rw-r--r--scripts/vyos/cloud-init-datasource.sh17
-rw-r--r--scripts/vyos/cloud-init-debian.sh6
-rw-r--r--scripts/vyos/cloud-init-vyos.sh8
-rw-r--r--scripts/vyos/configure.sh24
-rw-r--r--scripts/vyos/grub-serial.sh15
-rw-r--r--scripts/vyos/vyos-install-expect.sh (renamed from scripts/vyos/vyos-install.sh)0
7 files changed, 72 insertions, 2 deletions
diff --git a/scripts/vyos/vyos-install-pre.sh b/scripts/vyos/cleanup.sh
index c61905d..6ccf753 100644
--- a/scripts/vyos/vyos-install-pre.sh
+++ b/scripts/vyos/cleanup.sh
@@ -13,7 +13,7 @@ cat <<EOF > /home/vyos/cleanup-vyos.sh
#!/bin/vbash
source /opt/vyatta/etc/functions/script-template
configure
-set system host-name host-name 'test'
+set system host-name 'test'
commit
save
exit
@@ -45,6 +45,8 @@ rm -rf /tmp/*
# removing log files
rm -rf /var/log/*
+rm -rf /home/vyos/cleanup-vyos.sh
+
# removing history
export HISTFILE=0
rm -f /home/vyos/.bash_history
diff --git a/scripts/vyos/cloud-init-datasource.sh b/scripts/vyos/cloud-init-datasource.sh
new file mode 100644
index 0000000..66e5509
--- /dev/null
+++ b/scripts/vyos/cloud-init-datasource.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+set -e
+set -x
+
+if [[ "${CLOUD_INIT}" == "debian" || "${CLOUD_INIT}" == "vyos" ]]; then
+ if [[ "${CLOUD_INIT_DATASOURCE}" == "nocloud_configdrive" ]]; then
+ cat <<EOF > /etc/cloud/cloud.cfg.d/99_nocloud_configdrive.cfg
+datasource_list: [ NoCloud, ConfigDrive ]
+EOF
+ else
+ echo "$0 - info: cloud_init_datasource will not run, not supported cloud_init_datasource"
+ exit 0
+ fi
+else
+ echo "$0 - info: cloud_init_datasource will not run, not supported cloud_init"
+fi
diff --git a/scripts/vyos/cloud-init-debian.sh b/scripts/vyos/cloud-init-debian.sh
index 2cf398f..6a66935 100644
--- a/scripts/vyos/cloud-init-debian.sh
+++ b/scripts/vyos/cloud-init-debian.sh
@@ -21,3 +21,9 @@ apt install -y \
ifupdown
systemctl enable cloud-init
+
+cat <<EOF > /etc/cloud/cloud.cfg.d/99_pve.cfg
+datasource_list: [ NoCloud, ConfigDrive ]
+EOF
+
+
diff --git a/scripts/vyos/cloud-init-vyos.sh b/scripts/vyos/cloud-init-vyos.sh
index 92be545..0dd3d93 100644
--- a/scripts/vyos/cloud-init-vyos.sh
+++ b/scripts/vyos/cloud-init-vyos.sh
@@ -19,5 +19,11 @@ apt install -t "$VYOS_RELEASE" --force-yes -y \
cloud-init \
cloud-utils \
ifupdown
-
systemctl enable cloud-init
+
+
+cat <<EOF > /etc/cloud/cloud.cfg.d/90_disable_config_stage.cfg
+# Disable all config-stage modules
+cloud_config_modules:
+EOF
+
diff --git a/scripts/vyos/configure.sh b/scripts/vyos/configure.sh
new file mode 100644
index 0000000..2628959
--- /dev/null
+++ b/scripts/vyos/configure.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+set -e
+set -x
+
+# export DEBIAN_FRONTEND=noninteractive
+
+# delete interfaces ethernet eth0 address
+# delete interfaces ethernet eth0 hw-id
+# delete system name-server
+
+cat <<EOF > /home/vyos/configure-vyos.sh
+#!/bin/vbash
+source /opt/vyatta/etc/functions/script-template
+configure
+set system host-name 'test'
+commit
+save
+exit
+EOF
+chmod 0700 /home/vyos/configure-vyos.sh
+chown vyos:users /home/vyos/configure-vyos.sh
+su - vyos -c "/home/vyos/configure-vyos.sh"
+
diff --git a/scripts/vyos/grub-serial.sh b/scripts/vyos/grub-serial.sh
new file mode 100644
index 0000000..b72b1a8
--- /dev/null
+++ b/scripts/vyos/grub-serial.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+set -e
+set -x
+
+if [[ "${GRUB_SERIAL}" -ne 1 ]]; then
+ echo "$0 - info: grub will keep default=0 (kvm). to use serial add to .env: GRUB_SERIAL=1"
+ exit 0
+fi
+
+GRUB_CFG="/boot/grub/grub.cfg"
+GRUB_DEFAULT="/etc/default/grub"
+
+sed -i 's/^set default=.*/set default=1/' $GRUB_CFG
+sed -i 's/^set default=.*/set default=1/' $GRUB_DEFAULT
diff --git a/scripts/vyos/vyos-install.sh b/scripts/vyos/vyos-install-expect.sh
index aa23064..aa23064 100644
--- a/scripts/vyos/vyos-install.sh
+++ b/scripts/vyos/vyos-install-expect.sh