summaryrefslogtreecommitdiff
path: root/fetch.rc
blob: d3ee459a8f1fd593f41bbb6dd5180e9c8745d8e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/rc

flag e +

aflag=0
if(~ $1 -a) aflag=1
if not if(~ $#* 0) {
	echo 'usage: '$0' package...'
	echo '       '$0' -a'
} >[1=2]

packages=$*

cd `{git rev-parse --show-toplevel}

fn fetch-git {
	git submodule update --init --checkout src
	if([ -d patch ]) {
		patches=patch/*
		git -C src am ../$patches
	}
	status=()
}

fn fetch-curl {
	if([ -d src ]) rm -rf src
	
	if(! sha256sum -c sha256 >[2]/dev/null) {
		curl -L -O -K url
		sha256sum -c sha256
	}
	
	for(archive in `{awk '{print $2}' sha256}) {
		switch($archive) {
		case *.gz
			tool=zcat
		case *.bz2
			tool=bzcat
		case *.xz
			tool=xzcat
		case *
			tool=()
		}
		if(! ~ $#tool 0) $tool $archive | pax -r -s '/^\.\|[^\/]*/src/'
	}
	
	if([ -d patch ]) {
		if(prefix=`{git rev-parse --show-prefix >[2]/dev/null}) dir=$prefix^src
		if not dir=src
		git apply -v --directory $dir patch/*
	}
	status=()
}

fn fetch {
	if (~ $aflag 1 || ~ $1 $packages) @ {
		cd $1
		switch($2) {
		case git
			fetch-git
		case curl
			fetch-curl
		case *
			echo 'unknown fetch type: '$2
		}
	}
	status=()
}

fetch core/awk git
fetch core/bc curl
fetch core/bzip2 curl
fetch core/curl git
fetch core/file git
fetch core/git git
fetch core/iproute2 git
fetch core/kbd git
fetch core/libressl git
fetch core/loksh git
fetch core/mdocml curl
fetch core/ninja git
fetch core/openbsd curl
fetch core/openssh git
fetch core/perp curl
fetch core/pigz git
fetch core/plan9port git
fetch core/sbase git
fetch core/sinit git
fetch core/tz git
fetch core/ubase git
fetch core/xz git
fetch core/zlib git
fetch desktop/plan9fonts git
fetch devel/cparser git
fetch devel/libfirm git
fetch devel/make git
fetch extra/hostap git
fetch extra/libevent git
fetch extra/libfuse git
fetch extra/libnl git
fetch extra/msmtp git
fetch extra/pcre curl
fetch extra/sshfs git
fetch extra/the_silver_searcher git
fetch extra/transmission curl
fetch extra/unzip curl