#!/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. java多线程 生产者消费者案例-虚假唤醒

    package com.java.juc; public class TestProductAndConsumer { public static void main(String[] args) { ...

  2. LeetCode Minimum Absolute Difference in BST

    原题链接在这里:https://leetcode.com/problems/minimum-absolute-difference-in-bst/#/description 题目: Given a b ...

  3. hdu5542 The Battle of Chibi[DP+BIT]

    求给定序列中长度为M的上升子序列个数.$N,M<=1000$. 很容易想到方法.$f[i,j]$表示以第$i$个数结尾,长度为$j$的满足要求子序列个数.于是转移也就写出来了$f[i][j]+= ...

  4. Unity 5 官方打包管理工具 Asset Bundle Manager

    http://blog.csdn.net/suifcd/article/details/51570003 Unity5在Asset bundle 打包管理上采用了全新的方式,不需要再对每个文件进行MD ...

  5. CentOS 7 安装Percona,Xtrabackup

    CentOS 7 安装Percona 5.7,Xtrabackup 简介 Percona Server为 MySQL 数据库服务器进行了改进,在功能和性能上较 MySQL 有着很显著的提升.该版本提升 ...

  6. C++动多态和静多态

    动多态的设计思想:对于相关的对象类型,确定它们之间的一个共同功能集,然后在基类中,把这些共同的功能声明为多个公共的虚函数接口.各个子类重写这些虚函数,以完成具体的功能.客户端的代码(操作函数)通过指向 ...

  7. PHP获取汉字拼音首字母 截取中文字符串

    http://blog.csdn.net/everything1209/article/details/39005785 substr是按字符分割,而mb_strcut是按字节来分割,但是都不会产生半 ...

  8. eclipse -- propedit 安装.

    SSH 项目中.用到国际化文件,Message.properties 但里面的文本都是 unicode 格式的,用起来不谁.而且也不想通过其它工具转码来使用. 可以通过安装 eclipse 的 pro ...

  9. QtCreator开启-O编译优化的方式

    首先,编译优化必须是在Release模式下进行,保证程序没有任何bug的条件下进行执行.编译优化能极大提升程序的运行效率,级别越高速度越快,但是对代码健壮性要求也越高! 选择编译release模式,在 ...

  10. Spring单例Bean和线程安全

    Spring的bean默认都是单例的,这些单例Bean在多线程程序下如何保证线程安全呢?例如对于Web应用来说,Web容器对于每个用户请求都创建一个单独的Sevlet线程来处理请求,引入Spring框 ...