/contrib/dialog/samples/copifuncs/copi.wheel

https://bitbucket.org/freebsd/freebsd-head/ · Bash · 54 lines · 51 code · 3 blank · 0 comment · 0 complexity · cec32561f73efd266f94b00522f71e8b MD5 · raw file

  1. #!/bin/bash
  2. # $Id: copi.wheel,v 1.2 2001/01/15 22:26:33 tom Exp $
  3. mkstemp size
  4. dialog --print-maxsize 2>$tmp_size
  5. ROWS="`cut $tmp_size -f1 -d, | cut -f2 -d:`"
  6. COLS="`cut $tmp_size -f2 -d,`"
  7. rm $tmp_size
  8. # Takes an integer, multiplies it for COLS, divides for 132
  9. scalex() {
  10. echo $[$1*$COLS/132]
  11. }
  12. scaley() {
  13. echo $[$1*$ROWS/60]
  14. }
  15. dialog --backtitle "$TITLE" --no-shadow \
  16. --begin `scaley 27` `scalex 98` --infobox "pushd /var/log >/dev/null" 0 0 --and-widget \
  17. --begin `scaley 35` `scalex 95` --infobox "mkdir -p news -m 755" 0 0 --and-widget \
  18. --begin `scaley 45` `scalex 86` --infobox "chown news.news news" 0 0 --and-widget \
  19. --begin `scaley 48` `scalex 78` --infobox "cd /var/log/news" 0 0 --and-widget \
  20. --begin `scaley 51` `scalex 61` --infobox "mkdir -p OLD -m 755" 0 0 --and-widget \
  21. --begin `scaley 52` `scalex 47` --infobox "chown news.news OLD" 0 0 --and-widget \
  22. --begin `scaley 51` `scalex 40` --infobox "cd /var/spool" 0 0 --and-widget \
  23. --begin `scaley 48` `scalex 25` --infobox "mkdir -p news -m 775" 0 0 --and-widget \
  24. --begin `scaley 42` `scalex 13` --infobox "chown news.news news" 0 0 --and-widget \
  25. --begin `scaley 35` `scalex 4` --infobox "cd /var/spool/news" 0 0 --and-widget \
  26. --begin `scaley 27` `scalex 2` --infobox "CURMASK=`umask`" 0 0 --and-widget \
  27. --begin `scaley 19` `scalex 4` --infobox "umask 02" 0 0 --and-widget \
  28. --begin `scaley 11` `scalex 13` --infobox "mkdir -p out.going control junk in.coming" 0 0 --and-widget \
  29. --begin `scaley 5` `scalex 25` --infobox "chown news.news out.going control junk in.coming" 0 0 --and-widget \
  30. --begin `scaley 2` `scalex 37` --infobox "cd in.coming" 0 0 --and-widget \
  31. --begin `scaley 1` `scalex 46` --infobox "mkdir -p bad tmp" 0 0 --and-widget \
  32. --begin `scaley 2` `scalex 61` --infobox "chown news.news bad tmp" 0 0 --and-widget \
  33. --begin `scaley 5` `scalex 76` --infobox "umask $CURMASK" 0 0 --and-widget \
  34. --begin `scaley 11` `scalex 87` --infobox "ln -sf ~news /usr/local/lib/" 0 0 --and-widget \
  35. --begin `scaley 18` `scalex 95` --infobox "ln -sf ~news/inews /usr/bin/" 0 0 --and-widget \
  36. --begin `scaley 26` `scalex 97` --infobox "chmod 1777 /var/tmp" 0 0 --and-widget \
  37. --begin `scaley 34` `scalex 95` --infobox "cd ~news" 0 0 --and-widget \
  38. --begin `scaley 42` `scalex 87` --infobox "touch history history.dir history.pag errlog log" 0 0 --and-widget \
  39. --begin `scaley 47` `scalex 76` --infobox "chown news.news history* log errlog" 0 0 --and-widget \
  40. --sleep 1 --infobox "Creating spooling and logging directories and files..." 0 0 --and-widget \
  41. --begin `scaley 51` `scalex 78` --infobox "chmod 664 history* log errlog" 0 0 --and-widget \
  42. --begin `scaley 52` `scalex 60` --infobox "echo \"control 0000000000 0000000001 y\" > active" 0 0 --and-widget \
  43. --begin `scaley 51` `scalex 42` --infobox "echo \"junk 0000000000 0000000001 y\" >> active" 0 0 --and-widget \
  44. --begin `scaley 48` `scalex 26` --infobox "chown news.news active" 0 0 --and-widget \
  45. --begin `scaley 42` `scalex 13` --infobox "echo \"control 814573260 usenet\" > active.times" 0 0 --and-widget \
  46. --begin `scaley 35` `scalex 4` --infobox "echo \"junk 814573260 usenet\" >> active.times" 0 0 --and-widget \
  47. --begin `scaley 27` `scalex 2` --infobox "chown news.news active.times" 0 0 --and-widget \
  48. --begin `scaley 19` `scalex 4` --infobox ":>newsgroups" 0 0 --and-widget \
  49. --begin `scaley 11` `scalex 12` --infobox "chown news.news newsgroups" 0 0 --and-widget \
  50. --begin `scaley 6` `scalex 25` --infobox "popd >/dev/null" 0 0
  51. sleep 1