summarylogtreecommitdiffstats
path: root/lenovo-wwan-unlock.install
blob: 03c8658b46f41c7cb04b232522c344f8aeaf0d63 (plain)
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
all_off="$(tput sgr0)"
bold="${all_off}$(tput bold)"
blue="${bold}$(tput setaf 4)"
yellow="${bold}$(tput setaf 3)"

msg_blue() {
    printf "${blue}==>${bold} $1${all_off}\n"
}

note() {
    printf "${blue}==>${yellow} NOTE:${bold} $1${all_off}\n"
}

post_install() {
    note "Enable the Lenovo config service with:"
    echo "sudo systemctl enable --now lenovo-cfgservice.service"

    note "If your system has a Fibocom L860-GL-16/FM350 or a Quectel EM160R-GL/RM520N-GL"
    note "Consider enabling the systemd drop-in file by uncommenting all the lines"
    echo "sudo systemctl edit ModemManager --drop-in=apply-test-option.conf"
    note "And then restart ModemManager:"
    echo "sudo systemctl daemon-reload && sudo systemctl restart ModemManager.service"
}

post_upgrade() {
    post_install
}

pre_remove() {
    msg_blue "Stopping lenovo-cfgservice.service"
    systemctl disable --now lenovo-cfgservice.service
}

post_remove() {
    msg_blue "Removing drop-in file (if exists) /etc/systemd/system/ModemManager.service.d/apply-test-option.conf"
    rm -rf /etc/systemd/system/ModemManager.service.d/apply-test-option.conf
    note "Consider restarting the ModemManager service:"
    echo "sudo systemctl daemon-reload && sudo systemctl restart ModemManager.service"
}