分类 技术分享 下的文章

斐讯N1刷linux后经常报错
E: dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem.

Read-only file system

这是系统无法写入文件导致报错,根据排查应该是有坏道导致的,修复方法只需要运行下面命令后重启N1就行了

e2fsck /dev/mmcblk1p2

注意:mmcblk1p2 是你的磁盘挂载的路径名称,如果你的名称不是这个请根据情况修改

本来准备直接yum install golang或者yum install go, 执行命名后,发现没有这个包。于是只能先添加源,然后在使用命令行安装了。

Install on CentOS: 
Current version: 1.11
rpm --import https://mirror.go-repo.io/centos/RPM-GPG-KEY-GO-REPO
curl -s https://mirror.go-repo.io/centos/go-repo.repo | tee /etc/yum.repos.d/go-repo.repo
yum install golang
        


Install on Fedora: 
Current version: 1.11
rpm --import https://mirror.go-repo.io/fedora/RPM-GPG-KEY-GO-REPO
curl -s https://mirror.go-repo.io/fedora/go-repo.repo | tee /etc/yum.repos.d/go-repo.repo
yum install golang
        


Example $GOPATH setup:
mkdir -p ~/go/{bin,pkg,src}
echo 'export GOPATH="$HOME/go"' >> ~/.bashrc
echo 'export PATH="$PATH:${GOPATH//://bin:}/bin"' >> ~/.bashrc
        


Unstable (Pre-release) Packages
Current version: 1.11rc2 

CentOS:
rpm --import https://mirror.go-repo.io/centos-unstable/RPM-GPG-KEY-GO-REPO
curl -s https://mirror.go-repo.io/centos-unstable/go-repo-unstable.repo | tee /etc/yum.repos.d/go-repo-unstable.repo
yum install golang
        

Fedora:
rpm --import https://mirror.go-repo.io/fedora-unstable/RPM-GPG-KEY-GO-REPO
curl -s https://mirror.go-repo.io/fedora-unstable/go-repo-unstable.repo | tee /etc/yum.repos.d/go-repo-unstable.repo
yum install golang

有时候需要把网页强制切换成HTTPS,即使用户已经访问了HTTP的版本。原因可能是你不想让用户使用HTTP来访问,因为它不安全。要做到这个很简单,如果不想用PHP或者Apache的mod_rewrite来做这件事,用Javascript也可以强制SSL。代码如下:

<script type="text/javascript">
var targetProtocol = "https:";
if (window.location.protocol != targetProtocol)
 window.location.href = targetProtocol +
  window.location.href.substring(window.location.protocol.length);
</script>

1、自定义设置---网络监测---监测模式---持续监测

2、在最底下点开在网络访问状态改变时运行脚本

3、在最底下加入以下代码

if [ $1 == "0" ] ; then
# 网络不通
        mtk_gpio -d 8 1
        mtk_gpio -d 10 0
        mtk_gpio -d 11 1
        logger -t "【网络检测】" "网络已断开,红灯!"
else
# 网络通
        mtk_gpio -d 8 1
        mtk_gpio -d 10 1
        mtk_gpio -d 11 0
        logger -t "【网络检测】" "网络已连接,绿灯!"
fi