#!/bin/sh
# url: http://pank.org/scripts/
# description: copy system to another disk
# comment: csh bash
# platform: linux

if [ -z $1 ] ; then
    echo "Usage: `basename $0` {directory}"
else
    mkdir $1/home $1/mnt $1/proc $1/tmp
    chmod 777 $1/tmp
    cp -a bin boot dev etc initrd lib root sbin usr var $1
    echo "Install GRUB to hd1?"
    read ANS
    if [ "$ANS" = y ] ; then
        printf "root (hd1,0)\nsetup (hd1)\nquit\n" | grub --no-floppy --batch > /dev/null 2>&1
    fi
fi