-
Notifications
You must be signed in to change notification settings - Fork 7
/
fcc_unlock_setup.sh
executable file
·95 lines (73 loc) · 2.57 KB
/
fcc_unlock_setup.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
#! /bin/bash
### Insure the working directory is the same as the script
pushd "$(dirname "$0")" &> /dev/null || exit 1
trap "popd &> /dev/null" EXIT
echo "Copying files and libraries..."
if [ ! -d "/opt/fcc_lenovo" ]
then
sudo mkdir /opt/fcc_lenovo
fi
if [ ! -d "/opt/fcc_lenovo/lib" ]
then
sudo mkdir /opt/fcc_lenovo/lib
fi
### Identify current OS
OS_UBUNTU="Ubuntu"
OS_FEDORA="Fedora"
### Identify current OS
OS_UBUNTU="Ubuntu"
OS_FEDORA="Fedora"
source /etc/os-release
echo $NAME
if [[ "$NAME" == *"$OS_UBUNTU"* ]]
then
### Copy fcc unlock script for MM
sudo tar -zxf fcc-unlock.d.tar.gz -C /usr/lib/x86_64-linux-gnu/ModemManager/
sudo chmod ugo+x /usr/lib/x86_64-linux-gnu/ModemManager/fcc-unlock.d/*
### Copy SAR config files
sudo tar -zxf sar_config_files.tar.gz -C /opt/fcc_lenovo/
### Copy libraries
sudo cp -rvf libmodemauth.so /opt/fcc_lenovo/lib/
sudo cp -rvf libconfigserviceR+.so /opt/fcc_lenovo/lib/
sudo cp -rvf libconfigservice350.so /opt/fcc_lenovo/lib/
sudo cp -rvf libmbimtools.so /opt/fcc_lenovo/lib/
elif [[ "$NAME" == *"$OS_FEDORA"* ]]
then
### Copy fcc unlock script for MM
sudo tar -zxf fcc-unlock.d.tar.gz -C /usr/lib64/ModemManager/
sudo chmod ugo+x /usr/lib64/ModemManager/fcc-unlock.d/*
### Copy SAR config files
sudo tar -zxf sar_config_files.tar.gz -C /opt/fcc_lenovo/
ln -s /usr/sbin/lspci /usr/bin/lspci
### Copy libraries
sudo cp -rvf libmodemauth.so /opt/fcc_lenovo/lib/
sudo cp -rvf libconfigserviceR+.so /opt/fcc_lenovo/lib/
sudo cp -rvf libconfigservice350.so /opt/fcc_lenovo/lib/
sudo cp -rvf libmbimtools.so /opt/fcc_lenovo/lib/
### Copy files for selinux for fedora
sudo cp -rvf mm_FccUnlock.cil /opt/fcc_lenovo
sudo cp -rvf mm_dmidecode.cil /opt/fcc_lenovo
sudo cp -rvf mm_sh.cil /opt/fcc_lenovo
sudo semodule -i /opt/fcc_lenovo/*.cil
else
echo "No need to copy files"
exit 0
fi
### Copy binary
sudo cp -rvf DPR_Fcc_unlock_service /opt/fcc_lenovo/
sudo cp -rvf configservice_lenovo /opt/fcc_lenovo/
## copy and enable service
sudo cp -rvf lenovo-cfgservice.service /etc/systemd/system/.
sudo systemctl daemon-reload
systemctl enable lenovo-cfgservice
### Grant permissions to all binaries and script
sudo chmod ugo+x /opt/fcc_lenovo/*
### Below mentioned script is executed to fix issues related to WWAN.
### Issue List:
### 1) System sometimes wake up during suspend mode, while using Fibocom
### L860-GL-16/FM350 and Quectel EM160R-GL/RM520N-GL WWAN module.
sudo chmod ugo+x suspend-fix/install.sh
suspend-fix/install.sh
## Please reboot machine (this will be needed only one for time)##
### Exit script
exit 0