Bash script add image


i want to automate to add a image to the running vyos.

my test setup

 echo |  add system image /home/vyos/iso/vyos-rolling-latest.iso
Checking SHA256 checksums of files on the ISO image... OK.
What would you like to name this image? [1.4-rolling-202301260317]: OK.  This image will be named: 1.4-rolling-202301260317
Installing "1.4-rolling-202301260317" image.
Copying new release files...
Would you like to save the current configuration
directory and config file? (Yes/No) [Yes]: Copying current configuration...
Would you like to save the SSH host keys from your
current configuration? (Yes/No) [Yes]: Copying SSH keys...
Running post-install script...
Setting up grub configuration...

that works fine on the cli, but if I execute this command over a jenkins or bash script, it will break.

my shell script

source /opt/vyatta/etc/functions/script-template
echo | add system image /home/vyos/iso/vyos-rolling-latest.iso

 Invalid command: [add]

but i execute only echo "$SHELL" than i see , it use the /bin/vbash

any idea, whats going wrong? Running Vyos Version is VyOS 1.4-rolling-202301151434

You can try something like this

printf '%s\n' "Yes" "" "Yes" "Yes" | /opt/vyatta/bin/vyatta-op-cmd-wrapper add system image link-to-iso.iso && reboot now

1 Like

that was the correct hint, thank you.

would this be something for documentation?

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.