setup_distrib.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #!/bin/sh
  2. ## Copyright (c) 2015 Minoca Corp. All Rights Reserved.
  3. ##
  4. ## Script Name:
  5. ##
  6. ## setup_distrib.sh
  7. ##
  8. ## Abstract:
  9. ##
  10. ## This script adds any additional files before the distribution build
  11. ## image is created.
  12. ##
  13. ## Author:
  14. ##
  15. ## Evan Green 20-Feb-2015
  16. ##
  17. ## Environment:
  18. ##
  19. ## Minoca Build
  20. ##
  21. set -e
  22. if test -z "$SRCROOT"; then
  23. SRCROOT=`pwd`/src
  24. fi
  25. if test -z "$ARCH"; then
  26. echo "ARCH must be set."
  27. exit 1
  28. fi
  29. if test -z "$DEBUG"; then
  30. echo "DEBUG must be set."
  31. exit 1
  32. fi
  33. export TMPDIR=$PWD
  34. export TEMP=$TMPDIR
  35. APPSROOT=$SRCROOT/$ARCH$VARIANT$DEBUG/bin/apps/
  36. ##
  37. ## Extract a few packages directly into the distribution image.
  38. ##
  39. mkdir -p "$APPSROOT"
  40. ##
  41. ## Create a package index.
  42. ##
  43. make_index="$SRCROOT/third-party/build/opkg-utils/opkg-make-index"
  44. package_dir="$SRCROOT/$ARCH$VARIANT$DEBUG/bin/packages"
  45. index_file="$package_dir/Packages"
  46. python "$make_index" "$package_dir" > "$index_file"
  47. cat "$index_file" | tr -d '\r' | gzip > "${index_file}.gz"
  48. ##
  49. ## Create a local configuration that prefers the local package repository.
  50. ##
  51. sed "s|src/gz main.*|src/gz local file:///$package_dir|" /etc/opkg/opkg.conf > \
  52. ./myopkg.conf
  53. ##
  54. ## Quark is i586 rather than i686.
  55. ##
  56. if [ "$ARCH$VARIANT" = "x86q" ]; then
  57. sed "s|i686|i586|g" ./myopkg.conf > ./myopkg.conf2
  58. mv ./myopkg.conf2 ./myopkg.conf
  59. fi
  60. ##
  61. ## Perform an offline install of distributed.
  62. ##
  63. PACKAGES="opkg gzip tar wget nano libpcre"
  64. mkdir -p "$APPSROOT/usr/lib/opkg/"
  65. opkg --conf=$PWD/myopkg.conf --offline-root="$APPSROOT" update
  66. opkg --conf=$PWD/myopkg.conf --offline-root="$APPSROOT" --force-postinstall \
  67. install $PACKAGES
  68. rm -rf "$APPSROOT/var/opkg-lists"
  69. echo Completed adding files