* 稍微清理了脚本
* Made it so the --exclude= for the archive doesn't have to be edited if you modify $stage4Location
* 添加了 --exclude=/var/tmp/*
* 为tar添加了 --verbose 选择
* 添加了删除 /bootcpy的代码
* 将$tarOptions输出的“ --exclude 目录/文件”移到了他们自己的变量中。 (感谢 kamilian )
File|mkstage4.sh
#! /bin/bash
## Backup script for Gentoo Linux
## Author: BrianW
## Date: 2004.10.26.
## Adapted from backupHome.sh by fdavid
## Adapted from mkstage4.sh by nianderson
## This is a script to create a custom stage 4 tarball (System and boot backup)
## I use this script to make a snapshot of my system. Meant to be done weekly in my case
## Please check the options and adjust to your specifics.
echo -=- Starting the Backup Script...
echo -=-
echo -=- Setting the variables...
## The location of the stage 4 tarball.
## Be sure to include a trailing / (译注:注意包含一个根)
stage4Location=/
## The name of the stage 4 tarball. (译注:stage4压缩包的名称)
archive=$stage4Location$(hostname)-stage4.tar.bz2
## Directories/files that will be exluded from the stage 4 tarball.
##
## Add directories that will be recursively excluded, delimited by a space.
## Add files that will be excluded, delimited by a space.
## You can use the * wildcard for multiple matches.
## There should always be $archive listed or bad things will happen.
file_excludes="$archive"
##
## Combine the two *-excludes variables into the $excludes variable
excludes="$(for i in $dir_excludes; do if [ -d $i ]; then echo -n " --exclude=$i/*"; fi; done) $(for i in $file_excludes; do echo -n " --exclude=$i"; done)"
## The options for the stage 4 tarball. (译注:stage4压缩选项)