#!/bin/bash

# This is the script that we install somewhere in your $PATH (as "meteor")
# when you run
# $ curl https://install.meteor.com/ | sh
# In fact, all that the curl script does is install this script and run it
# once. It's the only file that we install globally on your system; each user of
# Meteor gets their own personal package and tools repository, called the
# warehouse, in ~/.meteor/. This means that a user can share packages among
# multiple apps and automatically update to new releases without having to have
# permissions to write them to anywhere global.
#
# All this script does is exec ~/.meteor/meteor. But what if you don't have it
# yet? In that case, it downloads a "bootstrap tarball", which contains the
# latest version of the Meteor tools, and plops it down at ~/.meteor. In fact,
# once you've run this once, you don't even really need this script: you can put
# ~/.meteor/ into your PATH, or a symlink to ~/.meteor/meteor into some other
# PATH directory. No special permissions needed!
# 脚本的目的在于运行 ~/.meteor/meteor。它会下载一个包:bootstrap tarball,包含了最新
# 版本的Meteor的工具,存放在~/.meteor文件夹下面。事实上,你只要已经运行过一次,你就可
# 不许要这个脚本:你可以把~/.meteor/路径放到你的PATH目录下面,或者加一个链接到PATH目录
# 下面,不许要额外的权限。
#
# To uninstall Meteor from your system, just delete this shell script, and
# delete your warehouse (~/.meteor/).
# 卸载就直接删除~/.meteor/文件夹就行了。
#
# We'll keep around a copy of this file at
# ~/.meteor/engines/latest/launch-meteor just in case you ever want to find it
# again. And if you put it somewhere that other users on your system can run it,
# then when they run it they'll get their very own warehouse too!
# ~/.meteor/engines/latest/launch-meteor 是这个文件的副本,如果你把这个共享给了其他
# 用,那么他们也会有自己的仓库。

set -e
set -u
set -o pipefail # so curl failure triggers the "set -e"

# 设置两个地址
BOOTSTRAP_URL='https://install-bootstrap.meteor.com/'
METEOR_WAREHOUSE_DIR="${METEOR_WAREHOUSE_DIR:-$HOME/.meteor}"

if [ ! -x "$METEOR_WAREHOUSE_DIR/meteor" ]; then # 测试目录
if [ -e "$METEOR_WAREHOUSE_DIR" ]; then
echo "'$METEOR_WAREHOUSE_DIR' exists, but '$METEOR_WAREHOUSE_DIR/meteor' is not executable." 1>&2
echo 1>&2
echo "Remove it and try again." 1>&2
exit 1
fi # 发现仓库路径 但路径里面出现错误

# Bootstrap .meteor from a tarball. First, figure out our architecture.

UNAME=$(uname)
if [ "$UNAME" != "Linux" -a "$UNAME" != "Darwin" ] ; then
echo "Sorry, this OS is not supported yet." 1>&2
exit 1
fi # 系统是否正确

# If you change this, also change host() in tools/archinfo.js
if [ "$UNAME" = "Darwin" ] ; then # osx 系统
if [ "i386" != "$(uname -p)" -o "1" != "$(sysctl -n hw.cpu64bit_capable 2>/dev/null || echo 0)" ] ; then
# Can't just test uname -m = x86_64, because Snow Leopard can
# return other values.
echo "Only 64-bit Intel processors are supported at this time." 1>&2
exit 1 # osx 一定需要64位
fi
ARCH="x86_64"
elif [ "$UNAME" = "Linux" ] ; then # linux 系统
ARCH="$(uname -m)"
if [ "$ARCH" != "i686" -a "$ARCH" != "x86_64" ] ; then
echo "Unsupported architecture: $ARCH" 1>&2
echo "Meteor only supports i686 and x86_64 for now." 1>&2
exit 1 # 32和64都需要
fi
fi
PLATFORM="${UNAME}_${ARCH}" # 平台字符串

# This returns something like https://warehouse.meteor.com/bootstrap/0.6.1
ROOT_URL="$(curl -s --fail $BOOTSTRAP_URL)" # 判断是否提供
TARBALL_URL="${ROOT_URL}/meteor-bootstrap-${PLATFORM}.tar.gz" # 工具包地址

INSTALL_TMPDIR="$(dirname "$METEOR_WAREHOUSE_DIR")/.meteor-install-tmp" # 安装是的临时目录
rm -rf "$INSTALL_TMPDIR" # 清空安装临时目录
mkdir "$INSTALL_TMPDIR" # 创建目录
if [ -n "$USER" ]; then # 提示
echo "$USER, this is your first time using Meteor!" 1>&2
else
echo "This is your first time using Meteor!" 1>&2
fi
echo "Installing a Meteor distribution in your home directory." 1>&2
curl --progress-bar --fail "$TARBALL_URL" | tar -xzf - -C "$INSTALL_TMPDIR" # 下载工具包并且解压到临时目录里面
# bomb out if it didn't work, eg no net
test -x "${INSTALL_TMPDIR}/.meteor/meteor" # 是否有目录
mv "${INSTALL_TMPDIR}/.meteor" "$METEOR_WAREHOUSE_DIR"
rmdir "${INSTALL_TMPDIR}" # 删除临时文件
# just double-checking :)
test -x "$METEOR_WAREHOUSE_DIR/meteor" # 是否安装好
fi

exec "$METEOR_WAREHOUSE_DIR/meteor" "$@" # 执行

meteor 命令文件shell 解析的更多相关文章

  1. shell解析命令行的过程以及eval命令

    本文说明的是一条linux命令在执行时大致要经过哪些过程?以及这些过程的大致顺序. 1.1 shell解析命令行 shell读取和执行命令时的大致操作过程如下图: 以执行以下命令为例: echo -e ...

  2. (转)shell解析命令行的过程以及eval命令

    shell解析命令行的过程以及eval命令   本文说明的是一条linux命令在执行时大致要经过哪些过程?以及这些过程的大致顺序. 1.1 shell解析命令行 shell读取和执行命令时的大致操作过 ...

  3. 命令行工具解析Crash文件,dSYM文件进行符号化

    备份   文/爱掏蜂窝的熊(简书作者)原文链接:http://www.jianshu.com/p/0b6f5148dab8著作权归作者所有,转载请联系作者获得授权,并标注“简书作者”. 序 在日常开发 ...

  4. Shell命令-文件及内容处理之more、less

    文件及内容处理 - more.less 1. more:分页显示文件内容 more命令的功能说明 more 命令类似 cat,不过会以一页一页的形式显示,更方便使用者逐页阅读,而最基本的指令就是按空白 ...

  5. 一个简单的wed服务器SHTTPD(1)————命令行和文件配置解析

    开始学习<LInux网络编程>中的综合案例,虽然代码书上有,还是自己打一下加深理解和印象. 主要有两个函数,完成命令行的解析,另一个实现配置文件的解析,注释还是比较丰富的哦. //star ...

  6. shell脚本 在后台执行de 命令 >> 文件 2>&1 将标准输出与错误输出共同写入到文件中(追加到原有内容的后面)

    命令 >> 文件 2>&1或命令 &>> 文件 将标准输出与错误输出共同写入到文件中(追加到原有内容的后面) # ll >>aaa 2> ...

  7. 文件类型解析漏洞防御与攻击(PHP)

    简介: 解析漏洞主要是一些特殊文件被iis.Apache.Nginx等服务在某种情况下解释成脚本文件格式并得以执行而产生的漏洞,一般的思路都是用图片木马来欺骗服务器,上传webshell,达到提权的目 ...

  8. sqlmap os shell解析

    0x00 Background 最近遇到测试环境,最后利用sqlmap的--os-shell参数取得shell.一直以来,对这个参数的工作原理不是十分的清晰.大致的思想应该是将脚本插入到数据库中,然后 ...

  9. Linux命令行和shell编程

    Shell Shell是一个程序,用户输入的命令通过shell来传达给内核或其它程序.用户在linux打开一个终端,终端就会自动调用用户的shell. Linux上的Shell有很多种,用的最多是sh ...

随机推荐

  1. Long Jumps(二分查找lower_bound()函数的运用)

    Valery is a PE teacher at a school in Berland. Soon the students are going to take a test in long ju ...

  2. JS计算字符串的长度

    最近项目上经常要用到计算字符串的长度的问题,有时需要按照byte进行计算长度,所以我就想在页面上用js实现,于是就到网上查了相关的资料,发现确实有很多的版本,这里给出两个比较好用的. //方法一:逐个 ...

  3. BZOJ4009:[HNOI2015]接水果(整体二分版)

    浅谈离线分治算法:https://www.cnblogs.com/AKMer/p/10415556.html 题目传送门:https://lydsy.com/JudgeOnline/problem.p ...

  4. PhantomJS python 截屏

    参考:https://www.cnblogs.com/LanTianYou/p/5578621.html # coding:utf8 from time import sleep from selen ...

  5. Jmeter & TICK

    背景:   本来只是想在将Jmeter的测试结果写入InfluxDB, 但发现从InfluxDB V1.3后开始, 已经不支持Web Admin interface, 才发现InfluxData 搞了 ...

  6. CPU 和 Linux 进程

    进程与线程 进程应该是Linux中最重要的一个概念.进程运行在CPU上,是所有硬件资源分配的对象.Linux中用一个task_struct的结构来描述进程,描述了进程的各种信息.属性.资源. Linu ...

  7. YUV转换成RGB算法

    YUV转换成RGB void yuvtorgb ( double *rgb,unsigned char *yuv) { int i; rgb[] = ] + + ] - ); // r rgb[] = ...

  8. Spring集成Quartz定时任务框架介绍

    在JavaEE系统中,我们会经常用到定时任务,比如每天凌晨生成前天报表,每一小时生成汇总数据等等.我们可以使用java.util.Timer结合java.util.TimerTask来完成这项工作,但 ...

  9. 关于mybatis中基本类型条件判断问题

    零:sql动态语句中经常会有根据数据库某个字段状态进行判断的 如:status=0为未激活,status=1为激活的,那搜索未激活时: <if test="model.activeSt ...

  10. List转Datable(需区分对象充当List成员和数组充当List成员两种情况)

    对象充当List成员时: /// <summary> /// 将泛类型集合List类转换成DataTable /// </summary> /// <param name ...