Browse Source

Added full rsync backup

red-hat-laptop
Kevin Mok 6 years ago
parent
commit
1c200b74a7
Signed by: Kevin-Mok GPG Key ID: AEA75288DC135CF5
  1. 2
      README.md
  2. 2
      aliases/zsh_aliases
  3. 2
      configs/neofetch/config.conf
  4. 4
      dotfiles/.vimrc
  5. 18
      scripts/backup.sh
  6. 6
      setup.sh
  7. 8
      txt/exclude-dirs-backup-full.txt

2
README.md

@ -16,7 +16,7 @@ are also for my Linux
* **Terminal**: [rxvt-unicode-pixbuf](https://www.wikiwand.com/en/Rxvt)
* **Shell**: [Zsh](http://zsh.sourceforge.net/) + [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh)
* **Window Manager**: [i3-gaps](https://github.com/Airblader/i3)
* **Editor**: [Neovim](https://github.com/neovim/neovim) ([plugins](dotfiles/vimrc#L51))
* **Editor**: [Neovim](https://github.com/neovim/neovim) ([plugins](dotfiles/.vimrc#L51))
* **File Manager**: [ranger](https://ranger.github.io/)
<!--- }}} Basic Info -->

2
aliases/zsh_aliases

@ -262,7 +262,7 @@ function gcm(){ echo git commit -m \""$1"\" ; }
function psgi() {
git add .
git commit -m -S '.'
git commit -mS '.'
git push
}
alias gps="git push"

2
configs/neofetch/config.conf

@ -336,7 +336,7 @@ public_ip_host="http://ident.me"
# disk_show=('/'):
# 'Disk (/): 74G / 118G (66%)'
#
disk_show=('/' '/dev/sda3')
disk_show=('/' '/home' )
# Disk subtitle.
# What to append to the Disk subtitle.

4
dotfiles/.vimrc

@ -193,8 +193,8 @@ nnoremap <C-w> <C-W>|
" leader mappings {{{ "
let mapleader="\<Space>"
" replace vim-commentary Markdown comments with HTML
nnoremap <leader>cmt :%s/>\(.*\)>/<!---\1-->/g<CR>
" replace until end of line
nnoremap <leader>c c$
" delete entire buffer
nnoremap <leader>dg ggdG
" delete line into system clipboard

18
scripts/backup.sh

@ -1,19 +1,31 @@
#!/bin/bash
mount_dir="/run/media/kevin"
# Backup destination
case $1 in
nzxt )
backup_dest="/run/media/kevin/backup-hd/nzxt"
backup_dest="$mount_dir/backup-hd/nzxt"
# backup_dest="$mount_dir/backup-usb/nzxt"
;;
x1 )
backup_dest="/run/media/kevin/laptop-backup"
backup_dest="$mount_dir/laptop-backup"
;;
esac
exclude_dirs_list="/home/kevin/linux-config/txt/exclude-dirs-backup.txt"
exclude_dirs_list_full="/home/kevin/linux-config/txt/exclude-dirs-backup-full.txt"
case $2 in
tar )
# Labels for backup name
distro="arch"
datetime=$(date "+%m.%d-%H.%M")
backup_file="$backup_dest/$datetime-$distro.tar.gz"
backup_file="$backup_dest/tar/$datetime-$distro.tar.gz"
sudo tar -czpvf "$backup_file" --exclude-from="$exclude_dirs_list" /
;;
full )
sudo rsync -PraAX --exclude-from="$exclude_dirs_list_full" / "$backup_dest/full"
sudo rsync -PraAX /home "$backup_dest/full/home"
# echo rsync -PraAX --exclude-from="$exclude_dirs_list_full" / "$backup_dest/full"
# echo rsync -PraAX /home "$backup_dest/full/home"
esac

6
setup.sh

@ -19,14 +19,14 @@ link_to_lc () {
item_name=$(basename -- "$item")
# echo "$item_name"
# Remove system item and link config in repository to system.
rm -f "${sys_dir:?}"/"$item_name"
rm -rf "${sys_dir:?}"/"$item_name"
ln -s "$config_dir"/"$item_name" "$sys_dir"/"$item_name" && echo "Linked $item_name."
done
}
link_to_lc "files" "$HOME" "$lc_dir/dotfiles"
# link_to_lc "dirs" "$HOME/.config" "$lc_dir/configs"
# link_to_lc "dirs" "$HOME/.themes" "$lc_dir/gtk/themes"
link_to_lc "dirs" "$HOME/.config" "$lc_dir/configs"
link_to_lc "dirs" "$HOME/.themes" "$lc_dir/gtk/themes"
# setup nvim config
# nvim_file="/home/kevin/lc-test/init.vim"

8
txt/exclude-dirs-backup-full.txt

@ -0,0 +1,8 @@
/dev/*
/lost+found
/media/*
/mnt/*
/proc/*
/run/*
/sys/*
/tmp/*
Loading…
Cancel
Save