From a32ae82a3d746d6d7d0b61deb5871eba2b25e600 Mon Sep 17 00:00:00 2001 From: Joseph Shraibman Date: Tue, 5 Jun 2012 11:42:40 -0400 Subject: [PATCH 1/2] Check for existing $BIN/cs before clobbering. --- setup.sh | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/setup.sh b/setup.sh index c0c30ed..e50c589 100755 --- a/setup.sh +++ b/setup.sh @@ -1,5 +1,23 @@ #!/bin/sh +BIN=$HOME/bin +mkdir -p $BIN + +if [ -a $BIN/cs ] ; then + if ! [ -f $BIN/cs ] ; then + echo "$BIN/cs exists but is not a regular file. Not clobbering. Remove $BIN/cs and run this setup script again." + exit 1 + elif ! grep -q sbt-launch\\.jar $BIN/cs ; then + echo "$BIN/cs exists, but it does not not appear to be an old conscript file. Not clobbering. Remove $BIN/cs and run this setup script again." + exit 2 + else + echo + echo "Existing $BIN/cs found. Will overwrite." + fi +fi + + + echo " Fetching current launch configuration... " @@ -13,8 +31,7 @@ echo " [boot] directory: $CS/boot" >> $CLC -BIN=$HOME/bin -mkdir -p $BIN + echo "#!/bin/sh java -jar $CS/sbt-launch.jar @$CLC \"\$@\"" > $BIN/cs @@ -34,4 +51,4 @@ fi echo " conscript installed to $BIN/cs -" \ No newline at end of file +" From 3e4cd46c8cff1b214b5df202421a37e8d63e7b76 Mon Sep 17 00:00:00 2001 From: Joseph Shraibman Date: Tue, 5 Jun 2012 11:47:08 -0400 Subject: [PATCH 2/2] Added comment to cs file which will serve as a better grep target for future safety checks --- setup.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.sh b/setup.sh index e50c589..c8bc137 100755 --- a/setup.sh +++ b/setup.sh @@ -34,6 +34,7 @@ echo " echo "#!/bin/sh +#This is conscript: https://github.com/n8han/conscript java -jar $CS/sbt-launch.jar @$CLC \"\$@\"" > $BIN/cs chmod a+x $BIN/cs