オープンソース・ソフトウェアの開発とダウンロード

Subversion リポジトリの参照

Contents of /branches/centos-5.6/LiveCD/generate-livecd.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5282 - (show annotations) (download) (as text)
Sun Jul 17 13:12:03 2011 UTC (12 years, 10 months ago) by kumaneko
File MIME type: text/x-sh
File size: 5346 byte(s)


1 #!/bin/sh
2
3 LIVECD_HOME=~/LiveCD/
4 CD_LABEL="CentOS-5.6-i386-TOMOYO-LiveCD"
5 ISOIMAGE_NAME=../CentOS-5.6-i386-TOMOYO-LiveCD.iso
6 ORIGINAL_VERSION=2.6.18-238.el5
7 ORIGINAL_VERSION_REGEXP=2\.6\.18-238.el5
8 KERNEL_VERSION=2.6.18-238.12.1.el5_tomoyo_1.8.2p2
9
10 set -v
11
12 die () {
13 echo '********** ' $1 ' **********'
14 exit 1
15 }
16
17 cd ${LIVECD_HOME}
18 echo "********** Updating root filesystem for LiveCD. **********"
19
20 [ -d ext3/home/ ] || mount -o loop,noatime,nodiratime squash/LiveOS/ext3fs.img ext3/ || die "Mount squash/LiveOS/ext3fs.img on ext3/ ."
21
22 echo '<kernel>' > ext3/etc/ccs/domain_policy.conf
23 echo 'use_profile 1' >> ext3/etc/ccs/domain_policy.conf
24
25 mkdir -p -m 700 ext3/var/log/tomoyo
26 grep -q mount ext3/etc/rc.d/rc.local || echo 'mount -t tmpfs -o size=64m none /var/log/tomoyo/' >> ext3/etc/rc.d/rc.local
27 grep -q ccs-auditd ext3/etc/rc.d/rc.local || echo /usr/sbin/ccs-auditd >> ext3/etc/rc.d/rc.local
28
29 cd ext3/usr/share/doc/ || die "Can't change directory."
30 rm -fR tomoyo/ || die "Can't delete directory."
31 mkdir tomoyo/ || die "Can't create directory."
32 cd tomoyo/ || die "Can't change directory."
33 wget -O centos5-live.html.en 'http://sourceforge.jp/projects/tomoyo/svn/view/tags/htdocs/1.8/centos5-live.html.en?revision=HEAD&root=tomoyo' || die "Can't copy document."
34 wget -O centos5-live.html.ja 'http://sourceforge.jp/projects/tomoyo/svn/view/tags/htdocs/1.8/centos5-live.html.ja?revision=HEAD&root=tomoyo' || die "Can't copy document."
35 wget -O - 'http://sourceforge.jp/projects/tomoyo/svn/view/tags/htdocs/1.8/media.centos5.tar.gz?root=tomoyo&view=tar' | tar -zxf - || die "Can't copy document."
36 ln -s centos5-live.html.en index.html.en
37 ln -s centos5-live.html.ja index.html.ja
38 cd ../../../../../ || die "Can't change directory."
39 cp -p resources/*.desktop ext3/usr/share/doc/tomoyo/ || die "Can't copy document."
40 grep -q desktop ext3/etc/rc.d/rc.local || echo 'cp -af --remove-destination /usr/share/doc/tomoyo/*.desktop /home/centos/Desktop/' >> ext3/etc/rc.d/rc.local
41 grep -q centos:centos ext3/etc/rc.d/rc.local || echo 'chown centos:centos /home/centos/Desktop/*.desktop' >> ext3/etc/rc.d/rc.local
42
43 rm -f ext3/*.rpm
44 rm -f ext3/package-install.sh
45 rm -f ext3/root/.bash_history
46 rm -f ext3/boot/initrd-*
47
48 cd ${LIVECD_HOME}
49 echo "********** Copying kernel. **********"
50 cp -af ext3/boot/vmlinuz-${KERNEL_VERSION} cdrom/isolinux/vmlinuz0 || die "Can't copy kernel."
51
52 cd ${LIVECD_HOME}
53 echo "********** Updating initramfs. **********"
54 [ -e cdrom/isolinux/initrd0.img ] || die "Copy original initramfs image file to cdrom/isolinux/initrd0.img ."
55 rm -fR initrd/
56 mkdir initrd
57 zcat cdrom/isolinux/initrd0.img | (cd initrd/ ; cpio -id ) || die "Can't extract initramfs."
58
59 if [ ! -d initrd/lib/modules/${KERNEL_VERSION}/ ]
60 then
61 mkdir initrd/lib/modules/${KERNEL_VERSION} || die "Can't create kernel modules directory."
62 for i in `( cd initrd/lib/modules/${ORIGINAL_VERSION}/ ; echo *.ko )`
63 do
64 find ext3/lib/modules/${KERNEL_VERSION}/ -type f -name $i -exec cp -p \{\} initrd/lib/modules/${KERNEL_VERSION}/ \; || die "Can't copy kernel modules."
65 done
66 cp -p initrd/lib/modules/${ORIGINAL_VERSION}/modules.* initrd/lib/modules/${KERNEL_VERSION}/ || "Can't copy modules information."
67 sed -i -e "s/${ORIGINAL_VERSION_REGEXP}/${KERNEL_VERSION}/g" initrd/lib/modules/${KERNEL_VERSION}/modules.* || die "Can't update modules information."
68 rm -fR initrd/lib/modules/${ORIGINAL_VERSION}/ || die "Can't delete kernel modules directory."
69 fi
70
71 ( cd initrd ; find -print0 | cpio -o0 -H newc | gzip -9 ) > cdrom/isolinux/initrd0.img || die "Can't update initramfs."
72
73 cd ${LIVECD_HOME}
74 echo "********** Updating root filesystem for LiveCD. **********"
75
76 rm squash/LiveOS/ext3fs.img || die "Can't delete old image file."
77 dd if=/dev/zero of=squash/LiveOS/ext3fs.img bs=1048576 count=4096 || die "Can't create image file."
78 mke2fs -j -m 0 -L "CentOS-5.6-i386-" -F squash/LiveOS/ext3fs.img || die "Can't create filesystem."
79 tune2fs -c -1 -i 0 -o user_xattr,acl squash/LiveOS/ext3fs.img || die "Can't tune filesystem."
80 mount -o loop,noatime,nodiratime squash/LiveOS/ext3fs.img mnt/ || die "Can't mount filesystem."
81 cp -a ext3/* mnt/ || die "Can't copy image file."
82 umount -d ext3/ || die "Can't unmount old filesystem."
83
84 chroot mnt/ mount -t proc none /proc/
85 chroot mnt/ mount -t sysfs none /sys/
86 chroot mnt/ mount -t selinuxfs none /selinux/
87 chroot mnt/ restorecon -R /
88 chroot mnt/ umount -l /selinux/
89 chroot mnt/ umount -l /proc/
90 chroot mnt/ umount -l /sys/
91 umount -d mnt/ || die "Can't unmount new filesystem."
92
93 cd ${LIVECD_HOME}
94 echo "********** Generating squashfs image file. **********"
95 if mksquashfs -version | grep -qF 3.4
96 then
97 mksquashfs squash cdrom/LiveOS/squashfs.img -noappend -b 65536 -no-sparse -no-exports -no-recovery || die "Can't generate squashfs image file."
98 else
99 mksquashfs squash cdrom/LiveOS/squashfs.img -noappend || die "Can't generate squashfs image file."
100 fi
101
102 cd ${LIVECD_HOME}
103 echo "********** Generating iso image file. **********"
104 cd cdrom/
105 grep -q TOMOYO -- isolinux/isolinux.cfg || sed -i -e 's/i386/i386-TOMOYO/' -- isolinux/isolinux.cfg
106 mkisofs -r -V "${CD_LABEL}" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ${ISOIMAGE_NAME} . || die "Can't generate iso image file."
107
108 echo "********** Done. **********"
109 exit 0

Properties

Name Value
svn:executable *

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26