version 1.3.2.10, 2012/10/10 13:02:11
|
version 1.8, 2013/08/05 13:10:16
|
Line 33 fi
|
Line 33 fi
|
clean_fsdir() |
clean_fsdir() |
{ |
{ |
echo "+++ Clean ELWIX FS ..." |
echo "+++ Clean ELWIX FS ..." |
rm -rf ${FS} | rm -rf $1 $2 |
| |
echo "+++ Clean ELWIX FS release ..." | |
rm -rf ${REL}/${OS} | |
} |
} |
|
|
build_fsdir() |
build_fsdir() |
{ |
{ |
echo "+++ Build ELWIX FS directory ..." |
echo "+++ Build ELWIX FS directory ..." |
mkdir -p ${FS} | mkdir -p $1 |
|
|
cd ${FS} | cd $1 |
|
|
# altroot |
# altroot |
install -d altroot; |
install -d altroot; |
Line 60 build_fsdir()
|
Line 57 build_fsdir()
|
install -d altroot/var/db; |
install -d altroot/var/db; |
install -d -m 0555 altroot/var/empty; |
install -d -m 0555 altroot/var/empty; |
install -d altroot/var/log; |
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 -o 101 -g 101 altroot/var/log/quagga; |
|
install -d -o 883 -g 883 altroot/var/mqtt; |
install -d altroot/var/named; |
install -d altroot/var/named; |
install -d altroot/var/run; |
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 53 -g 53 altroot/var/run/named; |
install -d -o 101 -g 101 altroot/var/run/quagga; |
install -d -o 101 -g 101 altroot/var/run/quagga; |
install -d altroot/var/spool; |
install -d altroot/var/spool; |
Line 78 build_fsdir()
|
Line 75 build_fsdir()
|
install -d cf; |
install -d cf; |
# etc |
# etc |
install -d etc; |
install -d etc; |
|
install -d -o 883 -g 883 etc/mqtt; |
# exports |
# exports |
install -d exports; |
install -d exports; |
# home |
# home |
Line 95 build_fsdir()
|
Line 93 build_fsdir()
|
cd - |
cd - |
} |
} |
|
|
mkboot() |
|
{ |
|
echo "+++ Build ELWIX FS boot directory ..." |
|
InstallDir ${WORLD}/boot $1/boot |
|
|
|
install -m 644 ${CFGDIR}/boot/boot.config $1; |
|
|
|
install -m 444 ${CFGDIR}/boot/beastie.4th $1/boot; |
|
install -m 444 ${CFGDIR}/boot/brand.4th $1/boot; |
|
install -m 444 ${CFGDIR}/boot/menu.4th $1/boot; |
|
|
|
install -m 444 ${KERNDEVHINTS} $1/boot/device.hints; |
|
|
|
if [ -r ${CFGDIR}/boot/loader_${TARGET_ARCH}.conf ]; then |
|
install -m 644 ${CFGDIR}/boot/loader_${TARGET_ARCH}.conf $1/boot/loader.conf; |
|
else |
|
echo; |
|
echo "Can't find right loader.conf for TARGET_ARCH=${TARGET_ARCH} ... loader.conf not installed!"; |
|
echo; |
|
fi; |
|
} |
|
|
|
mkvar() |
|
{ |
|
echo "+++ Build ELWIX FS var directory ..." |
|
ln -s /tmp $1/altroot/var/tmp |
|
|
|
touch $1/altroot/var/log/elwix |
|
touch $1/altroot/var/log/lastlog |
|
touch $1/altroot/var/log/wifi.log |
|
touch $1/altroot/var/log/wtmp |
|
touch $1/altroot/var/run/utmp |
|
touch $1/altroot/var/account/acct |
|
|
|
touch $1/altroot/var/log/auth.log |
|
touch $1/altroot/var/log/cron |
|
touch $1/altroot/var/log/console.log |
|
touch $1/altroot/var/log/debug.log |
|
touch $1/altroot/var/log/lpd-errs |
|
touch $1/altroot/var/log/maillog |
|
touch $1/altroot/var/log/messages |
|
touch $1/altroot/var/log/security |
|
touch $1/altroot/var/log/xferlog |
|
touch $1/altroot/var/log/ppp.log |
|
chgrp network $1/altroot/var/log/ppp.log |
|
|
|
InstallDir ${WORLD}/var/named $1/altroot/var/named |
|
InstallList ${ELWIX_BSDSRC} ${BSDSRC} $1/altroot/var/named |
|
install -v ${FS_ETC}/resolv.safe $1/altroot/var/run/resolv.conf |
|
} |
|
|
|
create_etc_motd() |
|
{ |
|
ELWIX_VER="ELWIX-${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; }' \ |
|
${CFGDIR}/elwix_signature.txt; |
|
} |
|
|
|
create_etc_fstab() |
create_etc_fstab() |
{ |
{ |
cat >$1 <<_EOF | cat >$1/etc/fstab <<_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 |
/dev/ufs/elwix /elwix ufs ro 0 1 |
md3 /tmp mfs rw,-s8m,-oasync,-S 0 0 |
md3 /tmp mfs rw,-s8m,-oasync,-S 0 0 |
Line 166 md4 /var mfs rw,-s16m,-S 0 0
|
Line 104 md4 /var mfs rw,-s16m,-S 0 0
|
_EOF |
_EOF |
} |
} |
|
|
mketc() | install_fsdir() |
{ |
{ |
echo "+++ Build ELWIX FS etc directory ..." | echo "+++ Install ELWIX FS $1 in bundle OS install file ..." |
InstallDir ${FS_ETC} $1/etc | OSZ="" |
|
|
chown -R root:wheel $1/etc; | install -v ${REL}/${ROOTFS_KERN} $1/boot/kernel/kernel.gz |
|
|
chmod 0600 $1/etc/opieaccess; | case "$2" in |
chmod 0600 $1/etc/opiekeys; | [Ee][Xx][Tt]) |
| install -d $1/usr |
| cd $1/usr |
| pax -r -z -pe -f ${REL}/${ROMFS_IMG} |
| cd - |
|
|
chmod 0600 $1/etc/master.passwd; | install -d $1/usr/local |
chmod 0600 $1/etc/spwd.db; | cd $1/usr/local |
chmod 0600 $1/etc/ssh/ssh_host_dsa_key; | pax -r -z -pe -f ${REL}/${ROMFS_IMG2} |
chmod 0600 $1/etc/ssh/ssh_host_key; | cd - |
chmod 0600 $1/etc/ssh/ssh_host_rsa_key; | |
chmod 0600 $1/etc/ssh/ssh_host_ecdsa_key; | |
|
|
chmod 0440 $1/etc/sudoers; | OSZ=${REL}/${OS_EXT} |
| ;; |
| *) |
| 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} |
|
|
chgrp 80 $1/etc/config.xml; | install -v ${REL}/${ROMFS_IMG2} \ |
chmod 0660 $1/etc/config.xml; | $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} |
|
|
ln -sf /etc/rc.s $1/etc/rc.S | OSZ=${REL}/${OS} |
| ;; |
| esac |
|
|
ln -sf /usr/share/zoneinfo/${TIMEZONE} $1/etc/localtime; |
|
ln -sf /usr/share/misc/termcap $1/etc/termcap; |
|
|
|
ln -sf /var/named/etc/namedb $1/etc/namedb; |
|
ln -sf /var/run/resolv.conf $1/etc/resolv.conf; |
|
|
|
ln -sf /elwix/pkg/etc/mk.conf $1/etc/mk.conf; |
|
|
|
echo ${TARGET_ARCH} >$1/etc/platform; |
|
|
|
create_etc_motd $1/etc/motd; |
|
create_etc_fstab $1/etc/fstab; |
|
|
|
echo "+++ ELWIX clean CVS tags ..." |
|
CleanCVS ${FS} |
|
CleanCVS ${FS}/etc |
|
} |
|
|
|
mkbackup() |
|
{ |
|
echo "+++ Build ELWIX FS backup factory default directory ..." |
|
mkdir -p $1/altroot/backup |
|
|
|
cd $1 |
cd $1 |
cp -p etc/config.xml altroot/backup | tar -czvf $OSZ . |
tar -czf altroot/backup/.etc.tgz etc | |
| |
cd altroot | |
tar -czf backup/.var.tgz var | |
} |
} |
|
|
mkhome() |
|
{ |
|
echo "+++ Build ELWIX FS root home directory ..." |
|
install -d $1/root/.ssh |
|
[ -r ${CFGDIR}/root.skel/ssh/authorized_keys2 ] && \ |
|
install -v ${CFGDIR}/root.skel/ssh/authorized_keys2 $1/root/.ssh; |
|
|
|
install -v ${CFGDIR}/root.skel/cshrc $1/root/.cshrc; |
|
install -v ${CFGDIR}/root.skel/login $1/root/.login; |
|
install -v ${CFGDIR}/root.skel/logout $1/root/.logout; |
|
install -v ${CFGDIR}/root.skel/profile $1/root/.profile; |
|
install -v ${CFGDIR}/root.skel/vimrc $1/root/.vimrc; |
|
} |
|
|
|
install_fsdir() |
|
{ |
|
echo "+++ Install ELWIX FS in bundle OS install file ..." |
|
|
|
install -v ${REL}/${ROOTFS_KERN} ${FS}/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} |
|
|
|
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} |
|
else |
|
install -d ${FS}/usr |
|
cd ${FS}/usr |
|
pax -r -z -pe -f ${REL}/${ROMFS_IMG} |
|
cd - |
|
fi |
|
|
|
cd $FS |
|
tar -czvf ${REL}/${OS} . |
|
} |
|
|
|
### main() |
### main() |
if [ ! -r ${REL}/${ROOTFS_KERN} -o ! -r ${REL}/${ROMFS_IMG} ]; then |
if [ ! -r ${REL}/${ROOTFS_KERN} -o ! -r ${REL}/${ROMFS_IMG} ]; then |
echo |
echo |
Line 270 if [ ! -r ${REL}/${ROOTFS_KERN} -o ! -r ${REL}/${ROMFS
|
Line 158 if [ ! -r ${REL}/${ROOTFS_KERN} -o ! -r ${REL}/${ROMFS
|
exit 1 |
exit 1 |
fi |
fi |
|
|
clean_fsdir | clean_fsdir ${FS} ${REL}/${OS} |
build_fsdir | clean_fsdir ${FS_EXT} ${REL}/${OS_EXT} |
|
|
mkboot ${FS} | build_fsdir ${FS} |
mkhome ${FS} | build_fsdir ${FS_EXT} |
mkvar ${FS} | |
mketc ${FS} | |
mkbackup ${FS} | |
|
|
install_fsdir | MakeFS_home ${FS} |
| MakeFS_home ${FS_EXT} |
| |
| MakeFS_var ${FS} ${FS_ETC} |
| MakeFS_var ${FS_EXT} ${FS_EXT_ETC} |
| |
| MakeFS_etc ${FS} ${FS_ETC} |
| MakeFS_etc ${FS_EXT} ${FS_EXT_ETC} ext |
| |
| create_etc_fstab ${FS} |
| create_etc_fstab ${FS_EXT} ext |
| |
| MakeFS_backup ${FS} |
| MakeFS_backup ${FS_EXT} |
| |
| MakeFS_boot ${FS} |
| MakeFS_boot ${FS_EXT} |
| |
| install_fsdir ${FS} |
| install_fsdir ${FS_EXT} ext |
|
|
echo "+++ Complete build ELWIX FS" |
echo "+++ Complete build ELWIX FS" |
echo "ELWIX finish version ${VERSION}, Good luck!" |
echo "ELWIX finish version ${VERSION}, Good luck!" |