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 ...
随机推荐
- 20145336 张子扬 《网络对抗技术》 web安全基础实践
2014536 张子扬<网络攻防>Exp9 Web安全基础实践 实验准备 开启webgoat 1)开启webgoat,打开WebGoat: java -jar webgoat-contai ...
- 【源码编译】spark源码编译
本文采用cdh版本spark-1.6.0-cdh5.12.0 1.源码包下载 2.进入根目录编译,编译的方式有2种 maven mvn clean package \ -DskipTests -Pha ...
- C++ 清空队列(queue)的几种方法
C++中的queue自身是不支持clear操作的,但是双端队列deque是支持clear操作的. 方法一 直接用空的队列对象赋值 queue<int> q1; // process // ...
- flink架构介绍
前言 flink作为基于流的大数据计算引擎,可以说在大数据领域的红人,下面对flink-1.7的架构进行逻辑上的分析并和spark做了一些关键点的对比. 架构 如图1,flink架构分为3个部分,cl ...
- 前端验证用户登陆状态(vue.js)
首先用户需要进行登陆(请求登陆接口),接口请求成功之后后台会返回对应的用户信息(可以把用户信息存放在浏览器缓存中),并且后台会设置浏览器的cookie值(可以在network->header-& ...
- UVa 3349 Snowflake Snow Snowflakes(Hash)
http://poj.org/problem?id=3349 题意: 给出n片雪花留个角的长度,要求判断是否有一样的雪花. 思路: Hash表的应用. 首先将每个雪花所有角的总长计算出来,如果两片雪花 ...
- 项目中的一个分页功能pagination
项目中的一个分页功能pagination <script> //总页数 ; ; //分页总数量 $(function () { // $("#pagination"). ...
- Codeforces Beta Round #94 div 1 D Numbers map+思路
D. Numbers time limit per test 2 seconds memory limit per test 256 megabytes input standard input ou ...
- pyHook监听用户鼠标、键盘事件
一.代码部分:获取用户输入信息,并与截图一起保存到XX目录下 # -*- coding: utf-8 -*- # import pythoncom import pyHook impor ...
- 很火的Java题——判断一个整数是否是奇数
完成以下代码,判断一个整数是否是奇数: public boolean isOdd(int i) 看过<编程珠玑>的人都知道这道题的答案和其中极为简单的道理. 最普遍的风格,如下: 这个函数 ...