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 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499
|
#!/bin/sh
set -e
# make-sqlcl-package
# (2018-01-10)
# Copyright © 2017-2018 Lazarus Long <lazarus (dot) long (at) sapo (dot) pt>
##########################################################################
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
##########################################################################
# Debian package builder and installer for Oracle SQL Developer Command-Line
#DEBUG=1
#VERBOSE=1
PATH="/usr/bin:/bin:/usr/sbin:/sbin"
if [ ${DEBUG:=0} -ne 0 ] ; then
trap
set -x
fi
VERSION="0.1.1"
DESC="Debian package builder and installer for Oracle SQL Developer Command-Line"
AUTHOR="Lazarus Long"
COPYRIGHT="2017-2018"
ITP=882113
PROGNAME="sqlcl"
HOMEPAGE="http://www.oracle.com/technetwork/developer-tools/sqlcl/overview/"
BASENAME="basename"
CAT="cat"
CHMOD="chmod"
CUT="cut"
DATE="date"
DEBUILD="debuild"
DPKG="dpkg"
DPKG_QUERY="dpkg-query"
FILE="file"
FIND="find"
GETOPT="getopt"
GREP="grep"
HOSTNAME="hostname"
LS="ls"
MKDIR="mkdir"
MKTEMP="mktemp"
MV="mv"
RM="rm"
SED="sed"
TR="tr"
TRUE="true"
UNZIP="unzip"
XARGS="xargs"
GREP_OPTS="-E"
MKDIR_OPTS="-p"
SED_OPTS="-e"
DEBFULLNAME=${DEBFULLNAME:=""}
DEBEMAIL=${DEBEMAIL:="${USER}@$(${HOSTNAME})"}
STANDARDS="4.1.3"
INSTDIR="usr"
CURDIR="${PWD}"
INVOCATION="$(${BASENAME} "${0}")"
SILENT=0
RM_OPTS_FUNC_TRAP="-rf"
# Cleanup at exit
#
func_exit() {
if [ ${DEBUG} -ne 0 ] ; then
trap
set +x
fi
}
# Trap interrupt signals
#
func_break() {
func_exit
}
# Trap events
#
func_trap() {
trap func_exit 0
if [ ${DEBUG} -eq 0 ] ; then
trap func_break HUP INT QUIT ABRT
fi
}
# Display a header for the program
#
func_header() {
if [ ${SILENT} -eq 0 ] ; then
printf "%s %s Copyright © %s %s\n%s\n\n" "${INVOCATION}" "${VERSION}" "${COPYRIGHT}" "${AUTHOR}" "${DESC}"
fi
return 0
}
# Display the program version
#
func_version() {
printf "%s %s\n" "${INVOCATION}" "${VERSION}"
if [ ${SILENT} -eq 0 ] ; then
printf "\nCopyright © %s %s\nLicense GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.\n\nWritten by %s.\n" "${COPYRIGHT}" "${AUTHOR}" "${AUTHOR}"
fi
return 0
}
# Display the program help
#
func_help() {
func_header
local HELP_MSG="Usage:\t${INVOCATION} [options] <file>\n\nOptions:\n\t-b|--build-dir <dir>\n\t\tbase directory to build package(s) (autogenerated)\n\t-e|--email <email>\n\t\tlocal maintainer email (use DEBEMAIL or auto-generate)\n\t-i|--install\n\t\tinstall the generated package(s) - needs root privilege (no)\n\t-k|--keep-dir\n\t\tkeep the build directory (no)\n\t-l|--revision <number>\n\t\tlocal revision to append to package version (1)\n\t-m|--maintainer <name>\n\t\tlocal maintainer name (use DEBFULLNAME or leave empty)\n\t-q|--quiet\n\t\tsuppress normal output (no)\n\t-r|--root-command <command>\n\t\tcommand to gain root privilege for package build (fakeroot)\n\t-u|--upstream-version <version>\n\t\tforce the upstream version (autodetected)\n\t-x|--extract-only\n\t\tprepare build tree, do not build package(s) [implies -k|--keep-dir] (no)\n\t-h|--help\n\t\tdisplay this help screen\n\t-v|--version\n\t\tshow the program version (${VERSION})\n\n\t<file>\n\t\tthe \"Oracle SQL Developer Command-Line for all platforms\" archive\n\t\tfrom <${HOMEPAGE}>"
printf "%b\n" "${HELP_MSG}"
return 0
}
# Parse the command line options
#
func_opts() {
local GETOPT_OPTS="-o hb:e:ikl:m:qr:u:vx -l help,build-dir:,email:,install,keep-dir,revision:,maintainer:,quiet,root-command:,upstream-version:,version,extract-only -s sh"
local GETOPT_RUN="$(${GETOPT} ${GETOPT_OPTS} -n ${INVOCATION} -- "${@}")"
INSTALL=0
KEEPDIR=0
NOBUILD=0
if [ ${?} -ne 0 ] ; then
func_header >&2
if [ ${SILENT} -eq 0 ] ; then
printf "Error parsing command line, terminating...\n" >&2
else
printf "%s: Error parsing command line, terminating...\n" "${INVOCATION}" >&2
fi
exit 1
fi
eval set -- "${GETOPT_RUN}"
while $(${TRUE}) ; do
case "${1}" in
-h|--help)
func_help
exit 0
;;
-b|--build-dir)
WORKDIR="${2}"
shift 2
;;
-e|--email)
DEBEMAIL="${2}"
shift 2
;;
-i|--install)
INSTALL=1
shift
;;
-k|--keep-dir)
KEEPDIR=1
shift
;;
-l|--revision)
LOCALVER="${2}"
shift 2
;;
-m|--maintainer)
DEBFULLNAME="${2}"
shift 2
;;
-q|--quiet)
SILENT=1
shift
;;
-r|--root-command)
ROOTCMD="${2}"
shift 2
;;
-u|--upstream-version)
UPSTREAMVER="${2}"
shift 2
;;
-v|--version)
func_version
exit 0
;;
-x|--extract-only)
KEEPDIR=1
NOBUILD=1
shift
;;
--)
shift
break
;;
*)
func_header >&2
if [ ${SILENT} -eq 0 ] ; then
printf "Unknown option \"%s\" or internal error, terminating...\n" "${1}" >&2
else
printf "%s: Unknown option \"%s\" or internal error, terminating...\n" "${INVOCATION}" "${1}" >&2
fi
exit 1
;;
esac
done
if [ ${#} -lt 1 ] ; then
func_header >&2
if [ ${SILENT} -eq 0 ] ; then
printf "Missing command line parameter, use \"-h\" or \"--help\" for syntax, terminating...\n" >&2
else
printf "%s: Missing command line parameter, use \"-h\" or \"--help\" for syntax, terminating...\n" "${INVOCATION}" >&2
fi
exit 1
elif [ ${#} -gt 1 ] ; then
func_header >&2
if [ ${SILENT} -eq 0 ] ; then
printf "Extra command line parameter, use \"-h\" or \"--help\" for syntax, terminating...\n" >&2
else
printf "%s: Extra command line parameter, use \"-h\" or \"--help\" for syntax, terminating...\n" "${INVOCATION}" >&2
fi
exit 1
else
ARCHIVE="${1}"
if ! [ -f "${ARCHIVE}" ] ; then
func_header
if [ ${SILENT} -eq 0 ] ; then
printf "\"%s\" not found, aborting...\n" "${ARCHIVE}" >&2
else
printf "%s: \"%s\" not found, aborting...\n" "${INVOCATION}" "${ARCHIVE}" >&2
fi
exit 1
fi
fi
return 0
}
# Indicate active flags
#
func_flags() {
if [ ${SILENT} -eq 0 ] ; then
local COUNT=0
printf "Environment variables are:\n\tDEBFULLNAME=\"%s\"\n\tDEBEMAIL=\"%s\"\nActive flags are:" "${DEBFULLNAME}" "${DEBEMAIL}"
if [ ${INSTALL} -ne 0 ] ; then
COUNT=$((${COUNT} + 1))
printf " -i|--install"
fi
if [ ${KEEPDIR} -ne 0 ] ; then
COUNT=$((${COUNT} + 1))
printf " -k|--keep-dir"
fi
if [ ${NOBUILD} -ne 0 ] ; then
COUNT=$((${COUNT} + 1))
printf " -x|--extract-only"
fi
if [ ${COUNT} -eq 0 ] ; then
printf " (none)"
fi
printf "\n"
fi
return 0
}
# Setup the work directory
#
func_workdir() {
if [ -z "${WORKDIR}" ] ; then
local MKTEMP_OPTS_FUNC_WORKDIR="-d"
WORKDIR="$(${MKTEMP} ${MKTEMP_OPTS_FUNC_WORKDIR})" || {
if [ ${SILENT} -eq 0 ] ; then
printf "\nUnable to create the work directory, aborting...\n" >&2
else
printf "%s: Unable to create the work directory, aborting...\n" "${INVOCATION}" >&2
fi
exit 1
}
if [ ${SILENT} -eq 0 ] ; then
printf "Creating work directory \"%s\" ... " "${WORKDIR}"
fi
else
if [ ${SILENT} -eq 0 ] ; then
printf "Creating work directory \"%s\" ... " "${WORKDIR}"
fi
if ! [ -d "${WORKDIR}" ] ; then
if [ -e "${WORKDIR}" ] ; then
if [ ${SILENT} -eq 0 ] ; then
printf "\n\"%s\" already exists and isn't a directory, aborting...\n" "${WORKDIR}" >&2
else
printf "%s: \"%s\" already exists and isn't a directory, aborting...\n" "${INVOCATION}" "${WORKDIR}" >&2
fi
exit 1
fi
${MKDIR} ${MKDIR_OPTS} "${WORKDIR}"
else
local DIRTEST="$(${LS} "${WORKDIR}")"
if [ ${#DIRTEST} -ne 0 ] ; then
if [ ${SILENT} -eq 0 ] ; then
printf "\n\"%s\" is not empty, aborting...\n" "${WORKDIR}" >&2
else
printf "%s: \"%s\" is not empty, aborting...\n" "${INVOCATION}" "${WORKDIR}" >&2
fi
exit 1
fi
fi
fi
if [ ${KEEPDIR} -ne 1 ] ; then
trap "${RM} ${RM_OPTS_FUNC_TRAP} ${WORKDIR}" EXIT HUP INT TRAP TERM
fi
WORKDIR="${WORKDIR}/${PROGNAME}"
if [ ${SILENT} -eq 0 ] ; then
printf "done!\n"
printf "Creating build installation directory \"%s\" ... " "${WORKDIR}"
fi
${MKDIR} ${MKDIR_OPTS} "${WORKDIR}"
if [ ${SILENT} -eq 0 ] ; then
printf "done!\n"
fi
return 0
}
# Extract the archive to the work directory
#
func_extract() {
if [ ${#} -ne 2 ] ; then
printf "Usage: func_extract() <archive> <path for extraction>\n"
return 1
fi
local UNZIP_OPTS_FUNC_EXTRACT="-Xq ${1} -d ${2}"
if [ ${SILENT} -eq 0 ] ; then
printf "Extracting upstream archive \"%s\" to \"%s\" ... " "${1}" "${2}"
fi
local FILETYPE="$(${FILE} ${FILE_OPTS} "${1}")"
printf "%s\n" "${FILETYPE}" |${GREP} ${GREP_OPTS} "Zip archive data" >/dev/null 2>&1 || {
if [ ${SILENT} -eq 0 ] ; then
printf "\nfunc_extract(): Unknown archive format for \"%s\", aborting...\n" "${1}" >&2
else
printf "%s - func_extract(): Unknown archive format for \"%s\" , aborting...\n" "${INVOCATION}" "${1}" >&2
fi
exit 1
}
${UNZIP} ${UNZIP_OPTS_FUNC_EXTRACT}
if [ ${SILENT} -eq 0 ] ; then
printf "done!\n"
fi
return 0
}
# Set the program version and modifies paths accordingly
#
func_upstreamversion() {
if [ ${#} -ne 1 ] ; then
printf "Usage: func_upstreamversion() <directory>\n"
return 1
fi
local MV_OPTS_FUNC_UPVER="--strip-trailing-slashes"
if [ ${SILENT} -eq 0 ] ; then
printf "Obtaining upstream full version: "
fi
if ! [ -d "${1}" ] ; then
if [ ${SILENT} -eq 0 ] ; then
printf "\nfunc_upstreamversion(): Directory \"%s\" not found, aborting...\n" "${1}" >&2
else
printf "%s - func_upstreamversion(): Directory \"%s\" not found, aborting...\n" "${INVOCATION}" "${1}" >&2
fi
exit 1
fi
if [ -z "${UPSTREAMVER}" ] ; then
local CUT_OPTS_FUNC_UPVER="-d = -f 2"
local TR_OPTS_FUNC_UPVER="-d [[:space:]]"
local UNZIP_OPTS_FUNC_UPVER="-p"
local JARFILE="${1}/${PROGNAME}/lib/oracle.sqldeveloper.sqlcl.jar"
local VERSTRING="^SQLclVersion.VERSION"
local VERTEMP="$(${UNZIP} ${UNZIP_OPTS_FUNC_UPVER} "${JARFILE}" "oracle/dbtools/versions/version.properties" 2>/dev/null)"
if [ ${#VERTEMP} -eq 0 ] ; then
CUT_OPTS_FUNC_UPVER="-d : -f 2"
VERSTRING="Release"
VERTEMP="$(${UNZIP} ${UNZIP_OPTS_FUNC_UPVER} "${JARFILE}" "META-INF/MANIFEST.MF" 2>/dev/null)"
fi
if [ ${#VERTEMP} -eq 0 ] ; then
if [ ${SILENT} -eq 0 ] ; then
printf "\nfunc_upstreamversion(): Unable to process jar \"%s\", aborting...\n" "${JARFILE}" >&2
else
printf "%s - func_upstreamversion(): Unable to proces jar \"%s\", aborting...\n" "${INVOCATION}" "${JRFILE}" >&2
fi
exit 1
fi
UPSTREAMVER="$(printf "${VERTEMP}" |${GREP} ${GREP_OPTS} "^${VERSTRING}" |${CUT} ${CUT_OPTS_FUNC_UPVER} |${TR} ${TR_OPTS_FUNC_UPVER})"
fi
if [ ${SILENT} -eq 0 ] ; then
printf "\"%s\" ... " "${UPSTREAMVER}"
fi
UPSTREAMVERMAJ="${UPSTREAMVER%%.*}"
UPSTREAMVERMIN="${UPSTREAMVER#*.}"
UPSTREAMVERREV="${UPSTREAMVERMIN#*.}"
UPSTREAMVERMIN="${UPSTREAMVERMIN%%.*}"
UPSTREAMVERREV="${UPSTREAMVERREV%%.*}"
if [ -z "${LOCALVER}" ] ; then
LOCALVER=1
fi
local OLDNAME="${WORKDIR}"
WORKDIR="${WORKDIR}-${UPSTREAMVER}"
if [ ${SILENT} -eq 0 ] ; then
printf "done!\n"
printf "Renaming the work directory \"%s\" to \"%s\" ... " "${OLDNAME}" "${WORKDIR}"
fi
${MV} ${MV_OPTS_FUNC_UPVER} "${OLDNAME}" "${WORKDIR}"
if [ ${SILENT} -eq 0 ] ; then
printf "done!\n"
fi
return 0
}
# Reorganizes the work directory to comply with FHS
#
func_reorganize() {
if [ ${#} -ne 1 ] ; then
printf "Usage: func_reorganize() <directory>\n"
return 1
fi
local MV_OPTS_FUNC_REORG="--strip-trailing-slashes"
if [ ${SILENT} -eq 0 ] ; then
printf "Reorganizing the work directory \"%s\" to generate FSH compliant package(s) ... " "${1}"
fi
local OPTDIR="${1}/${PROGNAME}"
if ! [ -d "${OPTDIR}" ] ; then
if [ ${SILENT} -eq 0 ] ; then
printf "\nfunc_reorganize(): Directory \"%s\" not found, aborting...\n" "${OPTDIR}" >&2
else
printf "%s - func_reorganize(): Directory \"%s\" not found, aborting...\n" "${INVOCATION}" "${OPTDIR}" >&2
fi
exit 1
fi
if [ ! -d "${OPTDIR}/lib" -o ! -d "${OPTDIR}/bin" ] ; then
if [ ${SILENT} -eq 0 ] ; then
printf "\nfunc_reorganize(): Unrecognized directory structure in \"%s\", aborting...\n" "${OPTDIR}" >&2
else
printf "%s - func_reorganize(): Unrecognized directory structure in \"%s\", aborting...\n" "${INVOCATION}" "${OPTDIR}" >&2
fi
exit 1
fi
${MV} ${MV_OPTS_FUNC_REORG} "${OPTDIR}/lib" "${OPTDIR}/${UPSTREAMVER}"
${MKDIR} ${MKDIR_OPTS} "${OPTDIR}/share/${PROGNAME}"
${MV} ${MV_OPTS_FUNC_REORG} "${OPTDIR}/${UPSTREAMVER}" "${OPTDIR}/share/${PROGNAME}"
if [ -f "${OPTDIR}/bin/sql" ] ; then
${MV} ${MV_OPTS_FUNC_REORG} "${OPTDIR}/bin/sql" "${OPTDIR}/bin/sql.${UPSTREAMVER}.standalone"
else
if [ ${SILENT} -eq 0 ] ; then
printf "\nfunc_reorganize(): Original command \"%s\" not found, aborting...\n" "${OPTDIR}/bin/sql" >&2
else
printf "%s - func_reorganize(): Original command \"%s\" not found, aborting...\n" "${INVOCATION}" "${OPTDIR}/bin/sql" >&2
fi
exit 1
fi
${MV} ${MV_OPTS_FUNC_REORG} "${OPTDIR}" "${1}/usr"
if [ ${SILENT} -eq 0 ] ; then
printf "done!\n"
fi
return 0
}
# Cleans up the work direcory from cruft and binaries from other OS
#
func_cleanup() {
if [ ${#} -ne 1 ] ; then
printf "Usage: func_cleanup() <directory>\n"
return 1
fi
if [ ${SILENT} -eq 0 ] ; then
printf "Cleaning up work directory \"%s\" for compliant package(s) generation:\n" "${1}"
fi
local CHMOD_OPTS_EXEC="755"
local CHMOD_OPTS_NOEXEC="644"
local CUT_OPTS_FUNC_CLEAN="-d : -f 1"
local RM_OPTS_FUNC_CLEAN="-rf"
local SED_OPTS_INLINE="-i ${SED_OPTS}"
local OPTDIR="${1}/usr"
if ! [ -d "${OPTDIR}" ] ; then
if [ ${SILENT} -eq 0 ] ; then
printf "func_cleanup(): Directory \"%s\" not found, aborting...\n" "${OPTDIR}" >&2
else
printf "%s - func_cleanup(): Directory \"%s\" not found, aborting...\n" "${INVOCATION}" "${OPTDIR}" >&2
fi
exit 1
fi
# Deletes
#
if [ ${SILENT} -eq 0 ] ; then
printf "\tdeleting foreign binaries ... "
fi
# Binaries from other OSs
${FIND} "${OPTDIR}" ! \( -type d -o -iname "*.jar" \) |${XARGS} ${XARGS_OPTS} ${FILE} ${FILE_OPTS} |${GREP} ${GREP_OPTS} "PE32\+ executable|PE32 executable|DOS batch" |${CUT} ${CUT_OPTS_FUNC_CLEAN} |${XARGS} ${XARGS_OPTS} ${RM} ${RM_OPTS_FUNC_CLEAN}
${FIND} "${OPTDIR}" ! -type d \( -iname "*.bat" \) |${XARGS} ${XARGS_OPTS} ${RM} ${RM_OPTS_FUNC_CLEAN}
if [ ${SILENT} -eq 0 ] ; then
printf "done!\n"
fi
# Fixes
#
if [ ${SILENT} -eq 0 ] ; then
printf "\tfixing paths"
fi
# Fix path
for f in $(${FIND} "${OPTDIR}" ! \( -type d -o -iname "*.jar" \) |${XARGS} ${XARGS_OPTS} ${FILE} ${FILE_OPTS} |${GREP} ${GREP_OPTS} "text executable" |${GREP} ${GREP_OPTS} "shell script" |${CUT} ${CUT_OPTS_FUNC_CLEAN} |${SED} ${SED_OPTS} 's/[[:space:]]/#/g') ; do
${SED} ${SED_OPTS_INLINE} "s%_HOME/lib%_HOME/share/${PROGNAME}/${UPSTREAMVER}%g" "$(printf "${f}\n" |${SED} ${SED_OPTS} 's/#/ /g')"
done
if [ ${SILENT} -eq 0 ] ; then
printf ", executable bit"
fi
# Set executable bit
${FIND} "${OPTDIR}" ! -type d -iname "*.jar" |${XARGS} ${XARGS_OPTS} ${CHMOD} ${CHMOD_OPTS_NOEXEC}
${FIND} "${OPTDIR}" ! \( -type d -o -iname "*.jar" \) |${XARGS} ${XARGS_OPTS} ${FILE} ${FILE_OPTS} |${GREP} ${GREP_OPTS} "text executable" |${GREP} ${GREP_OPTS} "shell script"|${CUT} ${CUT_OPTS_FUNC_CLEAN} |${XARGS} ${XARGS_OPTS} ${CHMOD} ${CHMOD_OPTS_EXEC}
if [ ${SILENT} -eq 0 ] ; then
printf " ... done!\n"
fi
return 0
}
# Setup the debian directory
#
func_debianize() {
if [ ${#} -ne 1 ] ; then
printf "Usage: func_debianize() <directory>\n"
return 1
fi
if [ ${SILENT} -eq 0 ] ; then
printf "Populating the \"%s/debian\" package control directory:\n" "${1}"
fi
if ! [ -d "${1}" ] ; then
if [ ${SILENT} -eq 0 ] ; then
printf "func_debianize(): Directory \"%s\" not found, aborting...\n" "${1}" >&2
else
printf "%s - func_debianize(): Directory \"%s\" not found, aborting...\n" "${INVOCATION}" "${1}" >&2
fi
exit 1
fi
local CHMOD_OPTS_EXEC="755"
local DATE_OPTS_FUNC_DEB="-R"
local DPKG_QUERY_OPTS_VERSION="--showformat=\${Version} --show"
local DEBIAN_WORKDIR="${1}/debian"
local POSTINST_PRIO=$(printf "%02u%02u%02u" ${UPSTREAMVERMAJ} ${UPSTREAMVERMIN} ${UPSTREAMVERREV})
${MKDIR} ${MKDIR_OPTS} "${DEBIAN_WORKDIR}"
if [ ${SILENT} -eq 0 ] ; then
printf "\tdebian/changelog ... "
fi
(
${CAT} <<EOF
${PROGNAME}-${UPSTREAMVER} (${UPSTREAMVER}+${VERSION}-${LOCALVER}) unstable; urgency=low
* Built with ${INVOCATION} ${VERSION} (Closes: #${ITP})
* The upstream invocation 'sql' has been changed to
'sql.${UPSTREAMVER}.standalone' to avoid conflict with package 'parallel'
* Since version 4.2 Oracle started to bundle Oracle SQL Developer
Command-Line (SQLcl) with Oracle SQL Developer. When available, and as an
alternative to the bundled package (see "sqldeveloper-package"),
"sql.[upstream version].standalone" will invoke a specific version of
SQLcl while "sqlcl.standalone" takes advantage of Debian's alternatives
system and, when left in auto mode, will always invoke the highest
standalone version installed, and "sqlcl" will invoke the highest version
installed (either standalone or bundled, by this order)
-- ${DEBFULLNAME} <${DEBEMAIL}> $(${DATE} ${DATE_OPTS_FUNC_DEB})
EOF
) >"${DEBIAN_WORKDIR}/changelog"
if [ ${SILENT} -eq 0 ] ; then
printf "done!\n"
printf "\tdebian/compat ... "
fi
printf "11\n" >"${DEBIAN_WORKDIR}/compat"
if [ ${SILENT} -eq 0 ] ; then
printf "done!\n"
printf "\tdebian/control ... "
fi
(
${CAT} <<EOF
Source: ${PROGNAME}-${UPSTREAMVER}
Section: non-free/misc
Priority: optional
Maintainer: ${DEBFULLNAME} <${DEBEMAIL}>
Build-Depends: debhelper (>= $(${DPKG_QUERY} ${DPKG_QUERY_OPTS_VERSION} debhelper))
Standards-Version: ${STANDARDS}
Homepage: ${HOMEPAGE}
Package: ${PROGNAME}-${UPSTREAMVER}
Architecture: all
Depends: \${misc:Depends}
Recommends: java8-runtime | java9-runtime
Provides: oracle-sql-client, oracle-sql-client-cli, ${PROGNAME}.standalone, ${PROGNAME}
Description: Oracle SQL Developer Command-Line
Oracle SQL Developer Command-Line (SQLcl) is a free command line interface
for Oracle Database. It allows you to interactively or batch execute SQL and
PL/SQL. SQLcl provides in-line editing, statement completion, and command
recall for a feature-rich experience, all while also supporting your
previously written SQL*Plus scripts.
.
Oracle SQL Developer Command-Line is a Java application and requires a Java
JRE. The minimum JRE you should use is 1.8 (JRE8.0).
EOF
) >>"${DEBIAN_WORKDIR}/control"
if [ ${SILENT} -eq 0 ] ; then
printf "done!\n"
printf "\tdebian/copyright ... "
fi
(
${CAT} <<EOF
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Oracle SQL Developer Command-Line
Upstream-Contact: https://www.oracle.com/corporate/contact/index.html
Source: ${HOMEPAGE}
Disclaimer:
This package is not part of the Debian GNU/Linux distribution. It falls into
category 2.2.3 of the Debian Policy Manual ("... not compliant with the DFSG
or are encumbered by patents or other legal issues that make their
distribution problematic.").
Comment:
This package was debianized by ${DEBFULLNAME} <${DEBEMAIL}> on
$(${DATE} ${DATE_OPTS_FUNC_DEB}).
Files: *
Copyright: Copyright © 2009-2017 Oracle USA, Inc.
License: OracleSQLDeveloper
Files: debian/*
Copyright: Copyright © 2017-2018 Lazarus Long <lazarus.long@sapo.pt>
License: GPL-3+
License: OracleSQLDeveloper
Oracle SQL Developer License Terms
Oracle SQL Developer Data Modeler License Terms
.
Export Controls on the Programs
Selecting the "Accept License Agreement" button is a confirmation of
your agreement that you comply, now and during the trial term, with
each of the following statements:
.
-You are not a citizen, national, or resident of, and are not under
control of, the government of Cuba, Iran, Sudan, Libya, North Korea,
Syria, nor any country to which the United States has prohibited export.
-You will not download or otherwise export or re-export the Programs,
directly or indirectly, to the above mentioned countries nor to citizens,
nationals or residents of those countries.
-You are not listed on the United States Department of Treasury lists
of Specially Designated Nationals, Specially Designated Terrorists,
and Specially Designated Narcotic Traffickers, nor are you listed on
the United States Department of Commerce Table of Denial Orders.
.
You will not download or otherwise export or re-export the Programs,
directly or indirectly, to persons on the above mentioned lists.
.
You will not use the Programs for, and will not allow the Programs to
be used for, any purposes prohibited by United States law, including,
without limitation, for the development, design, manufacture or production
of nuclear, chemical or biological weapons of mass destruction.
.
EXPORT RESTRICTIONS
You agree that U.S. export control laws and other applicable export
and import laws govern your use of the programs, including technical
data; additional information can be found on Oracle®'s Global Trade
Compliance web site (http://www.oracle.com/products/export).
.
You agree that neither the programs nor any direct product thereof will
be exported, directly, or indirectly, in violation of these laws, or
will be used for any purpose prohibited by these laws including, without
limitation, nuclear, chemical, or biological weapons proliferation.
.
Oracle Employees: Under no circumstances are Oracle Employees
authorized to download software for the purpose of distributing it to
customers. Oracle products are available to employees for internal
use or demonstration purposes only. In keeping with Oracle's trade
compliance obligations under U.S. and applicable multilateral law,
failure to comply with this policy could result in disciplinary action
up to and including termination.
.
Note: You are bound by the Oracle Technology Network ("OTN") License
Agreement terms. The OTN License Agreement terms also apply to all
updates you receive under your Technology Track subscription.
.
The OTN License Agreement terms below supersede any shrinkwrap license
on the OTN Technology Track software CDs and previous OTN License terms
(including the Oracle Program License as modified by the OTN Program
Use Certificate).
.
Oracle SQL Developer License Agreement
Oracle SQL Developer Data Modeler License Agreement
.
"We," "us," and "our" refers to Oracle America, Inc., for and on behalf of
itself and its subsidiaries and affiliates under common control. "You" and
"your" refers to the individual or entity that wishes to use the programs
from Oracle. "Programs" refers to the Oracle software product you wish to
download and use and program documentation. "License" refers to your right
to use the programs under the terms of this agreement. This agreement
is governed by the substantive and procedural laws of California. You
and Oracle agree to submit to the exclusive jurisdiction of, and venue
in, the courts of San Francisco, San Mateo, or Santa Clara counties in
California in any dispute arising out of or relating to this agreement.
.
We are willing to license the programs to you only upon the condition
that you accept all of the terms contained in this agreement. Read the
terms carefully and select the "Accept" button at the bottom of the
page to confirm your acceptance. If you are not willing to be bound
by these terms, select the "Do Not Accept" button and the registration
process will not continue.
.
LICENSE RIGHTS
We grant you a nonexclusive, nontransferable limited license to use
the programs solely for your business operations and any third party
training as part of such business operations. We may audit your use
of the programs. Program documentation may be accessed online at
http://www.oracle.com/technetwork/indexes/documentation/index.html.
.
Ownership and Restrictions
We retain all ownership and intellectual property rights in the
programs. You may make a sufficient number of copies of the programs
for the licensed use and one copy of the programs for backup purposes.
.
You may not:
- remove or modify any program markings or any notice of our proprietary
rights;
- make the programs available in any manner to any third party, other
than as specified above;
- use the programs for any purpose other than as provided above;
- assign this agreement or give or transfer the programs or an interest
in them to another individual or entity;
- cause or permit reverse engineering (unless required by law for
interoperability), disassembly or decompilation of the programs;
- disclose results of any program benchmark tests without our prior
consent.
.
Export
You agree that U.S. export control laws and other applicable
export and import laws govern your use of the programs,
including technical data; additional information can be
found on Oracle's Global Trade Compliance web site located at
http://www.oracle.com/products/export/index.html?content.html. You
agree that neither the programs nor any direct product thereof will be
exported, directly, or indirectly, in violation of these laws, or will
be used for any purpose prohibited by these laws including, without
limitation, nuclear, chemical, or biological weapons proliferation.
.
Disclaimer of Warranty and Exclusive Remedies
THE PROGRAMS ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. WE
FURTHER DISCLAIM ALL WARRANTIES, EXPRESS AND IMPLIED, INCLUDING WITHOUT
LIMITATION, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE OR NONINFRINGEMENT.
.
IN NO EVENT SHALL WE BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
PUNITIVE OR CONSEQUENTIAL DAMAGES, OR DAMAGES FOR LOSS OF PROFITS,
REVENUE, DATA OR DATA USE, INCURRED BY YOU OR ANY THIRD PARTY, WHETHER
IN AN ACTION IN CONTRACT OR TORT, EVEN IF WE HAVE BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES. OUR ENTIRE LIABILITY FOR DAMAGES HEREUNDER
SHALL IN NO EVENT EXCEED ONE THOUSAND DOLLARS (U.S. \$1,000).
.
Trial Programs Included With Orders
We may include additional programs with an order which may be used for
trial purposes only. You will have 30 days from the delivery date to
evaluate these programs. Any use of these programs after the 30 day
trial period requires you to obtain the applicable license. Programs
licensed for trial purposes are provided "as is" and we do not provide
technical support or any warranties for these programs.
.
Technical Support
Our technical support organization does not provide technical support,
phone support, or updates specifically for the programs licensed under
this agreement. However, if you have a supported license of an Oracle
database program, then the technical support organization will provide
technical support, phone support for the program licensed hereunder in
conjunction with the Oracle database program license.
.
End of Agreement
You may terminate this agreement by destroying all copies of the
programs. We have the right to terminate your right to use the programs
if you fail to comply with any of the terms of this agreement, in which
case you shall destroy all copies of the programs.
.
Relationship Between the Parties
The relationship between you and us is that of licensee/licensor. Neither
party will represent that it has any authority to assume or create
any obligation, express or implied, on behalf of the other party,
nor to represent the other party as agent, employee, franchisee, or
in any other capacity. Nothing in this agreement shall be construed
to limit either party's right to independently develop or distribute
software that is functionally similar to the other party's products,
so long as proprietary information of the other party is not included
in such software.
.
Open Source
Third party technology that may be appropriate or necessary for use with
the program may be specified in the program documentation. To the extent
stated in the program documentation, such third party technology is
licensed to you under the terms of the third party technology license
agreement specified in the program documentation and not under the
terms of this agreement. Nothing in this agreement should be construed
as modifying or limiting your rights to use such third party technology
under the terms of the specified third party license.
.
Entire Agreement
You agree that this agreement is the complete agreement for the programs
and licenses, and this agreement supersedes all prior or contemporaneous
agreements or representations. If any term of this agreement is found
to be invalid or unenforceable, the remaining provisions will remain
effective.
.
Last updated: 09/17/10 (jlr)
.
Should you have any questions concerning this License Agreement, or if
you desire to contact Oracle for any reason, please write:
.
Oracle America, Inc.
500 Oracle Parkway,
Redwood City, CA 94065
.
Oracle may contact you to ask if you had a satisfactory experience
installing and using this OTN software download.
License: GPL-3+
This package is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 3 of the License, or (at your option) any later
version.
.
This package is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
.
You should have received a copy of the GNU General Public License along with
this package; if not, write to the Free Software Foundation, Inc., 51
Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
.
On Debian systems, the complete text of the GNU General Public License
version 3, can be found in \`/usr/share/common-licenses/GPL-3'.
EOF
) >"${DEBIAN_WORKDIR}/copyright"
if [ ${SILENT} -eq 0 ] ; then
printf "done!\n"
printf "\tdebian/install ... "
fi
(
${CAT} <<EOF
${INSTDIR}/* ${INSTDIR}
EOF
) >"${DEBIAN_WORKDIR}/install"
if [ ${SILENT} -eq 0 ] ; then
printf "done!\n"
printf "\tdebian/lintian-overrides ... "
fi
(
${CAT} <<EOF
classpath-contains-relative-path
missing-manifest
no-upstream-changelog
EOF
) >"${DEBIAN_WORKDIR}/lintian-overrides"
if [ ${SILENT} -eq 0 ] ; then
printf "done!\n"
printf "\tdebian/manpages ... "
fi
printf "debian/sql.${UPSTREAMVER}.standalone.1\n" >"${DEBIAN_WORKDIR}/manpages"
if [ ${SILENT} -eq 0 ] ; then
printf "done!\n"
printf "\tdebian/postinst ... "
fi
(
${CAT} <<EOF
#!/bin/sh
set -e
BINNAME="sql"
MANSECTION=1
COMPRESS=".gz"
PROG_PRIO=100
PRIO=${POSTINST_PRIO}
UPDALT_MASTER="${PROGNAME}.standalone"
UPDALT_ALT_REAL="\${BINNAME}.${UPSTREAMVER}.standalone"
UPDALT_ALT_LINK="\${BINNAME}.${UPSTREAMVER}"
INSTBINDIR="/usr/bin"
INSTMANDIR="/usr/share/man/man\${MANSECTION}"
UPDALT="update-alternatives"
UPDALT_SLAVE="--slave"
RET=0
# Invoke update-alternatives --install on the package
#
func_updalt_install() {
local RET=0
local UPDALT_ACTION="--install"
\${UPDALT} \\
\${UPDALT_ACTION} \${INSTBINDIR}/\${UPDALT_ALT_LINK} \${UPDALT_ALT_LINK} \${INSTBINDIR}/\${UPDALT_ALT_REAL} \${PRIO} \\
\${UPDALT_SLAVE} \${INSTMANDIR}/\${UPDALT_ALT_LINK}.\${MANSECTION}\${COMPRESS} \${UPDALT_ALT_LINK}.\${MANSECTION}\${COMPRESS} \${INSTMANDIR}/\${UPDALT_ALT_REAL}.\${MANSECTION}\${COMPRESS}
RET=\${?}
if [ \${RET} -ne 0 ] ; then
printf "%s postinst - unexpected return code \"%d\"\n" "${INVOCATION}" \${RET} >&2
return \${RET}
fi
\${UPDALT} \\
\${UPDALT_ACTION} \${INSTBINDIR}/\${UPDALT_MASTER} \${UPDALT_MASTER} \${INSTBINDIR}/\${UPDALT_ALT_REAL} \${PRIO} \\
\${UPDALT_SLAVE} \${INSTMANDIR}/\${UPDALT_MASTER}.\${MANSECTION}\${COMPRESS} \${UPDALT_MASTER}.\${MANSECTION}\${COMPRESS} \${INSTMANDIR}/\${UPDALT_ALT_REAL}.\${MANSECTION}\${COMPRESS}
RET=\${?}
if [ \${RET} -ne 0 ] ; then
printf "%s postinst - unexpected return code \"%d\"\n" "${INVOCATION}" \${RET} >&2
return \${RET}
fi
if [ -f "\${INSTBINDIR}/\${UPDALT_MASTER}" ] ; then
\${UPDALT} \\
\${UPDALT_ACTION} \${INSTBINDIR}/${PROGNAME} ${PROGNAME} \${INSTBINDIR}/\${UPDALT_MASTER} \${PROG_PRIO} \\
\${UPDALT_SLAVE} \${INSTMANDIR}/${PROGNAME}.\${MANSECTION}\${COMPRESS} ${PROGNAME}.\${MANSECTION}\${COMPRESS} \${INSTMANDIR}/\${UPDALT_MASTER}.\${MANSECTION}\${COMPRESS}
RET=\${?}
if [ \${RET} -ne 0 ] ; then
printf "%s postinst - unexpected return code \"%d\"\n" "${INVOCATION}" \${RET} >&2
return \${RET}
fi
fi
return \${RET}
}
case "\${1}" in
configure|abort-upgrade|abort-remove|abort-deconfigure)
func_updalt_install
RET=\${?}
;;
*)
printf "%s postinst - called with an unknown parameter\"%s\"\n" "${INVOCATION}" "\${1}" >&2
RET=1
;;
esac
exit \${RET}
EOF
) >"${DEBIAN_WORKDIR}/postinst" && ${CHMOD} ${CHMOD_OPTS_EXEC} "${DEBIAN_WORKDIR}/postinst"
if [ ${SILENT} -eq 0 ] ; then
printf "done!\n"
printf "\tdebian/prerm ... "
fi
(
${CAT} <<EOF
#!/bin/sh
set -e
BINNAME="sql"
UPDALT_MASTER="${PROGNAME}.standalone"
UPDALT_ALT_REAL="\${BINNAME}.${UPSTREAMVER}.standalone"
UPDALT_ALT_LINK="\${BINNAME}.${UPSTREAMVER}"
INSTBINDIR="/usr/bin"
UPDALT="update-alternatives"
RET=0
# Invoke update-alternatives --remove on the package
#
func_updalt_remove() {
local RET=0
local UPDALT_ACTION="--remove"
\${UPDALT} \\
\${UPDALT_ACTION} \${UPDALT_ALT_LINK} \${INSTBINDIR}/\${UPDALT_ALT_REAL}
RET=\${?}
if [ \${RET} -ne 0 ] ; then
printf "%s prerm - unexpected return code \"%d\"\n" "${INVOCATION}" \${RET} >&2
return \${RET}
fi
\${UPDALT} \\
\${UPDALT_ACTION} \${UPDALT_MASTER} \${INSTBINDIR}/\${UPDALT_ALT_REAL}
RET=\${?}
if [ \${RET} -ne 0 ] ; then
printf "%s prerm - unexpected return code \"%d\"\n" "${INVOCATION}" \${RET} >&2
return \${RET}
fi
if ! [ -f "\${INSTBINDIR}/\${UPDALT_MASTER}" ] ; then
\${UPDALT} \\
\${UPDALT_ACTION} ${PROGNAME} \${INSTBINDIR}/\${UPDALT_MASTER}
RET=\${?}
if [ \${RET} -ne 0 ] ; then
printf "%s prerm - unexpected return code \"%d\"\n" "${INVOCATION}" \${RET} >&2
return \${RET}
fi
fi
return \${RET}
}
case "\${1}" in
remove|upgrade|deconfigure|failed-upgrade)
func_updalt_remove
RET=\${?}
;;
*)
printf "%s prerm - called with an unknown parameter\"%s\"\n" "${INVOCATION}" "\${1}" >&2
RET=1
;;
esac
exit \${RET}
EOF
) >"${DEBIAN_WORKDIR}/prerm" && ${CHMOD} ${CHMOD_OPTS_EXEC} "${DEBIAN_WORKDIR}/prerm"
if [ ${SILENT} -eq 0 ] ; then
printf "done!\n"
printf "\tdebian/rules ... "
fi
(
${CAT} <<EOF
#!/usr/bin/make -f
# verbose mode
#export DH_VERBOSE=1
override_dh_builddeb:
dh_builddeb --destdir="${CURDIR}"
override_dh_strip_nondeterminism:
%:
dh \$@
EOF
) >"${DEBIAN_WORKDIR}/rules" && ${CHMOD} ${CHMOD_OPTS_EXEC} "${DEBIAN_WORKDIR}/rules"
if [ ${SILENT} -eq 0 ] ; then
printf "done!\n"
printf "\tdebian/NEWS ... "
fi
(
${CAT} <<EOF
${PROGNAME}-${UPSTREAMVER} (${UPSTREAMVER}+${VERSION}-${LOCALVER}) unstable; urgency=low
To allow multiple versions to co-exist, the alternatives system was used
with the master program as 'sqlcl'. This is the preferred method of
invocation, since if the alternatives system is left in auto mode for this
master, '/usr/bin/sqlcl' will always point to the highest version
installed.
To avoid conflicts with package 'parallel', the upstream program name
'/usr/bin/sql' has been changed to '/usr/bin/sql.${UPSTREAMVER}.standalone'.
-- ${DEBFULLNAME} <${DEBEMAIL}> $(${DATE} ${DATE_OPTS_FUNC_DEB})
EOF
) >"${DEBIAN_WORKDIR}/NEWS"
if [ ${SILENT} -eq 0 ] ; then
printf "done!\n"
printf "\tdebian/README.Debian ... "
fi
(
${CAT} <<EOF
${PROGNAME} for Debian
----------------
In order to run Oracle SQL Developer Command-Line you'll need a working JRE. The
minimum JRE you should use is 1.8 (JRE8.0).
There are several ways to obtain a compatible JRE:
- install default-jre (java), making sure it depends, at least, on the minimum
required JRE version
- install one of the required openjdk-8-jre or openjdk-9-jre (java)
- install the meta-package java-runtime, making sure that it installs, at
least, the minimum required JRE version as dependency
- install one of the meta-packages java8-runtime or java9-runtime, making sure
that it installs, at least, the minimum required JRE version as dependency
- download and run the installer for the version you wish to install from
Oracle <http://www.oracle.com/technetwork/java/javase/downloads/>
- install java-package (contrib/misc) and generate a Debian package from the
above installer
After installing a compatible JRE simply launch SQL Developer Command-Line
by invoking either sqlcl or sql.${UPSTREAMVER}.standalone. The JRE will be
automatically detected and used as long as properly installed.
-- Lazarus Long <lazarus.long@sapo.pt> $(${DATE} ${DATE_OPTS_FUNC_DEB})
EOF
) >"${DEBIAN_WORKDIR}/README.Debian"
if [ ${SILENT} -eq 0 ] ; then
printf "done!\n"
printf "\tdebian/sql.${UPSTREAMVER}.standalone.1 ... "
fi
(
${CAT} <<EOF
.\\" sql.${UPSTREAMVER}.standalone.1
.\\"
.\\" (2018-01-10)
.\\"
.\\" Copyright © 2017-2018 Lazarus Long <lazarus (dot) long (at) sapo (dot) pt>
.\\"
.\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\"
.\\" This program is free software: you can redistribute it and/or modify .\\"
.\\" it under the terms of the GNU General Public License as published by .\\"
.\\" the Free Software Foundation, either version 3 of the License, or .\\"
.\\" (at your option) any later version. .\\"
.\\" .\\"
.\\" This program is distributed in the hope that it will be useful, .\\"
.\\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\\"
.\\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\\"
.\\" GNU General Public License for more details. .\\"
.\\" .\\"
.\\" You should have received a copy of the GNU General Public License .\\"
.\\" along with this program. If not, see <http://www.gnu.org/licenses/>. .\\"
.\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\".\\"
.\\"
.\\" Debian package builder and installer for Oracle SQL Developer Command-Line
.\\"
.\\"
.TH SQL.${UPSTREAMVER}.STANDALONE 1 2018-01-10 Oracle "Oracle SQL Developer Command-Line"
.\\"
.SH NAME
sql.${UPSTREAMVER}.standalone \\- Oracle SQL Developer Command-Line
.\\"
.SH SYNOPSIS
.PP
\\fIUsage 1:\\fP
.PP
.B sql.${UPSTREAMVER}.standalone
.RI -H\\ |\\ -V
.PP
.B ${PROGNAME}
.RI -H\\ |\\ -V
.PP
\\fIUsage 2:\\fP
.PP
.B sql.${UPSTREAMVER}.standalone \\\\\\\\
.PP
.RI [\\fB<option>\\fP] \\ [{\\fB<logon>\\fP\\ |\\ /nolog}]\\ [\\fB<start>\\fP]
.PP
.B ${PROGNAME}
.RI [\\fB<option>\\fP] \\ [{\\fB<logon>\\fP\\ |\\ /nolog}]\\ [\\fB<start>\\fP]
.\\"
.SH DESCRIPTION
\\fBsql.${UPSTREAMVER}.standalone\\fP is a \\fIJava\\fP utility that allows
one to develop for and administer \\fIOracle\\fP databases.
.PP
\\fIOracle SQL Developer Command-Line\\fP (\\fISQLcl\\fP) is a free command
line interface for \\fIOracle Database\\fP. It allows you to interactively or
batch execute \\fISQL\\fP and \\fIPL/SQL\\fP. \\fISQLcl\\fP provides in-line
editing, statement completion, and command recall for a feature-rich
experience, all while also supporting your previously written \\fISQL*Plus\\fP
scripts.
.PP
The \\fIOracle SQL Developer Command-Line \\fP program is governed by the
copyright holder (\\fIOracle USA, Inc.\\fP), it is your responsibility to use
it accordingly to the \\fI\\fBOTN\\fP license\\fP, a copy of which is included
in "\\fI/usr/share/doc/sqlcl-${UPSTREAMVER}\\fP".
.\\"
.SH OPTIONS
.TP
\\fB\\-H\\fP
Displays the SQLcl version and the usage help.
.TP
\\fB\\-V\\fP
Displays the SQLcl version.
.PP
\\fB<option>\\fP is:
.RI [-R\\ <level>]\\ [-S]\\ [-verbose]\\ [-oci]\\ [-L[OGON]]a
.TP
\\fB\\-R\\fP \\fI<level>\\fP
Sets restricted mode to disable \\fISQLcl\\fP commands that interact with the
file system. The level can be \\fB1\\fP, \\fB2\\fP, \\fB3\\fP or \\fB4\\fP. The
most restrictive is -R 4 which disables all user commands interacting with the
file system.
.TP
\\fB-S\\fP
Sets silent mode which suppresses the display of the \\fISQLcl\\fP banner,
prompts, and echoing of commands.
.TP
\\fB-verbose\\fP
Set this to show logging messages inline. By default these messages are
suppressed.
.TP
\\fB-nohistory\\fP
Switch off history logging.
.TP
\\fB-noupdates\\fP
Do not check update site for newer versions available.
.TP
\\fB-oci\\fP
Set this to use an \\fIOracle Instant Client\\fP installation. If this option
is set, then \\fISQLcl\\fP will use the drivers from the first Installation on
the path.
.TP
\\fB-L\\fP[OGON]
Specifies not to reprompt for username or password if the initial connection
does not succeed.
.PP
\\fB<logon>\\fP is:
.RI {<username>[/<password>][@<connect_identifier>]\\ |\\ /}\\ [AS\\
{SYSDBA\\ |\\ SYSOPER\\ |\\ SYSASM}]
.PP
Specifies the database account \\fBusername\\fP, \\fBpassword\\fP and
\\fBconnect identifier\\fP for the database connection. Without a connect
identifier, \\fISQLcl\\fP connects to the default database.
.PP
The \\fBAS SYSDBA\\fP, \\fBAS SYSOPER\\fP and \\fBAS SYSASM\\fP options are
database administration privileges.
.PP
\\fB<connect_identifier>\\fP can be in the form of \\fINet Service Name\\fP or
\\fIEasy Connect\\fP.
.PP
\\fB@\\fP[\\fB<net_service_name>\\fP\\ |\\ [//]\\fBHost\\fP[\\fB:Port\\fP]/\\fB<service_name>\\fP]
.PP
\\fI<net_service_name>\\fP is a simple name for a service that resolves to a
connect descriptor.
.PP
\\fBExample\fP: Connect to database using \\fINet Service Name\\fP and the
database net service name is \\fBORCL\\fP.
.PP
\\fBsql.${UPSTREAMVER}.standalone\\fP myusername/mypassword@ORCL
.PP
\\fIHost\\fP specifies the host name or IP address of the database server
computer.
.PP
\\fIPort\\fP specifies the listening port on the database server.
.PP
\\fI<service_name>\\fP specifies the service name of the database you want to
access.
.PP
\\fBExample\\fP: Connect to database using \\fIEasy Connect\\fP and the Service
name is \\fBORCL\\fP.
.PP
\\fBsql.${UPSTREAMVER}.standalone\\fP myusername/mypassword@Host/ORCL
.PP
The \\fB/NOLOG\\fP option starts \\fISQLcl\\fP without connecting to a database.
.PP
\\fB<start>\\fP is:
.RI @<URL>\\ |\\ <filename>[.<ext>]\\ [<parameter>\\ \\...]
.PP
Runs the specified \\fISQLc\\fPl script from a web server (\\fBURL\\fP) or the
local file system (\\fBfilename.ext\\fP) with specified parameters that will be
assigned to substitution variables in the script.
.PP
When \\fISQLcl\\fP starts, and after \\fBCONNECT\\fP commands, the site profile
(e.g. \\fI\$ORACLE_HOME/sqlplus/admin/glogin.sql\\fP) and the user profile (e.g.
\\fIlogin.sql\\fP in the working directory) are run. The files may contain
\\fISQLcl\\fP commands.
.PP
Refer to the \\fISQLDeveloper User's Guide and Reference\\fP for more information.
.\\"
.SH AUTHOR
\\fBOracle SQL Developer Command-Line\\fP is copyright by \\fIOracle USA, Inc.\\fP
.PP
This manual page was written by \\fILazarus Long <lazarus.long@sapo.pt>\\fP,
for the Debian project (but may be used by others).
EOF
) >"${DEBIAN_WORKDIR}/sql.${UPSTREAMVER}.standalone.1"
if [ ${SILENT} -eq 0 ] ; then
printf "done!\n"
fi
return 0
}
# Generate the Debian package
#
func_builddeb() {
if [ ${#} -ne 1 ] ; then
printf "Usage: func_builddeb() <directory>\n"
return 1
fi
if [ ${NOBUILD} -ne 0 ] ; then
return 0
fi
if [ ${SILENT} -eq 0 ] ; then
printf "Building debian package(s) from %s v%s in \"%s\":\n" "${PROGNAME}" "${UPSTREAMVER}" "${CURDIR}"
fi
if ! [ -d "${1}/debian" ] ; then
if [ ${SILENT} -eq 0 ] ; then
printf "func_builddeb(): Directory \"%s/debian\" not found, aborting...\n" "${1}" >&2
else
printf "%s - func_builddeb(): Directory \"%s/debian\" not found, aborting...\n" "${INVOCATION}" "${1}" >&2
fi
exit 1
fi
local DEBUILD_OPTS="--no-lintian --no-tgz-check"
if [ -n "${ROOTCMD}" ] ; then
DEBUILD_OPTS="--rootcmd=${ROOTCMD} ${DEBUILD_OPTS}"
fi
local DEBUILD_OPTS_INDEP="${DEBUILD_OPTS} -- binary-indep"
cd "${WORKDIR}"
if [ ${SILENT} -eq 0 ] ; then
printf "\t%s ... " "${PROGNAME}-${UPSTREAMVER}_${UPSTREAMVER}+${VERSION}-${LOCALVER}_all.deb"
fi
${DEBUILD} ${DEBUILD_OPTS_INDEP} >/dev/null 2>&1
local RET=${?}
if [ ${RET} -eq 0 ] ; then
if [ ${SILENT} -eq 0 ] ; then
printf "done!\n"
fi
else
if [ ${SILENT} -eq 0 ] ; then
printf "FAILED!\n"
fi
exit ${RET}
fi
cd "${CURDIR}"
if [ ${INSTALL} -eq 1 ] ; then
local DPKG_OPTS_FUNC_BUILD="-i"
if [ ${SILENT} -eq 0 ] ; then
printf "Installing generated package(s):\n\t%s\n" "${PROGNAME}-${UPSTREAMVER}_${UPSTREAMVER}-${LOCALVER}_all.deb"
fi
${DPKG} ${DPKG_OPTS_FUNC_BUILD} "${CURDIR}/${PROGNAME}-${UPSTREAMVER}_${UPSTREAMVER}+${VERSION}-${LOCALVER}_all.deb"
fi
return 0
}
# Run the script
#
func_run() {
func_trap
func_opts "${@}"
func_header
func_flags
func_workdir
func_extract "${ARCHIVE}" "${WORKDIR}"
func_upstreamversion "${WORKDIR}"
func_reorganize "${WORKDIR}"
func_cleanup "${WORKDIR}"
func_debianize "${WORKDIR}"
func_builddeb "${WORKDIR}"
return 0
}
func_run "${@}"
# EOF make-sqlcl-package
|