diff -Naur yacoto_orig/Makefile yacoto/Makefile --- yacoto_orig/Makefile 1970-01-01 01:00:00.000000000 +0100 +++ yacoto/Makefile 2010-03-11 13:20:14.000000000 +0100 @@ -0,0 +1,234 @@ +PACKAGE = yacoto-scripts +VERSION = 0.0.3 +ARCHIVE = $(PACKAGE)-helau-$(VERSION) +prefix ?= /usr +DOCDIR = $(DESTDIR)$(prefix)/share/doc/$(PACKAGE)-$(VERSION) + +YAC_CONF_DIR ?= /etc/vdr/plugins/yacoto +YAC_DIR ?= $(YAC_CONF_DIR) + +# +# "detect" mandatory dependencies +HAVE_VDRSYNC ?= $(shell which vdrsync.pl &>/dev/null && echo "1") +HAVE_SCREEN ?= $(shell which screen &>/dev/null && echo "1") +HAVE_REPLEX ?= $(shell which replex &>/dev/null && echo "1") + +# +# "detect" optional dependencies +HAVE_MJPEGTOOLS ?= $(shell which png2yuv &>/dev/null && echo "1") +HAVE_CDRTOOLS ?= $(shell which mkisofs &>/dev/null && echo "1") +HAVE_DVDPLUSRWTOOLS ?= $(shell which growisofs &>/dev/null && echo "1") +HAVE_IMAGEMAGICK ?= $(shell which convert &>/dev/null && echo "1") +HAVE_VAMPS ?= $(shell which vamps &>/dev/null && echo "1") +HAVE_DVDAUTHOR ?= $(shell which dvdauthor &>/dev/null && echo "1") +HAVE_MENCODER ?= $(shell which mencoder &>/dev/null && echo "1") +HAVE_FFMPEG ?= $(shell which ffmpeg &>/dev/null && echo "1") +HAVE_MP4BOX ?= $(shell which MP4Box &>/dev/null && echo "1") +HAVE_LAME ?= $(shell which lame &>/dev/null && echo "1") +HAVE_VORBISTOOLS ?= $(shell which oggenc &>/dev/null && echo "1") + + +# +# +# "select" options +WITH_DVD ?= 1 +WITH_3GP ?= 1 +WITH_IPOD ?= 1 +WITH_MP3 ?= 1 +WITH_OGG ?= 1 +WITH_H264 ?= 1 +WITH_DIVX ?= 1 + +# these need mandatory deps only: +ENC_SCRIPTS = mpeg2 +ENC_CONFIGS = mpeg2 + +# want DVD and have all the deps? +ifeq ($(WITH_DVD),1) +ifeq ($(HAVE_MJPEGTOOLS),1) +ifeq ($(HAVE_CDRTOOLS),1) +ifeq ($(HAVE_DVDPLUSRWTOOLS),1) +ifeq ($(HAVE_IMAGEMAGICK),1) +ifeq ($(HAVE_VAMPS),1) +ifeq ($(HAVE_DVDAUTHOR),1) + ENC_SCRIPTS += dvd + ENC_CONFIGS += dvd +endif +endif +endif +endif +endif +endif +endif + +# if we have just mencoder +ifeq ($(HAVE_MENCODER),1) + ENC_SCRIPTS += yac_enc_mencoder youtube + ENC_CONFIGS += youtube + ifeq ($(WITH_DIVX),1) + ENC_SCRIPTS += divx divx_mobile + ENC_CONFIGS += divx divx_mobile + endif + ifeq ($(HAVE_MP4BOX),1) + ifeq ($(WITH_IPOD),1) + ENC_SCRIPTS += ipod_menc + ENC_CONFIGS += ipod_menc + endif + endif + ifeq ($(WITH_H264),1) + ENC_SCRIPTS += h264 + ENC_CONFIGS += h264 + endif +endif + +# if we have just ffmpeg +ifeq ($(HAVE_FFMPEG),1) + ENC_SCRIPTS += yac_enc_ffmpeg + ifeq ($(WITH_DIVX),1) + ENC_SCRIPTS += divx_ffmpeg + ENC_CONFIGS += divx_ffmpeg + endif + ifeq ($(HAVE_MP4BOX),1) + ifeq ($(WITH_IPOD),1) + ENC_SCRIPTS += ipod_ffmpeg + ENC_CONFIGS += ipod_ffmpeg + endif + endif +endif + +# if we have both mencoder and ffmpeg +ifeq ($(HAVE_MENCODER),1) + ifeq ($(HAVE_FFMPEG),1) + ifeq ($(WITH_3GP),1) + ENC_SCRIPTS += 3gp + ENC_CONFIGS += 3gp + endif + ifeq ($(WITH_IPOD),1) + ENC_SCRIPTS += ipod_nano + ENC_CONFIGS += ipod_nano + endif + endif +endif + +# if we have lame and possibly vorbis tools +ifeq ($(HAVE_LAME),1) + ifeq ($(WITH_MP3),1) + ENC_SCRIPTS += mp3 + ENC_CONFIGS += mp3 + endif + ifeq ($(HAVE_VORBISTOOLS),1) + ifeq ($(WITH_OGG),1) + ENC_SCRIPTS += ogg + ENC_CONFIGS += ogg + endif + endif +endif + + + +detect-deps: + @echo "" + @if ! [[ "$(HAVE_VDRSYNC)" = "1" ]] || ! [[ "$(HAVE_SCREEN)" = "1" ]] || ! [[ "$(HAVE_REPLEX)" = "1" ]]; then \ + if ! [[ "$(HAVE_VDRSYNC)" = "1" ]]; then \ + echo "Mandatory package 'vdrsync' not found !!!"; \ + fi; \ + if ! [[ "$(HAVE_SCREEN)" = "1" ]]; then \ + echo "Mandatory package 'screen' not found !!!"; \ + fi; \ + if ! [[ "$(HAVE_REPLEX)" = "1" ]]; then \ + echo "Mandatory package 'replex' not found !!!"; \ + fi; \ + echo ""; \ + echo "The scripts cannot work on your system and will not be installed."; \ + false; \ + fi + @if [[ "$(WITH_DVD)" = "1" ]] && ! [[ "$(HAVE_MJPEGTOOLS)" = "1" ]]; then \ + echo "Optional package 'mjpegtools' not found !!!"; \ + fi + @if [[ "$(WITH_DVD)" = "1" ]] && ! [[ "$(HAVE_CDRTOOLS)" = "1" ]]; then \ + echo "Optional package 'cdrtools' not found !!!"; \ + fi + @if [[ "$(WITH_DVD)" = "1" ]] && ! [[ "$(HAVE_DVDPLUSRWTOOLS)" = "1" ]]; then \ + echo "Optional package 'dvd+rw-tools' not found !!!"; \ + fi + @if [[ "$(WITH_DVD)" = "1" ]] && ! [[ "$(HAVE_IMAGEMAGICK)" = "1" ]]; then \ + echo "Optional package 'imagemagick' not found !!!"; \ + fi + @if [[ "$(WITH_DVD)" = "1" ]] && ! [[ "$(HAVE_VAMPS)" = "1" ]]; then \ + echo "Optional package 'vamps' not found !!!"; \ + fi + @if [[ "$(WITH_DVD)" = "1" ]] && ! [[ "$(HAVE_DVDAUTHOR)" = "1" ]]; then \ + echo "Optional package 'dvdauthor' not found !!!"; \ + fi + @if [[ "$(WITH_3GP)" = "1" ]] || [[ "$(WITH_IPOD)" = "1" ]] || [[ "$(WITH_H264)" = "1" ]] || [[ "$(WITH_DIVX)" = "1" ]]; then \ + if ! [[ "$(HAVE_MENCODER)" = "1" ]]; then \ + echo "Optional package 'mencoder' (sometimes part of 'mplayer') not found !!!"; \ + fi; \ + if ! [[ "$(HAVE_FFMPEG)" = "1" ]]; then \ + echo "Optional package 'ffmpeg' not found !!!"; \ + fi; \ + fi + @if [[ "$(WITH_IPOD)" = "1" ]]; then \ + if ! [[ "$(HAVE_MP4BOX)" = "1" ]]; then \ + echo "Optional package 'MP4Box' (sometimes part of 'gpac') not found !!!"; \ + fi; \ + fi + @if [[ "$(WITH_MP3)" = "1" ]] || [[ "$(WITH_OGG)" = "1" ]]; then \ + if ! [[ "$(HAVE_LAME)" = "1" ]]; then \ + echo "Optional package 'Lame' not found !!!"; \ + fi; \ + fi + @if [[ "$(WITH_OGG)" = "1" ]]; then \ + if ! [[ "$(HAVE_VORBISTOOLS)" = "1" ]]; then \ + echo "Optional package 'oggenc' (sometimes part of 'vorbis tools') not found !!!"; \ + fi; \ + fi + @echo "" + @echo "Scripts for these encoding profiles will be installed:" + @echo " $(ENC_CONFIGS)" + @echo "" + +all: detect-deps + @for scriptfile in $$(grep -r -l --include=*.sh 'YAC_CONF_DIR=' .); do \ + if ! [[ "$$(grep "YAC_CONF_DIR=" "$$scriptfile")" = 'YAC_CONF_DIR="$(YAC_CONF_DIR)"' ]]; then \ + sed -i $$scriptfile -e 's#$$(grep "YAC_CONF_DIR=" "$$scriptfile")#YAC_CONF_DIR=\"\${YAC_CONF_DIR\:=$(YAC_CONF_DIR)}\"#'; \ + fi; \ + done + +install: all + @mkdir -p $(DESTDIR)$(YAC_CONF_DIR)/conf + @mkdir -p $(DESTDIR)$(YAC_DIR)/conf + @mkdir -p $(DESTDIR)$(YAC_DIR)/queue + @mkdir -p $(DESTDIR)/var/log/yacoto + @cp --recursive --remove-destination --archive yac_*.sh $(DESTDIR)$(YAC_DIR) + @cp --recursive --remove-destination --archive yacoto.conf.sample $(DESTDIR)$(YAC_CONF_DIR) + @for cfg in $(ENC_CONFIGS); do \ + if [[ -d conf/"$$cfg" ]]; then \ + cp --archive --recursive conf/"$$cfg" $(DESTDIR)$(YAC_DIR)/conf; \ + mkdir -p $(DESTDIR)$(YAC_CONF_DIR)/conf/"$$cfg"; \ + mv $(DESTDIR)$(YAC_DIR)/conf/"$$cfg"/*.conf.sample $(DESTDIR)$(YAC_CONF_DIR)/conf/"$$cfg"; \ + fi; \ + if [[ -x conf/"$$cfg".conf.sh ]]; then \ + cp --recursive --remove-destination --archive conf/"$$cfg".conf.sh $(DESTDIR)$(YAC_DIR)/conf; \ + fi; \ + cp --recursive --remove-destination --archive conf/"$$cfg".conf.sample $(DESTDIR)$(YAC_CONF_DIR)/conf; \ + done + @for cfg in $(ENC_SCRIPTS); do \ + cp --recursive --remove-destination --archive conf/"$$cfg".sh $(DESTDIR)$(YAC_DIR)/conf; \ + done + @mkdir -p $(DOCDIR) + @cp --recursive --remove-destination --archive HISTORY README README.en -t $(DOCDIR) + +dist: + @for cfgfile in $$(find . -name "*.conf"); do \ + mv $$cfgfile $$cfgfile.sample; \ + done + @chmod +x $$(find . -name "*.sh") + @tar -czvf ./$(ARCHIVE).tgz -C . --exclude=*.tgz --exclude=*.conf.old --exclude=*.org --exclude=*.conf.new \ + --exclude=status/* --exclude=queue/* --exclude=yacadmin.conf* ../yacoto/* + @echo Distribution package created as ./$(ARCHIVE).tgz +# @tar -tzvf "$(ARCHIVE).tgz" + @sh ./yac_update.sh + + +.PHONY: install diff -Naur yacoto_orig/conf/dvd/dvd_menu.sh yacoto/conf/dvd/dvd_menu.sh --- yacoto_orig/conf/dvd/dvd_menu.sh 2008-12-18 20:00:15.000000000 +0100 +++ yacoto/conf/dvd/dvd_menu.sh 2010-03-11 10:54:55.000000000 +0100 @@ -1,15 +1,16 @@ #!/bin/sh #set -x -DVD_CONF_DIR="${YAC_DIR}/conf/dvd" -if [ "$DVD_MENU" != "" ] && [ -d ${YAC_DIR}/conf/dvd/${DVD_MENU} ] ; then +DVD_CONF_DIR="$(yac_choosedir conf/dvd/$DVD_MENU)/conf/dvd" + +if [ "$DVD_MENU" != "" ] && [ -d ${DVD_CONF_DIR}/${DVD_MENU} ] ; then if [ -f "${DVD_CONF_DIR}/${DVD_MENU}/menu.conf" ] ; then source "${DVD_CONF_DIR}/${DVD_MENU}/menu.conf" fi fi source "${DVD_CONF_DIR}/menu.conf" -CONVERT_VDR_INFO="${DVD_CONF_DIR}/format_info.sh" +CONVERT_VDR_INFO="$(yac_choosedir /conf/dvd/format_info.sh)/conf/dvd/format_info.sh" TEMP_DIR=${TEMP_DIR:=/tmp/dvd_menu} [ ! -d "$TEMP_DIR" ] && mkdir "$TEMP_DIR" diff -Naur yacoto_orig/conf/dvd.conf.sh yacoto/conf/dvd.conf.sh --- yacoto_orig/conf/dvd.conf.sh 2008-12-18 20:00:12.000000000 +0100 +++ yacoto/conf/dvd.conf.sh 2010-03-11 13:20:25.000000000 +0100 @@ -1,23 +1,34 @@ #!/bin/sh #set -x -cd "$(dirname "$0")" -DVD_CONF="dvd.conf" +YAC_CONF_DIR="${YAC_CONF_DIR:=/etc/vdr/plugins/yacoto}" +DVD_CONF="${YAC_CONF_DIR}/conf/dvd.conf" +cd "$(dirname "$0")/.." +YAC_DIR="$(pwd)" -CONF_LINE="$(grep DVD_MENU dvd.conf)" +CONF_LINE="$(grep DVD_MENU $DVD_CONF)" act_conf="${CONF_LINE#*=\"}" act_conf="${act_conf%%\"*}" val_conf="none" all_conf="none" -for dvd_menu in dvd/*/mm-button.png ; do - [ ! -s $dvd_menu ] && break - cfg=${dvd_menu%/*} - all_conf="$all_conf,${cfg##*/}" - [ "${cfg##*/}" = "$act_conf" ] && val_conf=$act_conf +for curr_basedir in ${YAC_CONF_DIR}/conf ${YAC_DIR}/conf; do + if [ -d ${curr_basedir} ]; then + cd ${curr_basedir} + for dvd_menu in dvd/*/mm-button.png ; do + if [[ ${curr_basedir} = ${YAC_DIR}/conf ]]; then + [ ! -s $dvd_menu ] && break + fi + cfg=${dvd_menu%/*} + if ! [[ $all_conf =~ ${cfg##*/} ]]; then + all_conf="$all_conf,${cfg##*/}" + [ "${cfg##*/}" = "$act_conf" ] && val_conf=$act_conf + fi + done + fi done if [ "$act_conf" != "none" ] && [ "$act_conf" != "$val_conf" ] ; then logger -s "Active dvd menu <$act_conf> is invalid" -fi +fi sed -i $DVD_CONF -e "s/\(^DVD_MENU=.*#~[^~]*~[^~]*~[^~]*~\).*/\1$all_conf~/" diff -Naur yacoto_orig/conf/dvd.sh yacoto/conf/dvd.sh --- yacoto_orig/conf/dvd.sh 2008-12-18 20:00:12.000000000 +0100 +++ yacoto/conf/dvd.sh 2010-03-11 10:54:55.000000000 +0100 @@ -5,7 +5,7 @@ [ "$CREATE_ISO" = "1" ] && CONV_STEPS=$(($CONV_STEPS+1)) [ "$BURN_DVD" = "1" ] && CONV_STEPS=$(($CONV_STEPS+1)) -source "${YAC_DIR}/conf/dvd/dvd_menu.sh" +source "$(yac_choosedir /conf/dvd/dvd_menu.sh)/conf/dvd/dvd_menu.sh" function yac_convert() { if [ "$1" = "" ] ; then @@ -52,8 +52,7 @@ mv -f $i.req $i done fi - - if [ "${DVD_MENU}" != "" -a -d ${YAC_DIR}/conf/dvd/${DVD_MENU} ] ; then + if [ "${DVD_MENU}" != "" -a -d ${DVD_CONF_DIR}/${DVD_MENU} ]; then dvd_make_menu $ID $DVD_DIR "$@" elif [ "$SPLIT_MODE" = "chapters" -a "$2" != "" ] ; then in_fls="" diff -Naur yacoto_orig/conf/ffmpeg.conf.sample yacoto/conf/ffmpeg.conf.sample --- yacoto_orig/conf/ffmpeg.conf.sample 2008-12-18 21:44:11.000000000 +0100 +++ yacoto/conf/ffmpeg.conf.sample 1970-01-01 01:00:00.000000000 +0100 @@ -1,13 +0,0 @@ -REMUX_TYPE="remux_convert" #~Remux mode~F~5~ ~ -AUDIO_SOURCE="mp2" #~Audio source~F~5~ ~ -VCODEC="libxvid" #~Video codec~F~15~ ~ -VBITRATE="1400" #~Video bitrate~I~5~100,2000~ -ACODEC="libmp3lame" #~Audio codec~F~15~ ~ -ABITRATE="128" #~Audio bitrate~I~5~40,256~ -ASRATE="44100" #~Resample rate~F~10~ ~ -SCALE="640x480" #~Skalierung~F~10~ ~ -ZOOM="2" #~Zoom~F~1~ ~ -CROP="1" #~CROP~F~1~ ~ -SIZE="0" #~Groesse~F~10~ ~ -EXT="avi" #~Format~F~5~ ~ -SPECIALOPT="-deinterlace" #~Zusatzoptionen~F~128~ ~ diff -Naur yacoto_orig/mkdist.sh yacoto/mkdist.sh --- yacoto_orig/mkdist.sh 2008-12-18 21:35:34.000000000 +0100 +++ yacoto/mkdist.sh 1970-01-01 01:00:00.000000000 +0100 @@ -1,15 +0,0 @@ -#!/bin/bash -#set -x -PACKAGE="yacoto-scripts-helau-0.0.2" - -find . -name "*.conf" | while read i ; do - mv "$i" "$i.sample" -done -chmod +x $(find . -name "*.sh") -tar -czvf "${PACKAGE}.tgz" -C ../yacoto --exclude=*.tgz --exclude=*.conf.old --exclude=*.org --exclude=*.conf.new \ - --exclude=status/* --exclude=queue/* --exclude=yacadmin.conf* \ - ../yacoto/* -echo "Distribution package created as ${PACKAGE}.tgz :" -tar -tzvf "${PACKAGE}.tgz" - -sh yac_update.sh diff -Naur yacoto_orig/yac_choosedir.sh yacoto/yac_choosedir.sh --- yacoto_orig/yac_choosedir.sh 1970-01-01 01:00:00.000000000 +0100 +++ yacoto/yac_choosedir.sh 2010-03-11 10:54:55.000000000 +0100 @@ -0,0 +1,26 @@ +#!/bin/bash + +# +# will return one of the base directories $YAC_CONF_DIR or $YAC_DIR (in +# this order of precedence) in which the file or directory (also +# possibly given with an absolute or relative path) is found, or return nothing +# if the file or directory is not found in either location +function yac_choosedir() { + # trim away leading full path if applicable + inpath=$1 + inpath=${inpath##$YAC_CONF_DIR/} + if [ -e "$YAC_CONF_DIR/$inpath" ]; then + echo "$YAC_CONF_DIR" + return 0 + else + # trim away leading full path if applicable + inpath=$1 + inpath=${inpath##$YAC_DIR/} + if [ -e "$YAC_DIR/$inpath" ]; then + echo "$YAC_DIR" + return 0 + fi + fi + echo "yac_choosedir_INVALID" + return 1 +} diff -Naur yacoto_orig/yac_exec.sh yacoto/yac_exec.sh --- yacoto_orig/yac_exec.sh 2008-12-18 20:00:05.000000000 +0100 +++ yacoto/yac_exec.sh 2010-03-11 13:20:25.000000000 +0100 @@ -18,10 +18,14 @@ logger -s "$*" echo "$(date +"%D %T") - $*" >> $LOG } -YAC_DIR="$(pwd)" [ "$DEBUG" = "1" ] && set -x +YAC_DIR="$(pwd)" +YAC_CONF_DIR="${YAC_CONF_DIR:=/etc/vdr/plugins/yacoto}" + +source $YAC_DIR/yac_choosedir.sh + #target_filename=${1// /_} target_name="$(echo "$1" | sed -e "s/[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]/_/g" | tr -s "_")" [ "$target_name" = "" ] && usage @@ -56,8 +60,7 @@ TEMP_DIR=${TEMP_DIR:=/tmp} TEMP_DIR="${TEMP_DIR}/YAC_$target_tempname" - -source "conf/${CONFIG}.sh" +source "$(yac_choosedir conf/${CONFIG}.sh)/conf/${CONFIG}.sh" VDR_VIDEO=${VDR_VIDEO:=/video} TARGET_VIDEO=${TARGET_VIDEO:=/film} TARGET_AUDIO=${TARGET_AUDIO:=/audio/yacoto} @@ -156,7 +159,7 @@ fi [ -f "$info_file" ] && info_file="${info_file%.info}.${act_date}.info" - sh $YAC_DIR/conf/dvd/format_info.sh "${REC_DIR[1]}/info.vdr" > "${info_file}" + sh $(yac_choosedir conf/dvd/format_info.sh)/conf/dvd/format_info.sh "${REC_DIR[1]}/info.vdr" > "${info_file}" fi RC="SUCCESS" else diff -Naur yacoto_orig/yac_manager.sh yacoto/yac_manager.sh --- yacoto_orig/yac_manager.sh 2008-12-18 20:00:05.000000000 +0100 +++ yacoto/yac_manager.sh 2010-03-11 13:20:25.000000000 +0100 @@ -6,14 +6,16 @@ if [ "$(pidof -o %PPID -x $0)" != "" ] ; then logger -s "$0 is already running" exit -fi +fi + +YAC_CONF_DIR="${YAC_CONF_DIR:=/etc/vdr/plugins/yacoto}" +YAC_CONF="${YAC_CONF_DIR}/yacoto.conf" -YAC_CONF="yacoto.conf" if [ ! -f $YAC_CONF ] ; then logger -s "Yac config <$CONFIG> nicht vorhanden" exit -fi +fi source $YAC_CONF if [ "$PARALLEL_EXECUTION" = "1" ] ; then if [ $(grep "^processor" /proc/cpuinfo |wc -l) -lt 2 ] ; then @@ -41,6 +43,5 @@ mv $i.run $i.old fi sleep 15 - done + done done - diff -Naur yacoto_orig/yac_setcfgfiles.sh yacoto/yac_setcfgfiles.sh --- yacoto_orig/yac_setcfgfiles.sh 2008-12-18 20:00:05.000000000 +0100 +++ yacoto/yac_setcfgfiles.sh 2010-03-11 13:20:25.000000000 +0100 @@ -1,8 +1,9 @@ #!/bin/bash cd "$(dirname "$0")" YAC_DIR="$(pwd)" +YAC_CONF_DIR="${YAC_CONF_DIR:=/etc/vdr/plugins/yacoto}" -YAC_PLG_CONF="yacadmin.conf" +YAC_PLG_CONF="${YAC_CONF_DIR}/yacadmin.conf" [ "$2" != "" ] && [ -f $2 ] && YAC_PLG_CONF=$2 @@ -28,7 +29,7 @@ VAL_INPUT=${ln%%~*} ln=${ln#*~} COMMENT=${ln%%~*} - + VARVAL="$VAR=\"$VAL\"" printf "%-25s #~$COMMENT~$TYPE~$LENGTH~$VAL_INPUT~\n" "$VARVAL" >> $cfg_file fi diff -Naur yacoto_orig/yac_setplgconf.sh yacoto/yac_setplgconf.sh --- yacoto_orig/yac_setplgconf.sh 2008-12-18 20:00:05.000000000 +0100 +++ yacoto/yac_setplgconf.sh 2010-03-11 13:20:25.000000000 +0100 @@ -1,7 +1,19 @@ #!/bin/bash cd "$(dirname "$0")" YAC_DIR="$(pwd)" - +YAC_CONF_DIR="${YAC_CONF_DIR:=/etc/vdr/plugins/yacoto}" +YAC_CONF="${YAC_CONF_DIR}/yacoto.conf" + +if [ ! -f $YAC_CONF ] ; then + logger -s "Yac config <$CONFIG> nicht vorhanden" + exit +fi + +source $YAC_CONF +source $YAC_DIR/yac_choosedir.sh + +YAC_PLG_CONF="${YAC_CONF_DIR}/yacadmin.conf" + function getVals() { ln=$1 VAR=${ln%%=*} @@ -32,8 +44,6 @@ [ "$COMMENT" = "" ] && COMMENT=$VAR } -YAC_PLG_CONF="yacadmin.conf" -YAC_CONF="yacoto.conf" [ "$1" != "" ] && [ -f $1 ] && YAC_CONF=$1 [ "$2" != "" ] && [ -f $2 ] && YAC_PLG_CONF=$2 @@ -45,22 +55,25 @@ [ -f $YAC_PLG_CONF ] && mv $YAC_PLG_CONF $YAC_PLG_CONF.old [ -f $YAC_PLG_CONF.new ] && rm $YAC_PLG_CONF.new -for cfg_file in conf/*.conf ; do - [ -f $cfg_file.sh ] && sh $cfg_file.sh - [ ! -f $cfg_file ] && break - cfg_name=${cfg_file##*/} - cfg_name=${cfg_name%%\.*} - CFG_NAMES="$CFG_NAMES,$cfg_name" - echo ":$cfg_name" >> $YAC_PLG_CONF.new - for i in $(grep "^[A-Z].*=" $cfg_file) ; do - getVals "$i" - - case "$VAR" in - *) - echo "${YAC_DIR}/$cfg_file~$VAR~$VAL~$TYPE~$LENGTH~$VAL_INPUT~$COMMENT~" >> $YAC_PLG_CONF.new - ;; - esac - done +for cfg_file in $YAC_CONF_DIR/conf/*.conf ; do + profile=${cfg_file##*/} + profile=${profile%%\.*} + script_dir="$(yac_choosedir conf/$profile.sh)/conf" + exitcode="$?" + if [ $exitcode = 0 ]; then + [ -f "$script_dir/$profile.conf.sh" ] && sh "$script_dir/$profile.conf.sh" + [ ! -f "$script_dir/$profile.sh" ] && continue + CFG_NAMES="$CFG_NAMES,$profile" + echo ":$profile" >> $YAC_PLG_CONF.new + for i in $(grep "^[A-Z].*=" $cfg_file) ; do + getVals "$i" + case "$VAR" in + *) + echo "$cfg_file~$VAR~$VAL~$TYPE~$LENGTH~$VAL_INPUT~$COMMENT~" >> $YAC_PLG_CONF.new + ;; + esac + done + fi done CFG_NAMES=${CFG_NAMES:1} @@ -101,11 +114,10 @@ *) ;; esac - echo "${YAC_DIR}/$YAC_CONF~$VAR~$VAL~$TYPE~$LENGTH~$VAL_INPUT~$COMMENT~" >> $YAC_PLG_CONF + echo "$YAC_CONF~$VAR~$VAL~$TYPE~$LENGTH~$VAL_INPUT~$COMMENT~" >> $YAC_PLG_CONF done if [ "$ACT_CFG" != "" ] ; then - echo "${YAC_DIR}/$YAC_CONF~CONFIG~$ACT_CFG~L~0~$CFG_NAMES~Konfiguration~" >> $YAC_PLG_CONF + echo "$YAC_CONF~CONFIG~$ACT_CFG~L~0~$CFG_NAMES~Konfiguration~" >> $YAC_PLG_CONF fi cat $YAC_PLG_CONF.new >> $YAC_PLG_CONF - diff -Naur yacoto_orig/yac_start.sh yacoto/yac_start.sh --- yacoto_orig/yac_start.sh 2008-12-18 20:00:05.000000000 +0100 +++ yacoto/yac_start.sh 2010-03-11 10:54:55.000000000 +0100 @@ -1,17 +1,18 @@ #!/bin/bash -YAC_CONF="yacoto.conf" +YAC_CONF_DIR"/etc/vdr/plugins/yacoto" +YAC_CONF="${YAC_CONF_DIR}/yacoto.conf" cd "$(dirname "$0")" YAC_DIR="$(pwd)" if [ ! -f $YAC_CONF ] ; then logger -s "Yac config <$CONFIG> nicht vorhanden" exit -fi +fi source $YAC_CONF -if [ ! -f "conf/$CONFIG.conf" ] ; then - logger -s "Yac config nicht vorhanden" +if [ ! -f "${YAC_CONF_DIR}/conf/$CONFIG.conf" ] ; then + logger -s "Yac config <${YAC_CONF_DIR}/conf/$CONFIG.conf> nicht vorhanden" exit -fi +fi logger -s "$0" NICE_LEVEL=${NICE_LEVEL:=10} @@ -28,7 +29,7 @@ echo "#!/bin/bash" >$tmpFile -cat conf/$CONFIG.conf >> $tmpFile +cat ${YAC_CONF_DIR}/conf/$CONFIG.conf >> $tmpFile echo "" >> $tmpFile cat $YAC_CONF >> $tmpFile diff -Naur yacoto_orig/yac_update.sh yacoto/yac_update.sh --- yacoto_orig/yac_update.sh 2008-12-18 21:43:36.000000000 +0100 +++ yacoto/yac_update.sh 2010-03-11 13:20:25.000000000 +0100 @@ -1,8 +1,14 @@ #!/bin/bash + +YAC_CONF_DIR="${YAC_CONF_DIR:=/etc/vdr/plugins/yacoto}" +cd "$(dirname "$0")" +YAC_DIR="$(pwd)" +cd "${YAC_CONF_DIR}" find . -name "*.conf.sample" | while read i ; do if [ ! -f "${i%.sample}" ] ; then cp -v "$i" "${i%.sample}" else echo "Keeping <${i%.sample}>" - fi -done + fi +done +cd "${YAC_DIR}"