tar-backup.shon commit improve webp-convert.sh (b8ae487)
   1#!/bin/bash
   2# full system backup
   3# taken from Arch Wiki:
   4# https://wiki.archlinux.org/index.php/Full_system_backup_with_tar
   5
   6# Backup destination
   7backdest=/backup
   8
   9# Labels for backup name
  10#PC=${HOSTNAME}
  11pc=ruslan
  12distro=arch
  13type=full
  14date=$(date "+%F")
  15backupfile="$backdest/$distro-$type-$date.tar.gz"
  16
  17# Exclude file location
  18prog=${0##*/} # Program name from filename
  19excdir="/home/<user>/.bin/root/backup"
  20exclude_file="$excdir/$prog-exc.txt"
  21
  22# Check if chrooted prompt.
  23echo -n "First chroot from a LiveCD.  Are you ready to backup? (y/n): "
  24read executeback
  25
  26# Check if exclude file exists
  27if [ ! -f $exclude_file ]; then
  28  echo -n "No exclude file exists, continue? (y/n): "
  29  read continue
  30  if [ $continue == "n" ]; then exit; fi
  31fi
  32
  33if [ $executeback = "y" ]; then
  34  # -p and --xattrs store all permissions and extended attributes. 
  35  # Without both of these, many programs will stop working!
  36  # It is safe to remove the verbose (-v) flag. If you are using a 
  37  # slow terminal, this can greatly speed up the backup process.
  38  tar --exclude-from=$exclude_file --xattrs -czpvf $backupfile /
  39fi
  40