remove bunkchat scripts #2
1 changed files with 32 additions and 25 deletions
57
install.sh
57
install.sh
|
@ -1,14 +1,9 @@
|
|||
#!/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
|
||||
|
@ -18,26 +13,38 @@ chattrfailed() {
|
|||
exit 1
|
||||
}
|
||||
|
||||
# do this setup first in case chattr fails
|
||||
# mk chat directory and touch file
|
||||
mkdir $chatlogdir
|
||||
chmod 755 $chatlogdir
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
cp proclaim heed scry $installtarget
|
||||
echo "SUCCESS! bunkchat installed!"
|
||||
exit 0
|
||||
}
|
||||
|
||||
chmod 755 ${installtarget}/proclaim
|
||||
chmod 755 ${installtarget}/heed
|
||||
chmod 755 ${installtarget}/scry
|
||||
# check for root perms
|
||||
if ! [ "$(id -u)" = 0 ]; then
|
||||
echo "ERROR: please run install with root permission" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
chown root:root ${installtarget}/proclaim
|
||||
chown root:root ${installtarget}/heed
|
||||
chown root:root ${installtarget}/scry
|
||||
|
||||
|
||||
echo "SUCCESS! bunkchat installed!"
|
||||
exit 0
|
||||
# if chat.log exists, skip prep
|
||||
if [ -f ${chatlogdir}/${chatlog} ]; then
|
||||
install
|
||||
else
|
||||
prep
|
||||
install
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue