累积更新

This commit is contained in:
mofeng-git 2024-06-10 14:56:23 +08:00
parent b8b6dff995
commit e2126cc3ca
2 changed files with 38 additions and 16 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
ARCH=$(uname -m) ARCH=$(uname -s)
MACHINE=$(uname -o -s -r -m) MACHINE=$(uname -o -s -r -m)
PYVER=$(python3 -V) PYVER=$(python3 -V)
CURRENTWD=$PWD CURRENTWD=$PWD
@ -8,9 +8,9 @@ FIND_FILE="/etc/sudoers"
FIND_STR="short_press_gpio420" FIND_STR="short_press_gpio420"
#检查架构和Python版本 #检查架构和Python版本
check-environment(){ check_environment(){
echo -e "\e[0;32m设备名称$MACHINE\nPython版本$PYVER" echo -e "\e[0;32m设备名称$MACHINE\nPython版本$PYVER"
if [ ! $ARCH = "armv7l" ]; then if [ ! $ARCH = "onecloud" ]; then
echo -e "\e[0;31m此脚本暂不支持armv7l架构以外的设备\n退出脚本" echo -e "\e[0;31m此脚本暂不支持armv7l架构以外的设备\n退出脚本"
exit exit
fi fi
@ -22,7 +22,7 @@ check-environment(){
} }
#安装依赖软件 #安装依赖软件
install-dependencies(){ install_dependencies(){
bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh) --source mirrors.tuna.tsinghua.edu.cn --updata-software false --web-protocol http && echo "换源成功!" bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh) --source mirrors.tuna.tsinghua.edu.cn --updata-software false --web-protocol http && echo "换源成功!"
echo -e "\e[0;32m正在安装依赖软件p......" echo -e "\e[0;32m正在安装依赖软件p......"
apt install -y python3.10 python3-pip python3-dev patch iptables nginx \ apt install -y python3.10 python3-pip python3-dev patch iptables nginx \
@ -31,7 +31,7 @@ install-dependencies(){
} }
#安装PiKVM #安装PiKVM
install-pikvm(){ install_pikvm(){
echo "正在安装PiKVM......" echo "正在安装PiKVM......"
dpkg -i ./fruity-pikvm_0.2_armhf.deb dpkg -i ./fruity-pikvm_0.2_armhf.deb
systemctl enable kvmd-vnc systemctl enable kvmd-vnc
@ -51,7 +51,7 @@ install-pikvm(){
} }
#应用补丁 #应用补丁
add-patches(){ add_patches(){
if [ ! -f `grep -c "$FIND_STR" $FIND_FILE` ]; then if [ ! -f `grep -c "$FIND_STR" $FIND_FILE` ]; then
echo kvmd ALL=\(ALL\) NOPASSWD: /usr/bin/onecloud_gpio.sh >> /etc/sudoers echo kvmd ALL=\(ALL\) NOPASSWD: /usr/bin/onecloud_gpio.sh >> /etc/sudoers
fi fi
@ -72,7 +72,8 @@ add-patches(){
} }
fix-motd() { #设置网页终端欢迎语
fix_motd(){
#cd $CURRENTWD #cd $CURRENTWD
if [ -e /etc/motd ]; then rm /etc/motd; fi if [ -e /etc/motd ]; then rm /etc/motd; fi
cat > /usr/bin/armbian-motd << EOF cat > /usr/bin/armbian-motd << EOF
@ -96,14 +97,35 @@ EOF
echo "fixed motd" echo "fixed motd"
} }
show-info(){ #玩客云特定配置
onecloud_conf{
if [ ! $ARCH = "cloud" ]; then
exit
else
cat <<EOF >/etc/rc.local
#!/bin/sh -e
echo "default-on" >/sys/class/leds/onecloud\:green\:alive/trigger
echo "none" >/sys/class/leds/onecloud\:red\:alive/trigger
echo "none" >/sys/class/leds/onecloud\:blue\:alive/trigger
cpufreq-set -d 1200MHz -u 1200MHz
echo device > /sys/class/usb_role/c9040000.usb-role-switch/role
systemctl disabled kvmd
systemctl start kvmd
exit 0
EOF
fi
}
#打印完成信息
show_info(){
ipaddr=`ip addr | grep "scope global" | awk '{print $2}' |awk -F/ '{print $1}'` ipaddr=`ip addr | grep "scope global" | awk '{print $2}' |awk -F/ '{print $1}'`
echo -e "\e[0;32m内网访问地址为\nhttp://$ipaddr\nhttps://$ipaddr" echo -e "\e[0;32m内网访问地址为\nhttp://$ipaddr\nhttps://$ipaddr"
} }
check-environment check_environment
install-dependencies install_dependencies
install-pikvm install_pikvm
add-patches add_patches
fix-motd fix_motd
show-info onecloud_conf
show_info

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
#配置H.264功能 #配置H.264功能
kvmd-ffmpeg-h-264(){ kvmd_ffmpeg_h-264(){
echo "正在配置H.264功能..." echo "正在配置H.264功能..."
cd $CURRENTWD cd $CURRENTWD
apt install -y ffmpeg apt install -y ffmpeg
@ -57,4 +57,4 @@ EOF
systemctl start kvmd-ffmpeg && systemctl start kvmd-janus-static systemctl start kvmd-ffmpeg && systemctl start kvmd-janus-static
} }
kvmd-ffmpeg-h-264 kvmd_ffmpeg_h-264