save_config_dotfiles/save_config_file

49 lines
1.1 KiB
Text
Raw Permalink 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
2024-08-24 17:50:37 +02:00
#echo "$_GIT_FOLDER"
#echo "$_INSTRUCTIONS"
2024-08-03 17:04:51 +02:00
function deploy {
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" = "du" ]
then
cp -Rf ${_GIT_FOLDER}/${operand_2}/* ${operand_1}
elif [ "$order" = "fu" ]
then
install -Dm644 ${_GIT_FOLDER}/${operand_2} ${operand_1}
elif [ "$order" = "dr" ]
then
doas cp -Rf ${_GIT_FOLDER}/${operand_2}/* ${operand_1}
elif [ "$order" = "fr" ]
then
doas install -Dm644 ${_GIT_FOLDER}/${operand_2} ${operand_1}
elif [ "$order" = "uu" ]
then
cd "${_GIT_FOLDER}/${operand_1}"
git pull
cd -
else
echo "Err, $order uknown"
echo ".. ${order} ${operand_1} ${operand_2} ..";
fi
done <<< "$_INSTRUCTIONS"
}
deploy