#!/sbin/openrc-run # Copyright 1999-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 my_daemon="shellinaboxd" pidfile="/run/${my_daemon}.pid" command="/usr/sbin/${my_daemon}" command_args="${SIAB_OPTS}" command_background=yes output_log="${SIAB_LOGFILE}" error_log="${SIAB_LOGFILE}" depend() { use net } start_pre() { local css label [ -z "${SIAB_CSS_DIR}" ] && return # This code searches SIAB_CSS_DIR for CSS files # and formats the --user-css option accordingly. set -- for css in "${SIAB_CSS_DIR}"/*.css; do test -e "${css}" || continue label=$(basename "${css}") label=${label%.css} case ${label} in # These are the default style sheets. Don't load them. print-styles|styles) ;; *) label=$( printf %s "${label}" \ | awk '{ gsub("[:+,-]", "_"); print toupper(substr($0, 1, 1)) substr($0, 2); }' ) if [ $# -eq 0 ]; then set -- "${label}:+${css}" else set -- "$@" "${label}:-${css}" fi esac done if [ $# -gt 0 ]; then command_args="${command_args} --user-css=\"$(IFS=,; printf %s "$*")\"" fi }