Created
August 9, 2010 05:31
-
-
Save frogonwheels/514982 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| !/bin/bash | |
| # vim: filetype=csh | |
| latest=$(cat /home/backup/latestsnap) | |
| srcdir=/home/built/openwrt/${latest}/x86 | |
| owroot= | |
| bootpart=/dev/hda1 | |
| kernel=${srcdir}/openwrt-x86-Kontron-vmlinuz | |
| if [ ! -f ${kernel} ] ; then | |
| echo Missing: ${kernel} | |
| exit 1 | |
| fi | |
| rootfs=${srcdir}/openwrt-x86-Kontron-rootfs.tar.gz | |
| if [ ! -f ${rootfs} ] ; then | |
| echo Missing: ${rootfs} | |
| exit 1 | |
| fi | |
| if [ ! -d ${owroot}/tmp ] ; then | |
| echo Is ${owroot}/ mounted? | |
| exit 1 | |
| fi | |
| if [ -d ${owroot}/src ] ; then | |
| [ -d ${owroot}/last/ ] && rm -rf ${owroot}/last/* | |
| [ -d ${owroot}/last/ ] || mkdir ${owroot}/last | |
| fi | |
| /home/backup/backup | |
| /etc/init.d/lucid stop | |
| /etc/init.d/asterisk stop | |
| /etc/init.d/xmail stop | |
| /etc/init.d/fourohseven stop | |
| /etc/init.d/ser2net stop | |
| [ -d /boot/ ] || mkdir /boot/ | |
| [ -f /boot/boot/vmlinuz ] || mount ${bootpart} /boot/ | |
| if [ ! -f /boot/boot/vmlinuz ] ; then | |
| echo "Unable to find boot partition on ${bootpart}" | |
| exit | |
| fi | |
| mv /boot/boot/vmlinuz /boot/boot/vmlinuz.old | |
| cp ${kernel} /boot/boot/vmlinuz | |
| cd / | |
| cp /bin/busybox /tmp | |
| b=/tmp/busybox | |
| # lib | |
| for i in bin sbin usr etc www lib ; do | |
| $b mv /$i /last/$i | |
| done | |
| export LD_LIBRARY_PATH=/last/lib:/lib:${LD_LIBRARY_PATH} | |
| # This doesn't work either. | |
| # b="LD_LIBRARY_PATH=/last/lib /tmp/busybox" | |
| ### This fails ######### | |
| $b tar -xzf ${rootfs} | |
| echo "Done" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment