From c5b4f4bc737d7451266f0d6c5b6681cbecc8390e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Jourdois?= Date: Sun, 11 Jul 2010 13:52:47 +0200 Subject: [PATCH] Test file before modifying This shuts down errors during t/hook-inittab.t proving, and does not modify hook during real run. --- hooks/intrepid/30-disable-gettys | 8 +++++--- hooks/karmic/30-disable-gettys | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/hooks/intrepid/30-disable-gettys b/hooks/intrepid/30-disable-gettys index 8b14381..333b61e 100755 --- a/hooks/intrepid/30-disable-gettys +++ b/hooks/intrepid/30-disable-gettys @@ -27,9 +27,11 @@ logMessage Script $0 starting # # Remove the links for upstart # -rm ${prefix}/etc/event.d/tty[!1] -sed -i -e s/tty1/hvc0/ ${prefix}/etc/event.d/tty1 -mv ${prefix}/etc/event.d/tty1 ${prefix}/etc/event.d/hvc0 +rm -f ${prefix}/etc/event.d/tty[!1] +[ -f ${prefix}/etc/event.d/tty1 ] && { + sed -i -e s/tty1/hvc0/ ${prefix}/etc/event.d/tty1 + mv ${prefix}/etc/event.d/tty1 ${prefix}/etc/event.d/hvc0 +} [ -f ${prefix}/etc/inittab ] && sed -i -e 's/^\([2-6].*:respawn*\)/#\1/' -e 's/^T/#\t/' -e 's/tty1$/hvc0/' ${prefix}/etc/inittab # diff --git a/hooks/karmic/30-disable-gettys b/hooks/karmic/30-disable-gettys index c471be9..6752e0c 100755 --- a/hooks/karmic/30-disable-gettys +++ b/hooks/karmic/30-disable-gettys @@ -27,9 +27,11 @@ logMessage Script $0 starting # # Remove the links for upstart # -rm ${prefix}/etc/init/tty[!1].conf -sed -i -e s/tty1/hvc0/ ${prefix}/etc/init/tty1.conf -mv ${prefix}/etc/init/tty1.conf ${prefix}/etc/init/hvc0.conf +rm -f ${prefix}/etc/init/tty[!1].conf +[ -f ${prefix}/etc/event.d/tty1 ] && { + sed -i -e s/tty1/hvc0/ ${prefix}/etc/init/tty1.conf + mv ${prefix}/etc/init/tty1.conf ${prefix}/etc/init/hvc0.conf +} [ -f ${prefix}/etc/inittab ] && sed -i -e 's/^\([2-6].*:respawn*\)/#\1/' -e 's/^T/#\t/' -e 's/tty1$/hvc0/' ${prefix}/etc/inittab #