Compare commits

...

4 commits

Author SHA1 Message Date
0148f909d9 Revert "tmp add readme"
This reverts commit 0606e93cde.
2024-04-13 14:49:49 -04:00
0606e93cde tmp add readme 2024-04-13 14:49:28 -04:00
bf9eb0ef73 add install script 2024-04-13 14:49:28 -04:00
cd14df1f11 change default chat.log location and tone of prompts 2024-04-13 14:49:13 -04:00
4 changed files with 73 additions and 20 deletions

43
build Executable file
View file

@ -0,0 +1,43 @@
#!/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
echo
echo "ERROR: could not set append only attribute in ${chatlogdir}"
echo " does your filesystem support 'chattr +a' ?"
exit 1
}
# do this setup first in case chattr fails
# mk chat directory and touch file
mkdir $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
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
echo "SUCCESS! bunkchat installed!"
exit 0

13
heed
View file

@ -1,12 +1,17 @@
#!/bin/sh -e
chatlog=var/log/bunkchat/chat.log
clear
figlet -f future heed - bunkchat
echo "╻ ╻┏━╸┏━╸╺┳┓ ┏┓ ╻ ╻┏┓╻╻┏ ┏━╸╻ ╻┏━┓╺┳╸"
echo "┣━┫┣╸ ┣╸ ┃┃ ╺━╸ ┣┻┓┃ ┃┃┗┫┣┻┓┃ ┣━┫┣━┫ ┃ "
echo "╹ ╹┗━╸┗━╸╺┻┛ ┗━┛┗━┛╹ ╹╹ ╹┗━╸╹ ╹╹ ╹ ╹ "
echo "#######################################################################"
echo "# Take heed, $USER! This is a group chat with everyone on the server! #"
echo "# You can view earlier chat with 'scry' or 'less /srv/bunkchat.txt' #"
echo " Take heed, $USER! This is a group chat with everyone on the server!"
echo " You can view earlier chat with 'scry' or 'less /srv/bunkchat.txt'"
echo "#######################################################################"
echo
tail -f /srv/bunkchat.txt
tail -f $chatlog

View file

@ -1,9 +1,10 @@
#!/bin/bash -e
#!/bin/sh -e
# make username uppercase
username=$(echo "$USER" | tr '[:lower:]' '[:upper:]')
timezone="America/New_York"
declare prompt
timezone=UTC
chatlog=/var/log/bunkchat/chat.log
prompt=""
makeSlug () {
# make time and date
@ -19,11 +20,14 @@ clear
while true
do
figlet -f future proclaim - bunkchat
echo "You may view old chat with 'scry', heathen."
echo "-------------------------------------------"
read -r -p "speak to the server: " text
echo "┏━┓┏━┓┏━┓┏━╸╻ ┏━┓╻┏┳┓ ┏┓ ╻ ╻┏┓╻╻┏ ┏━╸╻ ╻┏━┓╺┳╸"
echo "┣━┛┣┳┛┃ ┃┃ ┃ ┣━┫┃┃┃┃ ╺━╸ ┣┻┓┃ ┃┃┗┫┣┻┓┃ ┣━┫┣━┫ ┃ "
echo "╹ ╹┗╸┗━┛┗━╸┗━╸╹ ╹╹╹ ╹ ┗━┛┗━┛╹ ╹╹ ╹┗━╸╹ ╹╹ ╹ ╹ "
echo "You may view old chat with 'scry'!"
echo "----------------------------------"
printf "speak to the server: " >&2
read -r text
makeSlug
echo "${prompt}: $text" >> /srv/bunkchat.txt
echo "${prompt}: $text" >> $chatlog
clear
done

3
scry
View file

@ -1,3 +1,4 @@
#!/bin/sh -e
chatlog=/var/log/bunkchat/chat.log
less /srv/bunkchat.txt
less $chatlog