Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
284bb186
提交
284bb186
authored
4月 16, 2016
作者:
Jeromy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add a dist_get script for getting bins from dist.ipfs.io
License: MIT Signed-off-by:
Jeromy
<
why@ipfs.io
>
上级
00f9ce6c
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
161 行增加
和
10 行删除
+161
-10
Makefile
Makefile
+18
-10
dist_get
bin/dist_get
+143
-0
没有找到文件。
Makefile
浏览文件 @
284bb186
...
...
@@ -9,6 +9,12 @@ else
go_test
=
go
test
endif
gx_bin
=
bin/gx-v0.6.0
gx-go_bin
=
bin/gx-go-v1.1.0
# use things in our bin before any other system binaries
export
PATH
:=
bin:
$(PATH)
export
IPFS_API
?=
v04x.ipfs.io
all
:
help
...
...
@@ -21,21 +27,23 @@ toolkit_upgrade: gx_upgrade gxgo_upgrade
go_check
:
@
bin/check_go_version
$(IPFS_MIN_GO_VERSION)
gx_upgrade
:
go get
-u
github.com/whyrusleeping/gx
bin/gx-%
:
@
echo
"installing gx
$
(@:bin/gx-%=%)"
@
bin/dist_get gx
$@
$
(
@:bin/gx-%
=
%
)
gxgo_upgrade
:
go get
-u
github.com/whyrusleeping/gx-go
bin/gx-go-%
:
@
echo
"installing gx-go
$
(@:bin/gx-go-%=%)"
@
bin/dist_get gx-go
$@
$
(
@:bin/gx-go-%
=
%
)
rm
-f
bin/gx-go
ln
-s
$
(
@:bin/%
=
%
)
bin/gx-go
gx_check
:
${gx_bin} ${gx-go_bin}
path_check
:
@
bin/check_go_path
$
(
realpath
$(
shell
pwd
)
)
$
(
realpath
$(GOPATH)
/src/github.com/ipfs/go-ipfs
)
gx_check
:
@
bin/check_gx_program
"gx"
$(IPFS_MIN_GX_VERSION)
'Upgrade or install gx using your package manager or run `make gx_upgrade`'
@
bin/check_gx_program
"gx-go"
$(IPFS_MIN_GX_GO_VERSION)
'Upgrade or install gx-go using your package manager or run `make gxgo_upgrade`'
deps
:
go_check gx_check path_check
gx
--verbose
install
--global
${
gx_bin
}
--verbose
install
--global
# saves/vendors third-party dependencies to Godeps/_workspace
# -r flag rewrites import paths to use the vendored path
...
...
@@ -58,7 +66,7 @@ clean:
uninstall
:
make
-C
cmd/ipfs uninstall
PHONY
+=
all
help
godep toolkit_upgrade gx_
upgrade gxgo_upgrade gx_
check
PHONY
+=
all
help
godep toolkit_upgrade gx_check
PHONY
+=
go_check deps vendor install build nofuse clean uninstall
##############################################################
...
...
bin/dist_get
0 → 100755
浏览文件 @
284bb186
#!/bin/bash
die
()
{
echo
"
$@
"
>
&2
exit
1
}
have_binary
()
{
type
"
$1
"
>
/dev/null
}
check_writeable
()
{
printf
""
>
"
$1
"
&&
rm
"
$1
"
}
download
()
{
local
url
=
"
$1
"
local
output
=
"
$2
"
if
[
-z
"
$url
"
]
||
[
-z
"
$output
"
]
;
then
die
"download takes exactly two arguments. was given '
$@
'"
fi
if
!
check_writeable
"
$output
"
;
then
die
"download error: cannot write to
$output
"
fi
printf
'Downloading "%s" to "%s"\n'
"
$url
"
"
$output
"
if
have_binary wget
;
then
wget
"
$url
"
-O
"
$output
"
elif
have_binary curl
;
then
curl
--silent
"
$url
"
>
"
$output
"
elif
have_binary fetch
;
then
fetch
"
$url
"
-o
"
$output
"
else
die
"no binary found to download
$url
. exiting."
fi
}
unarchive
()
{
local
archivetype
=
"
$1
"
local
infile
=
"
$2
"
local
outfile
=
"
$3
"
local
distname
=
"
$4
"
if
!
check_writeable
"
$outfile
"
;
then
die
"unarchive error: cannot write to
$outfile
"
fi
case
$archivetype
in
tar.gz
)
if
have_binary
tar
;
then
echo
"==> using 'tar' to extract binary from archive"
tar
-x
"
$distname
/
$distname
"
-f
"
$infile
"
-O
>
"
$outfile
"
else
die
"no binary on system for extracting tar files"
fi
;;
zip
)
if
have_binary unzip
;
then
echo
"==> using 'unzip' to extract binary from archive"
unzip
-p
"
$infile
"
"
$distname
/
$distname
"
>
"
$outfile
"
else
die
"no installed method for extracting .zip archives"
fi
;;
*
)
die
"unrecognized archive type '
$archivetype
'"
esac
chmod +x
"
$outfile
"
}
get_go_vars
()
{
if
[
!
-z
"
$GOOS
"
]
&&
[
!
-z
"
$GOARCH
"
]
;
then
printf
"%s-%s"
"
$GOOS
"
"
$GOARCH
"
fi
if
have_binary go
;
then
printf
"%s-%s"
"
$(
go env GOOS
)
"
"
$(
go env GOARCH
)
"
else
die
"no way of determining system GOOS and GOARCH
\n
Please manually set GOOS and GOARCH then retry."
fi
}
mkurl
()
{
local
name
=
"
$1
"
local
vers
=
"
$2
"
local
archive
=
"
$3
"
local
govars
=
$(
get_go_vars
)
echo
"http://dist.ipfs.io/
$name
/
$vers
/
${
name
}
_
${
vers
}
_
$govars
.
$archive
"
}
distname
=
"
$1
"
outpath
=
"
$2
"
version
=
"
$3
"
if
[
-z
"
$distname
"
]
||
[
-z
"
$outpath
"
]
||
[
-z
"
$version
"
]
;
then
die
"usage: dist_get <distname> <outpath> <version>"
fi
if
[
${
version
:0:1
}
!=
"v"
]
;
then
die
"versions must begin with 'v', for example: v0.4.0"
fi
# TODO: don't depend on the go tool being installed to detect this
goenv
=
$(
get_go_vars
)
case
$goenv
in
linux-
*
)
archive
=
"tar.gz"
;;
darwin-
*
)
archive
=
"tar.gz"
;;
windows-
*
)
archive
=
"zip"
;;
freebsd-
*
)
archive
=
"tar.gz"
;;
*
)
echo
"unrecognized system environment:
$goenv
"
>
&2
die
"currently only linux, darwin, windows and freebsd are supported by this script"
esac
mkdir
-p
bin/tmp
url
=
$(
mkurl
"
$distname
"
"
$version
"
"
$archive
"
)
tmpfi
=
"bin/tmp/
$distname
.
$archive
"
download
"
$url
"
"
$tmpfi
"
if
[
$?
-ne
0
]
;
then
die
"failed to download
$url
to
$tmpfi
"
fi
unarchive
"
$archive
"
"
$tmpfi
"
"
$outpath
"
"
$distname
"
if
[
$?
-ne
0
]
;
then
die
"failed to exract archive
$tmpfi
"
fi
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论