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.

216 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.1"
  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. cd ..
  60. echo_status "Copying programs"
  61. for x in \
  62. bin/bash2 \
  63. bin/bash \
  64. bin/cat \
  65. bin/grep \
  66. bin/gzip \
  67. bin/ln \
  68. bin/ls \
  69. bin/mount \
  70. bin/sed \
  71. bin/umount \
  72. bin/rm \
  73. bin/find \
  74. bin/gawk \
  75. bin/loadkeys \
  76. etc/udev \
  77. lib/modules/${kernelversion}-rock \
  78. sbin/agetty \
  79. sbin/hwscan \
  80. sbin/rmmod \
  81. sbin/modprobe \
  82. sbin/insmod \
  83. sbin/udevstart \
  84. usr/bin/chroot \
  85. usr/bin/eject \
  86. usr/bin/lsmod \
  87. usr/sbin/lspci \
  88. usr/share/kbd/keymaps \
  89. usr/share/pci.ids
  90. do
  91. mkdir -p ${x%/*}
  92. cp -ar ${rootdir}/${x} ${x}
  93. chmod u-s,g-s,u+w ${x}
  94. dynamic=`file ${x} | grep -c dynamic`
  95. if [ "${dynamic}" != "0" ] ; then
  96. echo_error "WARNING! ${x} is NOT linked statically!"
  97. fi
  98. done
  99. cp ${base}/target/${target}/${arch}/initrd/* bin/
  100. cd bin
  101. chmod +x *
  102. ln -sf gzip gunzip
  103. ln -sf gzip gzcat
  104. ln -sf bash sh
  105. cd ..
  106. mv bin/linuxrc .
  107. echo_status "Creating the livesystem"
  108. echo_status "Creating directory structure"
  109. mkdir -p ${releasedir}/livesystem
  110. cd ${releasedir}/livesystem
  111. tar --use-compress-program=bzip2 -xf ${ROCKdir}/pkgs/00-dirtree.tar.bz2
  112. rm -rf var/adm
  113. cd usr/
  114. rm -rf X11 X11R6
  115. mkdir X11R6
  116. ln -sf X11R6 X11
  117. cd ..
  118. echo_status "Copying programs"
  119. for x in \
  120. bin/bash2 \
  121. bin/bash \
  122. bin/ln \
  123. bin/mount \
  124. bin/rm \
  125. bin/sh \
  126. bin/umount \
  127. etc/mplayer/mplayer.conf \
  128. usr/share/mplayer/font-arial-24-iso-8859-1 \
  129. usr/X11/bin/Xorg \
  130. usr/X11/bin/X \
  131. usr/X11/bin/startx \
  132. usr/X11/bin/xauth \
  133. usr/X11/bin/xinit \
  134. usr/X11/bin/xterm \
  135. usr/X11/lib/X11/fonts/misc \
  136. usr/bin/lvp \
  137. usr/bin/mplayer \
  138. usr/bin/md5sum \
  139. sbin/blockdev \
  140. sbin/dmsetup \
  141. sbin/losetup \
  142. sbin/mdadm
  143. do
  144. mkdir -p ${x%/*}
  145. cp -ar ${rootdir}/${x} ${x}
  146. chmod u-s,g-s,u+w ${x}
  147. dynamic=`file ${x} | grep -c dynamic`
  148. if [ "${dynamic}" != "0" ] ; then
  149. echo_error "WARNING! ${x} is NOT linked statically!"
  150. fi
  151. done
  152. cd etc/
  153. ln -sf /proc/mounts mtab
  154. ln -sf /proc/mounts fstab
  155. cd ../usr/share/mplayer
  156. mv font-arial-24-iso-8859-1 font
  157. cd ../../..
  158. echo_status "Copying linuxrc as init-replacement ..."
  159. cp ${base}/target/${target}/${arch}/livesystem/linuxrc ${releasedir}/livesystem/linuxrc ; chmod +x ${releasedir}/livesystem/linuxrc
  160. echo_status "Copying startlvp script ..."
  161. cp ${base}/target/${target}/${arch}/livesystem/startlvp ${releasedir}/livesystem/sbin/; chmod +x ${releasedir}/livesystem/sbin/startlvp
  162. echo_status "Creating xorg.conf symlink"
  163. mkdir -p ${releasedir}/livesystem/etc/X11
  164. ln -sf /tmp/xorg.conf ${releasedir}/livesystem/etc/X11/xorg.conf
  165. echo_status "Copying xinitrc ..."
  166. mkdir -p ${releasedir}/livesystem/usr/X11R6/lib/X11/xinit
  167. cp ${base}/target/${target}/${arch}/livesystem/xinitrc ${releasedir}/livesystem/usr/X11R6/lib/X11/xinit/xinitrc
  168. echo_status "Copying etc scripts ..."
  169. mkdir -p ${releasedir}/livesystem/etc/lvp
  170. for x in ${base}/target/${target}/${arch}/livesystem/etc_* ; do
  171. y=${x##*/}
  172. cp ${x} ${releasedir}/livesystem/${y//_/\/}
  173. done
  174. echo "LVP v${lvp_ver}" >>${releasedir}/livesystem/etc/VERSION
  175. echo_status "Compressing binaries ... "
  176. ${rootdir}/usr/bin/upx --best --crp-ms=999999 --nrv2d `find ${releasedir}/livesystem -type f | xargs file | grep "statically linked" | grep -v bin/bash | grep -v bin/mount | cut -f1 -d:` `find ${releasedir}/initrd -type f | xargs file | grep "statically linked" | grep -v bin/bash | grep -v bin/mount | cut -f1 -d:` >/proc/${$}/fd/1 2>/proc/${$}/fd/2 </proc/${$}/fd/0
  177. echo_status "Creating initrd.img"
  178. dd if=/dev/zero of=${releasedir}/isolinux/initrd bs=1k count=16384 >/dev/null 2>&1
  179. mkfs.ext2 -m 0 -F ${releasedir}/isolinux/initrd >/dev/null 2>&1
  180. mkdir ${releasedir}/initrd.tmp.${$}
  181. mount -o loop ${releasedir}/isolinux/initrd ${releasedir}/initrd.tmp.${$}
  182. mv ${releasedir}/initrd/* ${releasedir}/initrd.tmp.${$}
  183. umount ${releasedir}/initrd.tmp.${$}
  184. echo_status "Compressing initrd ..."
  185. gzip -9 ${releasedir}/isolinux/initrd
  186. mv ${releasedir}/isolinux/initrd.gz ${releasedir}/isolinux/initrd
  187. echo_status "Cleaning up ..."
  188. rm -rf ${releasedir}/initrd.tmp.${$} ${releasedir}/initrd
  189. echo_status "LVP v${lvp_ver} built for ${ROCKCFG_X86_OPT} is now ready in ${releasedir}."
  190. fi
  191. cd ${base}