Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Package Request] expect #6169

Closed
digi74 opened this issue Jul 7, 2024 · 7 comments · Fixed by #6171
Closed

[Package Request] expect #6169

digi74 opened this issue Jul 7, 2024 · 7 comments · Fixed by #6171
Labels
request request for new package

Comments

@digi74
Copy link

digi74 commented Jul 7, 2024

Software Name

expect

Brief Description

Expect is a tool for automating interactive applications such as telnet, ftp, passwd, fsck, rlogin, tip, etc. Expect is also useful for testing these same applications.

Website

https://packages.debian.org/bookworm/expect

Documentation

https://sourceforge.net/projects/expect/

Build/Installation documentation

https://sourceforge.net/projects/expect/

Source code

https://sourceforge.net/projects/expect/

OpenSource License

MIT

Other License

No response

@digi74 digi74 added the request request for new package label Jul 7, 2024
@hgy59
Copy link
Contributor

hgy59 commented Jul 8, 2024

@digi74 what do you need expect for?
AFAICS expect requires tcl and is hard to cross compile.

@digi74
Copy link
Author

digi74 commented Jul 8, 2024

Thanks for asking!
A backup script that connects to switches via telnet and pulls a configuration backup. Unfortunately these devices do not support ssh.
I thought it might be easy, not in this case, no problem
:)

@hgy59
Copy link
Contributor

hgy59 commented Jul 8, 2024

Thanks for asking! A backup script that connects to switches via telnet and pulls a configuration backup. Unfortunately these devices do not support ssh. I thought it might be easy, not in this case, no problem :)

Don't give up so fast, I have done some progress, I tend to include expect in the synocli-misc package.

EDIT:
Everything builds successfully, except the sample scripts (those fail to create since the cross compiled tclsh is not executable).
But I think we do not need those scripts in the package (those are: timed-run timed-read ftp-rfc autopasswd lpunlock weather passmass rftp kibitz rlogin-cwd xpstat tkpasswd dislocate xkibitz tknewsbiff unbuffer mkpasswd cryptdir decryptdir autoexpect multixterm)

@digi74
Copy link
Author

digi74 commented Jul 8, 2024

I think you really don't need the examples.
an example of my telnet part of the script:

`
expect - <<EOF
set timeout 10
spawn ssh -l$username "$hostname"
expect "password"
send $password
send "\r"
expect "continue"
send "\r"
expect "#"
send "copy startup-config tftp fs1 $tftpfolder/$filename pc\r"
sleep 3

send "exit\r"
expect "#"
send "exit\r"
expect ">"
send "quit\r"
expect "log out"
send "y"

EOF
`

regards us gsiberg

@hgy59 hgy59 mentioned this issue Jul 8, 2024
6 tasks
@hgy59
Copy link
Contributor

hgy59 commented Jul 8, 2024

@digi74 you can download the synocli-misc package created by github build action
https://github.com/SynoCommunity/spksrc/actions/runs/9847463175

you need to extract the spk file from the artifacts-zip-file for the arch of you model, then you can manually install the spk File in the DSM package center.

@digi74
Copy link
Author

digi74 commented Jul 8, 2024

I am thrilled!
It works after changing from "#!/bin/bash" to "#!/bin/sh" in the script.
THANKS

@hgy59
Copy link
Contributor

hgy59 commented Jul 9, 2024

@digi74 thanks for the feedback.

Indeed, the example scripts use /bin/sh too

#!/bin/sh
# -*- tcl -*-
# The next line is executed by /bin/sh, but not tcl \
exec tclsh "$0" ${1+"$@"}

package require Expect

...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
request request for new package
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants