addon-grocy/grocy/rootfs/etc/s6-overlay/s6-rc.d/php-fpm/run
2024-12-23 16:01:56 -05:00

151 lines
4.5 KiB
Text
Executable file

#!/command/with-contenv bashio
# shellcheck shell=bash
# ==============================================================================
# Home Assistant Community Add-on: Grocy
# Runs the PHP-FPM daemon
# ==============================================================================
declare caldayweek
declare mealday
declare label_printer_webhook
declare label_printer_params
declare tprinter_ip
declare tprinter_port
declare tprinter_connector
export GROCY_CULTURE
export GROCY_CURRENCY
export GROCY_ENTRY_PAGE
bashio::log.info "Starting PHP-FPM..."
if bashio::config.false 'features.batteries'; then
export GROCY_FEATURE_FLAG_BATTERIES=0
fi
if bashio::config.false 'features.calendar'; then
export GROCY_FEATURE_FLAG_CALENDAR=0
fi
if bashio::config.false 'features.chores'; then
export GROCY_FEATURE_FLAG_CHORES=0
fi
if bashio::config.false 'features.equipment'; then
export GROCY_FEATURE_FLAG_EQUIPMENT=0
fi
if bashio::config.false 'features.recipes'; then
export GROCY_FEATURE_FLAG_RECIPES=0
fi
if bashio::config.false 'features.shoppinglist'; then
export GROCY_FEATURE_FLAG_SHOPPINGLIST=0
fi
if bashio::config.false 'features.stock'; then
export GROCY_FEATURE_FLAG_STOCK=0
fi
if bashio::config.false 'features.tasks'; then
export GROCY_FEATURE_FLAG_TASKS=0
fi
if bashio::config.true 'features.label_printer'; then
export GROCY_FEATURE_FLAG_LABEL_PRINTER=1
fi
if bashio::config.true 'features.thermal_printer'; then
export FEATURE_FLAG_THERMAL_PRINTER=1
fi
if bashio::config.has_value 'tweaks.calendar_first_day_of_week'; then
caldayweek=$(bashio::config 'tweaks.calendar_first_day_of_week')
export GROCY_CALENDAR_FIRST_DAY_OF_WEEK=${caldayweek}
fi
if bashio::config.false 'tweaks.chores_assignment'; then
export GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS=0
fi
if bashio::config.has_value 'tweaks.meal_plan_first_day_of_week'; then
mealday=$(bashio::config 'tweaks.meal_plan_first_day_of_week')
export GROCY_MEAL_PLAN_FIRST_DAY_OF_WEEK=${mealday}
fi
if bashio::config.false 'tweaks.multiple_shopping_lists'; then
export GROCY_FEATURE_FLAG_SHOPPINGLIST_MULTIPLE_LISTS=0
fi
if bashio::config.false 'tweaks.stock_best_before_date_tracking'; then
export GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING=0
fi
if bashio::config.false 'tweaks.stock_location_tracking'; then
export GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING=0
fi
if bashio::config.false 'tweaks.stock_price_tracking'; then
export GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING=0
fi
if bashio::config.false 'tweaks.stock_product_freezing'; then
export GROCY_FEATURE_FLAG_STOCK_PRODUCT_FREEZING=0
fi
if bashio::config.false 'tweaks.stock_product_opened_tracking'; then
export GROCY_FEATURE_FLAG_STOCK_PRODUCT_OPENED_TRACKING=0
fi
if bashio::config.false 'tweaks.stock_count_opened_products_against_minimum_stock_amount'; then
export GROCY_FEATURE_SETTING_STOCK_COUNT_OPENED_PRODUCTS_AGAINST_MINIMUM_STOCK_AMOUNT=0
fi
if bashio::config.has_value 'tweaks.label_printer_webhook'; then
label_printer_webhook=$(bashio::config 'tweaks.label_printer_webhook')
export LABEL_PRINTER_WEBHOOK=${label_printer_webhook}
fi
if bashio::config.false 'tweaks.label_printer_run_server'; then
export GROCY_LABEL_PRINTER_RUN_SERVER=0
fi
if bashio::config.has_value 'tweaks.label_printer_params'; then
label_printer_params=$(bashio::config 'tweaks.label_printer_params')
export GROCY_LABEL_PRINTER_PARAMS=${label_printer_params}
fi
if bashio::config.true 'tweaks.label_printer_hook_json'; then
export GROCY_LABEL_PRINTER_HOOK_JSON=1
fi
if bashio::config.true 'tweaks.tprinter_is_network_printer'; then
export GROCY_TPRINTER_IS_NETWORK_PRINTER=1
fi
if bashio::config.false 'tweaks.tprinter_print_quantity_name'; then
export GROCY_TPRINTER_PRINT_QUANTITY_NAME=0
fi
if bashio::config.false 'tweaks.tprinter_print_notes'; then
export GROCY_TPRINTER_PRINT_NOTES=0
fi
if bashio::config.has_value 'tweaks.tprinter_ip'; then
tprinter_ip=$(bashio::config 'tweaks.tprinter_ip')
export GROCY_TPRINTER_IP=${tprinter_ip}
fi
if bashio::config.has_value 'tweaks.tprinter_port'; then
tprinter_port=$(bashio::config 'tweaks.tprinter_port')
export GROCY_TPRINTER_PORT=${tprinter_port}
fi
if bashio::config.has_value 'tweaks.tprinter_connector'; then
tprinter_connector=$(bashio::config 'tweaks.tprinter_connector')
export GROCY_TPRINTER_CONNECTOR=${tprinter_connector}
fi
GROCY_CULTURE=$(bashio::config "culture")
GROCY_CURRENCY=$(bashio::config "currency")
GROCY_ENTRY_PAGE=$(bashio::config 'entry_page')
exec php-fpm82 -R --nodaemonize