1
0

update_packages.sh 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #!/bin/sh
  2. ## Copyright (c) 2015 Minoca Corp. All Rights Reserved.
  3. ##
  4. ## Script Name:
  5. ##
  6. ## update_packages.sh
  7. ##
  8. ## Abstract:
  9. ##
  10. ## This script downloads the files needed to run OS builder tasks.
  11. ##
  12. ## Author:
  13. ##
  14. ## Evan Green 27-Feb-2015
  15. ##
  16. ## Environment:
  17. ##
  18. ## Minoca Build
  19. ##
  20. set -xe
  21. export TMPDIR=$PWD
  22. export TEMP=$TMPDIR
  23. if test -z "$DEBUG"; then
  24. echo "DEBUG must be set."
  25. exit 1
  26. fi
  27. ##
  28. ## Update the files for each architecture.
  29. ## TODO: Add armv6 once an armv6 build is created.
  30. ##
  31. for arch in x86 x86q armv7; do
  32. ARCH=$arch
  33. case $arch in
  34. x86) package_arch=minoca-i686 ;;
  35. x86q)
  36. package_arch=minoca-i586
  37. ARCH=x86
  38. VARIANT=q
  39. ;;
  40. armv6) package_arch=minoca-armv6 ;;
  41. armv7) package_arch=minoca-armv7 ;;
  42. esac
  43. parch=${package_arch#minoca-}
  44. ##
  45. ## Download the latest build. This will create a "bin" directory with the
  46. ## build binaries.
  47. ##
  48. OLDPWD="$PWD"
  49. rm -rf "../$arch"
  50. mkdir "../$arch"
  51. cd "../$arch"
  52. sh ../../tasks/build/download_build.sh
  53. VERSION=`cat ./bin/kernel-version | sed 's/\([0-9]*\)\.\([0-9]*\)\..*/\1.\2/'`
  54. ##
  55. ## Assuming this is an x86 machine, copy the x86 createimage into the path.
  56. ##
  57. if test "x$arch" = "xx86"; then
  58. cp -pv ./bin/createimage /usr/bin/
  59. fi
  60. ##
  61. ## Get the packages and packages.gz file.
  62. ##
  63. url="http://${MBUILD_SERVER_ADDRESS}:${MBUILD_SERVER_PORT}"
  64. url="$url/packages/$VERSION/$parch/main"
  65. rm -rf "./packages"
  66. mkdir "./packages"
  67. cd "./packages"
  68. wget "$url/Packages"
  69. wget "$url/Packages.gz"
  70. ##
  71. ## Go get all the packages buster.
  72. ##
  73. package_list=`cat ./Packages | sed -n 's/Filename: *\([^ \t]*\)/\1/p'`
  74. for package in $package_list; do
  75. wget "$url/$package"
  76. done
  77. ##
  78. ## Create a working opkg.conf file for builds.
  79. ##
  80. cd ..
  81. cat >./opkg.conf <<_EOS
  82. arch $package_arch 100
  83. src/gz main file:///$PWD/packages
  84. dest root /
  85. lists_dir ext $PWD/opkg-lists
  86. _EOS
  87. done
  88. echo Completed Updating packages.
  89. exit