#!/bin/bash
# https://cypht.org/install.html
# this is where Cypht will be installed
DESTINATION="/usr/local/share/cypht"
# validate the destination directory
test -r $DESTINATION -a -x $DESTINATION
if [ $? -ne 0 ]; then
mkdir $DESTINATION
fi
# create working directory
mkdir cypht-temp
cd cypht-temp
# grab latest code
wget https://github.com/jasonmunro/cypht/archive/master.zip
# unpack the archive
unzip master.zip
# run composer
cd cypht-master && composer install && cd ..
# create a vanilla ini file
cp cypht-master/hm3.sample.ini cypht-master/hm3.ini
# fix permissions and ownership
find cypht-master -type d -print | xargs chmod 755
find cypht-master -type f -print | xargs chmod 644
chown -R root:root cypht-master
# copy to destination folder
mv cypht-master/* $DESTINATION
# remove working directory
cd ..
rm -rf cypht-temp