Advertisement
devinteske

pvtest.sh

Jul 14th, 2013
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.70 KB | None | 0 0
  1. #!/bin/sh
  2. . /usr/share/bsdconfig/script.subr
  3. nonInteractive=1
  4. #debug=1
  5. if [ "$1" = "/tmp" ]; then
  6.     shift 1 # /tmp
  7.     _directoryPath=/tmp
  8.     mediaSetDirectory
  9.     mediaOpen
  10. else
  11.     _ftpPath=ftp://ftp-archive.freebsd.org
  12.     mediaSetFTP
  13.     mediaOpen
  14.     echo "ftpHost=[$ftpHost] ftpPort=[$ftpPort]"
  15.     echo "ftpDirectory=[$ftpDirectory]"
  16.     echo "=="
  17. fi
  18. FILE=packages/INDEX
  19. size=$( f_device_get media "$FILE" $PROBE_SIZE ) ||
  20.     f_die 1 "$FILE: No such file or directory"
  21. echo "Downloading $FILE ($size bytes) to /dev/null"
  22. if [ "$1" = "fail" ]; then # pv seems to have a bug
  23.     exec 7<<-EOF
  24.     $( f_device_get media $FILE )
  25.     EOF
  26.     pv -s $size <&7 > /dev/null
  27. else
  28.     f_device_get media "$FILE" | pv -s $size > /dev/null
  29. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement