diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a10a5ca --- /dev/null +++ b/.gitignore @@ -0,0 +1,161 @@ +# ignore autogenerated .rst files in docs directory +docs/source/**/*.rst + +# custom, package specific ignores +.DS_Store +.DS_Store? +pymakr.conf +tests/ +config/config*.py +thinking/ +*.bin +.idea +*.bak + +*.o + +.vagrant/ + +# meson files under development +untitled.meson.build + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +# micropython libs are stored in lib/ +# lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal +*.sqlite3 + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..cc33637 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,20 @@ +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Set the version of Python and other tools you might need +build: + os: ubuntu-22.04 + tools: + python: "3.9" + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: docs/conf.py + +# Optionally declare the Python requirements required to build your docs +python: + install: + - requirements: docs/requirements.txt diff --git a/README.md b/README.md index bb7fc31..e8dafd4 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,81 @@ -# Oracle-Instant-Client +# Oracle Instant Client + +## Webmin Module for installing Oracle Instant Client + +![Oracle Instant Client](docs/_static/oracle-instant-client.png) + +# About + +Installs Oracle Instant Client Basic, jdbc, odbc, sdk, sqlplus, and tools packages + + +# Supported Operating Systems + +Ubuntu 22 + +Rocky Linux 9 + +Alma Linux 9 + +# Install via Webmin + +Webmin->Webmin Configuration->Webmin Modules->From ftp or http URL + +URL: http://github.com/cited/Oracle-Instant-Client/raw/master/scripts/Oracle-Instant-Client.wbm.gz + +Go to Servers->Apache Tomcat to complete set up using the setup Wizard (you may need to refresh page). + +# Install via Script + +Ubuntu (as root): + +```bash +wget https://raw.githubusercontent.com/cited/Oracle-Instant-Client/master/scripts/ubuntu.sh +chmod +x pre-install.sh +./pre-install.sh +``` + +Rocky Linux or Alma Linux (as root): + +```bash +wget https://raw.githubusercontent.com/cited/Oracle-Instant-Client/master/scripts/alma-rocky.sh +chmod +x pre-install.sh +./pre-install.sh +``` + +Go to Servers->Apache Tomcat to complete set up using the setup Wizard. + +# Install via GIT + +As Root: + +```bash +git clone https://github.com/cited/Oracle-Instant-Client +mv Oracle-Instant-Client oci +tar -cvzf oci.wbm.gz oci/ +``` + +Upload from Webmin->Webmin Configuration->Webmin Modules + +Go to Servers->Oracle Instant Client (you may need to refresh page) + +## **Issues** +Please report issue here + +# Screen Shots + +![Oracle Instant Client](docs/_static/6.png) + +# SQLPlus Connection via Webmin Terminal + +![Oracle Instant Client](docs/_static/9.png) + + + +Copyright +--------- + +* Copyright AcuGIS, 2023 +* Copyright Cited, Inc., 2023 + diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000..b1bfed9 --- /dev/null +++ b/changelog.md @@ -0,0 +1,81 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + + + + +## Released +## [0.5.0] - 2022-12-17 +### Added +- Example for ReStructuredText evaluation directive to show a warning and a notes highlighted text + +### Changed +- Removed outdated command to convert Markdown files to ReStructuredText files + +### Fixed +- Call to generate sphinx documentation in USAGE + +## [0.4.0] - 2022-12-06 +### Added +- Usage guide for building docs locally in root README +- `changelog_link.rst` added to [docs](docs) to include this changelog from + its real location without further relocation before building the docs + +### Changed +- Relocate files of `docs/source` into `docs` directly +- Replace ReStructuredText references in Markdown files of [docs](docs) +- `docutils >=0.14,<0.18` is required to build the docs +- Sphinx extensions sorted aphabetically in [`config.py`](docs/config.py) + +### Removed +- Documentation build process is no longer depending in `m2rr` package +- Unused batch file and Makefile + +## [0.3.0] - 2022-10-29 +### Added +- Add link to created documentation to root README + +### Fixed +- Subtitle of root README does not reference MicroPython + +## [0.2.0] - 2022-10-29 +### Added +- Docs badge to root README, see [#2][ref-issue-2] + +### Changed +- Converted root README from Markdown to ReStructuredText + +## [0.1.0] - 2022-10-29 +### Added +- This changelog file +- [.gitignore](.gitignore) file +- Docs [requirements.txt](docs/requirements.txt) file to setup tools for + documentation generation +- [.readthedocs.yaml](.readthedocs.yaml) file to define custom actions after + the default installation and before the actual docs build process +- [Dummy python package files](my_package/) +- [Script to convert](docs/convert_md2rst.py) Markdown to ReStructuredText + files for Sphinx + + +[Unreleased]: https://github.com/brainelectronics/rtd-tutorial-template/compare/0.5.0...main + +[0.5.0]: https://github.com/brainelectronics/rtd-tutorial-template/tree/0.5.0 +[0.4.0]: https://github.com/brainelectronics/rtd-tutorial-template/tree/0.4.0 +[0.3.0]: https://github.com/brainelectronics/rtd-tutorial-template/tree/0.3.0 +[0.2.0]: https://github.com/brainelectronics/rtd-tutorial-template/tree/0.2.0 +[0.1.0]: https://github.com/brainelectronics/rtd-tutorial-template/tree/0.1.0 + +[ref-issue-2]: https://github.com/brainelectronics/rtd-tutorial-template/issues/2 diff --git a/config b/config new file mode 100644 index 0000000..40ff82f --- /dev/null +++ b/config @@ -0,0 +1 @@ +oci_config=/etc/webmin/oci/config diff --git a/config.info b/config.info new file mode 100644 index 0000000..c315c7f --- /dev/null +++ b/config.info @@ -0,0 +1 @@ +oci_config=Path to the Oracle Instant Client Webmin module config file,8 diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..861d878 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,18 @@ + +## Installation + + +The preferred method is installing via GIT. + +Install the package with GIT:: + + $ git clone https://github.com/cited/Tomcat-Webmin-Module + + $ mv Tomcat-Webmin-Module tomcat + + $ tar -cvzf tomcat.wbm.gz tomcat/ + + +Upload from Webmin->Webmin Configuration->Webmin Modules + +Go to Servers->Apache Tomcat (you may need to refresh page) diff --git a/docs/USAGE.md b/docs/USAGE.md new file mode 100644 index 0000000..3680041 --- /dev/null +++ b/docs/USAGE.md @@ -0,0 +1,73 @@ +# Usage + +## Package + +To use the very useless python classes of this example import the + +```python +from my_package.asdf import ASDF + +asdf = ASDF() +# ASDF init done + +asdf.print_hello(who='Carl') +# Hello Carl +``` + +To get a list of random integers the +[**`my_package.qwertz.QWERTZ.get_list_of_int`**](my_package.qwertz.QWERTZ.get_list_of_int) +function can be used. The list will contain 5 integers between 0 and 100 by +default. The `how_long` argument can be used to change the number of elements +in the returned list. + +```{note} Notes require **no** arguments, so content can start here. +``` + +```{eval-rst} +.. warning:: + This is warning text. Use a warning for information the user must + understand to avoid negative consequences. + + Warnings are formatted in the same way as notes. In the same way, + lines must be broken and indented under the warning tag. +``` + +## Create docs + +### Installation + +Python3 must be installed on your system. Check the current Python version +with the following command + +```bash +python --version +python3 --version +``` + +Depending on which command `Python 3.x.y` (with x.y as some numbers) is +returned, use that command to proceed. + +```bash +python3 -m venv .venv +source .venv/bin/activate + +pip install -r docs/requirements.txt +``` + +### Sphinx link checks + +```bash +sphinx-build \ + docs/ docs/build/linkcheck \ + -d docs/build/docs_doctree \ + --color -blinkcheck -W +``` + +### Sphinx build + +```bash +sphinx-build \ + docs/ docs/build/html \ + -d docs/build/docs_doctree \ + --color -bhtml -W +``` diff --git a/docs/_static/1.png b/docs/_static/1.png new file mode 100644 index 0000000..3d99ad3 Binary files /dev/null and b/docs/_static/1.png differ diff --git a/docs/_static/10.png b/docs/_static/10.png new file mode 100644 index 0000000..f747ae7 Binary files /dev/null and b/docs/_static/10.png differ diff --git a/docs/_static/11.png b/docs/_static/11.png new file mode 100644 index 0000000..ddc9c9b Binary files /dev/null and b/docs/_static/11.png differ diff --git a/docs/_static/6.png b/docs/_static/6.png new file mode 100644 index 0000000..179a3eb Binary files /dev/null and b/docs/_static/6.png differ diff --git a/docs/_static/7.png b/docs/_static/7.png new file mode 100644 index 0000000..bb6bfa7 Binary files /dev/null and b/docs/_static/7.png differ diff --git a/docs/_static/8.png b/docs/_static/8.png new file mode 100644 index 0000000..17f7a62 Binary files /dev/null and b/docs/_static/8.png differ diff --git a/docs/_static/9.png b/docs/_static/9.png new file mode 100644 index 0000000..b666b23 Binary files /dev/null and b/docs/_static/9.png differ diff --git a/docs/_static/Setup-2.png b/docs/_static/Setup-2.png new file mode 100644 index 0000000..fe2fd15 Binary files /dev/null and b/docs/_static/Setup-2.png differ diff --git a/docs/_static/index.rst b/docs/_static/index.rst new file mode 100644 index 0000000..b1699f6 --- /dev/null +++ b/docs/_static/index.rst @@ -0,0 +1 @@ +OCI Images diff --git a/docs/_static/oci-tab-main.png b/docs/_static/oci-tab-main.png new file mode 100644 index 0000000..fb94abf Binary files /dev/null and b/docs/_static/oci-tab-main.png differ diff --git a/docs/_static/oci-tab.png b/docs/_static/oci-tab.png new file mode 100644 index 0000000..7ac5b14 Binary files /dev/null and b/docs/_static/oci-tab.png differ diff --git a/docs/_static/oracle-instant-client.png b/docs/_static/oracle-instant-client.png new file mode 100644 index 0000000..aac14ed Binary files /dev/null and b/docs/_static/oracle-instant-client.png differ diff --git a/docs/_static/php-1.png b/docs/_static/php-1.png new file mode 100644 index 0000000..3b709f3 Binary files /dev/null and b/docs/_static/php-1.png differ diff --git a/docs/_static/php-2.png b/docs/_static/php-2.png new file mode 100644 index 0000000..a09bbc2 Binary files /dev/null and b/docs/_static/php-2.png differ diff --git a/docs/_static/wizard.png b/docs/_static/wizard.png new file mode 100644 index 0000000..1d4d8fe Binary files /dev/null and b/docs/_static/wizard.png differ diff --git a/docs/changelog_link.rst b/docs/changelog_link.rst new file mode 100644 index 0000000..b185706 --- /dev/null +++ b/docs/changelog_link.rst @@ -0,0 +1,3 @@ + +.. include:: ../changelog.md + :parser: myst_parser.sphinx_ \ No newline at end of file diff --git a/docs/components.rst b/docs/components.rst new file mode 100644 index 0000000..b6cb78b --- /dev/null +++ b/docs/components.rst @@ -0,0 +1,31 @@ + +Dashboard +=========================== + +The dashboard contains links to Oracle Instant Client installer and PHP installer. + +PHP +--------------------- + +Click the PHP tab: + +.. image:: _static/php-1.png + +Here, you can add/remove/update any listed PHP packages + +.. image:: _static/php-2.png + + + +php-2.png + +Instant Client +--------------------- + +Click the Oracle Instant Client tab: + +.. image:: _static/oci-tab.png + +Here, you can add/remove/update any listed Oracle Instant Client packages + +.. image:: _static/oci-tab-main.png diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..ab542d2 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,68 @@ +# Configuration file for the Sphinx documentation builder. + +import os +import sys +from pathlib import Path + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +sys.path.insert(0, os.path.abspath('../')) +here = Path(__file__).parent.resolve() + +# -- Project information + +project = 'Oracle Instant Client' +copyright = '2023, Cited Inc.' +author = 'Cited' + +release = '0.1' +version = '0.1.0' + + +# -- General configuration + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ +# 'myst_parser', + 'sphinx.ext.autodoc', + 'sphinx.ext.autosectionlabel', + 'sphinx.ext.autosummary', + 'sphinx.ext.doctest', + 'sphinx.ext.duration', + 'sphinx.ext.intersphinx', + 'sphinx.ext.viewcode', +] +autosectionlabel_prefix_document = True + +# The suffix of source filenames. +source_suffix = ['.rst', '.md'] + +intersphinx_mapping = { + 'python': ('https://docs.python.org/3/', None), + 'sphinx': ('https://www.sphinx-doc.org/en/master/', None), +} +intersphinx_disabled_domains = ['std'] +suppress_warnings = [ + # throws an error due to not found reference targets to files not in docs/ + 'ref.myst', + # throws an error due to multiple "Added" labels in "changelog.md" + 'autosectionlabel.*' +] + +templates_path = ['_templates'] + +# -- Options for HTML output + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'sphinx_rtd_theme' + +# -- Options for EPUB output +epub_show_urls = 'footnote' diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..60598ad --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,15 @@ +Oracle Instant Client +=================================== + +.. image:: _static/7.png + +Contents +-------- + +.. toctree:: + :maxdepth: 1 + + install + components + + diff --git a/docs/install.rst b/docs/install.rst new file mode 100644 index 0000000..b788951 --- /dev/null +++ b/docs/install.rst @@ -0,0 +1,100 @@ + +Installation +=========================== + +This module is for installing and configuring Oracle Instant Client + +The module can be used on a new or existing Webmin installation + +Installation +------------ + +Step 1: Get the repo from Github:: + + git clone https://github.com/cited/Oracle-Instant-Client.git + +Step 2: Change name:: + + mv Oracle-Instant-Client oci + +Step 4 Create the Webmin wbm.gz file:: + + tar -cvzf oci.wbm.gz oci/ + +Step 5: Install the module (Ubuntu):: + + /usr/share/webmin/install-module.pl oci.wbm.gz + +Step 5: Install the module (Rocky/Alma):: + + /usr/libexec/webmin/install-module.pl oci.wbm.gz + +Wizard +------- + +Once the module is installed, go to Servers >> Oracle Instant Client + +.. image:: _static/1.png + +Click throught the Set Up Wizard + +.. image:: _static/Setup-2.png + +Select the package(s) you want to install + +.. image:: _static/6.png + +Once completed, the panel should look like below: + +.. image:: _static/7.png + + +SQL Plus +----------------- + +If you selected SQLPlus, you can test functionality via the Webmin terminal app: + +.. image:: _static/8.png + +Start SQL Plus + +.. image:: _static/9.png + + +PHP OCI +----------------- + +PHP oci funcationality can be tested using below + +.. code-block:: console + + + + +Contribute +---------- + +- Issue Tracker: github.com/cited/Oracle-Instant-Client/issues +- Source Code: github.com/AcuGIS/Oracle-Instant-Client + +Support +------- + +If you are having issues, please let us know. +We have a mailing list located at: project@google-groups.com + +License +------- + +The project is licensed under the BSD license. diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000..f1990f2 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,13 @@ +# use fixed versions +# +# fix docutils to a version working for all +docutils >=0.14,<0.18 + +# sphinx 5.3.0 requires Jinja2 >=3.0 and docutils >=0.14,<0.20 +sphinx >=5.0.0,<6 + +# sphinx-rtd-theme >=1.0.0 would require docutils <0.18 +sphinx-rtd-theme >=1.0.0,<2 + +# replaces outdated and no longer maintained m2rr +# myst-parser >= 0.18.1,<1 diff --git a/edit_oci.cgi b/edit_oci.cgi new file mode 100644 index 0000000..3f4165b --- /dev/null +++ b/edit_oci.cgi @@ -0,0 +1,29 @@ +#!/usr/bin/perl + +require './oci-lib.pl'; + +&ReadParse(); +&ui_print_header(undef, $text{'oci_title'}, ""); + +my @oci_vers = get_oci_versions(); +my $page_number = pop @oci_vers; +my %pkgs = ('basic'=>1, 'jdbc'=>1, 'sqlplus'=>0, 'sdk'=>1, 'odbc'=>1, 'tools'=>0); + +print &ui_form_start("install_oci.cgi", "form-data"); + +print &ui_hidden('page_number', $page_number); +print &ui_table_start($text{'oci_install'}, undef, 2); + +print &ui_table_row($text{'oci_version'}, &ui_select("oci_ver", undef, \@oci_vers, 1, 0)); + +my $pkg_checks=''; +foreach my $name (sort keys %pkgs){ + $pkg_checks .= &ui_checkbox('pkg_'.$name, 1, $name, $pkgs{$name}); +} +print &ui_table_row($text{'oci_packages'}, $pkg_checks, 2); + +print &ui_table_end(); + +print &ui_form_end([ [ "", $text{'install_button'} ] ]); + +&ui_print_footer("", $text{'index_return'}); diff --git a/help/intro.html b/help/intro.html new file mode 100644 index 0000000..3df64f9 --- /dev/null +++ b/help/intro.html @@ -0,0 +1,8 @@ +
Oracle Client
+ +

Free, light-weight and easily installed Oracle Database tools, libraries and SDKs for building and connecting client applications to local or remote Oracle Databases

+ +

Oracle Instant Client enables development and production deployment of Oracle Database applications. It is used for popular languages and environments including Node.js, Python and PHP, as well as providing access for OCI, OCCI, JDBC-OCI, ODBC and Pro*C applications. +ISVs and Partners can benefit greatly from being able to bundle Instant Client in their applications.

+ +
diff --git a/images/java.png b/images/java.png new file mode 100644 index 0000000..1dc1235 Binary files /dev/null and b/images/java.png differ diff --git a/images/manual.gif b/images/manual.gif new file mode 100644 index 0000000..e65c7f0 Binary files /dev/null and b/images/manual.gif differ diff --git a/images/oci.png b/images/oci.png new file mode 100644 index 0000000..6a7b848 Binary files /dev/null and b/images/oci.png differ diff --git a/images/pg.png b/images/pg.png new file mode 100644 index 0000000..de4130f Binary files /dev/null and b/images/pg.png differ diff --git a/images/php.png b/images/php.png new file mode 100644 index 0000000..4c2bd26 Binary files /dev/null and b/images/php.png differ diff --git a/images/php.svg b/images/php.svg new file mode 100644 index 0000000..581bca4 --- /dev/null +++ b/images/php.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/index.cgi b/index.cgi new file mode 100644 index 0000000..735d131 --- /dev/null +++ b/index.cgi @@ -0,0 +1,36 @@ +#!/usr/bin/perl + +require './oci-lib.pl'; +require '../webmin/webmin-lib.pl'; #for OS detection + +# Check if config file exists +if (! -r $config{'oci_config'}) { + &ui_print_header(undef, $text{'index_title'}, "", "intro", 1, 1); + print &text('index_econfig', "$config{'oci_config'}", + "$gconfig{'webprefix'}/config.cgi?$module_name"),"

\n"; + &ui_print_footer("/", $text{"index"}); + exit; +} + +if(-f "$module_root_directory/setup.cgi"){ + &redirect("setup.cgi?mode=checks"); + exit; +} + +my %version = get_versions(); + +&ui_print_header(undef, $text{'index_title'}, "", "intro", 1, 1, 0, + &help_search_link("oracle", "oci", "php", "google"), undef, undef, + "InstantClient $version{'oci'} / PHP $version{'php'}"); + +push(@links, "php_install.cgi"); +push(@titles, $text{'php_title'}); +push(@icons, "images/php.png"); + +push(@links, "edit_oci.cgi"); +push(@titles, $text{'oci_title'}); +push(@icons, "images/oci.png"); + +&icons_table(\@links, \@titles, \@icons, 3); + +&ui_print_footer("/", $text{"index"}); diff --git a/install_oci.cgi b/install_oci.cgi new file mode 100644 index 0000000..fb6423a --- /dev/null +++ b/install_oci.cgi @@ -0,0 +1,254 @@ +#!/usr/bin/perl + +require './oci-lib.pl'; + +sub download_otn{ + my $ver = $_[0]; + my $ver2; + my $name = $_[1]; + my $page_number = $_[2]; + + ($ver2 = $ver) =~ s/\.//g; + + my $time_limit = time().100; + + print "


Downloading $name-$ver ...
"; + + my $url = "http://download.oracle.com/otn_software/linux/instantclient/$ver2/instantclient-$name-linux.x64-".$ver."dbru.zip"; + my $tmpfile = &transname("instantclient-$name-linux.x64-$ver.zip"); + #my $tmpfile = "/tmp/instantclient-$name-linux.x64-$ver.zip"; + &error_setup(&text('install_err3', $url)); + + &http_download("download.oracle.com", 443, "/otn_software/linux/instantclient/$ver2/instantclient-$name-linux.x64-".$ver."dbru.zip", + $tmpfile, \$error, undef, 1);#, undef, undef, 0, 0, 1, \%cookie_headers); + return $tmpfile; +} + +sub download_cdn{ + my $ver = $_[0]; + my $name = $_[1]; + + my $cdn_host = '10.0.3.1'; + my $cdn_folder = '/12.1.0.2.0'; + + print "
Downloading $name-$ver ...
"; + + my $url = "http://$cdn_host"."$cdn_folder/instantclient-$name-linux.x64-$ver.zip"; + my $tmpfile = &transname("instantclient-$name-linux.x64-$ver.zip"); + &error_setup(&text('install_err3', $url)); + + &http_download($cdn_host, 80,"$cdn_folder/instantclient-$name-linux.x64-$ver.zip", $tmpfile); + + return $tmpfile; +} + +sub install_oci8{ + my $oracle_home = $_[0]; + my $instantclient_home = $_[1]; + my $oci_ver; + + my %versions = get_versions(); + my @php_ver = split(/\./, $versions{'php'}); + if(($php_ver[0] == 8) and ($php_ver[1] == 2)){ + $oci_ver = '3.3.0'; + }elsif(($php_ver[0] == 8) and ($php_ver[1] == 1)){ + $oci_ver = '3.2.1'; + }elsif(($php_ver[0] == 8) and ($php_ver[1] == 0)){ + $oci_ver = '3.0.1'; + }elsif($php_ver[0] == 7){ + $oci_ver = '2.1.4'; + }elsif($php_ver[0] == 5){ + $oci_ver = '2.0.10'; + }elsif($php_ver[0] == 4){ + $oci_ver = '1.4.10'; + }else{ + &error("Error: oci8: Unsupported PHP version $versions{'php'}
"); + } + + my $oci8_home = "$oracle_home/src/oci8-$oci_ver"; + + &make_dir($oracle_home.'/src', 0754, 1); + + #pecl download oci8 + my $url = "https://pecl.php.net/get/oci8-$oci_ver.tgz"; + my $tmpfile = &transname("oci8-$oci_ver.tgz"); + &error_setup(&text('install_err3', $url)); + &http_download("pecl.php.net", 443,"/get/oci8-$oci_ver.tgz", $tmpfile, \$error, undef, 1); + + my $cmd_out=''; + my $cmd_err=''; + print "
Extracting $tmpfile to $oracle_home/src...
"; + local $out = &execute_command("tar -x --overwrite -f \"$tmpfile\" -C$oracle_home/src", undef, \$cmd_out, \$cmd_err, 0, 0); + + if($cmd_err){ + &error("Error: tar: $cmd_err"); + }else{ + $cmd_out =~ s/\r\n/
/g; + print &html_escape($cmd_out); + } + + #compile OCI 8 module + my $orig_cwd = cwd; + chdir $oci8_home; + + my @cmds = ('phpize', + "./configure --with-oci8=share,instantclient,$oracle_home/instantclient/", + "make && make install"); + foreach my $cmd (@cmds){ + my $cmd_out=''; + my $cmd_err=''; + local $out = &execute_command($cmd, undef, \$cmd_out, \$cmd_err, 0, 0); + if($out != 0){ + &error($cmd_err); + } + } + copy_source_dest("$oci8_home/modules/oci8.so", "$oracle_home/instantclient/oci8.so"); + + chdir $orig_cwd; + + #Add PHP config for CLI and CGI + print "Setting PHP ini files for CLI and CGI
"; + + my $cgi_file = &transname('info.php'); + open(my $fh, '>', $cgi_file) or die "open:$!"; + print $fh ""; + close $fh; + + my %php_cmds = ('php --ini' =>"^Scan for additional .ini files in: (.*)", + "REDIRECT_STATUS=200 REQUEST_METHOD=GET SCRIPT_FILENAME=$cgi_file SCRIPT_NAME=/info.php PATH_INFO=/ SERVER_NAME=site.tld SERVER_PROTOCOL=HTTP/1.1 REQUEST_URI=/nl/page HTTP_HOST=site.tld /usr/bin/php-cgi"=>"Scan this dir for additional \.ini files <\/td>([a-z0-9\/_\.-]+)"); + + my %ext_file = ('extension'=>'oci8.so'); + + $SIG{'TERM'} = 'ignore'; + foreach my $cmd (keys %php_cmds){ + &open_execute_command(CMD, $cmd, 1); + + my $pattern = $php_cmds{$cmd}; + my $php_confd = ''; + + while(my $line = ) { + if($line =~ /$pattern/){ + $php_confd = $1; + last; + } + } + close(CMD); + + if(-d $php_confd){ + write_file($php_confd.'/90-oci.ini', \%ext_file); + }else{ + print "Warning: Failed to add OCI extension to $cmd ini files.
"; + } + } +} + +sub setup_instant_libs{ + my $instantclient_home = $_[0]; + + print "
Setting Oracle Instant Client libs in /etc/ld.so.conf.d/instantclient.conf
"; + + opendir(DIR, $instantclient_home) or die $!; + my @libs + = grep { + /\.so([0-9\.]+)?$/ # Has .so* extension + && -f "$instantclient_home/$_" # and is a file + } readdir(DIR); + closedir(DIR); + + &make_dir($instantclient_home.'/lib', 0755, 1); + + for my $lib (@libs){ + symlink_file($instantclient_home.'/'.$lib, + $instantclient_home."/lib/$lib"); + } + + open(my $fh, '>', '/etc/ld.so.conf.d/instantclient.conf') or die "open:$!"; + print $fh '/opt/oracle/instantclient/lib'; + close $fh; + + #echo '/usr/lib/grass64/lib/' > /etc/ld.so.conf.d/grass.conf + #echo '/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server/' > /etc/ld.so.conf.d/jvm.conf + + my $cmd_out=''; + my $cmd_err=''; + local $out = &execute_command('ldconfig', undef, \$cmd_out, \$cmd_err, 0, 0); + if($out != 0){ + &error($cmd_err); + } +} + +sub setup_instant_env{ + my $instantclient_home = $_[0]; + my $instantclient_ver = $_[1]; + + my %os_env; + + $os_env{'INSTANTCLIENT_VERSION'} = $instantclient_ver; + $os_env{'INSTANTCLIENT_HOME'} = $instantclient_home; + $os_env{'ORACLE_HOME'} = $instantclient_home; + + print "
Setting Oracle Instant Client environment..."; + + if(-d '/etc/profile.d/'){ + $os_env{'PATH'} = "\$PATH:$instantclient_home"; + write_env_file('/etc/profile.d/instantclient.sh', \%os_env, 1); + }else{ + read_env_file('/etc/environment', \%os_env); + $os_env{'PATH'} = "$os_env{'PATH'}:$instantclient_home"; + write_env_file('/etc/environment', \%os_env, 0); + } +} + +$| = 1; + +if ($ENV{REQUEST_METHOD} eq "POST") { + &ReadParseMime(); +}else { + &ReadParse(); + $no_upload = 1; +} + +&ui_print_header(undef, $text{'install_title'}, ""); + +my $oci_ver = $in{'oci_ver'}; +my $page_number = $in{'page_number'}; +my @pkgs = ('basic', 'jdbc', 'sqlplus', 'sdk', 'odbc', 'tools'); + + +my $oracle_home = "/opt/oracle"; +&make_dir($oracle_home, 0755, 1); + +if(-d $oracle_home.'/instantclient_'.$oci_ver){ + print "Error: Oracle Instant Client $oci_ver is already installed!
"; + &ui_print_footer("", $text{'index_return'}); + exit; +} + +#download and unzip selected packages +foreach my $pkg_name (@pkgs){ + if($in{'pkg_'.$pkg_name} == 1){ + my $zip_file = download_otn($oci_ver, $pkg_name, $page_number); + unzip_file($zip_file, $oracle_home); + } +} + +my @oci_ver_digits = split(/\./, $oci_ver); + +&rename_file($oracle_home.'/instantclient_'.$oci_ver_digits[0].'_'.$oci_ver_digits[1], + $oracle_home.'/instantclient_'.$oci_ver); +my $instantclient_home = $oracle_home.'/instantclient_'.$oci_ver; + +symlink_file($instantclient_home, $oracle_home.'/instantclient'); + +#link clntsh and occi libs +symlink_file($instantclient_home.'/libclntsh.so.'.$oci_ver_digits[0].'.'.$oci_ver_digits[1], + $oracle_home.'/instantclient/libclntsh.so'); +symlink_file($instantclient_home.'/libocci.so.'.$oci_ver_digits[0].'.'.$oci_ver_digits[1], + $oracle_home.'/instantclient/libocci.so'); + +install_oci8($oracle_home); + +setup_instant_libs($instantclient_home); +setup_instant_env($instantclient_home, $oci_ver); + +&ui_print_footer("", $text{'index_return'}); diff --git a/lang/en b/lang/en new file mode 100644 index 0000000..3e27d12 --- /dev/null +++ b/lang/en @@ -0,0 +1,71 @@ +index_title=Oracle Instant Client +index_root=The root directory is $1. + +index_return=Oracle Instant Client + +manual_title=Edit config +manual_ecannot=You are not allowed to edit the Tomcat server.xml config file +manual_ok=Edit +manual_efile=Selected file is not part of the Tomcat server configuration +manual_file=Edit config file: +manual_edata=Nothing entered! +manual_err=Failed to save config file + +install_button=Install +install_title=Installing ... +install_err1=Invalid URL +install_err2=Failed to install uploaded module +install_err3=Failed to install module from $1 +install_efile=File does not exist +install_ebrowser=Your browser does not support file uploads + +java_title=Oracle Java 8 +java_tabinstall=Install +java_tabuninstall=Uninstall +java_desc1=Install Oracle Java 8 from an archive(tar.gz) +java_desc2=Uninstall Oracle Java 8 files from /usr/share +java_install=Install Oracle Java SDK/JRE 8 +java_uninstall=Uninstall Oracle Java SDK/JRE 8 +jdk_installsource=Oracle JDK source (.tar.gz) +jdk_latest=Latest JDK Version +java_installok=Install +java_deleteok=Uninstall +java_def_jdk=Set as system default Java +java_rm_def_jdk=Remove, if default Java +java_installed=JDK versions + +source_local=Local file +source_uploaded=Uploaded file +source_ftp=FTP or HTTP URL + +source_err0=File Error +source_err1=Upload Error +source_err1.2=No upload file +source_err2=Download error +source_err3=Invalid URL + +oci_title=Oracle Instant Client +oci_install=Select version and packages +oci_version=Version +oci_packages=Packages + +php_title=PHP +php_inst_title=Manage PHP packages +php_inst_edit=PHP Packages +php_inst_save=Update +php_versions=PHP Versions + +pg_ext_title=Extensions +pg_ext_edit=Edit PostgreSQL extensions +pg_ext_save=Save +pg_ext_enabled=Enabled +pg_ext_disabled=Disabled +pg_ext_database=Database + +pg_inst_title=PG Installer +pg_inst_edit=Edit PostgreSQL packages +pg_versions=Supported Versions +pg_inst_save=Update +pg_repo_install=Install repo +pg_enable_ssl=Enable SSL +pg_listen_all=Listen on all interfaces diff --git a/module.info b/module.info new file mode 100644 index 0000000..ea9e749 --- /dev/null +++ b/module.info @@ -0,0 +1,3 @@ +desc=Oracle Instant Client +os_support=*-linux freebsd archlinux +category=servers diff --git a/oci-lib.pl b/oci-lib.pl new file mode 100644 index 0000000..ac592a4 --- /dev/null +++ b/oci-lib.pl @@ -0,0 +1,155 @@ +BEGIN { push(@INC, ".."); }; +use WebminCore; +#use File::Copy; +init_config(); + +sub get_oci_config +{ +my $lref = &read_file_lines($config{'oci_conf'}); +my @rv; +my $lnum = 0; +foreach my $line (@$lref) { + my ($n, $v) = split(/\s+/, $line, 2); + if ($n) { + push(@rv, { 'name' => $n, 'value' => $v, 'line' => $lnum }); + } + $lnum++; + } +return @rv; +} + +sub get_versions +{ + local %version; + + my $cmd_out=''; + my $cmd_err=''; + local $out = &execute_command("php -v", undef, \$cmd_out, \$cmd_err, 0, 0); + + if($cmd_err ne ""){ + &error("Error: php: $cmd_err"); + return 1; + } + + my @lines = split /\n/, $cmd_out; + foreach my $line (@lines){ + if($line =~ /^PHP ([0-9\.-]+)/i){ + $version{'php'} = $1; + } + } + $version{'oci'} = installed_instantclient_version(); + + return %version; +} + +sub file_basename +{ + my $rv = $_[0]; + $rv =~ s/^.*[\/\\]//; + return $rv; +} + +sub installed_instantclient_version(){ + my %os_env; + if(-f '/etc/profile.d/instantclient.sh'){ + read_env_file('/etc/profile.d/instantclient.sh', \%os_env); + }else{ + read_env_file('/etc/environment', \%os_env); + } + return $os_env{'INSTANTCLIENT_VERSION'}; +} + +sub get_instantclient_home(){ + my %os_env; + if(-f '/etc/profile.d/oci.sh'){ + read_env_file('/etc/profile.d/oci.sh', \%os_env); + }else{ + read_env_file('/etc/environment', \%os_env); + } + return $os_env{'INSTANTCLIENT_HOME'}; +} + +#Parse available OCI versions from OTN +sub get_oci_versions(){ + my $error; + + $url = "https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html"; + $tmpfile = &transname("oci.html"); + &error_setup(&text('install_err3', $url)); + my %cookie_headers = ('Cookie'=> 'oraclelicense=accept-securebackup-cookie'); + &http_download("www.oracle.com", 443,"/database/technologies/instant-client/linux-x86-64-downloads.html", + $tmpfile, \$error, undef, 1, undef, undef, 0, 0, 1, \%cookie_headers); + + my @oci_versions; + open($fh, '<', $tmpfile) or die "open:$!"; + while(my $line = <$fh>){ + if($line =~ /Version ([0-9\.]+)/){ + push(@oci_versions, $1); + } + } + close $fh; + + push(@oci_versions, $page_number); + + return @oci_versions; +} + +sub download_file{ + my $url = $_[0]; + + my ($proto, $x, $host, $path) = split('/', $url, 4); + my @paths = split('/', $url); + my $filename = $paths[-1]; + if($filename eq ''){ + $filename = 'index.html'; + } + + my $sslmode = $proto eq 'https:'; + my $port = 80; + if($sslmode){ + $port = 443; + } + + &error_setup(&text('install_err3', $url)); + my $tmpfile = &transname($filename); + $progress_callback_url = $url; + + &http_download($host, $port, '/'.$path, $tmpfile, \$error, \&progress_callback, $sslmode); + + if($error){ + print &html_escape($error); + return ''; + } + return $tmpfile; +} + +sub exec_cmd{ + my $cmd = $_[0]; + my $cmd_out=''; + + my $rv = &execute_command($cmd, undef, \$cmd_out, \$cmd_out, 0, 0); + if($cmd_out){ + $cmd_out = &html_escape($cmd_out); + $cmd_out =~ s/[\r\n]/<\/br>/g; + print $cmd_out; + } + return $rv; +} + +sub unzip_file{ + my $file = $_[0]; + my $unzip_dir = $_[1]; + + my $unzip_out; + my $unzip_err; + print "
Unzipping $file to $unzip_dir ...
"; + local $out = &execute_command("unzip -ou \"$file\" -d \"$unzip_dir\"", undef, \$unzip_out, \$unzip_err, 0, 0); + + if($unzip_err){ + &error("Error: unzip: $unzip_err"); + }else{ + $unzip_out = s/\r\n/
/g; + print &html_escape($unzip_out); + } + return $unzip_dir; +} diff --git a/php_install.cgi b/php_install.cgi new file mode 100644 index 0000000..c39fbf8 --- /dev/null +++ b/php_install.cgi @@ -0,0 +1,190 @@ +#!/usr/bin/perl + +require './oci-lib.pl'; +require '../webmin/webmin-lib.pl'; #for OS detection +foreign_require('software', 'software-lib.pl'); + +sub get_packages_yum{ + + my $cmd_out=''; + my $cmd_err=''; + local $out = &execute_command("yum search php", undef, \$cmd_out, \$cmd_err, 0, 0); + + if($out != 0){ + &error("Error: yum: $cmd_err"); + return 1; + } + + my %pkgs; + my @lines = split /\n/, $cmd_out; + foreach my $line (@lines){ + if($line =~ /^(php[a-z0-9_\.-]+)\.(noarch|x86_64)+ : (.*)/i){ + $pkgs{$1} = $3; + } + } + return %pkgs; +} + +sub get_installed_yum{ + my $href = $_[0]; + + my $pkg_list = ""; + foreach my $pkg (keys %$href){ + $pkg_list .= " $pkg"; + } + + my $cmd_out=''; + my $cmd_err=''; + local $out = &execute_command("rpm -q --queryformat \"%{NAME}\n\" $pkg_list", undef, \$cmd_out, \$cmd_err, 0, 0); + + my %pkgs; + my @lines = split /\n/, $cmd_out; + foreach my $line (@lines){ + if($line =~ /^package\s+([a-z0-9_\.-]+)\s/i){ #package php is not installed + $pkgs{$1} = 0; + }else{ + $pkgs{$line} = 1; + } + } + return %pkgs; +}; + +sub get_packages_apt{ + + my $cmd_out=''; + my $cmd_err=''; + local $out = &execute_command("apt-cache search '^php'", undef, \$cmd_out, \$cmd_err, 0, 0); + + if($cmd_err ne ""){ + &error("Error: apt-cache: $cmd_err"); + return 1; + } + + my %pkgs; + my @lines = split /\n/, $cmd_out; + foreach my $line (@lines){ + if($line =~ /^(php.*) - (.*)/i){ + $pkgs{$1} = $2; + } + } + return %pkgs; +} + +sub get_installed_apt{ + my $href = $_[0]; #package names + + my %pkgs; + + my $cmd_out=''; + my $cmd_err=''; + local $out = &execute_command("dpkg -l 'php*'", undef, \$cmd_out, \$cmd_err); + + if($cmd_err ne ""){ + &error("Error: dpkg: $cmd_err"); + return %pkgs; + } + + #set all packages to not installed, since dpkg won't list them + foreach my $name (keys %$href){ + $pkgs{$name} = 0; + } + + my @lines = split /\n/, $cmd_out; + foreach my $line (@lines){ + if($line =~ /^(..)\s+(php[a-z0-9_\.-]+)\s+/i){ + my $pkg = $2; + if($1 =~ /[uirph]i/){ + $pkgs{$pkg} = 1; + } + } + } + return %pkgs; +}; + +sub update_packages{ + my $pkgs_install = $_[0]; + my $pkgs_remove = $_[1]; #\@lref + + if($pkgs_install ne ""){ + software::update_system_install($pkgs_install, undef); + } + + if(@$pkgs_remove){ + print "

Removing packages

"; + my %opts = ('depstoo'=>1); + my $error = ""; + if (defined(&delete_packages)) { + $error = software::delete_packages($pkgs_remove, \%opts, undef); + }else{ + foreach my $pkg (@$pkgs_remove){ + $error .= software::delete_package($pkg, \%opts, undef) + } + } + + if($error ne ""){ + &error($error); + }else{ + foreach my $pkg (@$pkgs_remove){ + print "Deleted $pkg
" + } + } + + } +} + +&ui_print_header(undef, $text{'php_inst_title'}, "", "intro", 1, 1); + +my $no_install = 1; +if($ENV{'CONTENT_TYPE'} =~ /boundary=(.*)$/) { + &ReadParseMime(); + $no_install = 0; +}else{ + &ReadParse(); + $no_install = 1; +} + +my %pkgs; +my %pkgs_installed; + +my %osinfo = &detect_operating_system(); +if( $osinfo{'os_type'} =~ /redhat/i){ #other redhat + + %pkgs = get_packages_yum(); + %pkgs_installed = get_installed_yum(\%pkgs); + +}elsif( $osinfo{'real_os_type'} =~ /ubuntu/i){ #ubuntu + %pkgs = get_packages_apt(); + %pkgs_installed = get_installed_apt(\%pkgs); +} + +#Check what is updated +if ($ENV{REQUEST_METHOD} eq "POST" && $no_install == 0) { + #find what was changed + my @pkgs_remove; + my $pkgs_install=""; + foreach my $pkg (sort keys %pkgs_installed){ + if($in{$pkg.'_status'} != $pkgs_installed{$pkg}){ + if($in{$pkg.'_status'} == 1){ + $pkgs_install .= " $pkg"; + }else{ + push(@pkgs_remove, $pkg); + } + } + } + update_packages($pkgs_install, \@pkgs_remove); + + &ui_print_footer("", $text{'index_return'}); + exit; +} + +print &ui_form_start("php_install.cgi", "form-data"); +print &ui_table_start($text{'php_inst_edit'}, "width=100%", 3); + +foreach my $pkg (sort keys %pkgs){ + print &ui_table_row($pkg, ui_yesno_radio($pkg.'_status', $pkgs_installed{$pkg}).$pkgs{$pkg} ,3); +} + +print &ui_table_end(); +print &ui_form_end([ [ "", $text{'php_inst_save'} ] ]); + +&ui_print_footer("", $text{'index_return'}); diff --git a/scripts/alma-rocky.sh b/scripts/alma-rocky.sh new file mode 100644 index 0000000..8cabe89 --- /dev/null +++ b/scripts/alma-rocky.sh @@ -0,0 +1,95 @@ +# !/bin/bash -e +# Tomcat Module Script for Rocky Linux +# Usage: +# wget https://raw.githubusercontent.com/cited/Tomcat-Webmin-Module/master/scripts/rocky-linux.sh +# chmod +x pre-installer +# ./pre-installer.sh + +function get_deps(){ + + yum -y install wget unzip bzip2 + +} + +function setup_selinux(){ + + #allow apache port for django app + semanage port -a -t http_port_t -p tcp 7800 + semanage port -m -t http_port_t -p tcp 9000 + + setsebool -P httpd_can_network_connect 1 +} + + +function install_apache(){ + + yum -y install httpd + +} + +function install_webmin(){ + wget -P/tmp 'https://download.webmin.com/developers-key.asc' + rpm --import /tmp/developers-key.asc || true + cp -f /tmp/developers-key.asc /etc/pki/rpm-gpg/RPM-GPG-KEY-webmin-developers + + cat >/etc/yum.repos.d/webmin.repo < Tomcat to complete installation" + +} + +get_deps; +setup_selinux; +#install_apache; +#install_webmin; +#download_certbot_module; +#install_certbot_module; +download_oci_module; +install_oci_module; diff --git a/scripts/oci.wbm.gz b/scripts/oci.wbm.gz new file mode 100644 index 0000000..e4c7a11 Binary files /dev/null and b/scripts/oci.wbm.gz differ diff --git a/scripts/ubuntu.sh b/scripts/ubuntu.sh new file mode 100644 index 0000000..5898d5a --- /dev/null +++ b/scripts/ubuntu.sh @@ -0,0 +1,79 @@ +# !/bin/bash -e +# Tomcat Module Script for CentOS and Ubuntu +# For use on clean CentOS or Ubuntu box only +# Usage: +# wget https://raw.githubusercontent.com/cited/Tomcat-Webmin-Module/master/scripts/pre-install.sh +# chmod +x pre-installer +# ./pre-installer.sh + +function install_webmin(){ + + echo "deb http://download.webmin.com/download/repository sarge contrib" > /etc/apt/sources.list.d/webmin.list + wget -qO - http://www.webmin.com/jcameron-key.asc | apt-key add - + apt-get -y update + apt-get -y install webmin + + } + + +function download_oci_module(){ +pushd /tmp/ + wget https://github.com/cited/Oracle-Instant-Client/archive/master.zip + unzip master.zip + mv Oracle-Instant-Client-master oci + tar -czf /opt/oci.wbm.gz oci + rm -rf oci master.zip +popd +} + +function install_oci_module(){ +pushd /opt/ + + /usr/share/webmin/install-module.pl oci.wbm.gz + +popd + echo -e "Tomcat module is now installed. Go to Servers > Tomcat to complete installation" + +} + + + +function download_certbot_module(){ +pushd /tmp/ + wget https://github.com/cited/Certbot-Webmin-Module/archive/master.zip + unzip master.zip + mv Certbot-Webmin-Module-master certbot + tar -czf /opt/certbot.wbm.gz certbot + rm -rf certbot master.zip +popd +} + +function install_apache(){ + + apt-get -y install apache2 + +} + +function install_certbot_module(){ +pushd /opt/ + + /usr/share/webmin/install-module.pl certbot.wbm.gz + +popd + echo -e "Certbot is now installed. Go to Servers > Certbot to complete installation" + +} + +function get_deps(){ + + apt-get -y install wget unzip +} + +get_deps; +# Uncomment line(s) below if you wish to install Webmin, Apache HTTP Server, and Certbot as well. +#install_webmin; +#install_apache; +#download_certbot_module; +#install_certbot_module; +download_oci_module; +install_oci_module; diff --git a/setup.cgi b/setup.cgi new file mode 100644 index 0000000..0b22537 --- /dev/null +++ b/setup.cgi @@ -0,0 +1,96 @@ +#!/usr/bin/perl + + +require 'oci-lib.pl'; +require '../webmin/webmin-lib.pl'; #for OS detection +foreign_require('software', 'software-lib.pl'); +foreign_require('apache', 'apache-lib.pl'); + +sub setup_checks{ + + my %osinfo = &detect_operating_system(); + + if( $osinfo{'os_type'} =~ /redhat/i){ #other redhat + + @pinfo = software::package_info('epel-release', undef, ); + if(!@pinfo){ + print "

Info: You can install epel-release to have more PHP packages. Install it manually or ". + "click here to have it downloaded and installed.

"; + } + } + my @pkg_deps; + if( ( $osinfo{'real_os_type'} =~ /rocky/i) or #Rocky + ($osinfo{'real_os_type'} =~ /centos/i) or #CentOS + ($osinfo{'real_os_type'} =~ /alma/i) ){ #Alma Linux + @pkg_deps = ('php', 'php-devel', 'mod_fcgid', 'php-cli', 'httpd', 'libaio', 'make', 'gcc') + + }elsif( ($osinfo{'real_os_type'} =~ /ubuntu/i) or + ($osinfo{'real_os_type'} =~ /debian/i) ){ #ubuntu or debian + @pkg_deps = ('php', 'php-dev', 'php-cgi', 'php-cli', 'apache2', 'libaio1', 'make', 'gcc'); + if($found_pg_repo == 1){ + push(@pkg_deps, ("postgresql-$pg_ver-mysql-fdw", "postgresql-$pg_ver-tds-fdw", "postgresql-server-dev-$pg_ver")); + } + } + + my @pkg_missing; + foreach my $pkg (@pkg_deps){ + my @pinfo = software::package_info($pkg); + if(!@pinfo){ + push(@pkg_missing, $pkg); + } + } + + if(@pkg_missing){ + my $url_pkg_list = ''; + foreach my $pkg (@pkg_missing){ + $url_pkg_list .= '&u='.&urlize($pkg); + } + my $pkg_list = join(', ', @pkg_missing); + + print "

Warning: Missing package dependencies - $pkg_list - are not installed. Install them manually or ". + "click here to have them installed.

"; + } + + if(! -d '/opt/oracle'){ + print '

Oracle Instant Client is not installed. Install it from OCI'; + } + + print '

If you don\'t see any warning above, you can complete setup from '. + "here

"; +} + +#Remove all setup files +sub setup_cleanup{ + my $file = $module_root_directory.'/setup.cgi'; + print "Completing Installation
"; + &unlink_file($file); + + print &js_redirect("index.cgi"); +} + + +&ui_print_header(undef, $text{'setup_title'}, ""); + +if($ENV{'CONTENT_TYPE'} =~ /boundary=(.*)$/) { + &ReadParseMime(); +}else { + &ReadParse(); $no_upload = 1; +} + +my $mode = $in{'mode'} || "checks"; + +if($mode eq "checks"){ setup_checks(); + &ui_print_footer('', $text{'index_return'}); + exit 0; +}elsif($mode eq "cleanup"){ setup_cleanup(); + &ui_print_footer('', $text{'index_return'}); + exit 0; + +}elsif($mode eq "oracle_fdw"){ install_oracle_fdw(); + &ui_print_footer('', $text{'index_return'}); + exit 0; +}else{ + print "Error: Invalid setup mode\n"; +} + +&ui_print_footer('setup.cgi', $text{'setup_title'});