remove bunkchat from repo

This commit is contained in:
sorrel 2024-04-22 15:26:03 -04:00
parent d3145c6073
commit 383580a1ee
6 changed files with 10 additions and 117 deletions

View file

@ -1,17 +1,12 @@
#!/bin/sh -e
sessionname=bunkdeck
heedPane="bunkdeck:0.0"
proclaimPane="bunkdeck:0.1"
shellPane="bunkdeck:0.2"
heedPane=bunkdeck:0.0
proclaimPane=bunkdeck:0.1
shellPane=bunkdeck:0.2
isExistingDeck () {
# format `-F '#S' # formats the result as just the session name`
# filter `-f "{==:#S,${sessionname}}` # only returns sessions named $sessionname
# capture error and redirect
sessions=$(tmux list-sessions -F '#S' -f "#{==:#S,${sessionname}}" 2>/dev/null)
if [ "${sessions}" = "${sessionname}" ] ; then
if tmux has -t $sessionname ; then
return 0
else
return 1
@ -19,7 +14,8 @@ isExistingDeck () {
}
attachToDeck () {
tmux attach-session -t bunkdeck
# does not currently protect against nesting sessions (tmux does this for us)
tmux attach-session -d -t bunkdeck
}
startNewDeck () {

16
heed
View file

@ -1,16 +0,0 @@
#!/bin/sh -e
chatlog=/var/log/bunkchat/chat.log
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
tail -f $chatlog

View file

@ -1,50 +1,5 @@
#!/bin/sh -e
installtarget=/usr/local/bin
chatlogdir=/var/log/bunkchat
chatlog=chat.log
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
}
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
}
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
echo "SUCCESS! bunkchat installed!"
exit 0
}
# check for root perms
if ! [ "$(id -u)" = 0 ]; then
echo "ERROR: please run install with root permission" >&2
exit 1
fi
# if chat.log exists, skip prep
if [ -f ${chatlogdir}/${chatlog} ]; then
install
else
prep
install
fi
# pull in bunkchat
# run bunkchat install script

View file

@ -1,35 +0,0 @@
#!/bin/sh -e
# make username uppercase
username=$(echo "$USER" | tr '[:lower:]' '[:upper:]')
timezone=UTC
chatlog=/var/log/bunkchat/chat.log
prompt=""
makeSlug () {
# make time and date
time=$(TZ=${timezone} date +%I:%M%p)
date=$(TZ=${timezone} date +%m/%d)
# make name/time string
prompt="${username}-${date}-${time}"
}
# enter bunkchat mode (clear the screen)
clear
while true
do
echo "┏━┓┏━┓┏━┓┏━╸╻ ┏━┓╻┏┳┓ ┏┓ ╻ ╻┏┓╻╻┏ ┏━╸╻ ╻┏━┓╺┳╸"
echo "┣━┛┣┳┛┃ ┃┃ ┃ ┣━┫┃┃┃┃ ╺━╸ ┣┻┓┃ ┃┃┗┫┣┻┓┃ ┣━┫┣━┫ ┃ "
echo "╹ ╹┗╸┗━┛┗━╸┗━╸╹ ╹╹╹ ╹ ┗━┛┗━┛╹ ╹╹ ╹┗━╸╹ ╹╹ ╹ ╹ "
echo "Proclaim your musings, $USER! This is a group chat with everyone on the server!"
echo "You may view current chat with 'heed'!"
echo "You may view old chat with 'scry'!"
echo "----------------------------------"
printf "speak to the server: "
read -r text
makeSlug
echo "${prompt}: $text" >> $chatlog
clear
done

View file

@ -6,11 +6,8 @@ tmux wraps some hand-rolled local chat scripts, and the`bunkdeck` command starts
bunkdeck is comprised of these lil things:
* `bunkdeck` - run this command to start the interface
* `proclaim` - post in chat
* `heed` - read the chat
* `scry` - read the old chat
* `bunkchat` - the actual chat functionality [git](https://git.bunk.computer/bunk/bunkchat)
on the server, these are all installed in `/usr/local/bin` so everyone can run them
the file they all interact with, `/srv/bunkchat.txt` has permissions such that everyone can read and write to it
the file they all interact with, `/var/log/bunkchat/chat.log` is append-only

4
scry
View file

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