-
Notifications
You must be signed in to change notification settings - Fork 0
/
rename-camera-blobs.sh
executable file
·59 lines (48 loc) · 1.34 KB
/
rename-camera-blobs.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
#!/bin/bash -e
GIT_MV="1"
PREFIX="$1"
if [ ! -d "bin" ] && [ ! -d "lib" ]; then
echo "Please enter vendor/MANUFACTURER/DEVICE/proprietary/vendor first"
exit 1
fi
if [ "$(echo -n $PREFIX | wc -m)" != "1" ]; then
echo "Invalid prefix"
exit 1
fi
if [ "$GIT_MV" ]; then
MV="git mv"
else
MV="mv"
fi
set -x
cd bin
sed -i "s|libmmcamera_|lib${PREFIX}mcamera_|g" *
sed -i "s|libmmcamera2_|lib${PREFIX}mcamera2_|g" *
if [ "$GIT_MV" ]; then
git add .
fi
cd ..
cd etc
${MV} camera ${PREFIX}amera
cd ..
cd lib
# Common blobs
sed -i "s|libactuator_|lib${PREFIX}ctuator_|g" libmmcamera2_sensor_modules.so
sed -i "s|libchromatix_|lib${PREFIX}hromatix_|g" libmmcamera2_sensor_modules.so
sed -i "s|libflash_|lib${PREFIX}lash_|g" libmmcamera2_sensor_modules.so
sed -i "s|etc/camera|etc/${PREFIX}amera|g" libmmcamera2_sensor_modules.so
sed -i "s|libmmcamera_|lib${PREFIX}mcamera_|g" *.so
sed -i "s|libmmcamera2_|lib${PREFIX}mcamera2_|g" *.so
# Misc blobs
for blob in `ls *.so|grep -vE "libactuator_|libchromatix_|libmmcamera_|libmmcamera2_"`; do
NEW_NAME=$(echo ${blob}|sed "s|.|${PREFIX}|4")
sed -i "s|${blob}|${NEW_NAME}|g" $(ls *.so|grep -vE "libactuator_|libchromatix_")
done
if [ "$GIT_MV" ]; then
git add .
fi
for blob in `ls *.so`; do
${MV} ${blob} $(echo ${blob}|sed "s|.|${PREFIX}|4")
done
cd ..
find . -type f|sort|sed "s|\./||g" > ../../blobs.txt