Commits

Anonymous committed efa955e

Enable configure with dash as shell

Comments (0)

Files changed (1)

 
 ifile=Common.hs.in
 ofile=Common.hs
-flag=0
 
-if [ -e oauth ] ; then
-    oa=( $(cat oauth) )
-    noa=( ${#oa[@]} )
+oafile=oauth
+
+if [ -e $oafile ] ; then
+    noa=$(wc -l $oafile | awk '{ print $1; }' -)
     if [ $noa -eq 3 ] ; then
-        key=(${oa[0]})
-        secret=(${oa[1]})
-        dname=(${oa[2]})
+        # Too lazy to work out how best to do this in a POSIX shell
+        key=$(head -1 $oafile)
+        secret=$(tail -2 oauth | head -1)
+	dname=$(tail -1 oauth)
         sed -e s/@@KEY@@/$key/ -e s/@@SECRET@@/$secret/ -e s/@@DIRNAME@@/$dname/ $ifile > $ofile
-        flag=1
-        #echo "Created: Common.hs"
 
     else
         echo "WARNING: oauth does not contain 3 lines so skipping"
 else
 
     cp $ifile $ofile
+    echo "WARNING: the OAuth key/secret/directory have not been set in Common.hs"
 
 fi
 
-if [ $flag -eq 0 ] ; then
-    echo "WARNING: the OAuth key/secret have not been set in Common.hs"
-fi
-
 # end