-
Notifications
You must be signed in to change notification settings - Fork 0
/
customize.sh
126 lines (116 loc) · 4.07 KB
/
customize.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
117
118
119
120
121
122
123
124
125
126
# Mount ro partitions
mount_name efs /efs '-o ro'
mount_name sec_efs /sec_efs '-o ro'
mount_name product /product '-o ro'
mount_name odm /odm '-o ro'
mount_name prism /prism '-o ro'
mount_name optics /optics '-o ro'
# Functions
get_omc_path() {
local omc_code="$1"
if [ -d "/product/omc/" ]; then
if [ -d "/product/omc/${omc_code}/etc" ]; then
omc_etcpath=/product/omc/${omc_code}/etc
fi
omc_root=/product/omc
omc_path=/product/omc/${omc_code}/conf
elif [ -d "/odm/omc/" ]; then
if [ -d "/odm/omc/${omc_code}/etc" ]; then
omc_etcpath=/odm/omc/${omc_code}/etc
fi
omc_root=/odm/omc
omc_path=/odm/omc/${omc_code}/conf
elif [ -d "/system/omc/" ]; then
if [ -d "/system/omc/${omc_code}/etc" ]; then
omc_etcpath=/system/omc/${omc_code}/etc
fi
omc_root=/system/omc
omc_path=/system/omc/${omc_code}/conf
elif [ -d "/product/etc/omc/" ]; then
if [ -d "/product/etc/omc/${omc_code}/etc" ]; then
omc_etcpath=/product/etc/omc/${omc_code}/etc
fi
omc_root=/product/etc/omc
omc_path=/product/etc/omc/${omc_code}/conf
elif [ -d "/odm/etc/omc/" ]; then
if [ -d "/odm/etc/omc/${omc_code}/etc" ]; then
omc_etcpath=/odm/etc/omc/${omc_code}/etc
fi
omc_root=/odm/etc/omc
omc_path=/odm/etc/omc/${omc_code}/conf
elif [ -d "/system/etc/omc/" ]; then
if [ -d "/system/etc/omc/${omc_code}/etc" ]; then
omc_etcpath=/system/etc/omc/${omc_code}/etc
fi
omc_root=/system/etc/omc
omc_path=/system/etc/omc/${omc_code}/conf
else
if [ -d "/prism/etc/carriers/" ]; then
if [ -d "/prism/etc/carriers/single/${omc_code}" ]; then
omc_etcpath=/prism/etc/carriers/single/${omc_code}
elif [ -d "/prism/etc/carriers/${omc_code}" ]; then
omc_etcpath=/prism/etc/carriers/${omc_code}
fi
if [ -d "/optics/configs/carriers/" ]; then
if [ -d "/optics/configs/carriers/single/" ]; then
omc_root=/optics/configs/carriers/single
omc_path=/optics/configs/carriers/single/${omc_code}/conf
if [ -d "/optics/configs/carriers/single/${omc_code}/conf/system/" ]; then
mdc_path=/optics/configs/carriers/single/${omc_code}/conf/system
fi
else
omc_root=/optics/configs/carriers
omc_path=/optics/configs/carriers/${omc_code}/conf
if [ -d "/optics/configs/carriers/${omc_code}/conf/system/" ]; then
mdc_path=/optics/configs/carriers/${omc_code}/conf/system
fi
fi
fi
fi
fi
}
add_csc_feature() {
feature=$1
value=$2
lineNumber=0
lineNumber=`sed -n "/<${feature}>.*<\/${feature}>/=" $MODPATH/$i`
if [ $lineNumber > 0 ] ; then
ui_print "- Found feature $feature in line $lineNumber and changing it to ${value} in $i"
sed -i "${lineNumber} c<${feature}>${value}<\/${feature}>" $MODPATH/$i
else
ui_print "- Adding feature $feature to the feature set in $i"
sed -i "/<\/FeatureSet>/i \ \ <${feature}>${value}<\/${feature}>" $MODPATH/$i
fi
}
# Paths
path_mps="/efs/imei/mps_code.dat";
path_mps2="/sec_efs/imei/mps_code.dat";
# Your script starts here
omc_code=`cat ${path_mps} 2>/dev/null`;
[ ! -z "$omc_code" ] || omc_code=`cat ${path_mps2} 2>/dev/null`;
get_omc_path ${omc_code}
[ -z "$mdc_path" ] || omc_path=$mdc_path
original_files=`find $omc_path -type f -name 'cscfeature.xml'`
ui_print "- Copy omc files"
chmod 755 $MODPATH/omc-decoder
mkdir -p $MODPATH/$omc_path
cp -aR $omc_path/* $MODPATH/$omc_path
ui_print "- Start decodeing..."
xml_pattern="<?xml version=[\"']1.0[\"'] encoding=[\"']UTF-8[\"']?>"
for i in $original_files; do
if `$MODPATH/omc-decoder -d $MODPATH/$i $MODPATH/$i` ; then
ui_print "- Successfully decoded $i!"
else
ui_print "- Not decoded $i!"
fi
# Add CSC Features if decoded
if `grep -ixq "$xml_pattern" $MODPATH/$i` ; then
add_csc_feature CscFeature_VoiceCall_ConfigRecording RecordingAllowed
fi
done
# Change Module OMC Path
sed -i "s~omc\_path~$omc_path~g" $MODPATH/post-fs-data.sh;
# Set executable permissions
set_perm_recursive "$MODPATH" 0 0 0755 0644
# Clean up files
rm -rf $MODPATH/omc-decoder