#!/bin/bash

#   Copyright (C) by Lieven De Samblanx ON7LDS
#   Source project NextionDriver installer https://github.com/on7lds/NextionDriver
#   (c)2018-2019 by ON7LDS 

# 脚本目的：下载Nextion MModel 8/Model 10 驱动，展示详细信息

# 驱动装载：Pi-Star  
# -->> MMDVM Display Type :Modem
# -->> Port /dev/ttyNextionDriver  
# -->> Nextion Layout: ON7LDS L3 HS

# 可能遇到的问题：
# 安装启动后，Pi-Star管理界面会提示重新选择电台/调解解调器类型，重新选择一遍即可，或者直接忽视
# 磁盘空间不足时，执行扩容：sudo pistar-expand
# 交流：www.bi7jta.org 可以找到我
# sudo curl -Ls https://www.bi7jta.org/files/MMDVM_Nextion/Driver/install_NextionDriverScript_JP.sh | sudo bash

sudo mount -o remount,rw / ;

#uninstall history NextionDriver;
sudo rm -rf /usr/local/bin/NextionDriver;
sudo systemctl unmask nextiondriver;
sudo systemctl disable nextiondriver;

cd /home/pi-star;
sudo rm -f on7lds-NextionDriverInstaller-Offline.zip*;
sudo rm -rf NextionDriver;
sudo rm -rf NextionDriverInstaller;
sudo rm -f github-bi7jta.txt;
sudo rm -f build_20230508_bi7jta.org.txt;
#下载驱动包 

sudo wget https://www.bi7jta.org/files/MMDVM_Nextion/Driver/on7lds-NextionDriverInstaller-Offline.zip;    

sudo unzip -o on7lds-NextionDriverInstaller-Offline.zip;

#执行安装，
sudo chmod +x NextionDriverInstaller/install.sh;
sudo chmod +x NextionDriverInstaller/NextionDriver_ConvertConfig;
sudo NextionDriverInstaller/install.sh;


