forked from msysgit/msysgit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate-lib.sh
More file actions
93 lines (80 loc) · 1.82 KB
/
update-lib.sh
File metadata and controls
93 lines (80 loc) · 1.82 KB
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
#!/bin/sh
# Make sure that the working directory is clean and does not have untracked
# files; otherwise our semi-automatic finding the new files will not work!
die () {
echo "$*" >&2
exit 1
}
check_pristine () {
(cd / &&
git diff-files --quiet &&
git diff-index --cached --quiet HEAD &&
others="$(git ls-files --exclude-from=.gitignore \
--exclude-per-directory=.gitignore --others)" &&
test -z "$others") ||
die "State not pristine enough for successful package update"
}
# Remove old files stored in fileList.txt
pre_install () {
test -z "$FILELIST" && {
echo "No file list specified for pre_install"
exit 1
}
test -s "$FILELIST" &&
cat "$FILELIST" | (cd / && xargs git --ignore-unmatch rm) ||
exit
}
# update the index
post_install () {
(cd / && git add .) || exit
git diff --cached --diff-filter=AM --name-only |
sed -e "s/^/\//" > "$FILELIST" ||
exit
git add "$FILELIST" || exit
echo "Successfully built and installed $package $version"
echo "After checking the result, please commit (possibly with --amend)"
echo
}
download () {
test -z "$tar" &&
die "Script did not specify an archive"
test -f "$tar" || {
echo "Downloading $tar ..."
curl $url/$tar -o $tar || exit
}
}
extract () {
test -z "$d" &&
die "Script did not specify a directory"
test -d "$d" || {
echo "Unpacking $tar ..."
case "$tar" in
*.tar.gz|*.tgz)
tar -xzf "$tar"
;;
*.tar.bz2|*.tbz)
tar -xjf "$tar"
;;
*.zip)
unzip "$tar"
;;
esac || exit
}
}
setup () {
test -z "$d" &&
die "Script did not specify a directory"
test -f "$d/Makefile" ||
(cd "$d" && ./configure $configure_options) || exit
}
compile () {
test -z "$d" &&
die "Script did not specify a directory"
(cd "$d" && make) || exit
}
download_extract_setup_and_compile () {
download &&
extract &&
setup &&
compile || exit
}