version 1.3.2.5, 2012/03/20 16:12:44
|
version 1.7.2.3, 2013/07/29 15:54:13
|
Line 30 if [ "${USER}" != "root" ]; then
|
Line 30 if [ "${USER}" != "root" ]; then
|
exit 1 |
exit 1 |
fi |
fi |
|
|
clean_fsdir() | clean_rel() |
{ |
{ |
echo "+++ Clean ELWIX FS ..." | echo "+++ Clean ELWIX OS release ..." |
rm -rf ${FS} | rm -rf $1 $2 |
|
|
echo "+++ Clean ELWIX FS release ..." | mkdir -p $1 |
rm -rf ${REL}/${OS} | |
| cd ${ROMFS} |
| pax -rw -pe -X . $1 |
| cd - |
} |
} |
|
|
build_fsdir() | build_vardir() |
{ |
{ |
echo "+++ Build ELWIX FS directory ..." | echo "+++ Build ELWIX altroot directory ..." |
mkdir -p ${FS} | |
|
|
cd ${FS} | cd $1 |
| |
# altroot |
# altroot |
install -d altroot; |
install -d altroot; |
# altroot/var |
# altroot/var |
Line 54 build_fsdir()
|
Line 55 build_fsdir()
|
install -d altroot/var/at; |
install -d altroot/var/at; |
install -d altroot/var/at/jobs; |
install -d altroot/var/at/jobs; |
install -d altroot/var/at/spool; |
install -d altroot/var/at/spool; |
install -d -g authpf -m 0770 altroot/var/authpf; | install -d -g 63 -m 0770 altroot/var/authpf; |
install -d -m 0750 altroot/var/cron; |
install -d -m 0750 altroot/var/cron; |
install -d -m 0700 altroot/var/cron/tabs; |
install -d -m 0700 altroot/var/cron/tabs; |
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 www -g www altroot/var/log/lighttpd; | install -d -o 101 -g 101 altroot/var/log/quagga; |
install -d -o quagga -g quagga 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 www -g www altroot/var/run/lighttpd; | install -d -m 1777 altroot/var/tmp; |
install -d -o bind -g bind altroot/var/run/named; | install -d altroot/var/sys; |
install -d -o quagga -g quagga altroot/var/run/quagga; | 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; |
install -d altroot/var/spool; |
install -d -o uucp -g dialer -m 0775 altroot/var/spool/lock; | install -d -o 66 -g 68 -m 0775 altroot/var/spool/lock; |
install -d -g daemon altroot/var/spool/lpd; | install -d -g 1 altroot/var/spool/lpd; |
install -d -g daemon altroot/var/spool/output; | install -d -g 1 altroot/var/spool/output; |
install -d -g daemon altroot/var/spool/output/lpd; | install -d -g 1 altroot/var/spool/output/lpd; |
# boot | |
install -d boot; | |
# cf | |
install -d cf; | |
# etc | |
install -d etc; | |
# exports | |
install -d exports; | |
# home | |
install -d home; | |
# root | |
install -d -m 0700 root; | |
# pkg | |
install -d pkg; | |
install -d pkg/db; | |
# tftpboot | |
install -d tftpboot; | |
|
|
chown -hR root:wheel . |
chown -hR root:wheel . |
cd - |
cd - |
Line 96 build_fsdir()
|
Line 81 build_fsdir()
|
|
|
mkboot() |
mkboot() |
{ |
{ |
echo "+++ Build ELWIX FS boot directory ..." | echo "+++ Build ELWIX OS boot directory ..." |
InstallDir ${WORLD}/boot $1/boot |
InstallDir ${WORLD}/boot $1/boot |
|
|
install -m 644 ${CFGDIR}/boot/boot.config $1; |
install -m 644 ${CFGDIR}/boot/boot.config $1; |
Line 118 mkboot()
|
Line 103 mkboot()
|
|
|
mkvar() |
mkvar() |
{ |
{ |
echo "+++ Build ELWIX FS var directory ..." | echo "+++ Build ELWIX OS var directory ..." |
ln -s /tmp $1/altroot/var/tmp | touch $1/altroot/var/run/utmp |
|
|
|
touch $1/altroot/var/account/acct |
|
|
touch $1/altroot/var/log/elwix |
touch $1/altroot/var/log/elwix |
touch $1/altroot/var/log/lastlog |
touch $1/altroot/var/log/lastlog |
touch $1/altroot/var/log/wifi.log |
touch $1/altroot/var/log/wifi.log |
touch $1/altroot/var/log/wtmp | touch $1/altroot/var/log/utx.log |
touch $1/altroot/var/run/utmp | |
touch $1/altroot/var/account/acct | |
|
|
touch $1/altroot/var/log/auth.log |
touch $1/altroot/var/log/auth.log |
touch $1/altroot/var/log/cron |
touch $1/altroot/var/log/cron |
touch $1/altroot/var/log/console.log |
touch $1/altroot/var/log/console.log |
touch $1/altroot/var/log/debug.log |
touch $1/altroot/var/log/debug.log |
|
touch $1/altroot/var/log/init.log |
touch $1/altroot/var/log/lpd-errs |
touch $1/altroot/var/log/lpd-errs |
touch $1/altroot/var/log/maillog |
touch $1/altroot/var/log/maillog |
touch $1/altroot/var/log/messages |
touch $1/altroot/var/log/messages |
Line 147 mkvar()
|
Line 133 mkvar()
|
|
|
create_etc_motd() |
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}"; |
ELWIX_HDR_MOTD="${ELWIX_VER} :: Build date ${BUILD_DATE}"; |
|
|
awk -v fo="${1:-motd}" 'BEGIN { print "'"${ELWIX_HDR_MOTD}"'" > fo; } { print $0 >> fo; }' \ |
awk -v fo="${1:-motd}" 'BEGIN { print "'"${ELWIX_HDR_MOTD}"'" > fo; } { print $0 >> fo; }' \ |
Line 157 create_etc_motd()
|
Line 143 create_etc_motd()
|
create_etc_fstab() |
create_etc_fstab() |
{ |
{ |
cat >$1 <<_EOF |
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 | /dev/ufs/elwix / ufs ro 0 1 |
md3 /tmp mfs rw,-s8m,-oasync,-S 0 0 | md2 /var mfs rw,-s16m,-S 0 0 |
md4 /var mfs rw,-s16m,-S 0 0 | |
_EOF |
_EOF |
} |
} |
|
|
mketc() |
mketc() |
{ |
{ |
echo "+++ Build ELWIX FS etc directory ..." | echo "+++ Build ELWIX OS etc directory ..." |
InstallDir ${FS_ETC} $1/etc |
InstallDir ${FS_ETC} $1/etc |
|
|
chown -R root:wheel $1/etc; |
chown -R root:wheel $1/etc; |
Line 184 mketc()
|
Line 169 mketc()
|
|
|
chmod 0440 $1/etc/sudoers; |
chmod 0440 $1/etc/sudoers; |
|
|
chgrp www $1/etc/config.xml; | chgrp 80 $1/etc/config.xml; |
chmod 0660 $1/etc/config.xml; |
chmod 0660 $1/etc/config.xml; |
|
|
|
mkdir -p $1/etc/mqtt; |
|
chgrp -R 883 $1/etc/mqtt; |
|
chown -R 883 $1/etc/mqtt; |
|
|
ln -sf /etc/rc.s $1/etc/rc.S |
ln -sf /etc/rc.s $1/etc/rc.S |
|
|
ln -sf /usr/share/zoneinfo/${TIMEZONE} $1/etc/localtime; |
ln -sf /usr/share/zoneinfo/${TIMEZONE} $1/etc/localtime; |
Line 199 mketc()
|
Line 188 mketc()
|
|
|
echo ${TARGET_ARCH} >$1/etc/platform; |
echo ${TARGET_ARCH} >$1/etc/platform; |
|
|
create_etc_motd $1/etc/motd; | create_etc_motd $1/etc/motd $2; |
create_etc_fstab $1/etc/fstab; | create_etc_fstab $1/etc/fstab $2; |
|
|
echo "+++ ELWIX clean CVS tags ..." |
echo "+++ ELWIX clean CVS tags ..." |
CleanCVS ${FS} | CleanCVS $1 |
CleanCVS ${FS}/etc | CleanCVS $1/etc |
} |
} |
|
|
mkbackup() |
mkbackup() |
{ |
{ |
echo "+++ Build ELWIX FS backup factory default directory ..." | echo "+++ Build ELWIX OS backup factory default directory ..." |
mkdir -p $1/altroot/backup |
mkdir -p $1/altroot/backup |
|
|
cd $1 |
cd $1 |
tar -czf altroot/backup/.etc.tgz etc |
|
cp -p etc/config.xml altroot/backup |
cp -p etc/config.xml altroot/backup |
cd altroot | # tar -czf altroot/backup/.etc.tgz etc |
tar -czf backup/.var.tgz var | |
| # cd altroot |
| # tar -czf backup/.var.tgz var |
} |
} |
|
|
mkhome() |
mkhome() |
{ |
{ |
echo "+++ Build ELWIX FS root home directory ..." | echo "+++ Build ELWIX OS root home directory ..." |
install -d $1/root/.ssh |
install -d $1/root/.ssh |
[ -r ${CFGDIR}/root.skel/ssh/authorized_keys2 ] && \ |
[ -r ${CFGDIR}/root.skel/ssh/authorized_keys2 ] && \ |
install -v ${CFGDIR}/root.skel/ssh/authorized_keys2 $1/root/.ssh; |
install -v ${CFGDIR}/root.skel/ssh/authorized_keys2 $1/root/.ssh; |
Line 233 mkhome()
|
Line 223 mkhome()
|
install -v ${CFGDIR}/root.skel/vimrc $1/root/.vimrc; |
install -v ${CFGDIR}/root.skel/vimrc $1/root/.vimrc; |
} |
} |
|
|
install_fsdir() | install_rel() |
{ |
{ |
echo "+++ Install ELWIX FS in bundle OS install file ..." | echo "+++ Install ELWIX OS $1 in bundle OS install file ..." |
| OSZ="" |
|
|
install -v ${REL}/${ROOTFS_KERN} ${FS}/boot/kernel | install -v ${KERNEL} $1/boot/kernel; |
| cd $1/boot/kernel; |
| gzip -9 kernel; |
| cd -; |
|
|
install -v ${REL}/${ROMFS_IMG} ${FS}/altroot/elwix-firmware-${VERSION}_${TARGET_ARCH} | case "$2" in |
ln ${FS}/altroot/elwix-firmware-${VERSION}_${TARGET_ARCH} ${FS}/altroot/${ROMFS_IMG} | _128) |
ln -s /elwix/altroot/elwix-firmware-${VERSION}_${TARGET_ARCH} ${FS}/${ROMFS_IMG} | install -d $1/usr/local |
| cd $1/usr/local |
| pax -r -z -pe -f ${REL}/${ROMFS_IMG2} |
| cd - |
|
|
cd $FS | OSZ=${REL}/${OS_128} |
tar -czvf ${REL}/${OS} . | ;; |
| *) |
| OSZ=${REL}/${OS} |
| ;; |
| esac |
| |
| cd $1 |
| tar -czvf $OSZ . |
} |
} |
|
|
### main() |
### main() |
Line 257 if [ ! -r ${REL}/${ROOTFS_KERN} -o ! -r ${REL}/${ROMFS
|
Line 261 if [ ! -r ${REL}/${ROOTFS_KERN} -o ! -r ${REL}/${ROMFS
|
exit 1 |
exit 1 |
fi |
fi |
|
|
clean_fsdir | clean_rel ${FS} ${REL}/${OS} |
build_fsdir | build_vardir ${FS}/elwix |
| mkhome ${FS}/elwix |
| mkvar ${FS}/elwix |
| mketc ${FS}/elwix |
| mkbackup ${FS}/elwix |
mkboot ${FS} |
mkboot ${FS} |
mkhome ${FS} | install_rel ${FS} |
mkvar ${FS} | |
mketc ${FS} | |
mkbackup ${FS} | |
|
|
install_fsdir | echo "+++ Complete build ELWIX OS" |
| |
echo "+++ Complete build ELWIX FS" | |
echo "ELWIX finish version ${VERSION}, Good luck!" |
echo "ELWIX finish version ${VERSION}, Good luck!" |