OpenSDE Packages Database (without history before r20070)
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.

49 lines
1.4 KiB

  1. # --- T2-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # T2 SDE: package/.../udhcp/rocknet_udhcp.sh
  5. # Copyright (C) 2004 - 2006 The T2 SDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This program is free software; you can redistribute it and/or modify
  10. # it under the terms of the GNU General Public License as published by
  11. # the Free Software Foundation; version 2 of the License. A copy of the
  12. # GNU General Public License can be found in the file COPYING.
  13. # --- T2-COPYRIGHT-NOTE-END ---
  14. public_udhcp() {
  15. local opt_nodns=
  16. local HOSTNAME="`hostname`" cmdline=
  17. [ "$HOSTNAME" == "(none)" ] && HOSTNAME=
  18. [ "$CANUSESERVICE" == "1" ] && cmdline="exec "
  19. cmdline="$cmdline /usr/sbin/udhcpc ${HOSTNAME:+-h $HOSTNAME} -i $if"
  20. cmdline="$cmdline -s /etc/udhcp/t2-default.script"
  21. while [ $# -ge 1 ]; do
  22. case "$1" in
  23. nodns) opt_nodns=1 ;;
  24. *) echo "WARNING: udhcp doesn't understand '$1'"
  25. ;;
  26. esac
  27. shift
  28. done
  29. if [ "$opt_nodns" ]; then
  30. cmdline="export UPDATE_RESOLVCONF=0;
  31. $cmdline"
  32. fi
  33. if [ "$CANUSESERVICE" == "1" ]; then
  34. addcode up 5 1 "service_create $if '$cmdline -f' \
  35. 'sleep 2 ; ip link set $if down'"
  36. addcode down 5 1 "service_destroy $if"
  37. else
  38. addcode up 5 5 "$cmdline"
  39. addcode down 5 5 "killall -TERM udhcpc"
  40. addcode down 5 5 "sleep 2 ; ip link set $if down"
  41. fi
  42. }