Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/kindle-lightfix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Willis <onlynone@gmail.com>2013-06-15 07:09:13 +0400
committerSteven Willis <onlynone@gmail.com>2013-06-15 07:09:13 +0400
commit59d610539bea4101c598cb0e635644f450298b1d (patch)
treed20bc1fc1dc9ecf06a9c9f5d78c4382a00e42438
parent418f6a672692a03918d1670082e4ad2dac451771 (diff)
Avoid crontab clobbering
-rwxr-xr-xsrc/install.sh4
-rwxr-xr-xsrc/uninstall.sh4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/install.sh b/src/install.sh
index f8eeab4..71c7dc4 100755
--- a/src/install.sh
+++ b/src/install.sh
@@ -31,7 +31,9 @@ logmsg()
HACKNAME="${LOG_DOMAIN}"
HACKVER="0.0.1"
-cat /etc/crontab/root | grep -v FrontLight > /etc/crontab/root
+temp_crontab=`mktemp`
+cat /etc/crontab/root | grep -v FrontLight > ${temp_crontab}
+mv ${temp_crontab} /etc/crontab/root
update_percent_complete_scaled 1
echo "* * * * * if [ \"\`cat /sys/devices/system/fl_tps6116x/fl_tps6116x0/fl_intensity | /bin/grep Light\`\" == \"FrontLight(Intensity) = 1\" ] ; then echo -n 0 > /sys/devices/system/fl_tps6116x/fl_tps6116x0/fl_intensity ; fi" >> /etc/crontab/root
diff --git a/src/uninstall.sh b/src/uninstall.sh
index a80a6f3..5d5ed4c 100755
--- a/src/uninstall.sh
+++ b/src/uninstall.sh
@@ -31,7 +31,9 @@ logmsg()
HACKNAME="${LOG_DOMAIN}"
HACKVER="0.0.1"
-cat /etc/crontab/root | grep -v FrontLight > /etc/crontab/root
+temp_crontab=`mktemp`
+cat /etc/crontab/root | grep -v FrontLight > ${temp_crontab}
+mv ${temp_crontab} /etc/crontab/root
update_percent_complete_scaled 1
logmsg "Lightfix uninstalled"