Kerala Cyber Warriors
KCW Uploader V1.1

Path : /var/lib/dpkg/info/
File Upload :
Current File : //var/lib/dpkg/info/cpanel-sitejet-plugin.postinst

#!/bin/bash
# postinst script for cpanel-sitejet-plugin
#
# see: dh_installdeb(1)

set -e

# Begin vars.sh
#!/bin/bash
# DO NOT EDIT
# This file is regenerated each run.
# If you want to add or change a variable, edit debify/settings.json and the vars hashref

source /etc/os-release
export OBS_REPO="x${NAME}_${VERSION_ID}"
if ls debian/*.install &> /dev/null; then
    perl -pi -e 's/\${env:OBS_REPO}/$ENV{OBS_REPO}/' debian/*.install
fi

export DEB_INSTALL_ROOT="/usr/src/packages/BUILD/debian/tmp"
export DEB_SOURCE_ROOT="/usr/src/packages/BUILD/debian/SOURCES_FROM_SPEC"
export RPM_SOURCE_DIR="/usr/src/packages/BUILD/debian/SOURCES_FROM_SPEC"
export __isa_bits="64"
export __isa_name="x86"
export __sourcedir=""
export _bindir="/opt/cpanel//root/usr/bin"
export _cpanel_plugins="/var/cpanel/plugins"
export _datadir="/opt/cpanel//root/usr/share"
export _defaultdocdir="/opt/cpanel//root/usr/share/doc"
export _docdir="/opt/cpanel//root/usr/share/doc"
export _exec_prefix="/opt/cpanel//root/usr"
export _includedir="/opt/cpanel//root/usr/include"
export _infodir="/opt/cpanel//root/usr/share/info"
export _isa=""
export _lib="lib64"
export _libdir="/opt/cpanel//root/usr/lib64"
export _libexecdir="/opt/cpanel//root/usr/libexec"
export _localstatedir="/opt/cpanel//root/var"
export _mandir="/opt/cpanel//root/usr/share/man"
export _prefix="/opt/cpanel//root/usr"
export _root_bindir="/opt/cpanel//root/usr/bin"
export _root_datadir="/opt/cpanel//root/usr/share"
export _root_exec_prefix="/opt/cpanel//root/usr"
export _root_includedir="/opt/cpanel//root/usr/include"
export _root_infodir="/opt/cpanel//root/usr/share/info"
export _root_initddir="/opt/cpanel//root/etc/rc.d/init.d"
export _root_libdir="/opt/cpanel//root/usr/lib64"
export _root_libexecdir="/opt/cpanel//root/usr/libexec"
export _root_localstatedir="/opt/cpanel//root/var"
export _root_mandir="/opt/cpanel//root/usr/share/man"
export _root_prefix="/opt/cpanel//root/usr"
export _root_sbindir="/opt/cpanel//root/usr/sbin"
export _root_sharedstatedir="/opt/cpanel//root/usr/com"
export _root_sysconfdir="/opt/cpanel//root/etc"
export _sbindir="/opt/cpanel//root/usr/sbin"
export _scl_prefix="/opt/cpanel"
export _scl_root="/opt/cpanel//root"
export _sysconfdir="/opt/cpanel//root/etc"
export _ulc="/usr/local/cpanel"
export _unitdir="/usr/lib/systemd/system"
export buildroot="/usr/src/packages/BUILD/debian/tmp"
export config_docs_url="https://cpanel.net # TODO"
export full_package_name="cpanel-sitejet-plugin-1.5.3"
export ix86="i386"
export name="cpanel-sitejet-plugin"
export nil="0"
export ns_name="ea"
export pkg=""
export pkg_name=""
export pkgname=""
export previous_version="1.5.2"
export release="2"
export release_prefix="2"
export scl=""
export scl_name=""
export scl_name_base=""
export scl_name_version=""
export scl_prefix=""
export version="1.5.3"
export version_with_debian_revision="1.5.3-2"
export SOURCE0="$DEB_SOURCE_ROOT/LICENSE"
export SOURCE1="$DEB_SOURCE_ROOT/pkg.postinst"
export SOURCE2="$DEB_SOURCE_ROOT/pkg.postrm"
export SOURCE3="$DEB_SOURCE_ROOT/pkg.preinst"
export SOURCE4="$DEB_SOURCE_ROOT/pkg.prerm"
export SOURCE5="$DEB_SOURCE_ROOT/_usr_local_cpanel_Cpanel_API_Sitejet-add_api_token.openapi.yaml"
export SOURCE6="$DEB_SOURCE_ROOT/_usr_local_cpanel_Cpanel_API_Sitejet-create_account.openapi.yaml"
export SOURCE7="$DEB_SOURCE_ROOT/_usr_local_cpanel_Cpanel_API_Sitejet-create_restore_point.openapi.yaml"
export SOURCE8="$DEB_SOURCE_ROOT/_usr_local_cpanel_Cpanel_API_Sitejet-create_website.openapi.yaml"
export SOURCE9="$DEB_SOURCE_ROOT/_usr_local_cpanel_Cpanel_API_Sitejet-disk_quota_check.openapi.yaml"
export SOURCE10="$DEB_SOURCE_ROOT/_usr_local_cpanel_Cpanel_API_Sitejet-get_all_sites_metadata.openapi.yaml"
export SOURCE11="$DEB_SOURCE_ROOT/_usr_local_cpanel_Cpanel_API_Sitejet-get_all_user_sitejet_info.openapi.yaml"
export SOURCE12="$DEB_SOURCE_ROOT/_usr_local_cpanel_Cpanel_API_Sitejet-get_api_token.openapi.yaml"
export SOURCE13="$DEB_SOURCE_ROOT/_usr_local_cpanel_Cpanel_API_Sitejet-get_preview_url.openapi.yaml"
export SOURCE14="$DEB_SOURCE_ROOT/_usr_local_cpanel_Cpanel_API_Sitejet-get_sitebuilder_domain_statuses.openapi.yaml"
export SOURCE15="$DEB_SOURCE_ROOT/_usr_local_cpanel_Cpanel_API_Sitejet-get_sso_link.openapi.yaml"
export SOURCE16="$DEB_SOURCE_ROOT/_usr_local_cpanel_Cpanel_API_Sitejet-get_templates.openapi.yaml"
export SOURCE17="$DEB_SOURCE_ROOT/_usr_local_cpanel_Cpanel_API_Sitejet-get_user_site_metadata.openapi.yaml"
export SOURCE18="$DEB_SOURCE_ROOT/_usr_local_cpanel_Cpanel_API_Sitejet-poll_publish.openapi.yaml"
export SOURCE19="$DEB_SOURCE_ROOT/_usr_local_cpanel_Cpanel_API_Sitejet-publish.openapi.yaml"
export SOURCE20="$DEB_SOURCE_ROOT/_usr_local_cpanel_Cpanel_API_Sitejet-restore_document_root.openapi.yaml"
export SOURCE21="$DEB_SOURCE_ROOT/_usr_local_cpanel_Cpanel_API_Sitejet-set_template.openapi.yaml"
export SOURCE22="$DEB_SOURCE_ROOT/_usr_local_cpanel_Cpanel_API_Sitejet-start_publish.openapi.yaml"
export SOURCE23="$DEB_SOURCE_ROOT/_usr_local_cpanel_Cpanel_API_Sitejet.pm"
export SOURCE24="$DEB_SOURCE_ROOT/_usr_local_cpanel_Cpanel_Admin_Modules_Cpanel_sitejet.pm"
export SOURCE25="$DEB_SOURCE_ROOT/_usr_local_cpanel_Cpanel_Config_ConfigObj_Driver_Sitejet.pm"
export SOURCE26="$DEB_SOURCE_ROOT/_usr_local_cpanel_Cpanel_Config_ConfigObj_Driver_Sitejet_META.pm"
export SOURCE27="$DEB_SOURCE_ROOT/_usr_local_cpanel_Cpanel_Server_WebSocket_cpanel_LogStreamer.pm"
export SOURCE28="$DEB_SOURCE_ROOT/_usr_local_cpanel_Cpanel_Sitejet_Connector.pm"
export SOURCE29="$DEB_SOURCE_ROOT/_usr_local_cpanel_Cpanel_Sitejet_Publish.pm"
export SOURCE30="$DEB_SOURCE_ROOT/_usr_local_cpanel_Whostmgr_API_1_Sitejet-get_commerce.openapi.yaml"
export SOURCE31="$DEB_SOURCE_ROOT/_usr_local_cpanel_Whostmgr_API_1_Sitejet-get_ecommerce.openapi.yaml"
export SOURCE32="$DEB_SOURCE_ROOT/_usr_local_cpanel_Whostmgr_API_1_Sitejet-set_commerce.openapi.yaml"
export SOURCE33="$DEB_SOURCE_ROOT/_usr_local_cpanel_Whostmgr_API_1_Sitejet-set_ecommerce.openapi.yaml"
export SOURCE34="$DEB_SOURCE_ROOT/_usr_local_cpanel_Whostmgr_API_1_Sitejet.pm"
export SOURCE35="$DEB_SOURCE_ROOT/_usr_local_cpanel_base_frontend_jupiter_sitejet_3rdpartylicenses.txt"
export SOURCE36="$DEB_SOURCE_ROOT/_usr_local_cpanel_base_frontend_jupiter_sitejet_assets_Site_Builder_Dark.svg"
export SOURCE37="$DEB_SOURCE_ROOT/_usr_local_cpanel_base_frontend_jupiter_sitejet_assets_Site_Builder_Light.svg"
export SOURCE38="$DEB_SOURCE_ROOT/_usr_local_cpanel_base_frontend_jupiter_sitejet_assets_no-image.svg"
export SOURCE39="$DEB_SOURCE_ROOT/_usr_local_cpanel_base_frontend_jupiter_sitejet_index.html.tt"
export SOURCE40="$DEB_SOURCE_ROOT/_usr_local_cpanel_base_frontend_jupiter_sitejet_jupiter-styles-main-rtl.7862efc34a8366cd.css"
export SOURCE41="$DEB_SOURCE_ROOT/_usr_local_cpanel_base_frontend_jupiter_sitejet_jupiter-styles-main.68ae2510740fb843.css"
export SOURCE42="$DEB_SOURCE_ROOT/_usr_local_cpanel_base_frontend_jupiter_sitejet_main.a24f5ae83b1f27ae.js"
export SOURCE43="$DEB_SOURCE_ROOT/_usr_local_cpanel_base_frontend_jupiter_sitejet_polyfills.fe2a85d529afbbf9.js"
export SOURCE44="$DEB_SOURCE_ROOT/_usr_local_cpanel_base_frontend_jupiter_sitejet_runtime.d27c0ba731149486.js"
export SOURCE45="$DEB_SOURCE_ROOT/_usr_local_cpanel_base_frontend_jupiter_sitejet_styles.40f9dc8b1a33a0bb.css"
export SOURCE46="$DEB_SOURCE_ROOT/_usr_local_cpanel_base_frontend_jupiter_sitejet_vendor-89d5c698.f5434aa969ce8956.js"
export SOURCE47="$DEB_SOURCE_ROOT/_usr_local_cpanel_base_frontend_jupiter_sitejet_vendor-c0d76f48.2e182a425b340275.js"
export SOURCE48="$DEB_SOURCE_ROOT/_usr_local_cpanel_base_frontend_jupiter_sitejet_webpack.shim.html"
export SOURCE49="$DEB_SOURCE_ROOT/_usr_local_cpanel_scripts_modify_default_featurelist_entry.pl"
export SOURCE50="$DEB_SOURCE_ROOT/_usr_local_cpanel_t_medium_Cpanel-API-Sitejet_plugin.t"
export SOURCE51="$DEB_SOURCE_ROOT/_usr_local_cpanel_t_medium_Cpanel-Admin-Modules-Cpanel-sitejet_plugin.t"
export SOURCE52="$DEB_SOURCE_ROOT/_usr_local_cpanel_t_medium_Cpanel-Sitejet-Connector_sitejet_plugin.t"
export SOURCE53="$DEB_SOURCE_ROOT/_usr_local_cpanel_t_medium_Cpanel-Sitejet-Publish_sitejet_plugin.t"
export SOURCE54="$DEB_SOURCE_ROOT/_usr_local_cpanel_t_medium_Whostmgr-API-1-Sitejet_plugin.t"
export SOURCE55="$DEB_SOURCE_ROOT/_usr_local_cpanel_t_medium_scripts-modify_default_featurelist_entry_sitejet_plugin.t"
export SOURCE56="$DEB_SOURCE_ROOT/_var_cpanel_plugins_sitejet_.enabled_companyid_list.csv"
export SOURCE57="$DEB_SOURCE_ROOT/_var_cpanel_plugins_sitejet_README.md"
export SOURCE58="$DEB_SOURCE_ROOT/_var_cpanel_plugins_sitejet_cpanel-sitejet-plugin.svg"
export SOURCE59="$DEB_SOURCE_ROOT/_var_cpanel_plugins_sitejet_extra_strings"
export SOURCE60="$DEB_SOURCE_ROOT/_var_cpanel_plugins_sitejet_install.json"
export SOURCE61="$DEB_SOURCE_ROOT/_var_cpanel_plugins_sitejet_js_files_with_mt_calls"
export SOURCE62="$DEB_SOURCE_ROOT/_var_cpanel_plugins_sitejet_locale_ar.yaml"
export SOURCE63="$DEB_SOURCE_ROOT/_var_cpanel_plugins_sitejet_locale_de.yaml"
export SOURCE64="$DEB_SOURCE_ROOT/_var_cpanel_plugins_sitejet_locale_es.yaml"
export SOURCE65="$DEB_SOURCE_ROOT/_var_cpanel_plugins_sitejet_locale_es_419.yaml"
export SOURCE66="$DEB_SOURCE_ROOT/_var_cpanel_plugins_sitejet_locale_es_es.yaml"
export SOURCE67="$DEB_SOURCE_ROOT/_var_cpanel_plugins_sitejet_locale_fr.yaml"
export SOURCE68="$DEB_SOURCE_ROOT/_var_cpanel_plugins_sitejet_locale_id.yaml"
export SOURCE69="$DEB_SOURCE_ROOT/_var_cpanel_plugins_sitejet_locale_ja.yaml"
export SOURCE70="$DEB_SOURCE_ROOT/_var_cpanel_plugins_sitejet_locale_pt.yaml"
export SOURCE71="$DEB_SOURCE_ROOT/_var_cpanel_plugins_sitejet_locale_pt_br.yaml"
export SOURCE72="$DEB_SOURCE_ROOT/_var_cpanel_plugins_sitejet_locale_tr.yaml"
export SOURCE73="$DEB_SOURCE_ROOT/_var_cpanel_plugins_sitejet_menu_LeftMenu.default.yaml"
export SOURCE74="$DEB_SOURCE_ROOT/_var_cpanel_plugins_sitejet_menu_WelcomeModal.yaml"
export SOURCE75="$DEB_SOURCE_ROOT/_var_cpanel_plugins_sitejet_resources_api.php.tmpl"
export SOURCE76="$DEB_SOURCE_ROOT/_var_cpanel_plugins_sitejet_resources_flags.tar.gz"
export SOURCE77="$DEB_SOURCE_ROOT/_var_cpanel_plugins_sitejet_scripts_move_config_to_dot_cpanel.pl"
# End vars.sh

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <postinst> `abort-remove'
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package


case "$1" in
    configure)
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

# Contents of SOURCES/pkg.postinst
#!/bin/bash

PLUGIN_DIR='/var/cpanel/plugins/sitejet'
DEFAULT_THEME=jupiter
SITEJET_FEATURE='sitejet'
TOUCH=`which touch`
LOCALE_DIR='/var/cpanel/locale'
THEME_DIR="/var/cpanel/locale/themes/${DEFAULT_THEME}"

# First Install
if [[ "$1" == "1" || "$1" == "abort-upgrade" ]]; then
    # TODO: Add support for more themes
    /usr/local/cpanel/scripts/install_plugin --theme=${DEFAULT_THEME} ${PLUGIN_DIR} || true;

    # Workaround for DUCK-10039 so customers can disable the left menu extra marketing stuff if they want.
    [ -x /usr/local/cpanel/scripts/manage_extra_marketing ] && /usr/local/cpanel/scripts/manage_extra_marketing --verbose apply || true

    /usr/local/cpanel/scripts/modify_default_featurelist_entry.pl --feature=${SITEJET_FEATURE} || true;

    # Must be updated to force a rebuild of the locale databases in case there are any changes.
    # * cdb files are not tracked by the OS package.
    # * yaml files are tracked by OS package, so any change will show as a package update.
    # * In order to rebuild, the yaml files must show as newer than cdb files.
    # So, first, set an old date (1970...) for the cdb files, and build_locale_databases --clean will reset them after the critical comparison happens.
    find $PLUGIN_DIR/locale/ -type f -name "*.yaml" -exec basename {} .yaml \;  | xargs -I % $TOUCH -d '1970-12-12' $LOCALE_DIR/%.cdb $THEME_DIR/%.cdb
    # NOTE: --clean removes the cdb file first and then regenerates it.
    /usr/local/cpanel/bin/servers_queue queue 'build_locale_databases --clean' || true
fi
# Upgrades
if [[ "$1" == "2" || "$1" == "configure" ]]; then
    # TODO: Add support for more themes
    /usr/local/cpanel/scripts/install_plugin --theme=${DEFAULT_THEME} ${PLUGIN_DIR} || true;

    # Workaround for DUCK-10039 so customers can disable the left menu extra marketing stuff if they want.
    [ -x /usr/local/cpanel/scripts/manage_extra_marketing ] && /usr/local/cpanel/scripts/manage_extra_marketing --verbose apply || true

    /usr/local/cpanel/scripts/modify_default_featurelist_entry.pl --feature=${SITEJET_FEATURE} || true;
    /var/cpanel/plugins/sitejet/scripts/move_config_to_dot_cpanel.pl || true;

    # Must be updated to force a rebuild of the locale databases in case there are any changes.
    # * cdb files are not tracked by the OS package.
    # * yaml files are tracked by OS package, so any change will show as a package update.
    # * In order to rebuild, the yaml files must show as newer than cdb files.
    # So, first, set an old date (1970...) for the cdb files, and build_locale_databases --clean will reset them after the critical comparison happens.
    find $PLUGIN_DIR/locale/ -type f -name "*.yaml" -exec basename {} .yaml \;  | xargs -I % $TOUCH -d '1970-12-12' $LOCALE_DIR/%.cdb $THEME_DIR/%.cdb
    # NOTE: --clean removes the cdb file first and then regenerates it.
    /usr/local/cpanel/bin/servers_queue queue 'build_locale_databases --clean' || true
fi
# End SOURCES/pkg.postinst


exit 0

-=[ KCW uplo4d3r c0ded by cJ_n4p573r ]=-
Ⓒ2017 ҠЄГѦLѦ СүѣЄГ ЩѦГГіѺГՏ