linux command curl and sha256sum implement download verification package
example:
download_etcher_cli()
{
local url="https://github.com/resin-io/etcher/releases/download/v1.4.4/etcher-cli-1.4.4-linux-x64.tar.gz"
local hash="54709ad34ac304d2686130c7d22a3bc13b4f491387d987274eeca4f6eea34dce"
local filename=${url##*/}
#replace the suffix
local dirname=${filename/.tar.gz/-dist}
export PATH="$PATH:$SRC/cache/utility/$dirname"
if [[ -f $SRC/cache/utility/$dirname/.download-complete ]]; then
return
fi
cd $SRC/cache/utility/
display_alert "Downloading" "$dirname"
curl -Lf --progress-bar $url -o $filename
local verified=false
local b=$(sha256sum $filename)
display_alert "Verifying"
[[ "$hash" == "$(sha256sum $filename | cut -d ' ' -f 1)" ]] && verified=true
if [[ $verified == true ]]; then
display_alert "Extracting"
tar --no-same-owner --overwrite -xf $filename && touch $SRC/cache/utility/$dirname/.download-complete && rm $filename
display_alert "Download complete" "" "info"
else
display_alert "Verification failed" "" "wrn"
fi
}
linux command curl and sha256sum implement download verification package的更多相关文章
- [Linux][转载]Curl命令详解
命令:curl 在Linux中curl是一个利用URL规则在命令行下工作的文件传输工具,是一款很强大的http命令行工具,当处在无界面的服务器上的时候,利用curl下载上传文件是较为方便的事情. 语法 ...
- linux使用curl命令行进行接口测试
cURL介绍cURL 是很方便的Rest客戶端,可以很方便的完成许多Rest API测试的需求,甚至,如果是需要先登入或认证的rest api,也可以進行测试,利用curl指令,可以送出HTTP GE ...
- MDK st-link下载STM32程序出现Internal command error和Error:Flash download failed. Target DLL
MDK st-link下载STM32程序出现Internal command error和Error:Flash download failed. Target DLL 是因为目标板的芯片处于休眠 ...
- 《The Linux Command Line》 读书笔记04 Linux用户以及权限相关命令
Linux用户以及权限相关命令 查看身份 id:Display user identity. 这个命令的输出会显示uid,gid和用户所属的组. uid即user ID,这是账户创建时被赋予的. gi ...
- 《The Linux Command Line》 读书笔记02 关于命令的命令
<The Linux Command Line> 读书笔记02 关于命令的命令 命令的四种类型 type type—Indicate how a command name is inter ...
- 《The Linux Command Line》 读书笔记01 基本命令介绍
<The Linux Command Line> 读书笔记01 基本命令介绍 1. What is the Shell? The Shell is a program that takes ...
- Linux Command Line Basics
Most of this note comes from the Beginning the Linux Command Line, Second Edition by Sander van Vugt ...
- Linux Command Line 解析
Linux Command Line 解析 0 处理模型 Linux kernel的启动包括很多组件的初始化和相关配置,这些配置参数一般是通过command line进行配置的.在进行后续分析之前,先 ...
- 15 Examples To Master Linux Command Line History
When you are using Linux command line frequently, using the history effectively can be a major produ ...
随机推荐
- perl入门知识(2)
交互式编程你可以在命令行中使用 -e 选项来输入语句来执行代码,实例如下:$ perl -e 'print "Hello World\n"'输入以上命令,回车后,输出结果为:Hel ...
- mysql中时间计算函数SQL DATE_SUB()用法
本文为博主原创,未经允许不得转载: 在写sql的时候,经常要在sql中传值时间,对时间进行计算并过滤.之前都是将时间在后台计算好,直接传值给sql, 今天发现,有一个更方便的sql函数,可以简化很多代 ...
- C# WinCE项目 VS2008 单例窗体实现
项目现有主界面FormMain,模板界面FormModel,其余5个子界面皆继承自模板. 现在想要实现在主界面下可以打开任意子界面,并且可以随时关闭.当打开的子窗体未执行Close事件时,要保证每次显 ...
- Android程序示例
目录 Android代码示例 OptionsMenu ImageButton CheckBox & RadioButton Context Menu快捷菜单 Key Event ListVie ...
- hibernate报错 java.lang.StackOverflowError: null
在使用hibernate时,报错 java.lang.StackOverflowError: null 把当前线程的栈打满了 java.lang.StackOverflowError: null at ...
- testlogin
!/usr/bin/env python coding:utf-8 import requests import unittest import json,urllib class testlogin ...
- lncRNA研究利器之"TANRIC"
http://bioinformatics.mdanderson.org/main/Main_Page http://ibl.mdanderson.org/tanric/_design/basic/i ...
- Cocos2d-x学习笔记(三)main方法
0. UNREFERENCED_PARAMETER(X)避免编译器关于未引用参数的警告. 下边代码用于屏蔽单个函数的警告: #pragma warning( push ) #pragma warnin ...
- c++ 判断数组元素是否都是奇数(all_of)
#include <iostream> // std::cout #include <algorithm> // std::all_of #include <array& ...
- Spring Boot 2.1.1.RELEASE 多数据源配置与使用
有时候,一个系统的功能,需要两个或两个以上的数据库, 在Spring Boot 中要如何配置? How to? #primary primary.spring.datasource.jdbc-url= ...