version 1.2.2.4, 2011/10/25 13:55:56
|
version 1.6, 2013/01/28 10:42:47
|
Line 33 fi
|
Line 33 fi
|
clean_fsdir() |
clean_fsdir() |
{ |
{ |
echo "+++ Clean ELWIX FS ..." |
echo "+++ Clean ELWIX FS ..." |
rm -rf ${FS} | rm -rf ${FS} ${FS_LITE} ${FS_LITE128} |
|
|
echo "+++ Clean ELWIX FS release ..." |
echo "+++ Clean ELWIX FS release ..." |
rm -rf ${REL}/${OS} | rm -rf ${REL}/${OS} ${REL}/${OS_LITE} ${REL}/${OS_LITE128} |
} |
} |
|
|
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 54 build_fsdir()
|
Line 54 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 altroot/var/sys; |
install -d -o bind -g bind altroot/var/run/named; | install -d -o 53 -g 53 altroot/var/run/named; |
install -d -o quagga -g quagga altroot/var/run/quagga; | 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 |
# boot |
install -d boot; |
install -d boot; |
# cf |
# cf |
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 |
install -d home; |
install -d home; |
# root |
# root |
install -d -m 0700 root; |
install -d -m 0700 root; |
# local | # pkg |
install -d local; | install -d pkg; |
| install -d pkg/db; |
| install -d pkg/lib; |
# tftpboot |
# tftpboot |
install -d tftpboot; |
install -d tftpboot; |
|
|
Line 120 mkvar()
|
Line 123 mkvar()
|
echo "+++ Build ELWIX FS var directory ..." |
echo "+++ Build ELWIX FS var directory ..." |
ln -s /tmp $1/altroot/var/tmp |
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 146 mkvar()
|
Line 152 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 156 create_etc_motd()
|
Line 162 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 /elwix ufs ro 0 1 |
md3 /tmp mfs rw,-s8m,-oasync,-S 0 0 |
md3 /tmp mfs rw,-s8m,-oasync,-S 0 0 |
Line 167 _EOF
|
Line 173 _EOF
|
mketc() |
mketc() |
{ |
{ |
echo "+++ Build ELWIX FS etc directory ..." |
echo "+++ Build ELWIX FS etc directory ..." |
find ${FS_ETC} -name .#\* -exec rm -f {} \; |
|
|
|
InstallDir ${FS_ETC} $1/etc |
InstallDir ${FS_ETC} $1/etc |
|
|
find $1/etc -name CVS -exec rm -rf {} \; |
|
|
|
chown -R root:wheel $1/etc; |
chown -R root:wheel $1/etc; |
|
|
chmod 0600 $1/etc/opieaccess; |
chmod 0600 $1/etc/opieaccess; |
Line 187 mketc()
|
Line 189 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; |
|
|
|
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 198 mketc()
|
Line 203 mketc()
|
ln -sf /var/named/etc/namedb $1/etc/namedb; |
ln -sf /var/named/etc/namedb $1/etc/namedb; |
ln -sf /var/run/resolv.conf $1/etc/resolv.conf; |
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; |
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 ..." |
| CleanCVS $1 |
| CleanCVS $1/etc |
} |
} |
|
|
mkbackup() |
mkbackup() |
Line 210 mkbackup()
|
Line 221 mkbackup()
|
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 |
|
tar -czf altroot/backup/.etc.tgz etc |
|
|
cd altroot |
cd altroot |
tar -czf backup/.var.tgz var |
tar -czf backup/.var.tgz var |
} |
} |
Line 232 mkhome()
|
Line 244 mkhome()
|
|
|
install_fsdir() |
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 |
|
|
install -v ${REL}/${ROMFS_IMG} ${FS}/elwix-firmware-${VERSION}_${TARGET_ARCH} | case "$2" in |
ln -s /elwix/elwix-firmware-${VERSION}_${TARGET_ARCH} ${FS}/${ROMFS_IMG} | _[Ll][Ii][Tt][Ee]_128) |
| install -d $1/usr |
| cd $1/usr |
| pax -r -z -pe -f ${REL}/${ROMFS_IMG} |
| cd - |
|
|
cd $FS | install -d $1/usr/local |
tar -czvf ${REL}/${OS} . | cd $1/usr/local |
} | pax -r -z -pe -f ${REL}/${ROMFS_IMG2} |
| cd - |
|
|
cleancvs() | OSZ=${REL}/${OS_LITE128} |
{ | ;; |
echo "+++ ELWIX clean CVS tags ..." | _[Ll][Ii][Tt][Ee]) |
| install -d $1/usr |
| cd $1/usr |
| pax -r -z -pe -f ${REL}/${ROMFS_IMG} |
| cd - |
|
|
find $1 -type d -name CVS -exec rm -rf {} \; >/dev/null 2>&1 | OSZ=${REL}/${OS_LITE} |
| ;; |
| *) |
| 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} \ |
| $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} |
| ;; |
| esac |
| |
| cd $1 |
| tar -czvf $OSZ . |
} |
} |
|
|
### main() |
### main() |
Line 261 if [ ! -r ${REL}/${ROOTFS_KERN} -o ! -r ${REL}/${ROMFS
|
Line 305 if [ ! -r ${REL}/${ROOTFS_KERN} -o ! -r ${REL}/${ROMFS
|
fi |
fi |
|
|
clean_fsdir |
clean_fsdir |
build_fsdir |
|
|
|
|
build_fsdir ${FS} |
|
build_fsdir ${FS_LITE} |
|
build_fsdir ${FS_LITE128} |
|
|
mkboot ${FS} |
mkboot ${FS} |
|
mkboot ${FS_LITE} |
|
mkboot ${FS_LITE128} |
|
|
mkhome ${FS} |
mkhome ${FS} |
|
mkhome ${FS_LITE} |
|
mkhome ${FS_LITE128} |
|
|
mkvar ${FS} |
mkvar ${FS} |
|
mkvar ${FS_LITE} |
|
mkvar ${FS_LITE128} |
|
|
mketc ${FS} |
mketc ${FS} |
cleancvs ${FS} | mketc ${FS_LITE} "_lite" |
| mketc ${FS_LITE128} "_lite_128" |
| |
mkbackup ${FS} |
mkbackup ${FS} |
|
mkbackup ${FS_LITE} |
|
mkbackup ${FS_LITE128} |
|
|
install_fsdir | install_fsdir ${FS} |
| install_fsdir ${FS_LITE} "_lite" |
| install_fsdir ${FS_LITE128} "_lite_128" |
|
|
echo "+++ Complete build ELWIX FS" |
echo "+++ Complete build ELWIX FS" |
echo "ELWIX finish version ${VERSION}, Good luck!" |
echo "ELWIX finish version ${VERSION}, Good luck!" |