--- elwix/build_fs.sh 2012/10/10 14:13:16 1.3.2.11 +++ elwix/build_fs.sh 2012/10/11 13:31:33 1.3.2.14 @@ -5,7 +5,7 @@ # (C) AITNET ltd - Sofia/Bulgaria # by Michael Pounov # -# $Id: build_fs.sh,v 1.3.2.11 2012/10/10 14:13:16 misho Exp $ +# $Id: build_fs.sh,v 1.3.2.14 2012/10/11 13:31:33 misho Exp $ # [ -r ./config/rc.elwix ] && . ./config/rc.elwix @@ -33,18 +33,18 @@ fi clean_fsdir() { echo "+++ Clean ELWIX FS ..." - rm -rf ${FS} + rm -rf ${FS} ${FS_LITE} echo "+++ Clean ELWIX FS release ..." - rm -rf ${REL}/${OS} + rm -rf ${REL}/${OS} ${REL}/${OS_LITE} } build_fsdir() { echo "+++ Build ELWIX FS directory ..." - mkdir -p ${FS} + mkdir -p $1 - cd ${FS} + cd $1 # altroot install -d altroot; @@ -60,11 +60,10 @@ build_fsdir() install -d altroot/var/db; install -d -m 0555 altroot/var/empty; install -d altroot/var/log; -# install -d -o 80 -g 80 altroot/var/log/lighttpd; install -d -o 101 -g 101 altroot/var/log/quagga; install -d altroot/var/named; install -d altroot/var/run; -# install -d -o 80 -g 80 altroot/var/run/lighttpd; + install -d altroot/var/sys; install -d -o 53 -g 53 altroot/var/run/named; install -d -o 101 -g 101 altroot/var/run/quagga; install -d altroot/var/spool; @@ -148,7 +147,7 @@ mkvar() create_etc_motd() { - ELWIX_VER="ELWIX-${VERSION}_${TARGET_ARCH}"; + ELWIX_VER="ELWIX$2-${VERSION}_${TARGET_ARCH}"; ELWIX_HDR_MOTD="${ELWIX_VER} :: Build date ${BUILD_DATE}"; awk -v fo="${1:-motd}" 'BEGIN { print "'"${ELWIX_HDR_MOTD}"'" > fo; } { print $0 >> fo; }' \ @@ -158,11 +157,11 @@ create_etc_motd() create_etc_fstab() { cat >$1 <<_EOF -# Automatic generated fstab for ELWIX at ${BUILD_DATE} +# Automatic generated fstab for ELWIX$2 at ${BUILD_DATE} # /dev/ufs/elwix /elwix ufs ro 0 1 -md4 /tmp mfs rw,-s8m,-oasync,-S 0 0 -md5 /var mfs rw,-s16m,-S 0 0 +md3 /tmp mfs rw,-s8m,-oasync,-S 0 0 +md4 /var mfs rw,-s16m,-S 0 0 _EOF } @@ -200,12 +199,12 @@ mketc() echo ${TARGET_ARCH} >$1/etc/platform; - create_etc_motd $1/etc/motd; - create_etc_fstab $1/etc/fstab; + create_etc_motd $1/etc/motd $2; + create_etc_fstab $1/etc/fstab $2; echo "+++ ELWIX clean CVS tags ..." - CleanCVS ${FS} - CleanCVS ${FS}/etc + CleanCVS $1 + CleanCVS $1/etc } mkbackup() @@ -237,27 +236,32 @@ mkhome() install_fsdir() { - echo "+++ Install ELWIX FS in bundle OS install file ..." + echo "+++ Install ELWIX FS $1 in bundle OS install file ..." + OSZ="" - install -v ${REL}/${ROOTFS_KERN} ${FS}/boot/kernel + install -v ${REL}/${ROOTFS_KERN} $1/boot/kernel - if [ "${BUILD_FRMIMG}" = "YES" ]; then - install -v ${REL}/${ROMFS_IMG} ${FS}/altroot/elwix-firmware-${VERSION}_${TARGET_ARCH} - ln ${FS}/altroot/elwix-firmware-${VERSION}_${TARGET_ARCH} ${FS}/altroot/${ROMFS_IMG} - ln -s /elwix/altroot/elwix-firmware-${VERSION}_${TARGET_ARCH} ${FS}/${ROMFS_IMG} + if [ -z "$2" ]; then + install -v ${REL}/${ROMFS_IMG} $1/altroot/elwix-firmware-${VERSION}_${TARGET_ARCH} + ln $1/altroot/elwix-firmware-${VERSION}_${TARGET_ARCH} $1/altroot/${ROMFS_IMG} + ln -s /elwix/altroot/elwix-firmware-${VERSION}_${TARGET_ARCH} $1/${ROMFS_IMG} - install -v ${REL}/${ROMFS_IMG2} ${FS}/altroot/elwix-firmware2-${VERSION}_${TARGET_ARCH} - ln ${FS}/altroot/elwix-firmware2-${VERSION}_${TARGET_ARCH} ${FS}/altroot/${ROMFS_IMG2} - ln -s /elwix/altroot/elwix-firmware2-${VERSION}_${TARGET_ARCH} ${FS}/${ROMFS_IMG2} + install -v ${REL}/${ROMFS_IMG2} $1/altroot/elwix-firmware2-${VERSION}_${TARGET_ARCH} + ln $1/altroot/elwix-firmware2-${VERSION}_${TARGET_ARCH} $1/altroot/${ROMFS_IMG2} + ln -s /elwix/altroot/elwix-firmware2-${VERSION}_${TARGET_ARCH} $1/${ROMFS_IMG2} + + OSZ=${REL}/${OS} else - install -d ${FS}/usr - cd ${FS}/usr + install -d $1/usr + cd $1/usr pax -r -z -pe -f ${REL}/${ROMFS_IMG} cd - + + OSZ=${REL}/${OS_LITE} fi - cd $FS - tar -czvf ${REL}/${OS} . + cd $1 + tar -czvf $OSZ . } ### main() @@ -271,15 +275,27 @@ if [ ! -r ${REL}/${ROOTFS_KERN} -o ! -r ${REL}/${ROMFS fi clean_fsdir -build_fsdir +build_fsdir ${FS} +build_fsdir ${FS_LITE} + mkboot ${FS} +mkboot ${FS_LITE} + mkhome ${FS} +mkhome ${FS_LITE} + mkvar ${FS} +mkvar ${FS_LITE} + mketc ${FS} +mketc ${FS_LITE} "_lite" + mkbackup ${FS} +mkbackup ${FS_LITE} -install_fsdir +install_fsdir ${FS} +install_fsdir ${FS_LITE} "_lite" echo "+++ Complete build ELWIX FS" echo "ELWIX finish version ${VERSION}, Good luck!"