#!/bin/sh # (c) copyright 2010 by Thomas Tanner mountpoints="cdrom dev floppy home initrd media mnt nand proc sys syspart tmp" test "$#" -eq 0 && echo "$0 destination [source]" && exit 1 dest="$1" # rootfs destination (absolute path or device) #dest=`pwd` rawdest=no case $dest in /dev/mmcblk[01]p?) rawdest=yes echo destination is partition test -d /media/moebian && (echo cannot create mountdir; exit 1) mkdir -p /media/moebian mount $dest /media/moebian dest=/media/moebian ;; esac cd "$dest" # create toplevel dirs and nand mount point mountpoints="cdrom floppy home initrd media mnt nand proc srv sys syspart tmp" content="usr" copydirs="bin boot etc dev lib sbin root var" rm -rf $mountpoints $copydirs $content if test $dest = /home && test -L /opt; then if test -d opt.nand; then rm -rf opt mv opt.nand opt ln -sf $dest/opt /opt echo "/home/opt.nand moved to /home/opt and symlink updated" else echo "opt for NAND does not exist" fi fi rm /etc/bootmenu.d/moebian.item df -h $dest if test $rawdest = yes; then echo removing temporary mount point umount $dest && rm -rf $dest fi exit 0