dev_setup.sh 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. #!/bin/sh
  2. ## Copyright (c) 2015 Minoca Corp. All Rights Reserved.
  3. ##
  4. ## Script Name:
  5. ##
  6. ## dev_setup.sh
  7. ##
  8. ## Abstract:
  9. ##
  10. ## This script sets up a development build environment with the necessary
  11. ## packages to run the Minoca build client. When a subsequent OS image is
  12. ## built, the developer can do "cd /auto; python client.py -v" in the
  13. ## built OS to connect to the build server.
  14. ##
  15. ## Author:
  16. ##
  17. ## Evan Green 24-Mar-2015
  18. ##
  19. ## Environment:
  20. ##
  21. ## Build
  22. ##
  23. set -e
  24. if test -z "$SRCROOT"; then
  25. SRCROOT=`pwd`/src
  26. fi
  27. if test -z "$ARCH"; then
  28. echo "ARCH must be set."
  29. exit 1
  30. fi
  31. if test -z "$DEBUG"; then
  32. echo "DEBUG must be set."
  33. exit 1
  34. fi
  35. export TMPDIR=$PWD
  36. export TEMP=$TMPDIR
  37. BINROOT="$SRCROOT/$ARCH$VARIANT$DEBUG/bin"
  38. APPSROOT="$BINROOT/apps"
  39. AUTOROOT="$APPSROOT/auto"
  40. PKGROOT="$BINROOT/packages"
  41. ##
  42. ## Note that the ghetto extractor doesn't extract package dependencies, so
  43. ## truly everything needed should be listed here.
  44. ##
  45. PACKAGES="opkg
  46. awk
  47. binutils
  48. byacc
  49. flex
  50. gcc
  51. libgcc
  52. gzip
  53. m4
  54. make
  55. nano
  56. openssh
  57. patch
  58. perl
  59. expat
  60. python2
  61. tar
  62. wget
  63. libz
  64. acpica
  65. bzip2
  66. sqlite
  67. libiconv
  68. libncurses
  69. libreadline
  70. libopenssl
  71. libpcre
  72. ca-certificates"
  73. if ! [ -d $PKGROOT ]; then
  74. echo "*** Package directory $PKGROOT is missing. Please populate it. ***"
  75. exit 1
  76. fi
  77. mkdir -p "$AUTOROOT/"
  78. cd $PKGROOT
  79. missing=
  80. found=
  81. ##
  82. ## Loop extracting packages.
  83. ##
  84. for pkg in $PACKAGES; do
  85. ##
  86. ## Extract every package that matches package*.ipk.
  87. ##
  88. for ipk in ./$pkg*.ipk; do
  89. if [ ! -r $ipk ]; then
  90. missing="$missing $pkg"
  91. else
  92. found="$found $ipk"
  93. echo "=== Extracting $ipk ==="
  94. sh $SRCROOT/third-party/build/opkg-utils/opkg-extract-data \
  95. "$ipk" "$APPSROOT"
  96. fi
  97. done
  98. done
  99. if [ -n "$missing" ]; then
  100. if [ -z "$found" ]; then
  101. echo "*** No packages were found in $PKGROOT ***"
  102. else
  103. echo "*** The following required packages were missing from $PKGROOT:"
  104. echo "*** $missing"
  105. echo "*** Please go download them from the build server or build "
  106. echo "*** them manually."
  107. fi
  108. fi
  109. ##
  110. ## Add client.py and the tasks directory.
  111. ##
  112. git archive --format=tar --remote=ssh://git@git.minoca.co:2222/minoca/web.git \
  113. HEAD mweb/mbuild/client.py > $AUTOROOT/client.tar
  114. tar -Oxf $AUTOROOT/client.tar > $AUTOROOT/client.py
  115. rm $AUTOROOT/client.tar
  116. cp -Rp "$SRCROOT/os/tasks" "$AUTOROOT/"
  117. echo Completed adding files
  118. exit 0