diff options
author | Matthias Schwarzott <zzam@gentoo.org> | 2007-04-16 07:49:53 +0000 |
---|---|---|
committer | Matthias Schwarzott <zzam@gentoo.org> | 2007-04-16 07:49:53 +0000 |
commit | f9cbe18dbdfa79009099b6b30ec6d28dc6bc0de2 (patch) | |
tree | 0ad6f5fe48dffe3a64f4fc6720411852cddd48a7 | |
parent | Removed bash specific code. (diff) | |
download | gentoo-vdr-scripts-f9cbe18dbdfa79009099b6b30ec6d28dc6bc0de2.tar.gz gentoo-vdr-scripts-f9cbe18dbdfa79009099b6b30ec6d28dc6bc0de2.tar.bz2 gentoo-vdr-scripts-f9cbe18dbdfa79009099b6b30ec6d28dc6bc0de2.zip |
Removed more bash specific code.
svn path=/gentoo-vdr-scripts/trunk/; revision=427
26 files changed, 133 insertions, 111 deletions
@@ -2,6 +2,28 @@ # $Id$ 16 Apr 2007; Matthias Schwarzott <zzam@gentoo.org> + usr/share/vdr/rcscript/pre-start-10-chuid.sh, + usr/share/vdr/rcscript/pre-stop-10-watchdog.sh, + usr/share/vdr/rcscript/pre-start-20-dvb-device.sh, + usr/share/vdr/rcscript/watchdog-restart-20-modules.sh, + usr/share/vdr/rcscript/pre-start-30-parameter.sh, + usr/share/vdr/rcscript/pre-start-40-config-files.sh, + usr/share/vdr/rcscript/pre-start-45-nptl-check.sh, + usr/share/vdr/rcscript/pre-start-45-utf8-check.sh, + usr/share/vdr/rcscript/pre-start-50-shutdown.sh, + usr/share/vdr/rcscript/post-start-50-svdrp.sh, + usr/share/vdr/rcscript/post-start-90-watchdog.sh, + usr/share/vdr/rcscript/pre-start-95-plugins.sh, + usr/share/vdr/rcscript/pre-start-98-wait-conditions.sh, README.shutdown, + etc/init.d/vdr, etc/init.d/wakeup-reboot-halt, usr/sbin/acpi-wakeup.sh, + usr/share/vdr/inc/commands-functions.sh, usr/share/vdr/inc/functions.sh, + usr/share/vdr/inc/language-functions.sh, + usr/share/vdr/inc/message-functions.sh, + usr/share/vdr/inc/plugin-functions.sh, usr/share/vdr/inc/rc-functions.sh, + usr/share/vdr/inc/shutdown-functions.sh, usr/share/vdr/inc/time.sh: + Removed more bash specific code. + + 16 Apr 2007; Matthias Schwarzott <zzam@gentoo.org> usr/sbin/acpi-wakeup.sh, usr/sbin/vdr-inform-watchdog.sh, usr/sbin/vdr-watchdogd: Removed bash specific code. diff --git a/README.shutdown b/README.shutdown index 4a521b1..a29b182 100644 --- a/README.shutdown +++ b/README.shutdown @@ -54,7 +54,7 @@ void error_mesg(string message) Example: wakeup_check() { - if [[ ! -x needed_program ]]; then + if [ ! -x needed_program ]; then error_mesg "no acpi-driver installed" return 1 fi diff --git a/etc/init.d/vdr b/etc/init.d/vdr index b8ca248..bdf5270 100755 --- a/etc/init.d/vdr +++ b/etc/init.d/vdr @@ -4,7 +4,7 @@ opts="${opts} watchdogrestart" -source /usr/share/vdr/inc/functions.sh +. /usr/share/vdr/inc/functions.sh include rc-functions depend() { @@ -23,7 +23,7 @@ start() { init_params init_daemonctrl_params - [[ -z "${VDR_BIN}" ]] && VDR_BIN=/usr/bin/vdr + [ -z "${VDR_BIN}" ] && VDR_BIN=/usr/bin/vdr add_daemonctrl_param --start --chdir ~vdr --exec ${VDR_BIN} @@ -47,7 +47,7 @@ start() { einfo_level2 " CMDLINE:" start-stop-daemon $(quote_parameters "${daemonctrl_opts[@]}" "--" "${vdr_opts[@]}") - if [[ -z "${TERMINAL}" ]]; then + if [ -z "${TERMINAL}" ]; then start-stop-daemon "${daemonctrl_opts[@]}" \ -- --daemon "${vdr_opts[@]}" exitcode=$? @@ -61,7 +61,7 @@ start() { # strange commandline, to be fixed in next versions openvt_opts="" - if [[ "${SWITCH_TO_TERMINAL}" == "yes" ]]; then + if [ "${SWITCH_TO_TERMINAL}" = "yes" ]; then openvt_opts="${openvt_opts} -s" fi openvt -c ${TERMINAL} ${openvt_opts} -- \ @@ -71,9 +71,9 @@ start() { fi eend $exitcode "Failed to start vdr." - if [[ "${exitcode}" == "0" ]]; then + if [ "${exitcode}" = "0" ]; then load_addons_prefixed post-start - if [[ "$?" != "0" ]]; then + if [ "$?" != "0" ]; then exitcode=1 fi fi diff --git a/etc/init.d/wakeup-reboot-halt b/etc/init.d/wakeup-reboot-halt index 99334f2..1233abf 100755 --- a/etc/init.d/wakeup-reboot-halt +++ b/etc/init.d/wakeup-reboot-halt @@ -11,10 +11,10 @@ start() { # check weather this time this is a reboot and I should shutdown local STATEFILE=/var/vdr/shutdown-data/special_script_should_shutdown - if [[ -e ${STATEFILE} ]]; then + if [ -e "${STATEFILE}" ]; then einfo "This is a reboot to write the wakeup-time into the bios." einfo "Shutting down now." - rm -f ${STATEFILE} + rm -f "${STATEFILE}" init 0 fi } diff --git a/usr/sbin/acpi-wakeup.sh b/usr/sbin/acpi-wakeup.sh index 14dfbb0..60ccf4f 100755 --- a/usr/sbin/acpi-wakeup.sh +++ b/usr/sbin/acpi-wakeup.sh @@ -27,9 +27,9 @@ checkUTC() { unset CLOCK if [ -f /etc/conf.d/clock ]; then - CLOCK=$(source /etc/conf.d/clock; echo ${CLOCK}) + CLOCK=$(. /etc/conf.d/clock; echo ${CLOCK}) else - CLOCK=$(source /etc/rc.conf; echo ${CLOCK}) + CLOCK=$(. /etc/rc.conf; echo ${CLOCK}) fi [ "${DEBUG}" = "1" ] && echo CLOCK-MODE: ${CLOCK} } diff --git a/usr/share/vdr/inc/commands-functions.sh b/usr/share/vdr/inc/commands-functions.sh index 0264448..5b282ef 100644 --- a/usr/share/vdr/inc/commands-functions.sh +++ b/usr/share/vdr/inc/commands-functions.sh @@ -6,7 +6,7 @@ include language-functions # This merged file can then be used by the vdr process. merge_commands_conf() { - [[ -z ${VDR_LANGUAGE} ]] && read_vdr_language + [ -z "${VDR_LANGUAGE}" ] && read_vdr_language local CONFIG="${CONFIG:-/etc/vdr}" local sdir="${1}" @@ -17,7 +17,7 @@ merge_commands_conf() { local mergedfile="/var/vdr/merged-config-files/${bname}" # merging files - if [[ -f "${mergedfile}" ]]; then + if [ -f "${mergedfile}" ]; then if ! rm "${mergedfile}"; then ewarn " Could not change ${mergedfile}" return @@ -35,10 +35,10 @@ EOT local f local inputf for f in ${SFILES}; do - [[ -f "${f}" ]] || continue + [ -f "${f}" ] || continue inputf="${f}" - [[ -f "${f}.${VDR_LANGUAGE}" ]] && inputf="${f}.${VDR_LANGUAGE}" + [ -f "${f}.${VDR_LANGUAGE}" ] && inputf="${f}.${VDR_LANGUAGE}" echo "# source : ${inputf}" >> "${mergedfile}" cat "${inputf}" >> "${mergedfile}" @@ -48,12 +48,12 @@ EOT chown vdr:vdr "${mergedfile}" # link it to real location - if [[ -L "${destfile}" ]]; then + if [ -L "${destfile}" ]; then # remove link rm "${destfile}" else # no link - if [[ -f "${destfile}" ]]; then + if [ -f "${destfile}" ]; then mv "${destfile}" "${destfile}.backup" einfo " Saved original ${destfile} as ${destfile}.backup" fi diff --git a/usr/share/vdr/inc/functions.sh b/usr/share/vdr/inc/functions.sh index 9a3c411..d4d6943 100644 --- a/usr/share/vdr/inc/functions.sh +++ b/usr/share/vdr/inc/functions.sh @@ -7,9 +7,9 @@ include() local name="${1}" local vname=loaded_${name/-/_} local check=${!vname} - [[ ${check:-0} == "1" ]] && return + [ "${check:-0}" = "1" ] && return - source /usr/share/vdr/inc/${name}.sh + . /usr/share/vdr/inc/${name}.sh eval ${vname}=1 } @@ -19,8 +19,8 @@ read_caps() { local capfile for capfile in /usr/share/vdr/capabilities.sh /usr/lib/vdr/rcscript/vdr-capabilities.sh; do - if [[ -f "${capfile}" ]]; then - source ${capfile} + if [ -f "${capfile}" ]; then + . ${capfile} break fi done diff --git a/usr/share/vdr/inc/language-functions.sh b/usr/share/vdr/inc/language-functions.sh index df74a07..ffe32b7 100644 --- a/usr/share/vdr/inc/language-functions.sh +++ b/usr/share/vdr/inc/language-functions.sh @@ -8,7 +8,7 @@ read_vdr_language() { local OSDLANG local LANG_TAB - if [[ -f /etc/vdr/setup.conf ]]; then + if [ -f /etc/vdr/setup.conf ]; then OSDLANG=$(awk -F= '/^OSDLanguage/ { print $2 }' /etc/vdr/setup.conf) else OSDLANG="0" diff --git a/usr/share/vdr/inc/message-functions.sh b/usr/share/vdr/inc/message-functions.sh index 42bb47e..624fe5d 100644 --- a/usr/share/vdr/inc/message-functions.sh +++ b/usr/share/vdr/inc/message-functions.sh @@ -9,7 +9,7 @@ VDR_LOG_FILE="" init_vdr_start_log() { - [[ -e /var/vdr/vdr-start-log ]] && rm -f /var/vdr/vdr-start-log + [ -e /var/vdr/vdr-start-log ] && rm -f /var/vdr/vdr-start-log VDR_LOG_FILE=/var/vdr/tmp/vdr-start-log echo "Startlog for VDR" > ${VDR_LOG_FILE} LOG_MSG_COUNT=0 @@ -19,7 +19,7 @@ init_vdr_start_log() finish_vdr_start_log() { # wenn nachrichten vorhanden sind - if [[ ${LOG_ERROR_COUNT} = 0 ]]; then + if [ "${LOG_ERROR_COUNT}" = 0 ]; then vdr_log_generic "NO problems at start." else /usr/share/vdr/bin/vdr-bg.sh svdrpsend.pl mesg "Errors: View via Commands / View VDR Start Log" @@ -29,7 +29,7 @@ finish_vdr_start_log() vdr_log_generic() { - [[ -n ${VDR_LOG_FILE} ]] || return + [ -n "${VDR_LOG_FILE}" ] || return echo "$@" >> ${VDR_LOG_FILE} : $((LOG_MSG_COUNT++)) diff --git a/usr/share/vdr/inc/plugin-functions.sh b/usr/share/vdr/inc/plugin-functions.sh index f42e948..47db964 100644 --- a/usr/share/vdr/inc/plugin-functions.sh +++ b/usr/share/vdr/inc/plugin-functions.sh @@ -14,13 +14,13 @@ init_plugin_loader() { - if [[ ! -d /var/vdr/tmp ]]; then + if [ ! -d /var/vdr/tmp ]; then mkdir /var/vdr/tmp chown vdr:vdr /var/vdr/tmp fi plugin_dir=$(awk '/^PLUGINLIBDIR/{ print $3 }' /usr/include/vdr/Make.config) - if [[ -n ${plugin_dir} ]]; then + if [ -n "${plugin_dir}" ]; then plugin_dir=/usr/lib/vdr/plugins fi @@ -28,7 +28,7 @@ init_plugin_loader() { vdr_checksum_dir="${plugin_dir%/plugins}/checksums" vdr_checksum=${vdr_checksum_dir}/header-md5-vdr - if [[ ! -f ${vdr_checksum} ]]; then + if [ ! -f "${vdr_checksum}" ]; then vdr_checksum=/var/vdr/tmp/header-md5-vdr rm ${vdr_checksum} 2>/dev/null @@ -51,19 +51,19 @@ init_plugin_loader() { # Load list of plugins which were started to exec correct rcaddons local LOADED_PLUGINS_FILE=/var/vdr/tmp/loaded_plugins - if [[ ${INIT_PHASE} == "stop" && -e ${LOADED_PLUGINS_FILE} ]]; then + if [ "${INIT_PHASE}" = "stop" ] && [ -e "${LOADED_PLUGINS_FILE}" ]; then PLUGINS=$(< ${LOADED_PLUGINS_FILE} ) else rm -f ${LOADED_PLUGINS_FILE} # new conf-system - /etc/conf.d/vdr.plugins local PLUGIN_CONF=/etc/conf.d/vdr.plugins - if [[ -f ${PLUGIN_CONF} ]]; then + if [ -f "${PLUGIN_CONF}" ]; then local line exec 3<${PLUGIN_CONF} while read -u 3 line; do - [[ ${line} == "" ]] && continue - [[ ${line:0:1} == "#" ]] && continue + [ "${line}" = "" ] && continue + [ "${line:0:1}" = "#" ] && continue PLUGIN="${line}" PLUGINS="${PLUGINS} ${PLUGIN}" done @@ -79,13 +79,13 @@ check_plugin() { local PLUGIN="${1}" local plugin_file="${plugin_dir}/libvdr-${PLUGIN}.so.${APIVERSION}" - if [[ ! -f "${plugin_file}" ]]; then + if [ ! -f "${plugin_file}" ]; then skip_plugin "${PLUGIN}" "plugin not found" return fi local plugin_checksum_file=${vdr_checksum_dir}/header-md5-vdr-${PLUGIN} - if [[ "${PLUGIN_CHECK_MD5}" == "yes" && -e ${plugin_checksum_file} ]]; then + if [ "${PLUGIN_CHECK_MD5}" = "yes" ] && [ -e "${plugin_checksum_file}" ]; then if ! diff ${vdr_checksum} ${plugin_checksum_file} >/dev/null; then skip_plugin "${PLUGIN}" "wrong vdr-patchlevel" return @@ -105,14 +105,14 @@ load_plugin() SKIP_PLUGIN=0 # Only check when starting vdr - if [[ ${INIT_PHASE} != "stop" ]]; then + if [ "${INIT_PHASE}" != "stop" ]; then check_plugin ${PLUGIN} fi - [[ "${SKIP_PLUGIN}" == "1" ]] && return + [ "${SKIP_PLUGIN}" = "1" ] && return unset _EXTRAOPTS - if [[ -f /etc/conf.d/vdr.${PLUGIN} ]]; then - source /etc/conf.d/vdr.${PLUGIN} + if [ -f "/etc/conf.d/vdr.${PLUGIN}" ]; then + . /etc/conf.d/vdr.${PLUGIN} fi load_addon plugin-${PLUGIN} ${call_func} @@ -133,16 +133,16 @@ add_plugin_param() skip_plugin() { SKIP_PLUGIN=1 - if [[ -n "${1}" && "${addon_prefix}" == "pre-start" ]]; then + if [ -n "${1}" ] && [ "${addon_prefix}" = "pre-start" ]; then einfo_level1 " ${1}: ${2}" vdr_log_generic "I: ${1}: ${2}" fi } add_plugin_params_to_vdr_call() { - if [[ "${SKIP_PLUGIN}" == "0" ]]; then + if [ "${SKIP_PLUGIN}" = "0" ]; then # for not-skipped plugins, add the param to the vdr-call - if [[ -z ${_EXTRAOPTS} ]]; then + if [ -z "${_EXTRAOPTS}" ]; then add_param "${vdrplugin_opts[*]}" else add_param "${vdrplugin_opts[*]} ${_EXTRAOPTS}" diff --git a/usr/share/vdr/inc/rc-functions.sh b/usr/share/vdr/inc/rc-functions.sh index 6c8d8fe..8b46db5 100644 --- a/usr/share/vdr/inc/rc-functions.sh +++ b/usr/share/vdr/inc/rc-functions.sh @@ -17,7 +17,7 @@ SCRIPT_API=2 pidof=/sbin/pidof test -x /bin/pidof && pidof=/bin/pidof -source /etc/conf.d/vdr.watchdogd +. /etc/conf.d/vdr.watchdogd ENABLE_EXTERNAL_WATCHDOG=${ENABLE_EXTERNAL_WATCHDOG:-no} read_caps @@ -31,7 +31,7 @@ getvdrversion() { VDRVERSION=$(awk -F'"' '/define VDRVERSION/ {print $2}' /usr/include/vdr/config.h) APIVERSION=$(awk -F'"' '/define APIVERSION/ {print $2}' /usr/include/vdr/config.h) - [[ -z ${APIVERSION} ]] && APIVERSION="${VDRVERSION}" + [ -z "${APIVERSION}" ] && APIVERSION="${VDRVERSION}" case ${SHOW_VDR_VERSION:=no} in yes) VDRNAME=vdr-${VDRVERSION} ;; @@ -51,7 +51,7 @@ init_daemonctrl_params() add_daemonctrl_param() { - while [[ -n "$1" ]]; do + while [ -n "$1" ]; do daemonctrl_opts[daemonctrl_idx]="$1" daemonctrl_idx=$[daemonctrl_idx+1] shift; @@ -68,7 +68,7 @@ init_params() add_param() { - while [[ -n "$1" ]]; do + while [ -n "$1" ]; do vdr_opts[vdr_idx]="$1" vdr_idx=$[vdr_idx+1] shift @@ -88,7 +88,7 @@ load_addons_prefixed() for addon in ${vdr_rc_dir}/${addon_prefix}-*.sh; do load_addon ${addon} ${call_func} ret="$?" - if [[ "${ret}" != "0" ]]; then + if [ "${ret}" != "0" ]; then einfo_level2 Addon ${addon} failed. break fi @@ -103,12 +103,12 @@ load_addon() eval "${call_func}() { :; }" # source addon - if [[ ( "${addon:0:1}" == "/" ) && ( -f ${addon} ) ]]; then - source "${addon}" - elif [[ -f ${vdr_rc_dir}/${addon}.sh ]]; then - source "${vdr_rc_dir}/${addon}.sh" - elif [[ -f ${vdr_old_rc_dir}/${addon}.sh ]]; then - source "${vdr_old_rc_dir}/${addon}.sh" + if [ ( "${addon:0:1}" = "/" ) -a ( -f ${addon} ) ]; then + . "${addon}" + elif [ -f "${vdr_rc_dir}/${addon}.sh" ]; then + . "${vdr_rc_dir}/${addon}.sh" + elif [ -f "${vdr_old_rc_dir}/${addon}.sh" ]; then + . "${vdr_old_rc_dir}/${addon}.sh" fi # execute requested function @@ -118,19 +118,19 @@ load_addon() } has_debuglevel() { - [[ ${SCRIPT_DEBUG_LEVEL} -ge ${1} ]] + [ "${SCRIPT_DEBUG_LEVEL}" -ge "${1}" ] } einfo_level1() { - [[ ${SCRIPT_DEBUG_LEVEL} -ge 1 ]] && einfo "$@" + has_debuglevel 1 && einfo "$@" } einfo_level2() { - [[ ${SCRIPT_DEBUG_LEVEL} -ge 2 ]] && einfo "$@" + has_debuglevel 2 && einfo "$@" } einfo_debug() { - [[ ${SCRIPT_DEBUG_LEVEL} -ge 3 ]] && einfo "$@" + has_debuglevel 3 && einfo "$@" } quote_parameters() { @@ -165,7 +165,7 @@ waitfor() { local cond="${2}" local ok local waited=0 - while [[ "${waited}" -lt "${waittime}" ]]; do + while [ "${waited}" -lt "${waittime}" ]; do eval ${cond} case "$?" in 0) einfo_debug waited ${waited} seconds; return 0 ;; @@ -203,7 +203,7 @@ wait_for_multiple_condition() { } stop_watchdog() { - if [[ "${ENABLE_EXTERNAL_WATCHDOG}" == "yes" ]]; then + if [ "${ENABLE_EXTERNAL_WATCHDOG}" = "yes" ]; then ebegin "Stopping vdr watchdog" start-stop-daemon --stop --pidfile /var/run/vdrwatchdog.pid eend $? "failed stopping watchdog" @@ -211,7 +211,7 @@ stop_watchdog() { } start_watchdog() { - if [[ "${ENABLE_EXTERNAL_WATCHDOG}" == "yes" ]]; then + if [ "${ENABLE_EXTERNAL_WATCHDOG}" = "yes" ]; then WATCHDOG_LOGFILE=${WATCHDOG_LOGFILE:-/dev/null} ebegin "Starting vdr watchdog" start-stop-daemon \ diff --git a/usr/share/vdr/inc/shutdown-functions.sh b/usr/share/vdr/inc/shutdown-functions.sh index 4d6a067..0fbc850 100644 --- a/usr/share/vdr/inc/shutdown-functions.sh +++ b/usr/share/vdr/inc/shutdown-functions.sh @@ -8,7 +8,7 @@ shutdown_script_dir=/usr/share/vdr/shutdown shutdown_data_dir=/var/vdr/shutdown-data read_shutdown_config() { - source /etc/conf.d/vdr.shutdown + . /etc/conf.d/vdr.shutdown SHUTDOWN_ACTIVE="${SHUTDOWN_ACTIVE:-no}" WAKEUP_METHOD="${WAKEUP_METHOD:-acpi}" SHUTDOWN_FORCE_DETECT_INTERVALL="${SHUTDOWN_FORCE_DETECT_INTERVALL:-60}" diff --git a/usr/share/vdr/inc/time.sh b/usr/share/vdr/inc/time.sh index d4d53f1..3c5959d 100644 --- a/usr/share/vdr/inc/time.sh +++ b/usr/share/vdr/inc/time.sh @@ -7,7 +7,7 @@ time2min() { local t=${1} - if [[ $t == NOW ]]; then + if [ "$t" = "NOW" ]; then t=$(date +%H:%M) fi @@ -20,7 +20,7 @@ time2min() { m=${m##0} # Wenn die Zeit kein ":" enthaelt - [[ $m == $t ]] && m=0 + [ "$m" = "$t" ] && m=0 echo $(( ( h*60 + m ) % 1440 )) } @@ -47,31 +47,31 @@ check_interval() { start=$(time2min $start) stop=$(time2min $stop) - if [[ $start -le $stop ]]; then + if [ "$start" -le "$stop" ]; then # if (start <= testtime <= stop) - if [[ ( $start -le $testtime ) && ( $testtime -le $stop ) ]]; then + if [ ( "$start" -le "$testtime" ) -a ( "$testtime" -le "$stop" ) ]; then HIT=1 fi else # itervall ueber mitternacht # if ( 0 <= testtime <= stop ) || ( start <= testtime <= midnight) - if [[ ( $testtime -le $stop ) || ( $start -le $testtime ) ]]; then + if [ ( "$testtime" -le "$stop" ) -o ( "$start" -le "$testtime" ) ]]; then HIT=1 fi fi ;; *) local point=$(time2min $i) - if [[ $start -eq $testtime ]]; then + if [ "$start" -eq "$testtime" ]; then HIT=1 fi ;; esac - if [[ $HIT == 1 ]]; then + if [ "$HIT" = 1 ]; then : $((INSIDE++)) fi done - if [[ $INSIDE -gt 0 ]]; then + if [ "$INSIDE" -gt 0 ]; then return 0 else return 1 diff --git a/usr/share/vdr/rcscript/post-start-50-svdrp.sh b/usr/share/vdr/rcscript/post-start-50-svdrp.sh index 1048a18..d28ffb1 100644 --- a/usr/share/vdr/rcscript/post-start-50-svdrp.sh +++ b/usr/share/vdr/rcscript/post-start-50-svdrp.sh @@ -3,9 +3,9 @@ wait_for_svdrp() { local ret=0 SVDRP_PORT="${SVDRP_PORT:-2001}" SVDRP_HOSTNAME="${SVDRP_HOSTNAME:-localhost}" - [[ "${SVDRP_PORT}" == "0" ]] && return 0 + [ "${SVDRP_PORT}" = "0" ] && return 0 - if [[ ! -e /etc/vdr/remote.conf ]]; then + if [ ! -e /etc/vdr/remote.conf ]; then einfo "First start of vdr: No check for running vdr possible" einfo "until control device (remote/keyboard) keys are learnt!" return 0 diff --git a/usr/share/vdr/rcscript/post-start-90-watchdog.sh b/usr/share/vdr/rcscript/post-start-90-watchdog.sh index 3b5d893..6fd2f5c 100644 --- a/usr/share/vdr/rcscript/post-start-90-watchdog.sh +++ b/usr/share/vdr/rcscript/post-start-90-watchdog.sh @@ -1,6 +1,6 @@ # $Id$ addon_main() { - [[ -z "${WATCHDOG_RESTART}" ]] && start_watchdog + [ -z "${WATCHDOG_RESTART}" ] && start_watchdog return 0 } diff --git a/usr/share/vdr/rcscript/pre-start-10-chuid.sh b/usr/share/vdr/rcscript/pre-start-10-chuid.sh index 20bbf83..0f09798 100644 --- a/usr/share/vdr/rcscript/pre-start-10-chuid.sh +++ b/usr/share/vdr/rcscript/pre-start-10-chuid.sh @@ -1,14 +1,14 @@ # $Id$ addon_main() { - if [[ "${START_VDR_AS_ROOT}" == "YES" ]]; then - if [[ -n ${CAP_CHUID} ]]; then + if [ "${START_VDR_AS_ROOT}" = "YES" ]; then + if [ -n "${CAP_CHUID}" ]; then add_param "-u" "root" else : # vdr does nothing and stays root fi else - if [[ -n ${CAP_CHUID} ]]; then + if [ -n "${CAP_CHUID}" ]; then add_param "-u" "vdr" else add_daemonctrl_param --chuid vdr diff --git a/usr/share/vdr/rcscript/pre-start-20-dvb-device.sh b/usr/share/vdr/rcscript/pre-start-20-dvb-device.sh index b9bceee..1501a6d 100644 --- a/usr/share/vdr/rcscript/pre-start-20-dvb-device.sh +++ b/usr/share/vdr/rcscript/pre-start-20-dvb-device.sh @@ -1,6 +1,6 @@ # $Id$ check_dvbdevice() { - [[ -e /dev/dvb/adapter0/frontend0 ]] && return 0 + [ -e /dev/dvb/adapter0/frontend0 ] && return 0 condition_msg="dvb device not found" return 1 } @@ -8,7 +8,7 @@ check_dvbdevice() { addon_main() { DEVICE_CHECK=${DEVICE_CHECK:-yes} - if [[ "${DEVICE_CHECK}" == "yes" ]]; then + if [ "${DEVICE_CHECK}" = "yes" ]; then add_wait_condition check_dvbdevice fi return 0 diff --git a/usr/share/vdr/rcscript/pre-start-30-parameter.sh b/usr/share/vdr/rcscript/pre-start-30-parameter.sh index 3599e8b..a2b37d2 100644 --- a/usr/share/vdr/rcscript/pre-start-30-parameter.sh +++ b/usr/share/vdr/rcscript/pre-start-30-parameter.sh @@ -1,37 +1,37 @@ # $Id$ addon_main() { add_param "--watchdog=${INTERNAL_WATCHDOG:-60}" - [[ -n "${AC3_AUDIO}" ]] && add_param "--audio=${AC3_AUDIO}" - [[ ${MUTE} == yes ]] && add_param "--mute" - [[ -n "${CONFIG}" ]] && add_param "--config=${CONFIG}" - [[ -n "${DEVICE}" ]] && for i in ${DEVICE}; do add_param "--device=${i}"; done - [[ -n "${EPGFILE}" ]] && add_param "--epgfile=${EPGFILE}" + [ -n "${AC3_AUDIO}" ] && add_param "--audio=${AC3_AUDIO}" + [ "${MUTE}" = "yes" ] && add_param "--mute" + [ -n "${CONFIG}" ] && add_param "--config=${CONFIG}" + [ -n "${DEVICE}" ] && for i in ${DEVICE}; do add_param "--device=${i}"; done + [ -n "${EPGFILE}" ] && add_param "--epgfile=${EPGFILE}" add_param "--log=${LOG:-1}" - [[ -z "${VIDEO}" ]] && VIDEO="/var/vdr/video" - if [[ ! -d "${VIDEO}" ]]; then + [ -z "${VIDEO}" ] && VIDEO="/var/vdr/video" + if [ ! -d "${VIDEO}" ]; then mkdir -p "${VIDEO}" chown vdr:vdr "${VIDEO}" einfo "Created directory ${VIDEO}" fi add_param "--video=${VIDEO}" - [[ -n "${SVDRP_PORT}" ]] && add_param "--port=${SVDRP_PORT}" + [ -n "${SVDRP_PORT}" ] && add_param "--port=${SVDRP_PORT}" - [[ -n "${RECORD_HOOK}" ]] && add_param "--record=${RECORD_HOOK}" + [ -n "${RECORD_HOOK}" ] && add_param "--record=${RECORD_HOOK}" - if [[ -n "${CAP_IRCTRL_RUNTIME_PARAM}" ]] && [[ -n "${IR_CTRL}" ]]; then + if [ -n "${CAP_IRCTRL_RUNTIME_PARAM}" ] && [ -n "${IR_CTRL}" ]; then case "${IR_CTRL}" in lirc|rcu) add_param "--${IR_CTRL}" ;; esac fi - if [[ -n "${CAP_VFAT_RUNTIME_PARAM}" ]] && [[ "${VFAT_FILENAMES}" == "yes" ]]; then + if [ -n "${CAP_VFAT_RUNTIME_PARAM}" ] && [ "${VFAT_FILENAMES}" = "yes" ]; then add_param "--vfat" fi add_param "--record=/usr/share/vdr/bin/vdrrecord-gate.sh" - if [[ -n "${VDR_EXTRA_OPTIONS}" ]]; then + if [ -n "${VDR_EXTRA_OPTIONS}" ]; then add_param ${VDR_EXTRA_OPTIONS} fi return 0 diff --git a/usr/share/vdr/rcscript/pre-start-40-config-files.sh b/usr/share/vdr/rcscript/pre-start-40-config-files.sh index 479bfe0..6b4cb9e 100644 --- a/usr/share/vdr/rcscript/pre-start-40-config-files.sh +++ b/usr/share/vdr/rcscript/pre-start-40-config-files.sh @@ -1,9 +1,9 @@ # $Id$ -source /usr/share/vdr/inc/commands-functions.sh +include commands-functions addon_main() { ebegin " config files" - if [[ ! -d /var/vdr ]]; then + if [ ! -d /var/vdr ]; then mkdir -p /var/vdr/{shutdown-data,merged-config-files} chown vdr:vdr -R /var/vdr ewarn " created /var/vdr" @@ -11,18 +11,18 @@ addon_main() { merge_commands_conf /etc/vdr/commands /etc/vdr/commands.conf "${ORDER_COMMANDS}" merge_commands_conf /etc/vdr/reccmds /etc/vdr/reccmds.conf "${ORDER_RECCMDS}" - if [[ -f /etc/vdr/setup.conf ]]; then - if [[ -n "${STARTUP_VOLUME}" ]]; then + if [ -f /etc/vdr/setup.conf ]; then + if [ -n "${STARTUP_VOLUME}" ]; then /bin/sed -i /etc/vdr/setup.conf -e "s/^CurrentVolume =.*\$/CurrentVolume = ${STARTUP_VOLUME}/" fi - if [[ -n "${STARTUP_CHANNEL}" ]]; then + if [ -n "${STARTUP_CHANNEL}" ]; then /bin/sed -i /etc/vdr/setup.conf -e "s/^CurrentChannel =.*\$/CurrentChannel = ${STARTUP_CHANNEL}/" fi fi eend 0 - if [[ ! -e /etc/vdr/channels.conf ]]; then + if [ ! -e /etc/vdr/channels.conf ]; then ewarn " /etc/vdr/channels.conf missing, creating empty file." touch /etc/vdr/channels.conf chown vdr:vdr /etc/vdr/channels.conf diff --git a/usr/share/vdr/rcscript/pre-start-45-nptl-check.sh b/usr/share/vdr/rcscript/pre-start-45-nptl-check.sh index ba03a71..33ec2a1 100644 --- a/usr/share/vdr/rcscript/pre-start-45-nptl-check.sh +++ b/usr/share/vdr/rcscript/pre-start-45-nptl-check.sh @@ -1,6 +1,6 @@ # $Id$ addon_main() { - if [[ "${FORCE_OLD_THREADS:-yes}" == "yes" ]]; then + if [ "${FORCE_OLD_THREADS:-yes}" = "yes" ]; then # Test wheather force of old pthreads will work if LD_ASSUME_KERNEL=2.4.1 /bin/true 2>/dev/null; then export LD_ASSUME_KERNEL=2.4.1 diff --git a/usr/share/vdr/rcscript/pre-start-45-utf8-check.sh b/usr/share/vdr/rcscript/pre-start-45-utf8-check.sh index b61c1a3..adabf3d 100644 --- a/usr/share/vdr/rcscript/pre-start-45-utf8-check.sh +++ b/usr/share/vdr/rcscript/pre-start-45-utf8-check.sh @@ -12,7 +12,7 @@ addon_main() { done # set sort-order if specified in conf-file - if [[ -n ${VDR_SORT_ORDER} ]]; then + if [ -n "${VDR_SORT_ORDER}" ]; then export LC_COLLATE="${VDR_SORT_ORDER}" fi return 0 diff --git a/usr/share/vdr/rcscript/pre-start-50-shutdown.sh b/usr/share/vdr/rcscript/pre-start-50-shutdown.sh index fdabc12..47f0a49 100644 --- a/usr/share/vdr/rcscript/pre-start-50-shutdown.sh +++ b/usr/share/vdr/rcscript/pre-start-50-shutdown.sh @@ -15,9 +15,9 @@ list_wakeup_methods() { addon_main() { include shutdown-functions - [[ "${SHUTDOWN_ACTIVE}" == "no" ]] && return 0 + [ "${SHUTDOWN_ACTIVE}" = "no" ] && return 0 - if [[ -n "${USER_SHUTDOWN_SCRIPT}" ]]; then + if [ -n "${USER_SHUTDOWN_SCRIPT}" ]; then add_param "--shutdown=${USER_SHUTDOWN_SCRIPT}" return 0 fi @@ -36,8 +36,8 @@ addon_main() { vdr_ewarn fi - if [[ -f ${shutdown_script_dir}/wakeup-${WAKEUP_METHOD}.sh ]]; then - source ${shutdown_script_dir}/wakeup-${WAKEUP_METHOD}.sh + if [ -f "${shutdown_script_dir}/wakeup-${WAKEUP_METHOD}.sh" ]; then + . ${shutdown_script_dir}/wakeup-${WAKEUP_METHOD}.sh # test if needed programs are there if ! wakeup_check; then diff --git a/usr/share/vdr/rcscript/pre-start-95-plugins.sh b/usr/share/vdr/rcscript/pre-start-95-plugins.sh index aadc42b..d5ae401 100644 --- a/usr/share/vdr/rcscript/pre-start-95-plugins.sh +++ b/usr/share/vdr/rcscript/pre-start-95-plugins.sh @@ -20,14 +20,14 @@ addon_main() { add_plugin_params_to_vdr_call # count the skipped ones - if [[ "${SKIP_PLUGIN}" == "1" ]]; then + if [ "${SKIP_PLUGIN}" = "1" ]; then : $(( SKIP_COUNT++ )) fi done - if [[ ${SKIP_COUNT} > 0 ]]; then + if [ "${SKIP_COUNT}" -gt 0 ]; then if has_debuglevel 1; then eerror " ${SKIP_COUNT} Plugins out of ${PLUGIN_COUNT} could not be loaded!" else diff --git a/usr/share/vdr/rcscript/pre-start-98-wait-conditions.sh b/usr/share/vdr/rcscript/pre-start-98-wait-conditions.sh index 78b4cf9..a4a01d5 100644 --- a/usr/share/vdr/rcscript/pre-start-98-wait-conditions.sh +++ b/usr/share/vdr/rcscript/pre-start-98-wait-conditions.sh @@ -1,7 +1,7 @@ # $Id$ addon_main() { local exitcode=0 - if [[ "${waitconditions}" ]]; then + if [ "${waitconditions}" ]; then ebegin " Waiting for prerequisits (devices nodes etc.)" waitfor 10 wait_for_multiple_condition exitcode="$?" diff --git a/usr/share/vdr/rcscript/pre-stop-10-watchdog.sh b/usr/share/vdr/rcscript/pre-stop-10-watchdog.sh index f8290fd..f31bc91 100644 --- a/usr/share/vdr/rcscript/pre-stop-10-watchdog.sh +++ b/usr/share/vdr/rcscript/pre-stop-10-watchdog.sh @@ -1,6 +1,6 @@ # $Id$ addon_main() { - [[ -z "${WATCHDOG_RESTART}" ]] && stop_watchdog + [ -z "${WATCHDOG_RESTART}" ] && stop_watchdog return 0 } diff --git a/usr/share/vdr/rcscript/watchdog-restart-20-modules.sh b/usr/share/vdr/rcscript/watchdog-restart-20-modules.sh index 88d00ff..bb86740 100644 --- a/usr/share/vdr/rcscript/watchdog-restart-20-modules.sh +++ b/usr/share/vdr/rcscript/watchdog-restart-20-modules.sh @@ -19,14 +19,14 @@ rec_unload() { # unload all modules depending on $mod while true; do mod_line=$(grep "^${mod} " /proc/modules) - if [[ -z $mod_line ]]; then + if [ -z "$mod_line" ]; then # module not loaded return fi mod_deps=$(echo "$mod_line" | awk '{ gsub(","," ",$4); print $4 }') - if [[ ${mod_deps} == "-" ]]; then + if [ "${mod_deps}" = "-" ]; then # no more users einfo " unloading ${mod}" if do_unload ${mod}; then @@ -40,7 +40,7 @@ rec_unload() { einfo_level2 "${mod} has these users: ${mod_deps}" local dep for dep in ${mod_deps}; do - if [[ ${mod_tried} == ${dep} ]]; then + if [ "${mod_tried}" = "${dep}" ]; then ewarn "break infinite recursion at ${dep}" return fi @@ -53,14 +53,14 @@ rec_unload() { } kill_dvb_video_users() { - [[ -d /sys ]] || return + [ -d /sys ] || return einfo_level2 "Killing programms accessing video device of dvb cards" local dev bname name for dev in /sys/class/video4linux/video?; do - [[ -f "${dev}/name" ]] || continue + [ -f "${dev}/name" ] || continue name=$(cat "${dev}/name") - [[ ${name/av7110/} == ${name} ]] && continue + [ "${name/av7110/}" = "${name}" ] && continue bname=${dev/*\//} einfo_level2 " Killing users of device ${bname} (Name: ${name})" @@ -90,7 +90,7 @@ restart_load() { addon_main() { : ${WATCHDOG_RELOAD_DVB_MODULES:=no} - if [[ "${WATCHDOG_RELOAD_DVB_MODULES}" == "yes" ]]; then + if [ "${WATCHDOG_RELOAD_DVB_MODULES}" = "yes" ]; then sleep 2 restart_unload sleep 2 |