forked from flexiondotorg/oab-java6
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathoab-java.sh
executable file
·123 lines (105 loc) · 3.14 KB
/
oab-java.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
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
#!/usr/bin/env bash
# License
#
# Create a local 'apt' repository for Ubuntu Java packages.
# Copyright (c) 2012 Flexion.Org, http://flexion.org/
#
# Copyright (c) 2012 Tamer Saadeh <[email protected]>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# References
# - https://github.com/rraptorr/sun-java6
# - https://github.com/rraptorr/oracle-java7
# - https://github.com/flexiondotorg/oab-java6
# - http://ubuntuforums.org/showthread.php?t=1090731
# - http://irtfweb.ifa.hawaii.edu/~lockhart/gpg/gpg-cs.html
# Variables
export SCRIPTS="`pwd`/scripts"
export DOCS="$SCRIPTS/docs"
export LOG="`pwd`/build.log"
export BUILD_KEY=""
export BUILD_CLEAN=0
export BASE="/var/local/oab"
export JAVA6="sun-java6"
export JAVA7="oracle-java7"
"$DOCS/copywright.sh"
# Parse the options
OPTSTRING=bchk:
while getopts ${OPTSTRING} OPT
do
case ${OPT} in
b|-build-docs)
"$DOCS/build.sh" "`pwd`"
exit 0
;;
c|-clean) BUILD_CLEAN=1;;
h|-help)
"$DOCS/usage.sh"
exit 0
;;
k) BUILD_KEY=${OPTARG};;
*)
"$DOCS/usage.sh"
exit 1
;;
esac
done
shift "$(( $OPTIND - 1 ))"
source "$SCRIPTS/common.sh"
# Check we are running on a supported system in the correct way.
check_root
check_sudo
"$SCRIPTS/remove_ppa.sh"
"$SCRIPTS/install_build_deps.sh"
"$SCRIPTS/create_build_dirs.sh"
# Skip Java 6 as the download links are broken due to deprecation
# for sun-java6
#"$SCRIPTS/get_build_scripts.sh" "$JAVA6"
#"$SCRIPTS/get_java6.sh"
# for oracle-java7
"$SCRIPTS/get_build_scripts.sh" "$JAVA7"
"$SCRIPTS/get_java7.sh"
"$SCRIPTS/create_repository.sh"
"$SCRIPTS/sign_packages.sh"
# Update apt cache
echo "deb file://$BASE/deb /" > /etc/apt/sources.list.d/oab.list
apt_update
# remove download index and download release page
echo "removing extra files..." >> "$LOG"
rm -rf /tmp/oab-index.html
rm -rf /tmp/oab-download.html
# unset global variables
echo "unsetting variables..." >> "$LOG"
unset SCRIPTS
unset DOCS
unset BASE
unset LOG
unset BUILD_KEY
unset BUILD_CLEAN
unset DEB_VERSION
unset DEB_URGENCY
unset JAVA_VER
unset JAVA_UPD
unset JAVA6
unset JAVA7
echo "All done!"