From 8ca575be7cb8459ee59c7429d3cfba9450ded212 Mon Sep 17 00:00:00 2001 From: statzitz Date: Sat, 24 Aug 2024 17:23:45 +0200 Subject: [PATCH] change names in files.conf and add git pull in instractions. --- config/files.conf | 38 +++++++++++++++++++++++--------------- save_config_file | 22 +++++++++++++++------- 2 files changed, 38 insertions(+), 22 deletions(-) diff --git a/config/files.conf b/config/files.conf index 014347e..c00d77e 100644 --- a/config/files.conf +++ b/config/files.conf @@ -1,21 +1,29 @@ #!/bin/sh -_DOTFILES="~/Documents/git/dotfiles" +# Use HOME variable. -_FILE_TO_COPY='d ~/.config/alacritty dotconfig -d ~/.config/eww dotconfig -d ~/.config/hypr dotconfig -d ~/.config/nvim dotconfig -d ~/.config/gotop dotconfig -d ~/.config/waybar dotconfig -f ~/.bashrc dotscripts/bash/.bashrc -f ~/.bash_profile dotscripts/bash/.bash_profile -d ~/.config/conky dotconfig -d ~/.local/bin dotlocal -d /etc/ly dotetc -f /etc/makepkg.conf dotetc/makepkg.conf -f /etc/pacman.conf dotetc/makepkg.conf -f /etc/doas.conf dotetc/doas.conf' +_GIT_FOLDER="${HOME}/Documents/git" +# u for update +# d for directory, +# f for file + +_INSTRUCTIONS="u dotfiles +d ${HOME}/.config/alacritty dotfiles/dotconfig/alacritty +d ${HOME}/.config/eww dotfiles/dotconfig/eww +d ${HOME}/.config/hypr dotfiles/dotconfig/hypr +d ${HOME}/.config/nvim dotfiles/dotconfig/nvim +d ${HOME}/.config/gotop dotfiles/dotconfig/gotop +d ${HOME}/.config/waybar dotfiles/dotconfig/waybar +d ${HOME}/.config/conky dotfiles/dotconfig/conky +f ${HOME}/.bashrc dotfiles/dotscripts/bash/.bashrc +f ${HOME}/.bash_profile dotfiles/dotscripts/bash/.bash_profile +d ${HOME}/.local/bin dotfiles/dotlocal/bin +d /etc/ly dotfiles/dotetc/ly +f /etc/makepkg.conf dotfiles/dotetc/makepkg.conf +f /etc/pacman.conf dotfiles/dotetc/makepkg.conf +f /etc/doas.conf dotfiles/dotetc/doas.conf" + +# Use `git pull ~/Documents/git/${}` for u # Use `install -Dm644 ` for f # Use `cp -Rf ` for d diff --git a/save_config_file b/save_config_file index 40ed3cb..336ded7 100755 --- a/save_config_file +++ b/save_config_file @@ -1,30 +1,38 @@ #!/bin/sh +# Need doas to work. + cd "$( dirname "$( readlink -f "$0" )" )" || exit CONFIG_PATH="./config" -. ./config/*.conf +. ${CONFIG_PATH}/*.conf -echo "$_FILE_TO_COPY" -echo "$_DOTFILES" +echo "$_GIT_FOLDER" +echo "$_INSTRUCTIONS" while VAR= read -r line; do order="$(echo $line | cut -d ' ' -f 1)" - file_on_computer="$(echo $line | cut -d ' ' -f 2)" - file_on_dotfile="$(echo $line | cut -d ' ' -f 3)" + operand_1="$(echo $line | cut -d ' ' -f 2)" + operand_2="$(echo $line | cut -d ' ' -f 3)" if [ "$order" = "d" ] then echo ".. d detected .." + echo "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 $file_on_computer $file_on_dotfile.. "; + echo ".. ${order} ${operand_1} ${operand_2} .."; -done <<< "$_FILE_TO_COPY" +done <<< "$_INSTRUCTIONS"