You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
393 B

  1. #!/bin/sh
  2. # This script wraps openconnect in order to obtain the password
  3. # file from cmd.
  4. # $1 password file
  5. # $2... are passed to openconnect
  6. test -z "$1" && exit 1
  7. pwfile=$1
  8. shift
  9. pidfile=/var/run/ocwrap-$$.pid
  10. cleanup()
  11. {
  12. if ! test -z "$pid";then
  13. kill $pid
  14. wait $pid
  15. fi
  16. exit 0
  17. }
  18. trap cleanup 1 2 3 6 15
  19. rm -f "$pidfile"
  20. /usr/sbin/openconnect $* <$pwfile &
  21. pid=$!
  22. wait $pid