mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

219 lines
6.2 KiB

  1. #!/bin/bash
  2. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  3. #
  4. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  5. # Please add additional copyright information _after_ the line containing
  6. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  7. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  8. #
  9. # ROCK Linux: rock-src/target/lvp/build.sh
  10. # ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
  11. #
  12. # This program is free software; you can redistribute it and/or modify
  13. # it under the terms of the GNU General Public License as published by
  14. # the Free Software Foundation; either version 2 of the License, or
  15. # (at your option) any later version. A copy of the GNU General Public
  16. # License can be found at Documentation/COPYING.
  17. #
  18. # Many people helped and are helping developing ROCK Linux. Please
  19. # have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  20. # file for details.
  21. #
  22. # --- ROCK-COPYRIGHT-NOTE-END ---
  23. lvp_ver="0.5.3"
  24. rootdir="${base}/build/${ROCKCFG_ID}"
  25. ROCKdir="${rootdir}/ROCK"
  26. releasedir="${ROCKdir}/lvp_${lvp_ver}_${ROCKCFG_X86_OPT}"
  27. syslinux_ver="`sed -n 's,.*syslinux-\(.*\).tar.*,\1,p' ${base}/target/${target}/download.txt`"
  28. kernelversion="`grep '\[V\]' ${base}/package/base/linux/linux.desc | tail -n 1 | cut -f2 -d' '`"
  29. pkgloop
  30. . scripts/parse-config
  31. echo_header "Creating LVP ..."
  32. echo_header "Checking for *.err files ..."
  33. if [ `find "${rootdir}/var/adm/logs/" -name '*err' 2>/dev/null | wc -l` -gt 0 ] ; then
  34. echo_error "Found some. This is bad :-("
  35. else
  36. echo_status "None found. Good :-)"
  37. echo_status "(Re)creating releasedir"
  38. rm -rf ${releasedir}
  39. mkdir -p ${releasedir}
  40. chmod 700 ${releasedir}
  41. if [ -f ${base}/target/${target}/${arch}/build.sh ]; then
  42. echo_status "Executing ${arch} specific build instructions."
  43. . ${base}/target/${target}/${arch}/build.sh
  44. fi
  45. echo_status "Creating initrd"
  46. echo_status "Creating directory structure"
  47. mkdir -p ${releasedir}/initrd
  48. cd ${releasedir}/initrd
  49. mkdir -p bin etc proc dev tmp mnt sys
  50. mknod dev/ram0 b 1 0
  51. mknod dev/null c 1 3
  52. mknod dev/zero c 1 5
  53. mknod dev/tty c 5 0
  54. mknod dev/console c 5 1
  55. ln -sf bin sbin
  56. ln -sf . usr
  57. cd etc
  58. ln -sf /proc/mounts mtab
  59. touch fstab
  60. cd ..
  61. echo_status "Copying programs"
  62. for x in \
  63. bin/bash2 \
  64. bin/bash \
  65. bin/cp \
  66. bin/grep \
  67. bin/gzip \
  68. bin/ln \
  69. bin/mount \
  70. bin/mkdir \
  71. bin/umount \
  72. bin/rm \
  73. bin/sleep \
  74. bin/find \
  75. bin/gawk \
  76. bin/loadkeys \
  77. etc/udev \
  78. lib/modules/${kernelversion}-rock \
  79. lib/udev \
  80. sbin/agetty \
  81. sbin/hwscan \
  82. sbin/rmmod \
  83. sbin/modprobe \
  84. sbin/insmod \
  85. sbin/udevd \
  86. sbin/udevtrigger \
  87. sbin/udevsettle \
  88. usr/bin/chroot \
  89. usr/bin/eject \
  90. usr/bin/lsmod \
  91. usr/sbin/lspci \
  92. usr/share/kbd/keymaps \
  93. usr/share/pci.ids
  94. do
  95. mkdir -p ${x%/*}
  96. cp -ar ${rootdir}/${x} ${x}
  97. chmod u-s,g-s,u+w ${x}
  98. dynamic=`file ${x} | grep -c dynamic`
  99. if [ "${dynamic}" != "0" ] ; then
  100. echo_error "WARNING! ${x} is NOT linked statically!"
  101. fi
  102. done
  103. cp ${base}/target/${target}/${arch}/initrd/* bin/
  104. cd bin
  105. chmod +x *
  106. ln -sf gzip gunzip
  107. ln -sf gzip gzcat
  108. ln -sf bash sh
  109. cd ..
  110. mv bin/linuxrc .
  111. echo_status "Creating the livesystem"
  112. echo_status "Creating directory structure"
  113. mkdir -p ${releasedir}/livesystem
  114. cd ${releasedir}/livesystem
  115. tar --use-compress-program=bzip2 -xf ${ROCKdir}/pkgs/00-dirtree.tar.bz2
  116. rm -rf var/adm
  117. cd usr/
  118. rm -rf X11 X11R6
  119. mkdir X11R6
  120. ln -sf X11R6 X11
  121. cd ..
  122. echo_status "Copying programs"
  123. for x in \
  124. bin/bash2 \
  125. bin/bash \
  126. bin/ln \
  127. bin/mount \
  128. bin/rm \
  129. bin/sh \
  130. bin/sleep \
  131. bin/umount \
  132. etc/mplayer/mplayer.conf \
  133. usr/share/mplayer/font-arial-24-iso-8859-1 \
  134. usr/X11/bin/Xorg \
  135. usr/X11/bin/X \
  136. usr/X11/bin/startx \
  137. usr/X11/bin/xauth \
  138. usr/X11/bin/xinit \
  139. usr/bin/xterm \
  140. usr/X11/lib/X11/fonts/misc \
  141. usr/bin/lvp \
  142. usr/bin/mplayer \
  143. usr/bin/md5sum \
  144. sbin/blockdev \
  145. sbin/dmsetup \
  146. sbin/losetup \
  147. sbin/mdadm
  148. do
  149. mkdir -p ${x%/*}
  150. cp -ar ${rootdir}/${x} ${x}
  151. chmod u-s,g-s,u+w ${x}
  152. dynamic=`file ${x} | grep -c dynamic`
  153. if [ "${dynamic}" != "0" ] ; then
  154. echo_error "WARNING! ${x} is NOT linked statically!"
  155. fi
  156. done
  157. cd etc/
  158. ln -sf /proc/mounts mtab
  159. ln -sf /proc/mounts fstab
  160. cd ../usr/share/mplayer
  161. mv font-arial-24-iso-8859-1 font
  162. cd ../../..
  163. echo_status "Copying linuxrc as init-replacement ..."
  164. cp ${base}/target/${target}/${arch}/livesystem/linuxrc ${releasedir}/livesystem/linuxrc ; chmod +x ${releasedir}/livesystem/linuxrc
  165. echo_status "Copying startlvp script ..."
  166. cp ${base}/target/${target}/${arch}/livesystem/startlvp ${releasedir}/livesystem/sbin/; chmod +x ${releasedir}/livesystem/sbin/startlvp
  167. echo_status "Creating xorg.conf symlink"
  168. mkdir -p ${releasedir}/livesystem/etc/X11
  169. ln -sf /tmp/xorg.conf ${releasedir}/livesystem/etc/X11/xorg.conf
  170. echo_status "Copying xinitrc ..."
  171. mkdir -p ${releasedir}/livesystem/usr/X11R6/lib/X11/xinit
  172. cp ${base}/target/${target}/${arch}/livesystem/xinitrc ${releasedir}/livesystem/usr/X11R6/lib/X11/xinit/xinitrc
  173. echo_status "Copying etc scripts ..."
  174. mkdir -p ${releasedir}/livesystem/etc/lvp
  175. for x in ${base}/target/${target}/${arch}/livesystem/etc_* ; do
  176. y=${x##*/}
  177. cp ${x} ${releasedir}/livesystem/${y//_/\/}
  178. done
  179. echo "LVP v${lvp_ver}" >>${releasedir}/livesystem/etc/VERSION
  180. echo_status "Compressing binaries ... "
  181. ${rootdir}/usr/bin/upx2 --color --best --all-methods `find ${releasedir}/livesystem -type f | xargs file | grep "statically linked" | cut -f1 -d:` `find ${releasedir}/initrd -type f | xargs file | grep "statically linked" | cut -f1 -d:` >/proc/${$}/fd/1 2>/proc/${$}/fd/2 </proc/${$}/fd/0
  182. echo_status "Creating initrd.img"
  183. dd if=/dev/zero of=${releasedir}/isolinux/initrd bs=1k count=16384 >/dev/null 2>&1
  184. mkfs.ext2 -m 0 -F ${releasedir}/isolinux/initrd >/dev/null 2>&1
  185. mkdir ${releasedir}/initrd.tmp.${$}
  186. mount -o loop ${releasedir}/isolinux/initrd ${releasedir}/initrd.tmp.${$}
  187. mv ${releasedir}/initrd/* ${releasedir}/initrd.tmp.${$}
  188. umount ${releasedir}/initrd.tmp.${$}
  189. gzip -9 ${releasedir}/isolinux/initrd
  190. mv ${releasedir}/isolinux/initrd.gz ${releasedir}/isolinux/initrd
  191. echo_status "Cleaning up ..."
  192. rm -rf ${releasedir}/initrd.tmp.${$} ${releasedir}/initrd
  193. echo_status "LVP v${lvp_ver} built for ${ROCKCFG_X86_OPT} is now ready in ${releasedir}."
  194. fi
  195. cd ${base}