diff --git a/heed b/heed index 9a6d241..374bba2 100755 --- a/heed +++ b/heed @@ -7,10 +7,11 @@ clear echo "╻ ╻┏━╸┏━╸╺┳┓ ┏┓ ╻ ╻┏┓╻╻┏ ┏━╸╻ ╻┏━┓╺┳╸" echo "┣━┫┣╸ ┣╸ ┃┃ ╺━╸ ┣┻┓┃ ┃┃┗┫┣┻┓┃ ┣━┫┣━┫ ┃ " echo "╹ ╹┗━╸┗━╸╺┻┛ ┗━┛┗━┛╹ ╹╹ ╹┗━╸╹ ╹╹ ╹ ╹ " -echo "Take heed, $USER! This is a group chat with everyone on the server!" -echo "You may post in chat with 'proclaim'!" -echo "You may view old chat with 'scry'!" -echo "----------------------------------" + +echo "#######################################################################" +echo " Take heed, $USER! This is a group chat with everyone on the server!" +echo " You can view earlier chat with 'scry'!" +echo "#######################################################################" echo tail -f $chatlog diff --git a/install.sh b/install.sh index c82315c..dc110ee 100755 --- a/install.sh +++ b/install.sh @@ -1,9 +1,14 @@ #!/bin/sh -e - +# install.sh installtarget=/usr/local/bin chatlogdir=/var/log/bunkchat chatlog=chat.log +if ! [ "$(id -u)" = 0 ]; then + echo "ERROR: please run install with root permission" >&2 + exit 1 +fi + chattrfailed() { set +e rm -rf $chatlogdir @@ -13,38 +18,26 @@ chattrfailed() { exit 1 } -prep() { - mkdir -p $chatlogdir - chmod 755 $chatlogdir - touch ${chatlogdir}/${chatlog} - chmod 666 ${chatlogdir}/${chatlog} - # if chattr +a not supported on this file system, catch error and clean up - chattr +a ${chatlogdir}/${chatlog} || chattrfailed -} +# do this setup first in case chattr fails +# mk chat directory and touch file +mkdir $chatlogdir +chmod 755 $chatlogdir -install() { - cp proclaim heed scry $installtarget - chmod 755 ${installtarget}/proclaim - chmod 755 ${installtarget}/heed - chmod 755 ${installtarget}/scry - chown root:root ${installtarget}/proclaim - chown root:root ${installtarget}/heed - chown root:root ${installtarget}/scry +touch ${chatlogdir}/${chatlog} +chmod 666 ${chatlogdir}/${chatlog} +# if chattr +a not supported on this file system catch error and clean up +chattr +a ${chatlogdir}/${chatlog} || chattrfailed - echo "SUCCESS! bunkchat installed!" - exit 0 -} +cp proclaim heed scry $installtarget -# check for root perms -if ! [ "$(id -u)" = 0 ]; then - echo "ERROR: please run install with root permission" >&2 - exit 1 -fi +chmod 755 ${installtarget}/proclaim +chmod 755 ${installtarget}/heed +chmod 755 ${installtarget}/scry -# if chat.log exists, skip prep -if [ -f ${chatlogdir}/${chatlog} ]; then - install -else - prep - install -fi +chown root:root ${installtarget}/proclaim +chown root:root ${installtarget}/heed +chown root:root ${installtarget}/scry + + +echo "SUCCESS! bunkchat installed!" +exit 0 diff --git a/proclaim b/proclaim index 1d09759..b958e0b 100755 --- a/proclaim +++ b/proclaim @@ -23,7 +23,6 @@ do echo "┏━┓┏━┓┏━┓┏━╸╻ ┏━┓╻┏┳┓ ┏┓ ╻ ╻┏┓╻╻┏ ┏━╸╻ ╻┏━┓╺┳╸" echo "┣━┛┣┳┛┃ ┃┃ ┃ ┣━┫┃┃┃┃ ╺━╸ ┣┻┓┃ ┃┃┗┫┣┻┓┃ ┣━┫┣━┫ ┃ " echo "╹ ╹┗╸┗━┛┗━╸┗━╸╹ ╹╹╹ ╹ ┗━┛┗━┛╹ ╹╹ ╹┗━╸╹ ╹╹ ╹ ╹ " - echo "You may view current chat with 'heed'!" echo "You may view old chat with 'scry'!" echo "----------------------------------" printf "speak to the server: "