save_config_dotfiles/save_config_file

38 lines
747 B
Text
Raw Normal View History

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