Seite 2 von 3

Re: how to create a product that execute a given bash script for linux.

Verfasst: 13 Okt 2023, 15:08
von prakash
m.radtke hat geschrieben: 28 Sep 2023, 15:20 Hi

you can also download the package locally and start opsi-script locally to see where the script breaks. Exit Code is 1 so there's something wrong.

Regards
Mathias

Sorry for making late attempt. I tried again and analyzed it. The attached log image says, " /bin/bash: line 1: $: command not found" but "/bin/bash" exists.
As per log, the following is the place it breaks with exit code 127:
"/bin/bash -c "$installerSourceDir$ + "/new_touch_script.sh" || exit $?""
The following worked fine on the terminal:
"/bin/bash -c /tmp/new_touch_script.sh" || exit $?" (this working fine)

As you suggested, tried the package locally with opsi-script, and it breaks in the same place mentioned above.

Attached opsi-script log file. Eagerly waiting for your reply.

Edited again to attach the missed log file.

Regards,
arul

Re: how to create a product that execute a given bash script for linux.

Verfasst: 17 Okt 2023, 07:18
von prakash
Maybe I delayed my reply!!

Should i have to start in a fresh thread or this same is this okay to continue?


Regards,
arul

Re: how to create a product that execute a given bash script for linux.

Verfasst: 17 Okt 2023, 09:57
von m.radtke
Hi

could you please attach the opsiscript file?

Regards
Mathias

Re: how to create a product that execute a given bash script for linux.

Verfasst: 17 Okt 2023, 10:52
von prakash
Thanks Mathias, for your reply.

Attached is setup.opsiscript file.

Re: how to create a product that execute a given bash script for linux.

Verfasst: 17 Okt 2023, 11:51
von m.radtke
Hi

this should work

Code: Alles auswählen

set $exitcode$ = shellCall($installerSourceDir$ + "/new_touch_script.sh")
theres a difference how to use opsi-script variables in primary and secondary sections. Primary sections like this you dont include the variable within the string of the command, in secondary sections, like shellInAnIcon, you do.

Regards
Mathias

Re: how to create a product that execute a given bash script for linux.

Verfasst: 18 Okt 2023, 10:38
von prakash
Thanks Mathias,

It worked fine on local. Did the correction on opsi-server also, but from opsi-server getting same error. Attaching log image.

While i tried running from server, noticed it gets mounted for short time on "/media/opsi_depot/" with root permission, is it normal?

Thanks and Regards
arul

Re: how to create a product that execute a given bash script for linux.

Verfasst: 18 Okt 2023, 12:26
von m.radtke
hmmm this seems odd.

could you upload the package somewhere and post the link?
I would like to take a deeper look and ask a colleague.

Regards
Mathias

Re: how to create a product that execute a given bash script for linux.

Verfasst: 18 Okt 2023, 14:58
von prakash
Thanks for your interest,

Tried creating a new product "l-linux-script" to execute the same script, and got into the same issue, running fine locally but not from the server. Kept a copy of that also.
Kept it in Google Drive @:
https://drive.google.com/drive/folders/ ... sp=sharing

Thanks and Regards
arul

Re: how to create a product that execute a given bash script for linux.

Verfasst: 19 Okt 2023, 08:32
von prakash
Hi Mathias,

Have very few hosts installed and installed the license around 2nd week of September. Attached is an image of validation. Hope it is not for validity issues.

Regards,
arul

Re: how to create a product that execute a given bash script for linux.

Verfasst: 19 Okt 2023, 10:09
von m.radtke
soooo

it works with

Code: Alles auswählen

set $exitcode$ = shellCall($installerSourceDir$ + '/new_touch_script.sh')
As the opsi-script interpreter uses double quotes arround the shellCall itself while interpreting, you have to use single quotes for the string part of the shellCall

Code: Alles auswählen

root@debian:~# ls -l /tmp | grep helloo
-rw-r--r-- 1 root root    0 19. Okt 10:04 hellooooooo_opsi.txt
Regards

Mathias