mirror of
https://github.com/Paul-Houser/StartTree.git
synced 2024-11-21 23:13:06 +01:00
66 lines
1.7 KiB
Bash
Executable File
66 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
config_dir=$HOME/.config/StartTree
|
|
config_path=$HOME/.config/StartTree/config.yaml
|
|
cache_dir=$HOME/.cache/StartTree
|
|
|
|
# install pip reqs
|
|
echo "Downloading pip dependencies..."
|
|
pip install --user bs4
|
|
|
|
# check if .config path exists
|
|
if [ ! -d "$HOME/.config" ]; then
|
|
echo "The directory '~/.config' does not exist, or you do not have permissions to edit it."
|
|
exit
|
|
fi
|
|
|
|
# check if .cache path exists
|
|
if [ ! -d "$HOME/.cache" ]; then
|
|
echo "The directory '~/.cache' does not exist, or you do not have permissions to edit it."
|
|
exit
|
|
fi
|
|
|
|
# check if .config/StartTree exists, create it and config if not
|
|
if [ ! -d "$config_dir" ]; then
|
|
echo "Creating '~/.config/StartTree'..."
|
|
mkdir $config_dir
|
|
echo "Copying config.yaml..."
|
|
cp ./config.yaml $config_path
|
|
echo
|
|
fi
|
|
|
|
# check if config.yaml exists
|
|
if [ ! -f "$config_path" ]; then
|
|
echo "No config.yaml found in '~/.config/StartTree'"
|
|
echo "Copy the example config with:"
|
|
echo "\tcp ./config.yaml $HOME/.config/StartTree/config.yaml"
|
|
echo "or create your own in that directory."
|
|
exit
|
|
fi
|
|
|
|
# create directory structure in .cache
|
|
if [ ! -d "$cache_dir" ]; then
|
|
echo "Creating '$cache_dir'..."
|
|
mkdir $cache_dir
|
|
|
|
echo "Symlinking themes..."
|
|
ln -s $(pwd)/themes $HOME/.cache/StartTree/themes
|
|
|
|
echo "Creating '$cache_dir/styles'..."
|
|
mkdir "$cache_dir/styles"
|
|
fi
|
|
|
|
echo "Creating style.css..."
|
|
cp "./skeletons/style.css" "$cache_dir/styles/style.css"
|
|
|
|
echo "Creating Hack.ttf..."
|
|
cp "./skeletons/Hack.ttf" "$cache_dir/styles/Hack.ttf"
|
|
|
|
# add to path
|
|
FILEPATH=$(readlink -f "generate.py")
|
|
ln -s $FILEPATH $HOME/.local/bin/starttree.py
|
|
echo "generate.py has been linked to $HOME/.local/bin/"
|
|
echo "Make sure this directory is in your \$PATH"
|
|
|
|
sed -i "/# replace line/{n;s@.*@repo_dir = \"$(pwd)\"@}" generate.py
|