Compare commits

...

2 commits

Author SHA1 Message Date
08646a05d4 fuss with prompts 2024-04-13 19:36:15 -04:00
b13b57f15b handle re-install gracefully 2024-04-13 19:35:41 -04:00
3 changed files with 37 additions and 30 deletions

9
heed
View file

@ -7,11 +7,10 @@ clear
echo "╻ ╻┏━╸┏━╸╺┳┓ ┏┓ ╻ ╻┏┓╻╻┏ ┏━╸╻ ╻┏━┓╺┳╸" echo "╻ ╻┏━╸┏━╸╺┳┓ ┏┓ ╻ ╻┏┓╻╻┏ ┏━╸╻ ╻┏━┓╺┳╸"
echo "┣━┫┣╸ ┣╸ ┃┃ ╺━╸ ┣┻┓┃ ┃┃┗┫┣┻┓┃ ┣━┫┣━┫ ┃ " echo "┣━┫┣╸ ┣╸ ┃┃ ╺━╸ ┣┻┓┃ ┃┃┗┫┣┻┓┃ ┣━┫┣━┫ ┃ "
echo "╹ ╹┗━╸┗━╸╺┻┛ ┗━┛┗━┛╹ ╹╹ ╹┗━╸╹ ╹╹ ╹ ╹ " echo "╹ ╹┗━╸┗━╸╺┻┛ ┗━┛┗━┛╹ ╹╹ ╹┗━╸╹ ╹╹ ╹ ╹ "
echo "Take heed, $USER! This is a group chat with everyone on the server!"
echo "#######################################################################" echo "You may post in chat with 'proclaim'!"
echo " Take heed, $USER! This is a group chat with everyone on the server!" echo "You may view old chat with 'scry'!"
echo " You can view earlier chat with 'scry'!" echo "----------------------------------"
echo "#######################################################################"
echo echo
tail -f $chatlog tail -f $chatlog

View file

@ -1,14 +1,9 @@
#!/bin/sh -e #!/bin/sh -e
# install.sh
installtarget=/usr/local/bin installtarget=/usr/local/bin
chatlogdir=/var/log/bunkchat chatlogdir=/var/log/bunkchat
chatlog=chat.log chatlog=chat.log
if ! [ "$(id -u)" = 0 ]; then
echo "ERROR: please run install with root permission" >&2
exit 1
fi
chattrfailed() { chattrfailed() {
set +e set +e
rm -rf $chatlogdir rm -rf $chatlogdir
@ -18,26 +13,38 @@ chattrfailed() {
exit 1 exit 1
} }
# do this setup first in case chattr fails prep() {
# mk chat directory and touch file mkdir -p $chatlogdir
mkdir $chatlogdir chmod 755 $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
}
touch ${chatlogdir}/${chatlog} install() {
chmod 666 ${chatlogdir}/${chatlog} cp proclaim heed scry $installtarget
# if chattr +a not supported on this file system catch error and clean up chmod 755 ${installtarget}/proclaim
chattr +a ${chatlogdir}/${chatlog} || chattrfailed chmod 755 ${installtarget}/heed
chmod 755 ${installtarget}/scry
chown root:root ${installtarget}/proclaim
chown root:root ${installtarget}/heed
chown root:root ${installtarget}/scry
cp proclaim heed scry $installtarget echo "SUCCESS! bunkchat installed!"
exit 0
}
chmod 755 ${installtarget}/proclaim # check for root perms
chmod 755 ${installtarget}/heed if ! [ "$(id -u)" = 0 ]; then
chmod 755 ${installtarget}/scry echo "ERROR: please run install with root permission" >&2
exit 1
fi
chown root:root ${installtarget}/proclaim # if chat.log exists, skip prep
chown root:root ${installtarget}/heed if [ -f ${chatlogdir}/${chatlog} ]; then
chown root:root ${installtarget}/scry install
else
prep
echo "SUCCESS! bunkchat installed!" install
exit 0 fi

View file

@ -23,6 +23,7 @@ do
echo "┏━┓┏━┓┏━┓┏━╸╻ ┏━┓╻┏┳┓ ┏┓ ╻ ╻┏┓╻╻┏ ┏━╸╻ ╻┏━┓╺┳╸" echo "┏━┓┏━┓┏━┓┏━╸╻ ┏━┓╻┏┳┓ ┏┓ ╻ ╻┏┓╻╻┏ ┏━╸╻ ╻┏━┓╺┳╸"
echo "┣━┛┣┳┛┃ ┃┃ ┃ ┣━┫┃┃┃┃ ╺━╸ ┣┻┓┃ ┃┃┗┫┣┻┓┃ ┣━┫┣━┫ ┃ " echo "┣━┛┣┳┛┃ ┃┃ ┃ ┣━┫┃┃┃┃ ╺━╸ ┣┻┓┃ ┃┃┗┫┣┻┓┃ ┣━┫┣━┫ ┃ "
echo "╹ ╹┗╸┗━┛┗━╸┗━╸╹ ╹╹╹ ╹ ┗━┛┗━┛╹ ╹╹ ╹┗━╸╹ ╹╹ ╹ ╹ " echo "╹ ╹┗╸┗━┛┗━╸┗━╸╹ ╹╹╹ ╹ ┗━┛┗━┛╹ ╹╹ ╹┗━╸╹ ╹╹ ╹ ╹ "
echo "You may view current chat with 'heed'!"
echo "You may view old chat with 'scry'!" echo "You may view old chat with 'scry'!"
echo "----------------------------------" echo "----------------------------------"
printf "speak to the server: " printf "speak to the server: "