#!/usr/bin/bash gitea_url="https://${GITEA_USER}:${GITEA_PASSWORD}@${GITEA_DOMAIN}/" cd /tmp git clone ${URL_MULTI_MIGRATE} multi_migrate="/tmp/oc-multi_migrate_to_gitea/migrate_to_gitea.py" cd ${DIR_MODULES} PYTHON_VERSION="python"${PYTHON_VERSION} if [ "$WORKER" == "True" ]; then cat <>/etc/trytond.conf [queue] worker = True EOF fi if [ "$SMTP" == "True" ]; then cat <>/etc/trytond.conf [email] uri = ${SMTP_TYPE}://${SMTP_USER}:${SMTP_PASSWORD}@${SMTP_DOMAIN}:${SMTP_PORT} from = ${SMTP_FROM} <${SMTP_EMAIL}> EOF fi clone_module() { cd ${DIR_MODULES} local org=$1 local branch=$2 local prefix=$3 shift local Array=("${@}") url=${gitea_url}${org}"/" for module in "${Array[@]}"; do if [ ${prefix} = 'False' ]; then if [ ${branch} != "False" ]; then if [ -d $module ]; then echo "Module $module already exists" else git clone -b ${branch} $url$module fi fi elif [ `echo $module | awk /${prefix}/` ]; then name=`echo $modules$module | cut --complement -f 1 -d '-'` if [ ${branch} != "False" ]; then if [ -d $module ]; then echo "Module $module already exists" else git clone -b ${branch} $url$module mv $module $name fi else git clone $url$module cd $module ${PYTHON_VERSION} setup.py install cd .. fi fi done } inactive_module() { cd ${DIR_MODULES} local prefix=$1 local pip=$2 shift local Array=("${@}") for module in "${Array[@]}"; do if [ $pip = "True" ]; then pip uninstall -y $prefix$module --break-system-packages rm -rf $module else rm -rf $module fi done } if [ "$Provider" == "OneTeam" ]; then pip="True" inactive_modules_trytondo=( account account_asset account_be account_budget account_cash_rounding account_consolidation account_credit_limit account_deposit account_de_skr03 account_dunning account_dunning_email account_dunning_fee account_dunning_letter account_es account_es_sii account_eu account_fr account_fr_chorus account_invoice account_invoice_correction account_invoice_defer account_invoice_history account_invoice_line_standalone account_invoice_secondary_unit account_invoice_stock account_invoice_watermark account_move_line_grouping account_payment account_payment_braintree account_payment_clearing account_payment_sepa account_payment_sepa_cfonb account_payment_stripe account_product account_receivable_rule account_rule account_statement account_statement_aeb43 account_statement_coda account_statement_mt940 account_statement_ofx account_statement_rule account_statement_sepa account_stock_anglo_saxon account_stock_continental account_stock_eu account_stock_landed_cost account_stock_landed_cost_weight account_stock_shipment_cost account_stock_shipment_cost_weight account_tax_cash account_tax_non_deductible account_tax_rule_country analytic_account analytic_budget analytic_invoice analytic_purchase analytic_sale attendance authentication_saml authentication_sms bank carrier carrier_carriage carrier_percentage carrier_subdivision carrier_weight commission commission_waiting company company_work_time currency currency_ro currency_rs customs dashboard document_incoming document_incoming_invoice document_incoming_ocr document_incoming_ocr_typless edocument_uncefact edocument_unece google_maps inbound_email incoterm ldap_authentication marketing marketing_automation marketing_campaign marketing_email party party_avatar party_relationship party_siret product product_attribute product_classification product_classification_taxonomic product_cost_fifo product_cost_history product_cost_warehouse product_image product_image_attribute production production_outsourcing production_routing production_split production_work production_work_timesheet product_kit product_measurements product_price_list product_price_list_cache product_price_list_dates product_price_list_parent project project_invoice project_plan project_revenue purchase purchase_amendment purchase_blanket_agreement purchase_history purchase_invoice_line_standalone purchase_price_list purchase_product_quantity purchase_request purchase_request_quotation purchase_requisition purchase_secondary_unit purchase_shipment_cost quality sale sale_advance_payment sale_amendment sale_blanket_agreement sale_complaint sale_credit_limit sale_discount sale_extra sale_gift_card sale_history sale_invoice_date sale_invoice_grouping sale_opportunity sale_payment sale_point sale_price_list sale_product_customer sale_product_quantity sale_product_recommendation sale_product_recommendation_association_rule sale_promotion sale_promotion_coupon sale_promotion_coupon_payment sale_secondary_unit sale_shipment_cost sale_shipment_grouping sale_shipment_tolerance sale_stock_quantity sale_subscription sale_subscription_asset sale_supply sale_supply_drop_shipment sale_supply_production stock stock_assign_manual stock_consignment stock_forecast stock_inventory_location stock_location_move stock_location_sequence stock_lot stock_lot_sled stock_lot_unit stock_package stock_package_shipping stock_package_shipping_dpd stock_package_shipping_mygls stock_package_shipping_sendcloud stock_package_shipping_ups stock_product_location stock_quantity_early_planning stock_quantity_issue stock_secondary_unit stock_shipment_cost stock_shipment_cost_weight stock_shipment_measurements stock_split stock_supply stock_supply_day stock_supply_forecast stock_supply_production timesheet timesheet_cost user_role web_shop web_shop_shopify web_shop_vue_storefront web_shop_vue_storefront_stripe web_shortener web_user ) inactive_module "trytond-" $pip "${inactive_modules_trytondo[@]}" fi if [ "$Provider" == "OneTeam_Pos" ]; then apt-get update \ && apt-get install -y --no-install-recommends \ git \ pkg-config \ libxml2-dev \ libxmlsec1-dev \ libxmlsec1-openssl \ libffi-dev \ build-essential \ python3-dev \ python3-qrcode \ && rm -rf /var/lib/apt/lists/* \ && pip3 install --upgrade pip \ && pip3 install -r /opt/requirements_${Provider}.txt \ && pip3 install "git+https://git.disroot.org/OneTeam/facho.git@documento_soporte" \ && cd ${DIR_MODULES} prefix="trytondo-" team_org="OneTeam" pip="False" get_one_team=( `${PYTHON_VERSION} $multi_migrate list-repo-token --domain ${GITEA_DOMAIN} --team_org $Provider --access_token ${GITEA_ACCESS_TOKEN} --verbose True` ) clone_module $Provider ${TRYTOND_VERSION} $prefix "${get_one_team[@]}" inactive_modules_trytondo=( purchase_coffee sale_payment ) inactive_module "trytond-" $pip "${inactive_modules_trytondo[@]}" modules_nantic=( trytond-sale_w_tax trytond-purchase_discount trytond-sale_w_tax trytond-sale_pos trytond-sale_shop trytond-sale_payment trytond-purchase_discount trytond-account_invoice_discount ) clone_module "NaNtic" ${TRYTOND_VERSION} "trytond-" "${modules_nantic[@]}" fi if [ "$Provider" == "Presik" ]; then prefix="trytonpsk-" team_org="Presik" pip="True" pip3 install --upgrade pip \ && pip3 install -r /opt/requirements_${Provider}.txt get_presik=( `${PYTHON_VERSION} $multi_migrate list-repo-token --domain ${GITEA_DOMAIN} --team_org ${Provider} --access_token ${GITEA_ACCESS_TOKEN} --verbose True` ) clone_module $Provider "False" $prefix "${get_presik[@]}" inactive_modules_presik=( document document_collection document_expiration document_communication staff_document staff_document_alert sale_pos_frontend sale_pos_frontend_rest sale_pos_commission maintenance-indicators health health_ambulance health_calendar health_co health_functional health_gloss health_gyneco health_history health_icd10 health_inpatient health_lab health_lifestyle health_nursing health_optometry health_orthanc health_pediatrics health_services health_socioeconomics health_stock health_who_essential_medicines smtp sms ) inactive_module $prefix $pip "${inactive_modules_presik[@]}" modules_nantic=(trytond-smtp) clone_module "NaNtic" ${TRYTOND_VERSION} "trytond-" "${modules_nantic[@]}" fi if [ "$Provider" == "Datalife" ]; then prefix="trytond-" team_org="Datalife" pip="False" apt-get install -y --no-install-recommends \ build-essential \ python3-dev \ libffi-dev \ && pip3 uninstall -y trytond-incoterm \ && cd /usr/local \ && git clone -b main https://${GITEA_USER}:${GITEA_PASSWORD}@git.disroot.org/NaNtic/python-edifact.git \ && cd python-edifact \ && ${PYTHON_VERSION} setup.py install \ && cd /usr/local \ && git clone -b ${TRYTOND_VERSION} https://${GITEA_USER}:${GITEA_PASSWORD}@git.disroot.org/Datalife/tryton_replication.git \ && cd tryton_replication \ && ${PYTHON_VERSION} setup.py install \ && cd /usr/local \ && git clone -b ${TRYTOND_VERSION} https://${GITEA_USER}:${GITEA_PASSWORD}@git.disroot.org/Datalife/tryton_rpc.git \ && cd tryton_rpc \ && ${PYTHON_VERSION} setup.py install \ && cd $DIR_MODULES \ && rm -rf incoterm \ && pip3 install --upgrade pip \ && pip3 install -r /opt/requirements_${Provider}.txt inactive_modules_trytond=( sale_payment) inactive_module "trytond-" $pip "${inactive_modules_trytond[@]}" get_datalife=( `${PYTHON_VERSION} $multi_migrate list-repo-token --domain ${GITEA_DOMAIN} --team_org $Provider --access_token ${GITEA_ACCESS_TOKEN} --verbose True` ) clone_module $Provider ${TRYTOND_VERSION} $prefix "${get_datalife[@]}" inactive_modules_datalife=( edw_mssql sale_cost_apply_purchase agro_sale_board_harvest_request label_printer stock_label_printer account_payment_confirming_n68 electronic_mail_scheduler electronic_mail_wizard ) inactive_module $prefix $pip "${inactive_modules_datalife[@]}" modules_nantic=( trytond-account_payment_type trytond-company_bank trytond-account_invoice_company_currency trytond-jasper_reports trytond-stock_scanner trytond-stock_valued trytond-stock_kit trytond-sale_kit trytond-account_payment_type trytond-edocument_unedifact trytond-account_move_draft trytond-account_payment_receipt trytond-product_barcode ) clone_module "NaNtic" ${TRYTOND_VERSION} $prefix "${modules_nantic[@]}" fi if [ "$Provider" == "NaNtic" ]; then prefix="trytond-" team_org="NaNtic" pip="False" apt-get install -y --no-install-recommends \ build-essential \ python3-dev \ libffi-dev \ libldap2-dev \ libsasl2-dev \ libcups2-dev \ libpq-dev \ && pip3 install --upgrade pip \ && cd /opt \ && git clone --branch ${TRYTOND_VERSION} ${gitea_url}${Provider}/tryton-config.git \ && pip3 install -r tryton-config/requirements.txt \ && pip3 install -r /opt/requirements_${Provider}.txt get_nantic=( `${PYTHON_VERSION} $multi_migrate list-repo-token --domain ${GITEA_DOMAIN} --team_org $Provider --access_token ${GITEA_ACCESS_TOKEN} --verbose True` ) clone_module $Provider ${TRYTOND_VERSION} $prefix "${get_nantic[@]}" inactive_modules_nantic=(patches tryton-config ) inactive_module $prefix $pip "${inactive_modules_nantic[@]}" fi if [ "$Provider" == "Kalenis" ]; then team_org="kalenis" branch="master" apt-get install -y --no-install-recommends \ build-essential \ python3-dev \ wget \ && pip3 install --upgrade pip \ && pip3 install -r /opt/requirements_${Provider}.txt \ && git clone -b ${branch} ${gitea_url}${Provider}/kalenislims.git \ && mv kalenislims/lims* ${DIR_MODULES} \ && rm -rf kalenislims \ && git clone -b ${branch} ${gitea_url}${Provider}/kalenis_user_view.git \ && mv kalenis_user_view ${DIR_MODULES}/user_view \ && wget https://downloads.kalenislims.com/frontend_dist_${TRYTOND_VERSION}.tar.gz \ && tar -xzf frontend_dist_${TRYTOND_VERSION}.tar.gz \ && rm -rf /var/lib/trytond/www \ && mv frontend_dist_${TRYTOND_VERSION} /var/lib/trytond/www fi if [ "$Provider" == "GnuHealth" ]; then name_tar="gnuhealth-4.0.4" if [ "$TRYTOND_VERSION" == "5.0" ]; then name_tar="gnuhealth-3.8.0" fi apt-get install -y --no-install-recommends \ build-essential \ python3-dev \ wget \ libldap2-dev \ libsasl2-dev \ ldap-utils \ tox \ lcov \ valgrind \ && pip3 install --upgrade pip \ && pip3 install -r /opt/requirements_${Provider}.txt \ && cd /tmp \ && wget https://ftp.gnu.org/gnu/health/${name_tar}.tar.gz \ && tar -xzf ${name_tar}.tar.gz \ && mv ${name_tar}/health* ${DIR_MODULES} \ && rm -rf ${name_tar} if [ "$TRYTOND_VERSION" == "5.0" ]; then mv ${DIR_MODULES}/health_webdav3_server ${DIR_MODULES}/webdav mv ${DIR_MODULES}/health_caldav ${DIR_MODULES}/calendar fi fi if [ "$Provider" == "Trytonar" ]; then prefix="False" team_org="tryton-ar" pip="False" apt-get install -y --no-install-recommends \ wget \ unzip \ build-essential \ python3-dev \ libxslt-dev \ libffi-dev \ libssl-dev \ swig \ unzip \ && cd /opt \ && git clone https://github.com/reingart/pyafipws.git \ && cd pyafipws \ && ${PYTHON_VERSION} setup.py install \ && pip3 install --upgrade pip \ && pip3 install -r /opt/requirements_${Provider}.txt \ && cd ${DIR_MODULES} get_trytonar=( `${PYTHON_VERSION} $multi_migrate list-repo-token --domain ${GITEA_DOMAIN} --team_org $team_org --access_token ${GITEA_ACCESS_TOKEN} --verbose True` ) clone_module $team_org ${TRYTOND_VERSION} $prefix "${get_trytonar[@]}" inactive_modules_trytonar=( documentacion-tryton-ar tryton-demo-ar tryton-capacitacion-tecnica company_ar_NO_USAR tryton-ar.github.io deploy-localizacion-argentina_DEPRECATE TUBA2015 padron_afip_ar_DEPRECATE ) inactive_module $prefix $pip "${inactive_modules_trytonar[@]}" fi