-
Notifications
You must be signed in to change notification settings - Fork 0
/
Restore.sh
executable file
·116 lines (112 loc) · 3.18 KB
/
Restore.sh
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
112
113
114
115
116
#!/bin/sh
#Script for restoring the backup of Arch Linux conf files to the original position as links and deletes the current files
echo "Hi"
echo "If you have a good idea to improve this program"
echo "or if you want to tell me that you don't like my script "
echo "you can send an email to me. Maybe I even will answer."
echo "My e-mail Adress : [email protected]"
echo "I am thankful for every Feedback."
echo ""
echo "This script is going to delete the original files and then restore the backedup files as links to the original location."
echo ""
echo "Do you want a list of the files that will be deleted? (y/n):"; read -r answer
if [ "$answer" = "n" ]; then
echo ""
echo "Ok, lets go on!"
fi
if [ "$answer" = "y" ]; then
echo ""
echo "The following packages will be deleted:"
echo " /etc/modules-load.d
/etc/modprobe.d
/etc/cron.*
/etc/samba/
/etc/conf.d/
/etc/X11/
/home/$USER/.conky/*
/etc/sddm.conf
/etc/mkinitcpio.conf
/etc/pacman.conf
/etc/bash.bashrc
/etc/motd"
fi
echo ""
echo "Do you want to delete the BackedUp system files?"
echo "Your answer y / n :"; read -r answer
if [ "$answer" = "n" ]; then
echo ""
echo "Thank you. Bye!"
exit
fi
if [ "$answer" = "y" ]; then
echo ""
echo "Okay lets start!"
echo ""
echo "Removing system files."
sudo rm -R /etc/modules-load.d
sudo rm -R /etc/modprobe.d
sudo rm -R /etc/cron.*
sudo rm -R /etc/samba
sudo rm -R /etc/conf.d
sudo rm -R /etc/X11
sudo rm -R /home/$USER/.conky
sudo rm /etc/sddm.conf
# sudo rm /etc/fstab ##It's not working for me because i have the backup folder on another hdd.
sudo rm /etc/mkinitcpio.conf
sudo rm /etc/pacman.conf
sudo rm /etc/bash.bashrc
sudo rm /home/$USER/.bashrc
sudo rm /etc/motd
echo ""
echo "Done! All Files have been removed."
fi
echo ""
echo "Do you want a list of the files that will be linked? (y/n):"; read -r answer
if [ "$answer" = "n" ]; then
echo ""
echo "Ok, lets go on!"
fi
if [ "$answer" = "y" ]; then
echo ""
echo "The following packages will be linked:"
echo " /etc/modules-load.d
/etc/modprobe.d
/etc/cron.*
/etc/samba/
/etc/conf.d/
/etc/X11/
/home/$USER/.conky/*
/etc/sddm.conf
/etc/mkinitcpio.conf
/etc/pacman.conf
/etc/bash.bashrc
/etc/motd"
fi
echo ""
echo "Do you want to create symbolic links to the original location?"
echo "Your answer y / n :"; read -r answer
if [ "$answer" = "n" ]; then
echo ""
echo "Thank you. Bye!"
exit
fi
if [ "$answer" = "y" ]; then
echo ""
echo "Okay lets start!"
sudo ln -s $PWD/modules-load.d /etc/modules-load.d
sudo ln -s $PWD/modprobe.d /etc/modprobe.d
sudo ln -s $PWD/cron/cron.* /etc/
sudo ln -s $PWD/samba /etc/samba
sudo ln -s $PWD/conf.d /etc/conf.d
sudo ln $PWD/X11 /etc/X11
sudo ln -s $PWD/conky /home/nenpo/.conky
sudo ln -s $PWD/sddm.conf /etc/sddm.conf
# sudo ln $PWD/fstab /etc/fstab ##It's not working for me because i have the backup folder on another hdd.
sudo ln -s $PWD/mkinitcpio.conf /etc/mkinitcpio.conf
sudo ln -s $PWD/pacman.conf /etc/pacman.conf
sudo ln -s $PWD/bash.bashrc /etc/bash.bashrc
sudo ln -s $PWD/bash.bashrc /home/nenpo/.bashrc
sudo ln -s $PWD/motd /etc/motd
echo ""
echo "Done! Everyhing is linked back. Bye!"
fi