From bf9eb0ef73f6440da78c0dd402f3535a185c3c07 Mon Sep 17 00:00:00 2001 From: oxaliq Date: Sat, 13 Apr 2024 14:48:32 -0400 Subject: [PATCH] add install script --- build | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 build diff --git a/build b/build new file mode 100755 index 0000000..ddeb17b --- /dev/null +++ b/build @@ -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