2017-12-28 17:04:24 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
red="\033[38;5;1m"
|
|
|
|
blue="\033[38;5;6m"
|
|
|
|
reset="\033[0;5;0m"
|
|
|
|
|
|
|
|
function check_exec() {
|
|
|
|
if hash $1 2> /dev/null ; then
|
|
|
|
echo $2 is installed
|
|
|
|
else
|
|
|
|
echo -en "$red"
|
|
|
|
echo $2 is not installed or not in PATH
|
|
|
|
echo Exiting ...
|
|
|
|
echo -en "$reset"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
echo -e "${blue}Checking Dependencies $reset"
|
|
|
|
|
|
|
|
check_exec php PHP
|
|
|
|
check_exec composer Composer
|
|
|
|
check_exec i3lock i3lock-color
|
|
|
|
check_exec convert Imagemagick
|
|
|
|
|
|
|
|
echo -e "${blue}Dependencies Satisfied $reset \n"
|
|
|
|
|
|
|
|
echo -e "${blue}Checking repository location $reset"
|
|
|
|
cd $HOME/i3lock-delta
|
|
|
|
if [[ $? -ne 0 ]]; then
|
|
|
|
echo -e "$red Please clone the repo in your home folder $reset"
|
|
|
|
exit
|
|
|
|
else
|
|
|
|
echo "OK"
|
|
|
|
fi
|
|
|
|
echo -e "${blue}Checked repository location $reset \n"
|
|
|
|
echo -e "${blue}Installing Libraries $reset"
|
|
|
|
sleep 1
|
|
|
|
composer install
|
|
|
|
if [[ $? -ne 0 ]]; then
|
|
|
|
echo -e "$red Unable to install libraries. Check your internet connection"
|
|
|
|
echo -e "If the problem persists, open an issue at https://github.com/Ceda-EI/i3lock-delta/issues"
|
|
|
|
echo -e "$reset"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo -e "${blue}Finished Installing Libraries $reset \n"
|
|
|
|
|
|
|
|
echo -e "${blue}Creating Required Files$reset"
|
|
|
|
|
|
|
|
mkdir -p $HOME/.config
|
|
|
|
echo 1 > $HOME/.config/lock_screen.sta
|
|
|
|
> $HOME/.config/lock_preferences
|
|
|
|
|
2017-12-28 18:04:17 +01:00
|
|
|
read y <<<$(xdpyinfo | awk -F'[ x]+' '/dimensions:/{print $4}')
|
|
|
|
> box_config
|
|
|
|
echo "BOX_TOP_LEFT_X=10"
|
|
|
|
echo "BOX_TOP_LEFT_Y=$(($y-160))"
|
|
|
|
echo "BOX_BOTTOM_RIGHT_X=410"
|
|
|
|
echo "BOX_BOTTOM_RIGHT_Y=$(($y-50))"
|
2017-12-28 17:04:24 +01:00
|
|
|
echo -e "${blue}Finished Creating Required Files $reset \n"
|
|
|
|
echo -e "${blue}Installation Successful $reset"
|
|
|
|
echo -e "${blue}To set your random lock image themes, edit ~/.config/lock_preferences and enter your themes one per line."
|