#!/bin/sh # Need doas to work. cd "$( dirname "$( readlink -f "$0" )" )" || exit CONFIG_PATH="./config" . ${CONFIG_PATH}/*.conf #echo "$_GIT_FOLDER" #echo "$_INSTRUCTIONS" 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