~aleteoryx/muditaos

ref: d7c8a8a6bfbcd8735df9d62bf4f0a2083e488d5c muditaos/scripts/lua/install.sh -rwxr-xr-x 1.2 KiB
d7c8a8a6 — Lukasz Mastalerz [CP-1210] Contacts imported from SIM dont show up in Mudita Center 2 years ago
                                                                                
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
#!/usr/bin/env bash
# Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
# For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

function validate_product_selection() {
    case ${PRODUCT,,} in
        pure | purephone)
            PRODUCT_SHORTNAME="pure"
            PRODUCT="PurePhone"
            return 0 ;;
        bell | bellhybrid)
            PRODUCT_SHORTNAME="bell"
            PRODUCT="BellHybrid"
            return 0 ;;
        *)
            echo "Wrong product: \"${PRODUCT}\""
    esac
}

PRODUCT=$1
DESTINATION=$2

if validate_product_selection; then
    if [ -d ${DESTINATION} ]; then
        rm -Rf ${DESTINATION}
    fi
    parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
    cd "$parent_path"

    mkdir -p ${DESTINATION}
    cp -r products/${PRODUCT}/assets ${DESTINATION}/assets/
    cp -r share ${DESTINATION}/share
    cp -r migration/migration.lua ${DESTINATION}/share
    cp *.lua ${DESTINATION}

    if [ -n "$3" ]; then
        echo "Generating UDM update package"
        cp update_udm.lua ${DESTINATION}/update.lua
        cp products/${PRODUCT}/update_product.lua ${DESTINATION}
    fi
    rm ${DESTINATION}/update_udm.lua
    cd -
fi