2021/1/28

mender.io getting start, raspberry pi client install script

get.mender.io 得到的是 index.html,但是script 內容說明是install-mender.sh

就是把 https://downloads.mender.io/repos/debian 加到 source.list 中。
然後 apt install mender-client 跟 mender-connect

因為是用 deb 安裝...
apt-get download mender-client
dpkg-deb -R mender-client_2.5.0-1_armhf.deb mender-client
然後去 mender-client 看
.
├── DEBIAN
│   ├── conffiles
│   ├── control
│   ├── md5sums
│   ├── postinst
│   ├── postrm
│   └── prerm
├── etc
│   └── mender
│       └── artifact_info
├── lib
│   └── systemd
│       └── system
│           └── mender-client.service
└── usr
    ├── bin
    │   ├── directory-artifact-gen
    │   ├── docker-artifact-gen
    │   ├── mender
    │   └── single-file-artifact-gen
    └── share
        ├── dbus-1
        │   └── system.d
        │       └── io.mender.AuthenticationManager.conf
        ├── doc
        │   ├── mender
        │   └── mender-client
        │       ├── changelog.Debian.gz
        │       ├── copyright
        │       └── examples
        │           └── demo.crt
        └── mender
            ├── identity
            │   └── mender-device-identity
            ├── inventory
            │   ├── mender-inventory-bootloader-integration
            │   ├── mender-inventory-geo
            │   ├── mender-inventory-hostinfo
            │   ├── mender-inventory-network
            │   ├── mender-inventory-os
            │   ├── mender-inventory-provides
            │   ├── mender-inventory-rootfs-type
            │   └── mender-inventory-update-modules
            └── modules
                └── v3
                    ├── deb
                    ├── directory
                    ├── docker
                    ├── rpm
                    ├── script
                    └── single-file

20 directories, 31 files

DEBIAN 目錄下就是一些 安裝/移除 時 run 的 script (在 copy /rm 完 file 之後)
postint:
if [ ! -f /etc/mender/mender.conf ]; then

    # For non interactive installs, reproduce the default production
    # configuration with a dummy device type and tenant token.
    DEVICE_TYPE=${DEVICE_TYPE:=$(cat /etc/hostname)}
    if [ "$DEBIAN_FRONTEND" == "noninteractive" ]; then
        mender setup \
            --quiet \
            --device-type "${DEVICE_TYPE}" \
            --demo=false \
            --hosted-mender \
            --tenant-token "Paste your Hosted Mender token here" \
            --update-poll 1800 \
            --inventory-poll 28800 \
            --retry-poll 300

    # Run the interactive setup wizard
    else
        mender setup
    fi

fi
就是產生一個標準的 /etc/mender/mender.conf,.. 所以 demo 版的 後來要重新 run 一次,設定為 demo mode.
還有有關 service 新增與啟動..
# Automatically added by dh_installinit
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
        if [ -x "/etc/init.d/mender-client" ]; then
                update-rc.d mender-client defaults >/dev/null
                if [ -n "$2" ]; then
                        _dh_action=restart
                else
                        _dh_action=start
                fi
                invoke-rc.d mender-client $_dh_action || exit $?
        fi
fi
# End automatically added section
# Automatically added by dh_systemd_start
if [ -d /run/systemd/system ]; then
        systemctl --system daemon-reload >/dev/null || true
        if [ -n "$2" ]; then
                _dh_action=try-restart
        else
                _dh_action=start
        fi
        deb-systemd-invoke $_dh_action mender-client.service >/dev/null || true
fi

沒有留言:

張貼留言