-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpackage.sh
executable file
·44 lines (37 loc) · 1.09 KB
/
package.sh
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
#! /bin/bash
log() {
echo "$@"
}
clean() {
log "Clean workdir"
rm -rf "$work"
}
get() {
log "Get source $name - $version"
if [ -e "$download/$name/$version/$name.hpi" ]; then
log "Already downloaded."
return
fi
mkdir -p "$download/$name/$version"
cd "$download/$name/$version"
wget --output-document="${name}.hpi" http://updates.jenkins-ci.org/download/plugins/"${name}"/"${version}"/"${name}.hpi"
}
package() {
log "Package $name - $version"
mkdir -p "$work/$name/$version/var/lib/jenkins/plugins"
cd "$work"
cp "$download/$name/$version/$name.hpi" "$work/$name/$version/var/lib/jenkins/plugins"
fpm -s dir -t deb --name "jpi-$name" --version "$version" --depends 'jenkins' -a all -C "$work/$name/$version" --post-install "$base/post-install.sh" .
}
base=$(dirname $(readlink -f "$0"))
work="$base/work"
download="$base/download"
set -e
clean
cat plugins.txt | while read line; do
name=$(echo "$line" | awk '{ print $1 }')
version=$(echo "$line" | awk '{ print $2 }')
echo "Will do $name at $version"
get
package
done