gen_inst.sh 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. ##
  2. ## Copyright (c) 2016 Minoca Corp.
  3. ##
  4. ## This file is licensed under the terms of the GNU General Public License
  5. ## version 3. Alternative licensing terms are available. Contact
  6. ## info@minocacorp.com for details. See the LICENSE file at the root of this
  7. ## project for complete licensing information..
  8. ##
  9. ## Script Name:
  10. ##
  11. ## gen_inst.sh
  12. ##
  13. ## Abstract:
  14. ##
  15. ## This script generates the install archives.
  16. ##
  17. ## Author:
  18. ##
  19. ## Evan Green 30-Mar-2016
  20. ##
  21. ## Environment:
  22. ##
  23. ## Build
  24. ##
  25. set -e
  26. if test -z "$SRCROOT"; then
  27. echo "Error: SRCROOT must be set."
  28. exit 1
  29. fi
  30. REVISION="0"
  31. WORKING="$SRCROOT/instwork"
  32. if [ -d "$WORKING" ]; then
  33. echo "Removing old $WORKING"
  34. rm -rf "$WORKING"
  35. fi
  36. mkdir "$WORKING"
  37. for arch in x86 x86q armv7 armv6; do
  38. BINROOT=$SRCROOT/${arch}dbg/bin
  39. if ! [ -d $BINROOT ] ; then
  40. continue
  41. fi
  42. if [ -r $BINROOT/build-revision ] ; then
  43. rev=`cat $BINROOT/build-revision`
  44. if expr "$rev" \> "$REVISION" ; then
  45. REVISION="$rev"
  46. fi
  47. fi
  48. mkdir -p "$WORKING/$arch"
  49. if [ -r "$BINROOT/install.img" ]; then
  50. cp -pv "$BINROOT/install.img" "$WORKING/$arch/"
  51. fi
  52. if [ -r "$BINROOT/msetup" ]; then
  53. cp -pv "$BINROOT/msetup" "$WORKING/$arch/"
  54. fi
  55. if [ -r "$SRCROOT/x86dbg/tools/bin/msetup.exe" ]; then
  56. cp -pv "$SRCROOT/x86dbg/tools/bin/msetup.exe" "$WORKING/msetup.exe"
  57. fi
  58. done
  59. ##
  60. ## Add the readme file.
  61. ##
  62. DATE=`date "+%B %d, %Y"`
  63. echo "Minoca OS Installer Revision $REVISION.
  64. Created: $DATE
  65. Flavor: $DEBUG" > $WORKING/readme.txt
  66. cat >> $WORKING/readme.txt <<"_EOF"
  67. Website: www.minocacorp.com
  68. Contact Minoca at: info@minocacorp.com
  69. Minoca OS is a leading-edge, highly customizable, general purpose operating
  70. system. It features application level functionality such as virtual memory,
  71. networking, and POSIX compatibility, but at a significantly reduced image and
  72. memory footprint. Unique development, debugging, and real-time profiling tools
  73. make getting to the bottom of issues straightforward and easy. Direct support
  74. from the development team behind Minoca OS simplifies the process of creating
  75. OS images tailored to your application, saving on engineering resources and
  76. development time. Minoca OS is a one-stop shop for systems-level design.
  77. For a more detailed getting started guide, head to
  78. http://www.minocacorp.com/documentation/getting-started
  79. What is this?
  80. =============
  81. This archive contains the generic installation images and setup command line
  82. app for creating custom images of Minoca OS. If you're looking to simply get
  83. a quick bootable image of Minoca OS on a particular platform, this is not the
  84. archive for you. Go download one of our prebuilt images, available for each
  85. supported platform Minoca runs on.
  86. Inside the archive are installation images for each supported processor
  87. architecture. The Minoca native setup program for that architecture is also in
  88. that architecture directory. If you're running setup on Minoca to install
  89. Minoca, use the native setup programs.
  90. Additionally there is a setup command line tool for Windows. Use this if you'd
  91. like to install Minoca onto a removable disk from Windows. It is also possible
  92. to install directly onto your host system. Make sure to create a backup before
  93. trying to create a dual boot scenario. Currently the setup program will
  94. install its own MBR, blowing away the capability to boot back into Windows
  95. without a rescue disk. We recommend installing to removable media (such as a
  96. USB disk or SD card), a blank disk, or a disk file (for use with a VM).
  97. How do I use it?
  98. ================
  99. Run msetup with no arguments to get a list of available installation locations,
  100. including enumerated disks and partitions on the local machine. Use
  101. msetup --help to get a list of command line options and ways to specialize your
  102. image. You can install directly to a removable disk using its device ID number
  103. (eg. msetup -vD -d0x10000).
  104. Example
  105. =======
  106. C:\Users\Evan\Downloads\Minoca-Installer-1341>msetup
  107. Unable to detect platform name.
  108. No destination was specified. Please select one from the following list.
  109. Setup found 6 devices:
  110. DiskId PartID DevType Fmt Type Offset Size Path
  111. ----------------------------------------------------------------------------
  112. CB2C1753 00000000 Disk MBR 0 931G Device 0x0
  113. CB2C1753 00000001 Partition MBR B NTFS 1.0M 100M Device 0x1
  114. CB2C1753 00000002 Partition MBR NTFS 101M 931G Device 0x2
  115. 444A2245 00000000 Disk MBR 0 29G Device 0x10000
  116. 444A2245 00000001 Partition MBR B FAT16 1.0M 10M Device 0x10001
  117. 444A2245 00000000 Partition MBR Minoca 11M 501M Device 0x10002
  118. C:\Users\Evan\Downloads\mbin\Minoca-Installer-1341>msetup -i armv7\install.img -v -l beagleboneblack -D -d0x10000
  119. License
  120. =======
  121. The contents of this archive are licensed under the Creative Commons
  122. Non-Commercial Share-Alike license, which can be found at
  123. http://creativecommons.org/licenses/by-nc-sa/4.0/
  124. Contact
  125. =======
  126. Contact info@minocacorp.com with any questions or concerns.
  127. _EOF
  128. ##
  129. ## Create the archive.
  130. ##
  131. ARCHIVE="Minoca-Installer-$REVISION.zip"
  132. 7za a -tzip -mmt -mx9 -mtc "$ARCHIVE" $WORKING/*
  133. FILE_SIZE=`ls -l $ARCHIVE | \
  134. sed -n 's/[^ ]* *[^ ]* *[^ ]* *[^ ]* *\([0123456789]*\).*/\1/p'`
  135. if test -n "$MBUILD_STEP_ID"; then
  136. python $SRCROOT/client.py --result "$ARCHIVE Size" integer "$FILE_SIZE"
  137. python $SRCROOT/client.py --upload schedule $ARCHIVE $ARCHIVE
  138. echo Uploaded file $ARCHIVE, size $FILE_SIZE
  139. fi
  140. echo "Removing $WORKING"
  141. rm -rf "$WORKING"
  142. echo "Done creating installer archive."