跳转到主要内容

未提供项目描述

项目描述

rpiup - Raspberry Pi OS 设置

安装

pip install rpiup

用法

初始化应用程序

这是一个一次性设置,您只需为每个应用程序运行一次。

下载最新的Raspberry OS (firstboot)

操作系统来自 https://github.com/nmcclain/raspberian-firstboot 这是一个修改过的RPi OS,唯一的改变是它允许您在首次启动时运行脚本。

rpiup os download
初始化您的应用程序文件

这将在目录中创建一个目录,并将默认文件复制到其中。如果省略了./sd,它将使用当前目录(./)。

此目录中的所有文件都将复制到烧录后的小型PI引导目录中。

rpiup init ./myapp
# whats the app name? ...
# What should the device username be? ...
# What should the device password be? ...
# Do you want to set a git username?
# Do you want to set a git password?
# what's your wifi?: ...
# Do you have a set of alternate wifi credentials you would like to add?
# any app variables you want to set? (press enter to skip) ...
# all set!
cd myapp
ls *
# firstboot.sh
#
# resources:
# aps.yml docker services setup.sh vars.sh

安装Balena Etcher

这是一个将操作系统镜像烧录到SD卡的应用程序。您可以在这里找到它。

设备特定设置

为每个要设置的设备重复此操作。

烧录SD卡
  • 插入SD卡
  • 打开Etcher并烧录下载的操作系统镜像(应在myapp/目录之上)
复制文件并完成设备特定配置
rpi sd setup
# by default, the hostname will be <APP_NAME>-<ETH0_MAC_ADDR>
# but you can set a custom hostname
rpi sd setup --hostname mytestpi
替代方案

如果您正在进行大量设备的批量操作,在操作之前生成主机名并打印出要放在设备上的标签列表是有意义的。为此

### Run once - generate the hostname list and save it to a tsv file:
# pip install randomname
randomname saved --name myapp -g myapp,uuid/8 -n 100 --overwrite

randomname saved --name myapp export > hostnames.tsv

### Run for each device:
# increment the index at the end of the line
rpi sd setup --hostname $(randomname saved --name myapp get 0)
# increment from 0 to 1
rpi sd setup --hostname $(randomname saved --name myapp get 1)
# and so on...

它能做什么

  • 设置设备主机名
  • 设置Wi-Fi网络
  • 设置可以从设备访问的任意变量。
  • 运行任意命令

命令行界面

设置主机名

rpiup vars set --hostname blah-091091eh901eh
# or
pip install randomname
rpiup vars set --hostname $(randomname get)
设置任意环境变量
rpiup vars set --some-feature 1 --myapp_something blah

设置Wi-Fi网络

rpiup wifi add MySSID-2G
# enter password:

# or
rpiup wifi add MySSID-2G mypassword

项目详情


下载文件

下载适合您平台文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源代码发行版

rpiup-0.0.8.tar.gz (678.4 kB 查看哈希值)

上传时间 源代码

由以下组织支持