-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathv4-rename-driver.sh
executable file
·52 lines (38 loc) · 1.9 KB
/
v4-rename-driver.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
#!/bin/bash
echo "Script -> script migration"
function find_all() {
find . -name "*" -not \( -path "*/.git/*" -o -path "*/src_core/*" -o -path "*.xlsm" \) -type f -print0
}
## c2a-core ref
echo "rename c2a-core ref: Drivers -> driver"
find_all | xargs -0 sed -i -e "s#src_core/Drivers/Super#src_core/driver#g"
find_all | xargs -0 sed -i -e "s#src_core\\\Drivers\\\Super#src_core\\\driver#g"
find_all | xargs -0 sed -i -e "s#src_core/Drivers/Protocol#src_core/driver#g"
find_all | xargs -0 sed -i -e "s#src_core\\\Drivers\\\Protocol#src_core\\\driver#g"
find_all | xargs -0 sed -i -e "s#src_core/Drivers#src_core/driver#g"
find_all | xargs -0 sed -i -e "s#src_core\\\Drivers#src_core\\\driver#g"
find_all | xargs -0 sed -i -e "s#\${C2A_CORE_DIR}/Drivers#\${C2A_CORE_DIR}/driver#g"
# C2A user code
echo "rename C2A user code: Drivers -> driver"
mv src/src_user/Drivers src/src_user/driver
find_all | xargs -0 sed -i -e "s#\${C2A_USER_DIR}/Drivers#\${C2A_USER_DIR}/driver#g"
drv_org=("Aocs" "Cdh" "Com" "Etc" "Mission" "Power" "Prop" "Thermal")
drv_new=("aocs" "cdh" "com" "etc" "mission" "power" "prop" "thermal")
echo "rename dir: driver/Drivers -> driver/driver"
for ((i=0; i<${#drv_org[@]}; i++)); do
echo " driver/${drv_org[i]} -> driver/${drv_new[i]}"
mv src/src_user/driver/${drv_org[i]} src/src_user/driver/${drv_new[i]}
done
echo "rename ref: Drivers -> driver"
for ((i=0; i<${#drv_org[@]}; i++)); do
echo " Driver/${drv_org[i]} -> driver/${drv_new[i]}"
find_all | xargs -0 sed -i -e "s#Drivers/${drv_org[i]}#driver/${drv_new[i]}#g"
find_all | xargs -0 sed -i -e "s#Drivers\\\${drv_org}#driver\\\${drv_new}#g"
done
# CMake
for ((i=0; i<${#drv_org[@]}; i++)); do
echo "rename ref: ${drv_org[i]} -> ${drv_new[i]}"
find_all | xargs -0 sed -i -e "s#${drv_org[i]}/#${drv_new[i]}/#g"
done
# Script
find src/src_user/script -name "*" -not -path "*/.git/*" -type f -print0 | xargs -0 sed -i -e "s#Drivers#driver#g"