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 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302
|
j2se_readme() {
cat << EOF
Package for $j2se_title
---
This package has been automatically created with java-package ($version).
All files from the original distribution should have been installed in
the directory $jvm_base$j2se_name. Please take a look at this directory for
further information.
EOF
}
j2se_changelog() {
cat << EOF
$j2se_package ($j2se_version) $target_distribution; urgency=medium
* This package was created with java-package ($version).
-- $maintainer_name <$maintainer_email> $( date -R )
EOF
}
j2se_control() {
if test -n "$build_depends"; then
build_depends=", $build_depends"
fi
cat << EOF
Source: $j2se_package
Section: non-free/devel
Priority: optional
Maintainer: $maintainer_name <$maintainer_email>
Build-Depends: debhelper (>= 9)${build_depends}
Standards-Version: 3.9.8
EOF
}
j2se_copyright() {
cat << EOF
----------------------------------------------------------------------
This file contains a copy of all copyright files found in the original
distribution. The original copyright files and further information can
be found in the directory $jvm_base$j2se_name and its
subdirectories.
----------------------------------------------------------------------
EOF
(
cd "$package_dir"
find * -type f -iname copyright ! -path debian/copyright |
while read file; do
cat << EOF
File: $jvm_base$file
----------------------------------------------------------------------
EOF
iconv -f ISO-8859-15 -t UTF-8 "$file" | sed 's/[ \t]*$//'
cat << EOF
----------------------------------------------------------------------
EOF
done
)
}
j2se_rules() {
cat << EOF
#!/usr/bin/make -f
# Exclude libraries that pull in ALSA or OpenGL which are not needed in normal operation
EXCLUDE_LIBS = \\
--exclude=avplugin \\
--exclude=fxavcodecplugin \\
--exclude=libjsoundalsa.so \\
EOF
for lib in $exlude_libs; do
printf '\t--exclude=%s \\\n' "$lib"
done
cat << EOF
\$(NULL)
%:
dh \$@
override_dh_compress:
dh_compress \$(shell find $j2se_name/man/ -type f ! -name '*.gz' -printf '${jvm_base##/}/%p\n')
override_dh_shlibdeps:
dh_shlibdeps \$(EXCLUDE_LIBS) -l\$(shell find $j2se_name -type f -name '*.so*' -printf '${jvm_base##/}/%h\n' | sort -u | tr '\n' ':' | sed 's/:\$\$//')
override_dh_strip_nondeterminism:
# Disable dh_strip_nondeterminism to speed up the build
override_dh_strip:
# Disable, breaks jmap and other tools - BTS #852342
EOF
}
j2se_doc_rules() {
cat << EOF
#!/usr/bin/make -f
%:
dh \$@
override_dh_strip_nondeterminism:
# Disable dh_strip_nondeterminism to speed up the build
override_dh_strip:
# Disable, breaks jmap and other tools - BTS #852342
EOF
}
j2se_install_scripts() {
cat > "$debian_dir/postinst" << EOF
#!/bin/bash
set -e
if [ "\$1" = configure ]; then
# Common functions for all install scripts
# install_alternatives program_base programs
install_alternatives() {
program_base="\$1"
shift
for program in \$*; do
if [[ -f "\$program_base/\$program" ]]; then
update-alternatives \\
--install "/usr/bin/\$program" "\$program" "\$program_base/\$program" ${priority_override:-$j2se_priority} \\
--slave "/usr/share/man/man1/\$program.1.gz" "\$program.1.gz" "$jvm_base$j2se_name/man/man1/\$program.1.gz"
fi
done
}
# install_alternatives_no_man program_base programs
install_no_man_alternatives() {
program_base="\$1"
shift
for program in \$*; do
if [[ -f "\$program_base/\$program" ]]; then
update-alternatives --install "/usr/bin/\$program" "\$program" "\$program_base/\$program" ${priority_override:-$j2se_priority}
fi
done
}
EOF
if [ "$create_cert_softlinks" == "true" ];then
cat >> "$debian_dir/postinst" << EOF
for subdir in lib/security jre/lib/security;do
if [ -f $jvm_base$j2se_name/\$subdir/cacerts ]; then
ln -sf /etc/ssl/certs/java/cacerts $jvm_base$j2se_name/\$subdir/cacerts
fi
done
EOF
fi
eval "$j2se_install" >> "$debian_dir/postinst"
cat >> "$debian_dir/postinst" << EOF
fi
#DEBHELPER#
exit 0
EOF
chmod 755 "$debian_dir/postinst"
cat > "$debian_dir/prerm" << EOF
#!/bin/bash
set -e
case "\$1" in
remove | deconfigure)
# Common functions for all remove scripts
# remove_alternatives program_base programs
remove_alternatives() {
program_base="\$1"
shift
for program in \$*; do
update-alternatives --remove "\$program" "\$program_base/\$program"
done
}
EOF
eval "$j2se_remove" >> "$debian_dir/prerm"
cat >> "$debian_dir/prerm" << EOF
;;
esac
#DEBHELPER#
exit 0
EOF
chmod 755 "$debian_dir/prerm"
}
j2se_info() {
cat << EOF
version="$version"
j2se_version="$j2se_version"
maintainer_name="$maintainer_name"
maintainer_email="$maintainer_email"
date="$( date +%Y/%m/%d )"
EOF
}
# jinfos prefix program_base programs
jinfos() {
prefix="$1"
program_base="$2"
shift ; shift
for program in $*; do
echo "$prefix $program $program_base$program"
done
}
j2se_build() {
if [ -n "$build_source" ]; then
local source_dir=${j2se_package}-${j2se_version}
echo " copy ${source_dir} into directory $working_dir/"
rm -rf "$working_dir/${source_dir}"
cp -r "$package_dir" "$working_dir/${source_dir}"
cat << EOF
The Debian source package has been created in the current directory.
You can build the package with:
cd ${source_dir}
dpkg-buildpackage -b -uc -us
EOF
else
cd "$package_dir"
echo "Create debian package:"
dpkg-buildpackage -b -uc -us
cd "$tmp"
local deb_filename="$( echo "${j2se_package}_"*.deb )"
echo " copy $deb_filename into directory $working_dir/"
cp "$deb_filename" "$working_dir/"
if [ -n "$genchanges" ]; then
echo " dpkg-genchanges"
local changes_filename="${deb_filename%.deb}.changes"
echo " copy $changes_filename into directory $working_dir/"
cp "$changes_filename" "$working_dir/"
fi
cat << EOF
The Debian package has been created in the current directory.
You can install the package as root with:
dpkg -i $deb_filename
EOF
fi
}
# build debian package
j2se_run() {
echo
diskfree "$j2se_required_space"
read_maintainer_info
get_distribution
case "${j2se_arch}" in
i586)
j2se_debian_arch=i386
;;
amd64|x64)
j2se_debian_arch=amd64
;;
esac
j2se_name="$j2se_package-$j2se_debian_arch"
local target="$package_dir/$j2se_name"
install -d -m 755 "$( dirname "$target" )"
extract_bin "$archive_path" "$j2se_expected_min_size" "$target"
if [[ -n "$jce_archive" ]]; then
extract_jce "$jce_path" "$target/jre/lib/security"
fi
rm -rf "$target/.systemPrefs"
echo "9" > "$debian_dir/compat"
j2se_readme > "$debian_dir/README.Debian"
j2se_changelog > "$debian_dir/changelog"
eval "$j2se_control" > "$debian_dir/control"
j2se_copyright > "$debian_dir/copyright"
j2se_rules > "$debian_dir/rules"
chmod +x "$debian_dir/rules"
j2se_install_scripts
install -d "$target/debian"
j2se_info > "$target/debian/info"
eval "$j2se_jinfo" > "$package_dir/.$j2se_name.jinfo"
echo ".$j2se_name.jinfo $jvm_base" > "$debian_dir/install"
echo "$j2se_name $jvm_base" >> "$debian_dir/install"
j2se_build
}
|