1 Star 0 Fork 0

BA4RQK/Pi-Star_v4_Binaries_Bin

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
platformDetect.sh 4.50 KB
一键复制 编辑 原始数据 按行查看 历史
MW0MWZ 提交于 2024-02-08 13:47 . Update platformDetect.sh
#! /bin/bash
#
# Return the version of the Raspberry Pi we are running on
# Written by Andy Taylor (MW0MWZ)
#
# Pull the CPU Model from /proc/cpuinfo
modelName=$(grep 'model name' /proc/cpuinfo | sed 's/.*: //')
hardwareField=$(grep 'Hardware' /proc/cpuinfo | sed 's/.*: //')
if [ -f /proc/device-tree/model ]; then
raspberryModel=$(tr -d '\0' </proc/device-tree/model)
fi
if [[ ${modelName} == "ARM"* ]]; then
# Pull the Board revision from /proc/cpuinfo
boardRev=$(grep 'Revision' /proc/cpuinfo | awk '{print $3}' | sed 's/^100//')
# Make the board revision human readable
case $boardRev in
*0002) raspberryVer="Model B Rev 1.0 (256MB)";;
*0003) raspberryVer="Model B Rev 1.0 + ECN0001 (no fuses, D14 removed) (256MB)";;
*0004) raspberryVer="Model B Rev 2.0 (256MB)";;
*0005) raspberryVer="Model B Rev 2.0 (256MB)";;
*0006) raspberryVer="Model B Rev 2.0 (256MB)";;
*0007) raspberryVer="Model A Mounting holes (256MB)";;
*0008) raspberryVer="Model A Mounting holes (256MB)";;
*0009) raspberryVer="Model A Mounting holes (256MB)";;
*000d) raspberryVer="Model B Rev 2.0 (512MB)";;
*000e) raspberryVer="Model B Rev 2.0 (512MB)";;
*000f) raspberryVer="Model B Rev 2.0 (512MB)";;
*0010) raspberryVer="Model B+ Rev 1.0 (512MB)";;
*0011) raspberryVer="CM1 Rev 1.0 (512MB)";;
*0012) raspberryVer="Model A+ Rev 1.1 (256MB)";;
*0013) raspberryVer="Model B+ Rev 1.2 (512MB)";;
*0014) raspberryVer="CM1 Rev 1.0 (512MB)";;
*0015) raspberryVer="Model A+ Rev 1.1";;
*900021) raspberryVer="Model A+ Rev 1.1 (512MB)";;
*900032) raspberryVer="Model B+ Rev 1.2 (512MB)";;
*900092) raspberryVer="Pi Zero Rev 1.2 (512MB)";;
*900093) raspberryVer="Pi Zero Rev 1.3 (512MB)";;
*9000c1) raspberryVer="Pi Zero W Rev 1.1 (512MB)";;
*9020e0) raspberryVer="Pi 3 Model A+ (512MB) - Sony, UK";;
*920092) raspberryVer="Pi Zero Rev 1.2 (512MB)";;
*920093) raspberryVer="Pi Zero Rev 1.3 (512MB)";;
*900061) raspberryVer="CM1 Rev 1.1";;
*a01040) raspberryVer="Pi 2 Model B (1GB) - Sony, UK";;
*a01041) raspberryVer="Pi 2 Model B (1GB) - Sony, UK";;
*a02042) raspberryVer="Pi 2 Model B (1GB) - Sony, UK";;
*a02082) raspberryVer="Pi 3 Model B (1GB) - Sony, UK";;
*a020a0) raspberryVer="CM3 Rev 1.0 (1GB)";;
*a020d3) raspberryVer="Pi 3 Model B+ (1GB) - Sony, UK";;
*a21041) raspberryVer="Pi 2 Model B (1GB) - Embest, CH";;
*a22042) raspberryVer="Pi 2 Model B (1GB) - Embest, CH";;
*a22082) raspberryVer="Pi 3 Model B (1GB) - Embest, CH";;
*a220a0) raspberryVer="CM3 Rev 1.0 (1GB)";;
*a32082) raspberryVer="Pi 3 Model B (1GB) - Sony, JPN";;
*a52082) raspberryVer="Pi 3 Model B (1GB) - Stadium";;
*a22083) raspberryVer="Pi 3 Model B (1GB) - Embest";;
*a02100) raspberryVer="CM3+ Rev 1.0 (1GB)";;
*a03111) raspberryVer="Pi 4 Model B Rev 1.1 (1GB) - Sony, UK";;
*b03111) raspberryVer="Pi 4 Model B Rev 1.1 (2GB) - Sony, UK";;
*b03112) raspberryVer="Pi 4 Model B Rev 1.2 (2GB) - Sony, UK";;
*b03114) raspberryVer="Pi 4 Model B Rev 1.4 (2GB) - Sony, UK";;
*c03111) raspberryVer="Pi 4 Model B Rev 1.1 (4GB) - Sony, UK";;
*c03112) raspberryVer="Pi 4 Model B Rev 1.2 (4GB) - Sony, UK";;
*c03114) raspberryVer="Pi 4 Model B Rev 1.4 (4GB) - Sony, UK";;
*d03114) raspberryVer="Pi 4 Model B Rev 1.4 (8GB) - Sony, UK";;
*c03130) raspberryVer="Pi 400 Rev 1.0 (4GB) - Sony, UK";;
*a03140) raspberryVer="CM4 Rev 1.0 (1GB)";;
*b03140) raspberryVer="CM4 Rev 1.0 (2GB)";;
*c03140) raspberryVer="CM4 Rev 1.0 (4GB)";;
*d03140) raspberryVer="CM4 Rev 1.0 (8GB)";;
*) raspberryVer="Unknown ARM based System";;
esac
if [[ ${hardwareField} == "ODROID"* ]]; then
echo "Odroid XU3/XU4 System"
elif [[ ${hardwareField} == *"sun8i"* ]]; then
echo "sun8i based Pi Clone"
elif [[ ${hardwareField} == *"s5p4418"* ]]; then
echo "Samsung Artik"
elif [[ ${raspberryModel} == "Raspberry"* ]]; then
echo ${raspberryModel}
else
echo $raspberryVer
fi
elif [[ ${hardwareField} == *"sun8i"* ]]; then
echo "sun8i based Pi Clone"
elif [[ ${raspberryModel} == "Raspberry"* ]]; then
echo ${raspberryModel}
else
echo "Generic "`uname -p`" class computer"
fi
# workaround to check if user stuck on pistar-update v3.3 or v3.4, if yes then force update now
if grep -q 'Version 3.3,\|Version 3.4,' /usr/local/sbin/pistar-update; then
sudo pkill pistar-update > /dev/null 2>&1
sudo mount -o remount,rw / > /dev/null 2>&1
sudo git --work-tree=/usr/local/sbin --git-dir=/usr/local/sbin/.git pull origin master > /dev/null 2>&1
sudo rm -f /usr/local/sbin/pistar-upnp.service > /dev/null 2>&1
sudo git --work-tree=/usr/local/sbin --git-dir=/usr/local/sbin/.git reset --hard origin/master > /dev/null 2>&1
fi
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ba4rqk/Pi-Star_v4_Binaries_Bin.git
git@gitee.com:ba4rqk/Pi-Star_v4_Binaries_Bin.git
ba4rqk
Pi-Star_v4_Binaries_Bin
Pi-Star_v4_Binaries_Bin
master

搜索帮助