about summary refs log tree commit diff
path: root/backup.sh
blob: f60094d6c5528a0057effe1540e1d50c389d2063 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/sh

### Functions
prepare() {
    for i in etc var usr; do
        [ -d "./$i" ] &&
            rm -rf "./$i"
    done
}

mkdir_check() {
    [ ! -d "$1" ] &&
        mkdir -p "$1"
}

rm_check() {
    if [ -d "$1" ] || [ -f "$1" ]; then
        rm -rf "$1"
    fi
}

dump_dir() {
    mkdir_check ".$1"
    rsync --archive "$1/" ".$1"
}

dump_file() {
    rsync --archive "$1" ".$1"
}

### Prepare
prepare

### Dump
# portage
dump_dir /etc/portage
mkdir_check ./var/lib/portage
dump_file /var/lib/portage/world
dump_file /var/lib/portage/world_sets

# eclean
dump_dir /etc/eclean

# X11
dump_dir /etc/X11/xorg.conf.d

# doas
dump_file /etc/doas.conf

# Python
dump_dir /etc/python-exec

# Kernel
mkdir_check ./usr/src/linux
zcat /proc/config.gz >./usr/src/linux/.config

# Kernel modules
dump_dir /etc/modprobe.d
dump_dir /etc/modules-load.d

# sysctl
dump_dir /etc/sysctl.d
dump_file /etc/sysctl.conf

# OpenRC
dump_dir /etc/runlevels
dump_dir /etc/conf.d

# udev
dump_dir /etc/udev/rules.d
dump_file /etc/udev/udev.conf

# env.d
dump_dir /etc/env.d

# fontconfig
dump_dir /etc/fonts/conf.d

# laptop-mode-tools
mkdir_check ./etc/laptop-mode
dump_file /etc/laptop-mode/laptop-mode.conf
mkdir_check ./etc/laptop-mode/conf.d
dump_file /etc/laptop-mode/conf.d/intel-hda-powersave.conf
dump_file /etc/laptop-mode/conf.d/intel-sata-powermgmt.conf
dump_dir /etc/pm

# UPower
dump_dir /etc/UPower

# syslog-ng
mkdir_check ./etc/syslog-ng
dump_file /etc/syslog-ng/syslog-ng.conf

# logrotate
dump_dir /etc/logrotate.d
dump_file /etc/logrotate.conf

# Misc.
dump_file /etc/buildkernel.conf
dump_file /etc/dispatch-conf.conf
dump_file /etc/filesystems
dump_file /etc/fstab
dump_file /etc/fuse.conf
dump_file /etc/genkernel.conf
dump_file /etc/hdparm.conf
dump_file /etc/issue
dump_file /etc/locale.gen
dump_file /etc/login.defs
dump_file /etc/mpd.conf
dump_file /etc/thinkfan.conf
dump_file /etc/timezone

Consider giving Nix/NixOS a try! <3