-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathafs-install-tarball-client
executable file
·127 lines (99 loc) · 2.71 KB
/
afs-install-tarball-client
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/bin/sh
set -o nounset
VDTWWW=/p/vdt/public/html
TARBALLS_DIR=$VDTWWW/tarball-client
INSTALL_ROOT=/p/condor/workspaces/vdt/tarball-client
CA_CERTIFICATES_DIR=/p/condor/workspaces/vdt/osg-ca-certs
Version=
MajorVersion=
Release=
VR=
main () {
get_args "${1-}" "${2-}"
set -o errexit
die_if_dir_exists $INSTALL_ROOT/$VR
cd $INSTALL_ROOT
mkdir -p $VR
# @sys AFS magic to point to the dir that's appropriate for the system
ln -s '@sys' $VR/sys
if test $MajorVersion = 3.4; then
install_tarball osg-afs-client amd64_rhel6 el6 x86_64
fi
install_tarball osg-afs-client amd64_rhel7 el7 x86_64
newline
newline
if test -e $Version -a ! -L $Version; then
message "Not creating $Version -> $VR symlink: $Version already exists"
message "and is not a symlink"
newline
else
ln -snf $VR $Version
fi
set +o errexit
message "Extraction successful. If this was the latest release, please"
message "update the 'current' symlink by running:"
message "\tln -snf $VR $INSTALL_ROOT/current"
newline
}
# Sets Version, Release and VR
get_args () {
if test -z "$1"; then
die_with_usage
fi
Version=$1
MajorVersion=${Version%.*}
if test -z "$2"; then
message "Release not specified. Assuming '1' for the release."
Release=1
else
Release=$2
fi
VR=${Version}-${Release}
}
install_tarball () {
local metapackage="$1"; shift
local sysname="$1"; shift
local dver="$1"; shift
local arch="$1"; shift
local OLDPWD
newline
extract $metapackage $TARBALLS_DIR/$MajorVersion/$arch/$metapackage-$VR.$dver.$arch.tar.gz $VR/$sysname
message "Running post-install for $sysname"
OLDPWD=$PWD
cd $VR/$sysname
osg/osg-post-install
message "Setting up CA certs"
./osgrun osg-ca-manage setupCA --url osg
message "Getting VO data"
./osgrun osg-update-vos
cd "$OLDPWD"
}
die_with_usage () {
message "Usage: $0 <VERSION> [<RELEASE>]"
message " e.g.: $0 3.1.21"
message " or $0 3.1.21 2"
exit 2
}
die_if_dir_exists () {
if test -d "$1"; then
message "$1 already exists. Not overwriting it."
exit 1
fi
}
extract () {
local metapackage="$1"; shift
local tarball="$1"; shift
local destdir="$1"; shift
message "Extracting $tarball into $destdir"
# Note: There is a bug in the version of tar on EL5 that prevents
# --strip-components from working, hence the explicit 'mv' step
tar -xzf "$tarball"
mv "$metapackage" "$destdir"
}
message () {
# I can't portably print a tab with echo so I have to use printf
printf 2>&1 "\t$@\n"
}
newline () { echo 2>&1; }
main "$@"
# vim:ft=sh