Modify wrapup.sh

Hello,

I want to add some lines to the wrapup script that should be executed after the tezi installer finishes. These lines should copy something from the USB stick to the home directory and unpack it, plus add some scripts in services and init.d.

Until now i had no luck with this. My wrapup.sh looks like this:

#!/bin/sh

mkdir /home/torizon/test
sudo touch /home/torizon/first.txt
sudo chown -R torizon:torizon /home/torizon
sudo touch /home/torizon/second.txt
sudo cp /media/STICK/file.tar.gz /home/torizon/Documents
sudo touch /home/torizon/third.txt
reboot -f  # torizoncore-builder generated
exit 0

The only commands that execute are reboot and exit, else has no result.

What do i need to mount/modify to run what i need?

SOM: Apalis X8 QM
Carrier: Custom
BSP 5.7.2
Tezi: 5.72

Thanks,
Cristian

Please note that TEZi operates entirely in RAM, including the root filesystem. As a result, any modifications you make to /home/torizon will be lost after rebooting. You need to mount /dev/mmcblkX first, where X depends on the image you’re installing. It’s also important to remember that TEZI doesn’t support the sudo command - you can simply omit it

In addition to what Alex has said. Out of curiosity why exactly are you trying to install these files with the wrapup script? Could you not include these files in the image by default, either with TorizonCore Builder or Yocto? Or are these files something that only makes sense to deploy at flashing time?

Best Regards,
Jeremias

Hello @alex.tx and @jeremias.tx,

Thank you for the answers.

I had forgotten that TEZi runs from RAM, now it is clear why my copy attempts had no result. I will mount the image block and write to it then and i will drop the sudo command.

I am using the wrapup script to copy some files after we flash the torizoncore image. The files are needed to bring the application in a known running state. After this an update procedure is used.

Currently we use a usb stick with the image and the extra files to flash the new equipment automatically. After the auto restart the equipment is operational…

LE: is there a way i could connect via ssh to TEZi and test the commands i want to use in the script?

Thanks,
Cristian

LE: is there a way i could connect via ssh to TEZi and test the commands i want to use in the script?

I don’t believe Tezi has SSH installed, since it’s suppose to be a minimal image for installation of other images. The only recommended methods of access is via serial for the console or VNC for the GUI.

Best Regards,
Jeremias

Hello @c.gantner,

Hope you are doing well. May I know if you were able to solve this issue? Please feel free to let us know if you need any additional support!

Hello @rudhi.tx ,

i did not manage to resolve it. I connected to tezi over the debug uart and tried to mount the large partition of the 16GB flash but i get an error, FS is read only.

What would be the correct way to mount the partition so that i can copy the file?

Thank you,
Cristian

Hello @c.gantner,

Thanks for your patience!

One simple way to do this would be through greenboot script: Aktualizr - Modifying the Settings of Torizon Update Client | Toradex Developer Center

On a successful boot, shell scripts in /etc/greenboot/check/required.d/ will be executed. In your case, you will have to build a custom TorizonCore image adding such a greenboot script in that file location. You could use TorizonCore Builder to build your custom TorizonCore image by adding the greenboot script as a filesystem change:

The greenboot script should look like this:

torizon@apalis-imx6-10571902:~$ cat /etc/greenboot/check/required.d/01_check_system.sh 
#!/bin/sh
mkdir /home/torizon/test
sudo touch /home/torizon/first.txt
sudo chown -R torizon:torizon /home/torizon
sudo touch /home/torizon/second.txt
sudo cp /media/USB_STICK/testfile /home/torizon/Documents
sudo touch /home/torizon/third.txt
exit 0