备份Gentoo Linux的脚本,适用其他Linux的备份[2]

[入库:2006年2月23日] [更新:2007年3月24日]

本文简介:

                done
                if [ "$answer" == 'n' ]; then
                        default_exclude_list="$default_exclude_list $folder"
                fi
        done

        stage4Name=$stage4Location/$stage4prefix-custom
        final_command="tar $default_exclude_list $tarOptions $stage4Name.tar.bz2 /  /var/log/emerge.log"
        ;;
esac

# show what will be done
echo -e "\n* creating the stage4 at $stage4Location with the following options:\n\n"$final_command

# everything is set, are you sure to continue?
echo -ne "\nDo you want to continue? (y/n) "
read answer
while [ "$answer" != 'y' ] && [ "$answer" != 'n' ]; do
                        echo "please enter y or n"
                        read answer
done

if [ "$answer" == 'y' ]; then
        # mount boot
        echo -e "\n* mount boot"
        mount /boot >/dev/null 2>&1

        # if necessary, create the stage4Location
        if [ ! -d "$stage4Location" ] ; then
                echo "* creating directory $stage4Location"
                mkdir -p $stage4Location
        fi

        # check whether the file already exists
        if [ -a "$stage4Name.tar.bz2" ]; then
                echo -en "\nDo you want to overwrite $stage4Name.tar.bz2? (y/n) "
                read answer
                while [ "$answer" != 'y' ] && [ "$answer" != 'n' ]; do
                        echo "please enter y or n"
                        read answer
                done
                if [ "$answer" == 'n' ]; then
                        echo -e "\n* There's nothing to do ... Exiting"
                        exit 0;
                fi
        fi

        # do the backup
        time $final_command

        # copy the current world file to the stage4 location
        echo -e "\n* creating stage4 overview $stage4Name.txt"
        cp /var/lib/portage/world $stage4Name.txt >/dev/null 2>&1

        # we finished, clean up
        echo "* stage4 is done"
        echo "* umounting boot"
        umount /boot
else

本文关键:备份Gentoo Linux的脚本,适用其他Linux的备份
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top