-
Notifications
You must be signed in to change notification settings - Fork 2
/
cpfile.sh
executable file
·80 lines (74 loc) · 2.46 KB
/
cpfile.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
#!/usr/bin/bash
#
function fcp(){
local path="$1"
eval "local dpath=\$(echo '$path' | sed 's/^/.\\/rootfs/' | sed 's/\\/[^/]*$//')"
if [ ! -e "$dpath" ]; then
eval "mkdir -p '$dpath'"
echo -e " \e[2;37mmkdir -p '$dpath'\e[0m"
fi
if [ -f "$path" ]; then
eval "cp -f '$path' '$dpath'"
echo -e " \e[2;37mcp -f '$path' '$dpath'\e[0m"
elif [ -d "$path" ]; then
eval "cp -Rf '$path' '$dpath'"
echo -e " \e[2;37mcp -Rf '$path' '$dpath'\e[0m"
elif [[ $path =~ [^/]*\*[^/]*$ ]]; then
eval "local p=\$(echo '$path' | sed 's/.*\\/\([^/]*\)$/\1/' | sed 's/\\./\\\\./g' | sed 's/\\*/.*/g')"
eval "local spath=\$(echo '$dpath' | sed 's/^\\.\\/rootfs//')"
eval "local fs=\$(ls -1 '$spath' | egrep '$p' | tr '\n' ' ')"
eval "local fa=($fs)"
for f in ${fa[@]};do
eval "cp -f '${spath}/${f}' '$dpath'"
echo -e " \e[2;37mcp -f '${spath}/${f}' '$dpath'\e[0m"
done
fi
}
eval "dir=\$(dirname $0)"
eval "cd $dir"
echo -e " \e[2;37mcd $dir\e[0m"
rm -rf ./rootfs
mkdir ./rootfs
fcp /.cc.map
fcp /etc/acpi/events/vol-m
fcp /etc/default/grub
fcp /etc/default/tlp
fcp /etc/fstab
fcp /etc/hostname
fcp /etc/mkinitcpio.conf
fcp /etc/NetworkManager/NetworkManager.conf
fcp /etc/pam.d/login
fcp /etc/pam.d/passwd
fcp /etc/sysctl.d
fcp /etc/udev/rules.d
fcp /etc/X11/xorg.conf.d
fcp /etc/razer.conf
fcp /etc/pacman.conf
fcp /etc/sddm.conf
fcp /etc/iproute2/rt_tables
fcp /home/u/.config/awesome
fcp /home/u/.config/fcitx/skin
fcp /home/u/.config/fcitx/rime/default.yaml
fcp /home/u/.config/Code/User/settings.json
fcp /home/u/.config/sakura
fcp /home/u/.config/compton.conf
fcp /home/u/.config/kitty/kitty.conf
fcp /home/u/.vimrc
fcp /home/u/.Xresources
fcp /home/u/.xinitrc
fcp /home/u/.zsh
fcp /home/u/.zshrc
fcp /home/u/.zprofile
fcp /opt/bin/\*.sh
fcp /root/.vimrc
fcp /root/.zshrc
fcp /usr/share/sddm/themes/Starcraft
fcp /lib/systemd/system/custom-startup.service
fcp /lib/systemd/system/i3lock@.service
fcp /lib/systemd/system/myresuming@.service
fcp /lib/systemd/system/openconnect@.service
fcp /lib/systemd/system/net-checker@.service
fcp /lib/systemd/system/nmcontrol.service
fcp /home/u/.local/share/applications/netease-musicbox.desktop
sed -i 's/theme\.weather_widget_city.*/theme.weather_widget_city = {"Wuxi,CN", "Shenzhen,CN"}/' ./rootfs/home/u/.config/awesome/themes/my/theme.lua
sed -i 's/theme\.weather_widget_api_key.*/theme.weather_widget_api_key = ""/' ./rootfs/home/u/.config/awesome/themes/my/theme.lua