weechat-awayonlock/install.sh
2023-07-15 19:32:47 -07:00

26 lines
688 B
Bash
Executable file

#!/bin/sh
set -e
config_dir="${XDG_DATA_HOME:-$HOME/.local/share}"
if [ -z "$config_dir" ] ; then
echo "Couldn't guess your XDG_DATA_HOME! Please manually install the script." 2>&1
exit 1
fi
weechat_dir="${config_dir}/weechat"
if [ ! -d "${weechat_dir}" ] ; then
echo "Couldn't find your weechat home at ${weechat_dir}. Please manually install the script." 2>&1
exit 1
fi
mkdir -p "${weechat_dir}/python/autoload"
echo "Copying script files..."
cp -v "$PWD/src/"*.py "${weechat_dir}/python"
chmod +x "${weechat_dir}/python/away_on_lock.py"
echo "Setting script to autoload..."
ln -s "../away_on_lock.py" "${weechat_dir}/python/autoload/away_on_lock.py"
echo "Done!"