save_config_dotfiles/save_config_file

37 lines
747 B
Bash
Executable file

#!/bin/sh
# Need doas to work.
cd "$( dirname "$( readlink -f "$0" )" )" || exit
CONFIG_PATH="./config"
. ${CONFIG_PATH}/*.conf
echo "$_GIT_FOLDER"
echo "$_INSTRUCTIONS"
while VAR= read -r line;
do
order="$(echo $line | cut -d ' ' -f 1)"
operand_1="$(echo $line | cut -d ' ' -f 2)"
operand_2="$(echo $line | cut -d ' ' -f 3)"
if [ "$order" = "d" ]
then
cp -Rf ${_GIT_FOLDER}/${operand_2}/* ${operand_1}
elif [ "$order" = "f" ]
then
echo ".. f detected .."
elif [ "$order" = "u" ]
then
cd "${_GIT_FOLDER}/${operand_1}"
git pull
cd -
else
echo "Err, $order uknown"
fi
echo ".. ${order} ${operand_1} ${operand_2} ..";
done <<< "$_INSTRUCTIONS"