Source

astrosearch / configure

Full commit
#!/bin/sh
#
# Insert Twitter OAuth tokens into Common.hs if available.
#

ifile=Common.hs.in
ofile=Common.hs
flag=0

if [ -e oauth ] ; then
    oa=( $(cat oauth) )
    noa=( ${#oa[@]} )
    if [ $noa -eq 2 ] ; then
        key=(${oa[0]})
        secret=(${oa[1]})
        sed -e s/@@KEY@@/$key/ -e s/@@SECRET@@/$secret/ $ifile > $ofile
        flag=1
        #echo "Created: Common.hs"

    else
        echo "WARNING: oauth does not contain 2 lines so skipping"
        cp $ifile $ofile
    fi
  
else

    cp $ifile $ofile

fi

if [ $flag -eq 0 ] ; then
    echo "WARNING: the OAuth key/secret have not been set in Common.hs"
fi

# end