Ripped out some stuff and cleaned up, ready to start a rebuild.
This commit is contained in:
parent
dcc49a3863
commit
b4d8eb7cf1
96
Backup.sh
96
Backup.sh
|
@ -14,93 +14,17 @@
|
|||
# Run the script
|
||||
#./Backup.sh
|
||||
|
||||
# Change the following parameters to suit your setup...
|
||||
# Change the following variables to suit your setup...
|
||||
|
||||
id=/media/truecrypt1/tc1.txt # So we can see if the destination volume is available. You must have the corresponding file in the destination.
|
||||
src=/home/somebody
|
||||
dest=/media/truecrypt1
|
||||
|
||||
################################################################################
|
||||
######################## Here be dragons... ;-)! ###############################
|
||||
################################################################################
|
||||
|
||||
# Make sure the user has cleaned the system first.
|
||||
echo "
|
||||
###################################
|
||||
# #
|
||||
# Have you run Bleachbit? (y/n) #
|
||||
# #
|
||||
###################################"
|
||||
read -r answer
|
||||
until [ "$answer" = y ] || [ "$answer" = n ];
|
||||
do echo "
|
||||
####################################
|
||||
# #
|
||||
# That is an invalid answer. #
|
||||
# Please enter either 'y' or 'n' #
|
||||
# #
|
||||
####################################" && read -r answer
|
||||
done
|
||||
if [ "$answer" = y ];
|
||||
then echo "
|
||||
##############################################
|
||||
# #
|
||||
# Great, we will proceed to the nest step! #
|
||||
# #
|
||||
##############################################"
|
||||
elif [ "$answer" = n ];
|
||||
then echo "
|
||||
###############################################
|
||||
# #
|
||||
# Please do so and then re-run this script. #
|
||||
# Aborting! #
|
||||
# #
|
||||
###############################################" && read -r && exit 1
|
||||
else echo ""
|
||||
|
||||
fi
|
||||
|
||||
# Ascertain if the destination volume is available. If not terminate the script.
|
||||
if [ -f $id ]
|
||||
then vol=y
|
||||
else vol=n && echo "
|
||||
################################################################
|
||||
# !!!~ERROR~!!! #
|
||||
# #
|
||||
# Destination volume not found. #
|
||||
# Please mount the slave drive and then re-run this script ! #
|
||||
# #
|
||||
# Press Enter to close this window. #
|
||||
# #
|
||||
################################################################" && read -r && exit 1
|
||||
fi
|
||||
|
||||
# If the dest' vol' is available, then notify user!
|
||||
if [ $vol = y ]
|
||||
then echo "
|
||||
###############################################################
|
||||
# #
|
||||
# Destination volume found, we can proceed! #
|
||||
# #
|
||||
# Please note there are three choices to be made as to what #
|
||||
# you would like to back up, those being... #
|
||||
# #
|
||||
# - Just Firefox #
|
||||
# - Just Thunderbird #
|
||||
# - Just your home directory (excluding the two above). #
|
||||
# #
|
||||
# You can choose all, or any combination of the three. #
|
||||
# #
|
||||
# Note that the Desktop is backed up differentially, #
|
||||
# everything else incrementally. #
|
||||
# #
|
||||
###############################################################"
|
||||
fi
|
||||
# End variables
|
||||
|
||||
# Start the timer.
|
||||
res1=$(date +%s.%N)
|
||||
|
||||
# Ask if the user would like to back the three main things this script is designed to back up.
|
||||
# Ask if the user would like to backup the three main things this script is designed to back up.
|
||||
echo "
|
||||
############################################
|
||||
# #
|
||||
|
@ -173,19 +97,6 @@ then rsync -av --progress --delete-after $src/Desktop/ $dest/Desktop && rsync -a
|
|||
else echo "Home not being backed up."
|
||||
fi
|
||||
|
||||
echo "Now backing up PPAs"
|
||||
grep -RoPish '(?<=ppa.launchpad.net/)[^/]+/[^/ ]+' /etc/apt | sort -u | sed 's/^/ppa:/' > $dest/Documents/Backups/PPAs.txt
|
||||
|
||||
##########################################################################
|
||||
# To reinstate the PPAs, try running... #
|
||||
# <~/ppa-backup.txt xargs -I % sudo add-apt-repository % #
|
||||
# Source; https://askubuntu.com/questions/28644/how-can-i-backup-my-ppas #
|
||||
##########################################################################
|
||||
|
||||
echo "
|
||||
Now backing up list of installed app's"
|
||||
dpkg --get-selections > $dest/Documents/Backups/Installed_app-list.txt
|
||||
|
||||
# Let the user know we have finished!
|
||||
res2=$(date +%s.%N)
|
||||
dt=$(echo "$res2 - $res1" | bc)
|
||||
|
@ -197,7 +108,6 @@ dm=$(echo "$dt3/60" | bc)
|
|||
ds=$(echo "$dt3-60*$dm" | bc)
|
||||
|
||||
printf "
|
||||
# shellcheck disable=SC2086
|
||||
Total runtime: %d:%02d:%02d:%02.4f\n" "$dd" "$dh" "$dm" "$ds"
|
||||
echo "
|
||||
#########################################
|
||||
|
|
Loading…
Reference in New Issue