funcs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/bin/rc
  2. # Derived from the 9legacy build scripts.
  3. rfork en
  4. fn isodate {
  5. smon='s/Jan/01/
  6. s/Feb/02/
  7. s/Mar/03/
  8. s/Apr/04/
  9. s/May/05/
  10. s/Jun/06/
  11. s/Jul/07/
  12. s/Aug/08/
  13. s/Sep/09/
  14. s/Oct/10/
  15. s/Nov/11/
  16. s/Dec/12/'
  17. year=`{date | sed 's/.* //'}
  18. mon=`{date | sed -e 's/^....(...).*/\1/' -e $smon}
  19. day=`{date | sed -e 's/^........(..).*/\1/'}
  20. if(test $day -le 9)
  21. day = 0$day
  22. echo -n $year-$mon-$day
  23. }
  24. fn buildinit {
  25. if (! ~ $buildinitdone yes) {
  26. date=`{isodate}
  27. #arch=(386)
  28. #arch=(amd64)
  29. #arch=(386 arm)
  30. arch=(386 amd64)
  31. #arch=(386 amd64 arm)
  32. #arch=(386 mips mips64 spim spim64)
  33. #arch=(386 amd64 arm mips mips64 power sparc)
  34. #arch=(386 amd64 arm mips mips64 power sparc spim spim64)
  35. #nvram=/dev/sdE0/nvram
  36. #nvram=/mnt/term/home/djc/work/rpi/nvram
  37. if(~ $target '')
  38. target=plan9
  39. build=/n/harvey
  40. dir=/n/harvey/build
  41. path=(/bin $dir .)
  42. outputdir=/n/host
  43. rdev=/dev/sdD0
  44. buildinitdone=yes
  45. }
  46. }
  47. fn quitonfailure {
  48. if (! ~ $1 '' 0 '|')
  49. exit $1
  50. }
  51. buildinit