From c0ce6ea9610ec21f5cc89295015da762a7be1ee6 Mon Sep 17 00:00:00 2001 From: Andrejus Date: Thu, 7 Mar 2024 01:51:14 +0000 Subject: [PATCH] feat: installer and logging --- script/install | 5 +++-- script/install.d/03-apt.sh | 2 ++ script/install.d/04-git.sh | 2 ++ script/install.d/06-stow.sh | 3 ++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/script/install b/script/install index 00bd066..5322e51 100755 --- a/script/install +++ b/script/install @@ -14,6 +14,7 @@ sudo -v dir=$(dirname "$0") install_dir="$dir/install.d" +export DOTFILES=$(dirname "$dir") if [[ -z "$LOG_TARGET" ]]; then timestamp=$(date +%Y-%m-%dT%H:%M:%S) @@ -25,7 +26,7 @@ if [[ -z "$LOG_TARGET" ]]; then log_dir="$dir/logs" mkdir -p "$log_dir" log_target=${LOG_TARGET:-"$log_dir/$uuid.log"} -elif +else log_target="$LOG_TARGET" fi @@ -37,7 +38,7 @@ install() { script_name=$(basename $script) printf "\n\n<<< $script_name:\n" source $script - printf "\n\n>>> $script_name\n" + printf "\n>>> $script_name\n" unset script_name done } diff --git a/script/install.d/03-apt.sh b/script/install.d/03-apt.sh index bb913c7..6fca0f8 100644 --- a/script/install.d/03-apt.sh +++ b/script/install.d/03-apt.sh @@ -20,4 +20,6 @@ if command -v apt-get &> /dev/null; then fi unset apt_packages +else + echo "Skipping: apt-get not found" fi diff --git a/script/install.d/04-git.sh b/script/install.d/04-git.sh index d56f452..47569d3 100644 --- a/script/install.d/04-git.sh +++ b/script/install.d/04-git.sh @@ -12,3 +12,5 @@ if ! command -v git &> /dev/null; then brew install git fi fi + +git --version diff --git a/script/install.d/06-stow.sh b/script/install.d/06-stow.sh index 70e535c..3154e17 100644 --- a/script/install.d/06-stow.sh +++ b/script/install.d/06-stow.sh @@ -15,13 +15,14 @@ fi stow --version -root_dir=$(dirname "$(dirname "$(dirname "$(realpath "$0")")")") +root_dir=${DOTFILES:-$(dirname "$(dirname "$(dirname "$(realpath "$0")")")")} rm -f $HOME/.bash_profile rm -f $HOME/.bashrc rm -f $HOME/.gitconfig rm -f $HOME/.profile rm -f $HOME/.zshrc +rm -f $HOME/.p10k.zsh rm -f $HOME/.ssh/config mkdir -p $HOME/.config