diff options
author | Matthias Schwarzott <zzam@gentoo.org> | 2005-12-28 14:49:44 +0000 |
---|---|---|
committer | Matthias Schwarzott <zzam@gentoo.org> | 2005-12-28 14:49:44 +0000 |
commit | e48efd9f6132a2531484e2b0143c36b36ba5618a (patch) | |
tree | dafd211e3d938cb312bb179badaa0b744a6f8661 | |
parent | added chown to Makefile (diff) | |
download | gentoo-vdr-scripts-e48efd9f6132a2531484e2b0143c36b36ba5618a.tar.gz gentoo-vdr-scripts-e48efd9f6132a2531484e2b0143c36b36ba5618a.tar.bz2 gentoo-vdr-scripts-e48efd9f6132a2531484e2b0143c36b36ba5618a.zip |
made extra tmp-directores for shutdown and config-file-merging
svn path=/gentoo-vdr-scripts/trunk/; revision=95
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | usr/lib/vdr/bin/vdrshutdown-gate.sh | 6 | ||||
-rw-r--r-- | usr/lib/vdr/bin/vdrshutdown-really.sh | 6 | ||||
-rw-r--r-- | usr/lib/vdr/rcscript/functions-shutdown.sh | 1 | ||||
-rw-r--r-- | usr/lib/vdr/rcscript/pre-start-40-config-files.sh | 15 |
7 files changed, 26 insertions, 15 deletions
@@ -1,5 +1,12 @@ # ChangeLog for gentoo-vdr-scripts + 28 Dec 2005; Matthias Schwarzott <zzam@gentoo.org> + usr/lib/vdr/rcscript/pre-start-40-config-files.sh, Makefile, TODO, + usr/lib/vdr/bin/vdrshutdown-gate.sh, + usr/lib/vdr/bin/vdrshutdown-really.sh, + usr/lib/vdr/rcscript/functions-shutdown.sh: + made extra tmp-directores for shutdown and config-file-merging + 28 Dec 2005; Matthias Schwarzott <zzam@gentoo.org> Makefile: added chown to Makefile @@ -27,9 +27,7 @@ install: mkdir -p $(DESTDIR)/usr/lib/vdr/bin install -m 0755 -o root -g root usr/lib/vdr/bin/*.sh $(DESTDIR)/usr/lib/vdr/bin/ - mkdir -p $(DESTDIR)/var/vdr - mkdir -p $(DESTDIR)/var/vdr/video - mkdir -p $(DESTDIR)/var/vdr/shutdown-data + mkdir -p $(DESTDIR)/var/vdr/{video,shutdown-data,merged-config-files} chown vdr:vdr -R $(DESTDIR)/var/vdr mkdir -p $(DESTDIR)/etc/vdr/commands @@ -33,7 +33,7 @@ TODO file for gentoo-vdr-scripts This thread runs under a name for which is explicitly checked when shutdown so that it will not shutdown when it is not finished. - It writes the time it finished into a file (perhaps under /var/vdr) + It writes the time it finished into a file (under /var/vdr/shutdown-data) When doing shutdown and the last finish-time read from file is not longer ago than XXmin then it will not be started again and shutdown continues. diff --git a/usr/lib/vdr/bin/vdrshutdown-gate.sh b/usr/lib/vdr/bin/vdrshutdown-gate.sh index e4a7221..1e268b9 100644 --- a/usr/lib/vdr/bin/vdrshutdown-gate.sh +++ b/usr/lib/vdr/bin/vdrshutdown-gate.sh @@ -59,7 +59,7 @@ shutdown_abort_can_force() { init_shutdown_force() { # detect if this could be a forced shutdown - local shutdown_force_file=/var/vdr/last-shutdown-abort + local shutdown_force_file=${shutdown_data_dir}/last-shutdown-abort local LAST_SHUTDOWN_ABORT=0 if [[ -f "${shutdown_force_file}" ]]; then @@ -77,7 +77,7 @@ init_shutdown_force() { } write_force_file() { - local shutdown_force_file=/var/vdr/last-shutdown-abort + local shutdown_force_file=${shutdown_data_dir}/last-shutdown-abort echo "${NOW}" > "${shutdown_force_file}" } @@ -144,5 +144,5 @@ fi SUDO=/usr/bin/sudo ${SUDO} /usr/lib/vdr/bin/vdrshutdown-really.sh ${VDR_TIMER_NEXT} -date +%s > /var/vdr/shutdown-time-written +date +%s > ${shutdown_data_dir}/shutdown-time-written diff --git a/usr/lib/vdr/bin/vdrshutdown-really.sh b/usr/lib/vdr/bin/vdrshutdown-really.sh index 75339d8..6549667 100644 --- a/usr/lib/vdr/bin/vdrshutdown-really.sh +++ b/usr/lib/vdr/bin/vdrshutdown-really.sh @@ -28,13 +28,13 @@ read_shutdown_config SHUTDOWN_EXITCODE=0 set_reboot_needed() { - date +%s > /var/vdr/shutdown-need-reboot + date +%s > ${shutdown_data_dir}/shutdown-need-reboot } read_reboot_setting() { NEED_REBOOT=0 - [[ -e /var/vdr/shutdown-need-reboot ]] || return - local TSTAMP=$(</var/vdr/shutdown-need-reboot) + [[ -e ${shutdown_data_dir}/shutdown-need-reboot ]] || return + local TSTAMP=$(<${shutdown_data_dir}/shutdown-need-reboot) local NOW=$(date +%s) local REBOOT_SET_AGO=$(( NOW-TSTAMP )) diff --git a/usr/lib/vdr/rcscript/functions-shutdown.sh b/usr/lib/vdr/rcscript/functions-shutdown.sh index 3f0e246..037a8c6 100644 --- a/usr/lib/vdr/rcscript/functions-shutdown.sh +++ b/usr/lib/vdr/rcscript/functions-shutdown.sh @@ -1,4 +1,5 @@ shutdown_script_dir=/usr/lib/vdr/shutdown +shutdown_data_dir=/var/vdr/shutdown-data read_shutdown_config() { source /etc/conf.d/vdr.shutdown diff --git a/usr/lib/vdr/rcscript/pre-start-40-config-files.sh b/usr/lib/vdr/rcscript/pre-start-40-config-files.sh index 306d65f..75f06d0 100644 --- a/usr/lib/vdr/rcscript/pre-start-40-config-files.sh +++ b/usr/lib/vdr/rcscript/pre-start-40-config-files.sh @@ -3,18 +3,22 @@ create_commands_conf() { local bname="${1}" local order="${2}" local file="${CONFIG}/${bname}.conf" - local mergedfile="/var/vdr/${bname}.conf" + local mergedfile="/var/vdr/merged-config-files/${bname}.conf" local sdir="/etc/vdr/${bname}" - if [[ ! -L "${file}" ]]; then + if [[ -L "${file}" ]]; then + # remove link + rm "${file}" + else + # no link if [[ -f "${file}" ]]; then mv "${file}" "${file}.backup" einfo " Saved original ${file} as ${file}.backup" fi - - ln -s "../../${mergedfile}" "${file}" fi + ln -s "../../${mergedfile}" "${file}" + if [[ -f "${mergedfile}" ]]; then if ! rm "${mergedfile}"; then ewarn " Could not change ${mergedfile}" @@ -40,7 +44,8 @@ EOT addon_main() { ebegin " config files" if [[ ! -d /var/vdr ]]; then - mkdir -p /var/vdr + mkdir -p /var/vdr/{shutdown-data,merged-config-files} + chown vdr:vdr -R /var/vdr ewarn " created /var/vdr" fi create_commands_conf commands "${ORDER_COMMANDS}" |